From patchwork Mon Mar 28 21:45:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 8680451 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B49639F54E for ; Mon, 28 Mar 2016 21:46:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C4340201B9 for ; Mon, 28 Mar 2016 21:46:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B29AE20149 for ; Mon, 28 Mar 2016 21:46:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754754AbcC1VqE (ORCPT ); Mon, 28 Mar 2016 17:46:04 -0400 Received: from mail-qk0-f170.google.com ([209.85.220.170]:33846 "EHLO mail-qk0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752252AbcC1VqD (ORCPT ); Mon, 28 Mar 2016 17:46:03 -0400 Received: by mail-qk0-f170.google.com with SMTP id x64so91167287qkd.1; Mon, 28 Mar 2016 14:46:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WWat+lhCjMzxp1LEnqOQxDWx2gaoZ6g8dOM34cV0E+w=; b=bfZQteeWug9+YQRldTRVyFOB6MyVWrgl6YaCxt+LrVFdRfWNd3b7INYSJYM5g+4aez dQ+I7CZ1k2MXWFYAZqXbom1hEMuJKgmGPxecG7Ro3DL/oiG4msXaiQ0XddJTtheIDTLI 3Ahme5ZOs/FkOOcmnZYqmjnql9rLc8G7lZxigFqnA3Bg6wu2NYhT4ADR2zERZ2XxCEDH qJ6spB5L1Rcd/WnDtWwEEnigz2a+WNMk0r68xNJO57ANKwFZXnVyZFoZoq+Q4+2v1ujw o1XRfE8EfM7X863Mnxi3ygCAwV4U1EHYDbCcJfOoLvK1Q/iRBkVd4BTPxVqG37JJYvWH pY8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WWat+lhCjMzxp1LEnqOQxDWx2gaoZ6g8dOM34cV0E+w=; b=keb8w5mwsRbXRx648FzZapKHTB5V6dla+2gc03deO5HZ4+1FvahvfMu19m9hbj+FPU 6DVaexdwqR/StCUIMpmyfP5miTFcGX1po/dgI7weVL1B9Tdk4z6GBeh+qfA8DqlLUZPT rqzSXv0U0nw9wi4DGkRxKCjDSh5cVOaytzgYBQ9Cf+R+Z4qQKO34XETTQVZDL3z2RN8l uzAY05pwsim6X+BVPy2YDhuN2edqFcMFAAyKGP7uyqmVDteojxwB7QVTkQMAySWlA+KH QC0LGdhPIQtxqsreJwimrmIviIs2IF7gjPJc2B1D8WpL0NnTjP3E8Pil6qELe+AbfT7y VVLw== X-Gm-Message-State: AD7BkJKovX6tOq16Haf0wv/+uWN52ovwwm0K9ftTvwlUCpOQfDXjwJqA3yS5yJBXMvwL+g== X-Received: by 10.55.53.207 with SMTP id c198mr38281736qka.24.1459201561883; Mon, 28 Mar 2016 14:46:01 -0700 (PDT) Received: from localhost.localdomain ([187.180.185.191]) by smtp.gmail.com with ESMTPSA id u16sm12682256qka.22.2016.03.28.14.45.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Mar 2016 14:46:01 -0700 (PDT) From: Fabio Estevam To: bhelgaas@google.com Cc: l.stach@pengutronix.de, Richard.Zhu@freescale.com, khalasa@piap.pl, ynezz@true.cz, linux-pci@vger.kernel.org, tharvey@gateworks.com, Fabio Estevam , Subject: [PATCH v2] Revert "PCI: imx6: Add support for active-low reset GPIO" Date: Mon, 28 Mar 2016 18:45:36 -0300 Message-Id: <1459201536-5558-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam Commit 5c5fb40de8f14 ("PCI: imx6: Add support for active-low reset GPIO") cause regressions on some boards like MX6 Gateworks Ventana, for example. The reason for the breakage is that this commit sets the gpio polarity in the wrong logic level. Also, the commit log is wrong because active-low reset GPIO is what the driver used to support since the beginning. So keep the old behavior that ignores the gpio polarity specified in the device tree and treat the PCI reset GPIO as active-low. Cc: # 4.5 Reported-by: Krzysztof Ha?asa Signed-off-by: Fabio Estevam Acked-by: Tim Harvey Acked-by: Lucas Stach --- Changes since v1: - Improve wording of commit log (Tim) drivers/pci/host/pci-imx6.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index eb5a275..2f817fa 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c @@ -32,7 +32,7 @@ #define to_imx6_pcie(x) container_of(x, struct imx6_pcie, pp) struct imx6_pcie { - struct gpio_desc *reset_gpio; + int reset_gpio; struct clk *pcie_bus; struct clk *pcie_phy; struct clk *pcie; @@ -309,10 +309,10 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp) usleep_range(200, 500); /* Some boards don't have PCIe reset GPIO. */ - if (imx6_pcie->reset_gpio) { - gpiod_set_value_cansleep(imx6_pcie->reset_gpio, 0); + if (gpio_is_valid(imx6_pcie->reset_gpio)) { + gpio_set_value_cansleep(imx6_pcie->reset_gpio, 0); msleep(100); - gpiod_set_value_cansleep(imx6_pcie->reset_gpio, 1); + gpio_set_value_cansleep(imx6_pcie->reset_gpio, 1); } return 0; @@ -523,6 +523,7 @@ static int __init imx6_pcie_probe(struct platform_device *pdev) { struct imx6_pcie *imx6_pcie; struct pcie_port *pp; + struct device_node *np = pdev->dev.of_node; struct resource *dbi_base; struct device_node *node = pdev->dev.of_node; int ret; @@ -544,8 +545,15 @@ static int __init imx6_pcie_probe(struct platform_device *pdev) return PTR_ERR(pp->dbi_base); /* Fetch GPIOs */ - imx6_pcie->reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset", - GPIOD_OUT_LOW); + imx6_pcie->reset_gpio = of_get_named_gpio(np, "reset-gpio", 0); + if (gpio_is_valid(imx6_pcie->reset_gpio)) { + ret = devm_gpio_request_one(&pdev->dev, imx6_pcie->reset_gpio, + GPIOF_OUT_INIT_LOW, "PCIe reset"); + if (ret) { + dev_err(&pdev->dev, "unable to get reset gpio\n"); + return ret; + } + } /* Fetch clocks */ imx6_pcie->pcie_phy = devm_clk_get(&pdev->dev, "pcie_phy");