From patchwork Mon Mar 28 00:49:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 8677661 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BD83EC0553 for ; Mon, 28 Mar 2016 00:50:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C4F062021F for ; Mon, 28 Mar 2016 00:50:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C96A7201F4 for ; Mon, 28 Mar 2016 00:50:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752516AbcC1AuX (ORCPT ); Sun, 27 Mar 2016 20:50:23 -0400 Received: from mail-qg0-f53.google.com ([209.85.192.53]:34008 "EHLO mail-qg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752441AbcC1AuW (ORCPT ); Sun, 27 Mar 2016 20:50:22 -0400 Received: by mail-qg0-f53.google.com with SMTP id c67so64438724qgc.1; Sun, 27 Mar 2016 17:50:22 -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=4eFNRnM1U4ZG5o2uxPnBY/qRUu8TbouUEASJCwSWCTs=; b=BhnkPLrZDLWh3jA8simaRihOAUrn4yZbH5yXCz/K8raERDO8/uMTJ72uemVG+LiPZ9 qtQgg+cmJlx/qrc7/pk6nhv/doTPtyQEqudrTbVstBg3KM4k4q9NUuxlcbayk3OhFu01 33ZS/71n9VPZ1fc/B1hxZk5i05KJXcxhHnvyutwAbj5ZugW0DoI4TJNLYGlBgxBM6aSY mb6BRV83iGeD1Ec1AcW9jqA2NSmc8PPHKz16aUWT5DGZcUkdSVWH0AXZMFJ+o4mHNarr JprJ+4vP45HTiydpD01F/VFgfuQDtNCKYApXMlBnkXQgcXgfn746tlV3+9yMdukGnQ3V HzQg== 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=4eFNRnM1U4ZG5o2uxPnBY/qRUu8TbouUEASJCwSWCTs=; b=SLzcacmfHg8vPNJolsJr6URmuYiNRYNywsFJf/EBFaneTvTM1lsMq/T6VhioFWpuHR Ly1t1U7D8Qpy6ccX2WW6CKDEmRktcmkOwk0YvBWLByAWQBM0z6b08q8JoNO4dlENOyt5 +7she1KLOe1oRdsjnYE1TRMleHMflcAHASSKtRG0gHQeY9bsbVSCiiCMd+DRZxjC+HMw JJ/NE0mOnjoEum5Yyg8Eym08xnhDmEH444M+v4c2rIkQKBrP+OGNYswc+HV+Lbka5KoM hCpRzwKOOIwp34FHocQ1l0bpDjRHDHyiePQ2MoPR6D2U/bkJRSCelm/Nxaw9uHJe/yAl srug== X-Gm-Message-State: AD7BkJJFwlkbC2oNX5hsbEGB3zvCBMS2hpr2XE5ii+COfbCnjgmaB3fa7i9t+EmZQurifg== X-Received: by 10.140.99.69 with SMTP id p63mr31477758qge.97.1459126221747; Sun, 27 Mar 2016 17:50:21 -0700 (PDT) Received: from localhost.localdomain ([187.180.184.195]) by smtp.gmail.com with ESMTPSA id c108sm10743119qgc.13.2016.03.27.17.50.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 27 Mar 2016 17:50:21 -0700 (PDT) From: Fabio Estevam To: bhelgaas@google.com Cc: l.stach@pengutronix.de, hongxing.zhu@nxp.com, khalasa@piap.pl, ynezz@true.cz, linux-pci@vger.kernel.org, Fabio Estevam , Subject: [PATCH] Revert "PCI: imx6: Add support for active-low reset GPIO" Date: Sun, 27 Mar 2016 21:49:56 -0300 Message-Id: <1459126196-15063-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=unavailable 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") has the following issues: 1. It can break old dtb's that didn't take into account the gpio polarity specified in the device tree (For example: Gateworks Laguna imx6qdl-gw54xx.dtsi no longer works after this commit) 2. It sets the gpio polarity in the wrong logic level So revert the commit to avoid such regressions. Cc: # 4.5 Reported-by: Krzysztof Ha?asa Signed-off-by: Fabio Estevam --- 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");