From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com ([217.140.110.172]:38198 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725801AbfFNQx5 (ORCPT ); Fri, 14 Jun 2019 12:53:57 -0400 Date: Fri, 14 Jun 2019 17:53:53 +0100 From: Lorenzo Pieralisi Subject: Re: [PATCH V4 27/28] PCI: tegra: Add support for GPIO based PERST# Message-ID: <20190614165353.GB30511@e121166-lin.cambridge.arm.com> References: <20190516055307.25737-28-mmaddireddy@nvidia.com> <20190604132233.GT16519@ulmo> <20190613152404.GB30445@e121166-lin.cambridge.arm.com> <20190614143222.GB23116@e121166-lin.cambridge.arm.com> <1508173d-0ecc-f498-6ab2-78a718086b35@nvidia.com> <20190614145023.GA24588@e121166-lin.cambridge.arm.com> <20190614152304.GK15526@ulmo> <20190614155934.GA28253@e121166-lin.cambridge.arm.com> <51e4ae62-f842-1d2f-fbca-0b2063dd53a6@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51e4ae62-f842-1d2f-fbca-0b2063dd53a6@nvidia.com> Sender: devicetree-owner@vger.kernel.org To: Manikanta Maddireddy Cc: Thierry Reding , bhelgaas@google.com, robh+dt@kernel.org, mark.rutland@arm.com, jonathanh@nvidia.com, vidyas@nvidia.com, linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org List-ID: On Fri, Jun 14, 2019 at 10:00:49PM +0530, Manikanta Maddireddy wrote: [...] > GPIO based PERST# is per-platform requirement. > If DT prop is not present, then devm_gpiod_get_from_of_node() returns > NULL gpio_desc. > > struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, > const char *propname, int index, > enum gpiod_flags dflags, > const char *label) > { > struct gpio_desc *desc; > unsigned long lflags = 0; > enum of_gpio_flags flags; > bool active_low = false; > bool single_ended = false; > bool open_drain = false; > bool transitory = false; > int ret; > > desc = of_get_named_gpiod_flags(node, propname, > index, &flags); > > if (!desc || IS_ERR(desc)) { > */* If it is not there, just return NULL */****if (PTR_ERR(desc) == -ENOENT)****return NULL;* > return desc; > } > ... > > } Ok. My point then is that you have no way to enforce this requirement on platforms that actually need it, I do not even know if there is a way you can do it (I was thinking along the lines of using a compatible string to detect whether the GPIO #PERST reset is mandatory) but maybe this is not even a SOC property. Maybe what I am asking is overkill, I just wanted to understand. I was just asking a question to understand how you handle the case where a GPIO pin definition is missing in DT for a platform that actually needs it, the driver will probe but nothing will work. It would be good to describe this and capture it in the commit log. Thanks, Lorenzo