Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp764894ybc; Fri, 22 Nov 2019 12:45:24 -0800 (PST) X-Google-Smtp-Source: APXvYqyAlZKSJAA4wZZbQTtJ2B+2/0kK7kjQzV4m0GTuT7xr/vDmztsCJN9u9Fe1NBmt8pQltO6Z X-Received: by 2002:a50:da43:: with SMTP id a3mr3566171edk.229.1574455524697; Fri, 22 Nov 2019 12:45:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574455524; cv=none; d=google.com; s=arc-20160816; b=IwhswHWUYVL8jjqZFNrenDVvESiHKQcvB8nXVNOuTkHz6VM3+scQKBV7J2UmDY3DUV X3hp267VAdLdrtuUoN/zUSeFRFs7noJ4fnOTX1XE2s72Q+ILn3e9nrimW4dosjxDQRGY 4pnASG+pIHvvlCxkMB+dHkgKkq0dRI7ZH6faXD3tPeL6IRAi1Ns3gG71jXARBMa5R5x/ 9dBtwZQl46+g2AeGgff5z6dreMK6xiZWG1vIav/yM5GflLjaFgNqiuoG3Dm0andnQm1c z4bqYvnGjjUjWx7baaFvJvcd25n2jrKnkSsK1/O7mgGwfGiONmW0+KWyxrj3wXIs+r7M aOsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=hPU+I3qM5rWyCZ3PD+AVXublnqb5jw95OnAE90zps4E=; b=fQlFIrI8QmY6Kk8Y/eg28iI2q904GpusH1RtJTzTAbEW8BKzxhhkOJ5235JgHD+HHl kX2X7PmqAtQzzEGyhepaBSp9e01bBv9k0I/UXVuCviUajJFJFlDG7O77xwhM+WoqSDL+ evFxBeJqkmVSOAh0M7NKaSASH4oKR9397Q/MZYMiOsw5OS30u6lh+S0eWQwLO01K38Bo gGApKYLQKXtwTAHf1phnGNFg0Dkw0l3Z2UOSBNGaWZ8e+ArIp3kYfeS70AbSt4S4NgbN hwAhl/qaM1/C0zscXltVO+1FaBVoZ0ZgrfHzowAGZINP7e0RwgZXweRqVhB8MREtKtgv RDhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=grvZmVnp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gs14si4840690ejb.347.2019.11.22.12.45.00; Fri, 22 Nov 2019 12:45:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=grvZmVnp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727232AbfKVUmm (ORCPT + 99 others); Fri, 22 Nov 2019 15:42:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:45758 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726526AbfKVUml (ORCPT ); Fri, 22 Nov 2019 15:42:41 -0500 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 78E902071F; Fri, 22 Nov 2019 20:42:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574455360; bh=9jUl9hYzeTjE4cdYpV/s+MeWKqCO1YmPWEPxwsM65fc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=grvZmVnp3E4aSgHsuDL8R9hsxFoXmcVDe1FFYydprJZffl+G69JkxdyzngFxrcn9n tuZX8+loec9bMb6bUrnjv1LH6VWVodFipQ0gxLXNErnz2fqYd+g0jj/6o8URXNUw8q k8uOCOCL8DsGMYDbLbqgu/tEJWOgtmcrAsomh3Mg= Received: by mail-qk1-f169.google.com with SMTP id i19so7505520qki.2; Fri, 22 Nov 2019 12:42:40 -0800 (PST) X-Gm-Message-State: APjAAAVU5I8WO4l4eDS1ACPNiSfVcMHnw2TeOBPOsmoOJigbxRqiNSTv EqTbhw4x0Tb4b0JI3aQBtlr/mqrfVkGjDmqjxw== X-Received: by 2002:a05:620a:205d:: with SMTP id d29mr15274456qka.152.1574455359578; Fri, 22 Nov 2019 12:42:39 -0800 (PST) MIME-Version: 1.0 References: <20191120071302.227777-1-saravanak@google.com> In-Reply-To: From: Rob Herring Date: Fri, 22 Nov 2019 14:42:27 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] of: property: Add device link support for interrupt-parent, dmas and -gpio(s) To: Saravana Kannan Cc: Frank Rowand , Greg Kroah-Hartman , Thomas Gleixner , Vinod Koul , Linus Walleij , Android Kernel Team , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 22, 2019 at 1:34 PM Saravana Kannan wrote: > > On Fri, Nov 22, 2019 at 5:35 AM Rob Herring wrote: > > > > On Wed, Nov 20, 2019 at 1:13 AM Saravana Kannan wrote: > > > > > > Add support for creating device links out of more DT properties. > > > > > > Cc: Greg Kroah-Hartman > > > Cc: Thomas Gleixner > > > Cc: Vinod Koul > > > Cc: Linus Walleij > > > Signed-off-by: Saravana Kannan > > > --- > > > drivers/of/property.c | 8 ++++++++ > > > 1 file changed, 8 insertions(+) > > > > > > diff --git a/drivers/of/property.c b/drivers/of/property.c > > > index 0fa04692e3cc..dedbf82da838 100644 > > > --- a/drivers/of/property.c > > > +++ b/drivers/of/property.c > > > @@ -1188,7 +1188,11 @@ DEFINE_SIMPLE_PROP(interconnects, "interconnects", "#interconnect-cells") > > > DEFINE_SIMPLE_PROP(iommus, "iommus", "#iommu-cells") > > > DEFINE_SIMPLE_PROP(mboxes, "mboxes", "#mbox-cells") > > > DEFINE_SIMPLE_PROP(io_channels, "io-channel", "#io-channel-cells") > > > +DEFINE_SIMPLE_PROP(interrupt_parent, "interrupt-parent", NULL) > > > > This one is not going to work most of the time (ignoring the fact that > > the primary controller doesn't have a struct device) because the > > interrupt-parent is typically in a parent node. > > Just to make sure, I'm not parsing this property incorrectly, right? > > Are you saying it's listed at the parent of a bunch of devices and the > interrupt-parent is inherited and won't really create device links for > those child devices? > I mainly added this to make sure IRQ controllers are probed in the > right order. Also, if this delays the parent device probe, by the time > the child devices are added, the interrupt parent most likely would > already be probed. > > > You could make it work > > by specifying 'interrupt-parent' in every node, but that's not a > > pattern I want to encourage. > > I'm trying to take care of the basic per-device properties first. > Adding support for inherited properties isn't too difficult, I just > need to get to those at some point. Also, for inherited properties, we > can't really block probing because the child device might not depend > on that resource. Inherited properties are mainly relevant only for > sync_state() callbacks. You're looking at the wrong property. You need to look for 'interrupts' and 'interrupts-extended'. Pretty good chance if the device has interrupts, then it needs them. The latter is easy. It's just like the others you have (phandle + cells). If you have 'interrupts' then you need to walk the interrupt tree the same way the OF IRQ code already does. > > There's also all the other ways the > > parent can be determined. Any parent node with 'interrupt-controller' > > or 'interrupt-map' property is the parent. And there's > > 'interrupts-extended' too. > > Now I'm confused. Not sure if you are referring to actual device > parent now or if you are talking about an "interrupt supplier". Yes. both. The interrupt tree may or may not mirror the device node tree. Or you could have a mixture. You've got to handle both cases. But really, you just need to use the code that's already there to do all that and deal with all these conditions. Essentially, you need to copy of_irq_get(), but get the struct device from the irq_domain. Rob