From patchwork Mon Nov 1 14:03:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 12596485 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 ECC45C433F5 for ; Mon, 1 Nov 2021 14:05:14 +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 93C666108F for ; Mon, 1 Nov 2021 14:05:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 93C666108F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=usp.br 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: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:In-Reply-To:References: List-Owner; bh=GRlPZO5ZV3A2AU4Q9DEW+8mYglq5dJ8bVcyCwIoW44I=; b=xe8B4kbS4tGN/y 78nmD8mCan6nVbvMemKfcZJQI4sQuahy1MoRKhB3ocXe7lD7TxpM5h3rxeRIrEdstDQHst1KiagTH qa6sDd6M2b1+MiPAoTeP2D2U7bXR9Hnt7pC9pF9KKxKjUwBA3rw4neLwnIBuTRyfnrFczwGrEo30M G+50zz13uSIf1SJzXt5OeNCoM8S11/qBJHj1jz9Qe1/4qUvHurJeAciqfeJNjyimk9IeWfJHgmdTR 4cS7u4+FK+T8v6jGOlKa/GqlMti2TjSDTHRzI5jLYfx9lKiVXh89CwjPbGYavot66eNsaqRioVWpW LI2ynCJHIXmWuGOdL1HA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhXuA-00GX0H-Mz; Mon, 01 Nov 2021 14:03:18 +0000 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhXu5-00GWzK-Mr for linux-arm-kernel@lists.infradead.org; Mon, 01 Nov 2021 14:03:15 +0000 Received: by mail-qk1-x736.google.com with SMTP id bq14so5092447qkb.1 for ; Mon, 01 Nov 2021 07:03:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp.br; s=usp-google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding; bh=vAqbtjNRsMv6GLJP4TOcGidnTwH9qfmL1MAA54bPcrQ=; b=GNaBm93A51Bbuq8faqsXLGwvbBXFu60JtlT6b5OO00TmxnCP0o4983K3WdJVDo5ZEG QyEmMiedpoBE5li2sgkGAMFos4f9MfsFtwbezAI+ek5YUxYm0kqzV5Yl1OjyY+kUK5zP fqVfN+/efouhK2j4kIgN8GhLRmpmSffR7uxZ39kAEpnTP1zGQH9nNZ0g4tC8oDW29ZB8 QjI3H0ZwZmFDqiUdvCi8orv+0s742MpDaT5X9j2EkDZ5tdOwlpQHrLQSKgd3R7ej3eKd R+0UHRy7PX05TjgUdMiOnE0gYjlQSW4K/Zj9Nya9t9S6nEfYJJuf5NEeIpP841bove+D P0aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding; bh=vAqbtjNRsMv6GLJP4TOcGidnTwH9qfmL1MAA54bPcrQ=; b=dXQ4L7sj35aA7BpOMDBRQ/CPjWiP9BFJ6k9VtTnA8q0g2sqwQdzdOKaafG1xqv8+If 3LQPRpVDWoeonTiQ0F2rcTonkPn+T9IcbdxOQnHE7x5x0RAcGrgHaq+DMwIrfKSu5oBP U/sbmLtSsdxA4EHpd+MA4jDG3Cm54b2pz24XZl2Q2rDILjI6P4V55iHLJtiLI66mmk+p JU4cFEKUwAsLJJgxtmh+7/Ha9vV/rk55GBXmJ3m3lvRIqHOXNYEUK1FjHdkPsgjtd3ZI RLmsSCWqBx5IKjOdYaI1jm/8rluZPN6JwfWxvQnbDGYu+zGjlkPgM42XbYkuXcO674Cc f71Q== X-Gm-Message-State: AOAM530PUaCdOr/bKvh2Kn2BpKOd0goFMG56ARD2dV0q7xSRLW7Gtzug p3D+wVztgi+w4LmynjRCjvMaEw== X-Google-Smtp-Source: ABdhPJwTRMg1a0Lk2Pj6GJ7O5h3tD9vKAJbB1Z5snXpbFRqN9p4JsZnNjdmBTtzWNHtKW6ng0ZEatw== X-Received: by 2002:a05:620a:4721:: with SMTP id bs33mr23096566qkb.0.1635775387822; Mon, 01 Nov 2021 07:03:07 -0700 (PDT) Received: from fedora ([187.64.134.142]) by smtp.gmail.com with ESMTPSA id 18sm2010955qty.42.2021.11.01.07.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 07:03:07 -0700 (PDT) Date: Mon, 1 Nov 2021 11:03:01 -0300 From: =?iso-8859-1?q?Ma=EDra?= Canal To: hongxing.zhu@nxp.com, l.stach@pengutronix.de, lorenzo.pieralisi@arm.com, robh@kernel.org, bhelgaas@google.com, helgaas@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 RESEND] PCI: imx6: Replace legacy gpio interface for gpiod interface Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211101_070313_777405_293463F2 X-CRM114-Status: GOOD ( 16.94 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- drivers/pci/controller/dwc/pci-imx6.c | 30 +++++++++------------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 80fc98acf097..589cbd600d17 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,13 @@ 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");