From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DBEBC433F5 for ; Wed, 20 Oct 2021 14:58:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 32B2961374 for ; Wed, 20 Oct 2021 14:58:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230260AbhJTPAu (ORCPT ); Wed, 20 Oct 2021 11:00:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:43302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbhJTPAt (ORCPT ); Wed, 20 Oct 2021 11:00:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9C3B2611EF; Wed, 20 Oct 2021 14:58:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634741914; bh=sp4qR7s1fV+iZP+uIu6mtMZe0a47ZjWyonweUvCQqtg=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Z3mipcjJVlZSv3QT2R0Z2dfmtfo3zKUMp9cEr8u8j8uIuGEdeT0aolGBk4v/GeBV6 OLJTK9f0YI8Q5105e1hfv4Oy0FBVln2RsQnqTwq6b0UrZnIN9cUPQqmZ8VqdIdZvHo 4ZVCZiPpg4YXZGuZBrHdKmZxmEwxlsRq2ZnCYSGzyzhTfcZHcpT9WQdtJClVuj9iHK nVNf45uc+dFh72hFfNDNntdJgwtgJFY7POkCvPrPau+uzbSAJMHtmmmtmQujOAX7Fw Yx8vOabi926XFOH64WAuxBp3GsbOIgHrCrPdjU8ApQf8MO2/b2Ppg1FLFj9xeDxjs2 lbph4j8yk6H5Q== Date: Wed, 20 Oct 2021 09:58:33 -0500 From: Bjorn Helgaas To: =?iso-8859-1?Q?Ma=EDra?= Canal Cc: hongxing.zhu@nxp.com, l.stach@pengutronix.de, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] PCI: imx6: Replace legacy gpio interface for gpiod interface Message-ID: <20211020145833.GA2616210@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 19, 2021 at 08:56:47PM -0300, Maíra Canal wrote: > Considering the current transition of the GPIO subsystem, remove all > dependencies of the legacy GPIO interface (linux/gpio.h and linux > /of_gpio.h) and replace it with the descriptor-based GPIO approach. > > Signed-off-by: Maíra Canal > --- > V1 -> V2: Rewrite commit log and subject line to match PCI subsystem standard Thanks, I appreciate that! Lorenzo will take a look when it gets to the front of his queue. > --- > drivers/pci/controller/dwc/pci-imx6.c | 31 ++++++++++----------------- > 1 file changed, 11 insertions(+), 20 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c > index 80fc98acf097..e5ee54e37d05 100644 > --- a/drivers/pci/controller/dwc/pci-imx6.c > +++ b/drivers/pci/controller/dwc/pci-imx6.c > @@ -11,13 +11,12 @@ > #include > #include > #include > -#include > +#include > #include > #include > #include > #include > #include > -#include > #include > #include > #include > @@ -63,7 +62,7 @@ struct imx6_pcie_drvdata { > > struct imx6_pcie { > struct dw_pcie *pci; > - int reset_gpio; > + struct gpio_desc *reset_gpio; > bool gpio_active_high; > struct clk *pcie_bus; > struct clk *pcie_phy; > @@ -526,11 +525,11 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) > usleep_range(200, 500); > > /* Some boards don't have PCIe reset GPIO. */ > - if (gpio_is_valid(imx6_pcie->reset_gpio)) { > - gpio_set_value_cansleep(imx6_pcie->reset_gpio, > + if (imx6_pcie->reset_gpio) { > + gpiod_set_value_cansleep(imx6_pcie->reset_gpio, > imx6_pcie->gpio_active_high); > msleep(100); > - gpio_set_value_cansleep(imx6_pcie->reset_gpio, > + gpiod_set_value_cansleep(imx6_pcie->reset_gpio, > !imx6_pcie->gpio_active_high); > } > > @@ -1025,22 +1024,14 @@ static int imx6_pcie_probe(struct platform_device *pdev) > return PTR_ERR(pci->dbi_base); > > /* Fetch GPIOs */ > - imx6_pcie->reset_gpio = of_get_named_gpio(node, "reset-gpio", 0); > imx6_pcie->gpio_active_high = of_property_read_bool(node, > "reset-gpio-active-high"); > - if (gpio_is_valid(imx6_pcie->reset_gpio)) { > - ret = devm_gpio_request_one(dev, imx6_pcie->reset_gpio, > - imx6_pcie->gpio_active_high ? > - GPIOF_OUT_INIT_HIGH : > - GPIOF_OUT_INIT_LOW, > - "PCIe reset"); > - if (ret) { > - dev_err(dev, "unable to get reset gpio\n"); > - return ret; > - } > - } else if (imx6_pcie->reset_gpio == -EPROBE_DEFER) { > - return imx6_pcie->reset_gpio; > - } > + imx6_pcie->reset_gpio = devm_gpiod_get_optional(dev, "reset", > + imx6_pcie->gpio_active_high ? GPIOD_OUT_HIGH : > + GPIOD_OUT_LOW); > + if (IS_ERR(imx6_pcie->reset_gpio)) > + return dev_err_probe(dev, PTR_ERR(imx6_pcie->reset_gpio), > + "unable to get reset gpio\n"); > > /* Fetch clocks */ > imx6_pcie->pcie_phy = devm_clk_get(dev, "pcie_phy"); > -- > 2.31.1 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 842ECC433EF for ; Wed, 20 Oct 2021 15:18:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4452B61359 for ; Wed, 20 Oct 2021 15:18:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4452B61359 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=ffMUmqZaY3CTf2xSXaM15XCms1hZazQ9ypLsph2weA0=; b=IWJLkbXHKGJrlY JCdqJzDWLXhKnj9gfACVdTvkJtIydlLJcIQikUFQWmHTmi2j3FHA67SX/7PnHRzLCREi9MO0waOBP W92Aac5vLRppIrYdj1zYtHIs775P/v2kFn7gUi3Y3vooiYPuCQMnmVPCAqFFqaFCVRYzxgXisqjZq qWWAy9x/bucjBb8GetDrMZPmgRA6vhdDfGRPz1ev67q3MVylYE04S0rm3EpN0qb/I4PD5eULI5UgQ Szd9KcdDx+M6g3AK1aZwz5GaVJXaQflINoC9rO+b6CbZKUuYxODldMf7XdYyPuTkZQsp5kkXT/uLY HS48p6esp6A5wON6o2IQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdDKi-004xDA-DS; Wed, 20 Oct 2021 15:16:49 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdD35-004s5i-OQ for linux-arm-kernel@lists.infradead.org; Wed, 20 Oct 2021 14:58:37 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9C3B2611EF; Wed, 20 Oct 2021 14:58:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634741914; bh=sp4qR7s1fV+iZP+uIu6mtMZe0a47ZjWyonweUvCQqtg=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Z3mipcjJVlZSv3QT2R0Z2dfmtfo3zKUMp9cEr8u8j8uIuGEdeT0aolGBk4v/GeBV6 OLJTK9f0YI8Q5105e1hfv4Oy0FBVln2RsQnqTwq6b0UrZnIN9cUPQqmZ8VqdIdZvHo 4ZVCZiPpg4YXZGuZBrHdKmZxmEwxlsRq2ZnCYSGzyzhTfcZHcpT9WQdtJClVuj9iHK nVNf45uc+dFh72hFfNDNntdJgwtgJFY7POkCvPrPau+uzbSAJMHtmmmtmQujOAX7Fw Yx8vOabi926XFOH64WAuxBp3GsbOIgHrCrPdjU8ApQf8MO2/b2Ppg1FLFj9xeDxjs2 lbph4j8yk6H5Q== Date: Wed, 20 Oct 2021 09:58:33 -0500 From: Bjorn Helgaas To: =?iso-8859-1?Q?Ma=EDra?= Canal Cc: hongxing.zhu@nxp.com, l.stach@pengutronix.de, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] PCI: imx6: Replace legacy gpio interface for gpiod interface Message-ID: <20211020145833.GA2616210@bhelgaas> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211020_075835_922099_1A13F089 X-CRM114-Status: GOOD ( 20.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Oct 19, 2021 at 08:56:47PM -0300, Ma=EDra Canal wrote: > Considering the current transition of the GPIO subsystem, remove all > dependencies of the legacy GPIO interface (linux/gpio.h and linux > /of_gpio.h) and replace it with the descriptor-based GPIO approach. > = > Signed-off-by: Ma=EDra Canal > --- > V1 -> V2: Rewrite commit log and subject line to match PCI subsystem stan= dard Thanks, I appreciate that! Lorenzo will take a look when it gets to the front of his queue. > --- > drivers/pci/controller/dwc/pci-imx6.c | 31 ++++++++++----------------- > 1 file changed, 11 insertions(+), 20 deletions(-) > = > diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controll= er/dwc/pci-imx6.c > index 80fc98acf097..e5ee54e37d05 100644 > --- a/drivers/pci/controller/dwc/pci-imx6.c > +++ b/drivers/pci/controller/dwc/pci-imx6.c > @@ -11,13 +11,12 @@ > #include > #include > #include > -#include > +#include > #include > #include > #include > #include > #include > -#include > #include > #include > #include > @@ -63,7 +62,7 @@ struct imx6_pcie_drvdata { > = > struct imx6_pcie { > struct dw_pcie *pci; > - int reset_gpio; > + struct gpio_desc *reset_gpio; > bool gpio_active_high; > struct clk *pcie_bus; > struct clk *pcie_phy; > @@ -526,11 +525,11 @@ static void imx6_pcie_deassert_core_reset(struct im= x6_pcie *imx6_pcie) > usleep_range(200, 500); > = > /* Some boards don't have PCIe reset GPIO. */ > - if (gpio_is_valid(imx6_pcie->reset_gpio)) { > - gpio_set_value_cansleep(imx6_pcie->reset_gpio, > + if (imx6_pcie->reset_gpio) { > + gpiod_set_value_cansleep(imx6_pcie->reset_gpio, > imx6_pcie->gpio_active_high); > msleep(100); > - gpio_set_value_cansleep(imx6_pcie->reset_gpio, > + gpiod_set_value_cansleep(imx6_pcie->reset_gpio, > !imx6_pcie->gpio_active_high); > } > = > @@ -1025,22 +1024,14 @@ static int imx6_pcie_probe(struct platform_device= *pdev) > return PTR_ERR(pci->dbi_base); > = > /* Fetch GPIOs */ > - imx6_pcie->reset_gpio =3D of_get_named_gpio(node, "reset-gpio", 0); > imx6_pcie->gpio_active_high =3D of_property_read_bool(node, > "reset-gpio-active-high"); > - if (gpio_is_valid(imx6_pcie->reset_gpio)) { > - ret =3D devm_gpio_request_one(dev, imx6_pcie->reset_gpio, > - imx6_pcie->gpio_active_high ? > - GPIOF_OUT_INIT_HIGH : > - GPIOF_OUT_INIT_LOW, > - "PCIe reset"); > - if (ret) { > - dev_err(dev, "unable to get reset gpio\n"); > - return ret; > - } > - } else if (imx6_pcie->reset_gpio =3D=3D -EPROBE_DEFER) { > - return imx6_pcie->reset_gpio; > - } > + imx6_pcie->reset_gpio =3D devm_gpiod_get_optional(dev, "reset", > + imx6_pcie->gpio_active_high ? GPIOD_OUT_HIGH : > + GPIOD_OUT_LOW); > + if (IS_ERR(imx6_pcie->reset_gpio)) > + return dev_err_probe(dev, PTR_ERR(imx6_pcie->reset_gpio), > + "unable to get reset gpio\n"); > = > /* Fetch clocks */ > imx6_pcie->pcie_phy =3D devm_clk_get(dev, "pcie_phy"); > -- = > 2.31.1 > = _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel