From patchwork Tue Feb 7 15:50:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 9560487 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C00E36047A for ; Tue, 7 Feb 2017 15:52:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1F92282E2 for ; Tue, 7 Feb 2017 15:52:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A51E928438; Tue, 7 Feb 2017 15:52:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 39C63282E2 for ; Tue, 7 Feb 2017 15:52:41 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cb84J-0002Sk-B1; Tue, 07 Feb 2017 15:52:35 +0000 Received: from mail-pg0-f68.google.com ([74.125.83.68]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cb83q-0001t4-S8 for linux-arm-kernel@lists.infradead.org; Tue, 07 Feb 2017 15:52:10 +0000 Received: by mail-pg0-f68.google.com with SMTP id v184so12442298pgv.1 for ; Tue, 07 Feb 2017 07:51:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yrYrSVSiEVK+iA0sXiuyrB+RNXinH9LW/uX+wf5a79I=; b=Lt6GM5Opkhy7s26M4Pn+YPzWxslSJYSmY6mCI9w38mogdKG5+lAFJps3FCMxzvOlTj kw4hLXGPpQZ8cTX+SV8oeoSbu8hfmGk2IVVLRVyJxag9X1+n1nBMNu4Bvqmwkagwnd63 jqhTnIZuD6X8SAi0aUzjUxGa9Rr21xiuqn3PeyZH4rCrHq+EpDRdwnr2OSzKnDej+IaL Ny4++ENV9otYryD3NlQaSg/+6bEEqX+vfE60g2bG3yWqE6KPcfOsC51sXM9cgoG61vfz 2zRLPtd7A/HbtxyRh98w5Bnn5BI93A0D1kbf8/FQ+dp8Ap18Gf6dVWuvDXY6HOSyvYiE Zf8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yrYrSVSiEVK+iA0sXiuyrB+RNXinH9LW/uX+wf5a79I=; b=kxV6sWCTvPzYtmFFizyeAFMO2LFNOqYSxmNwFOcFSy4zF++Boj9NvuMvsotx3/aegr wSYGIGDJZggRd43+HbXI17g8wamSNiLHaXQvxrJ9V/OfWFMwF8lNW8e3SiCrKS8Geyvo F8zmxApDA8dXTlMrl72c7OIihuQKIXuCGveSOStlVhYg4rCwPSP13/qeqfRioqjnrndh 2UvgAsvAcf3a1XGbns7Clo1Fa9iX4Frb/8dwgafgByoRPKbFG1lgw0PT9PNkA6cCUCYo PL0EnwvOykBtkob69PZ+Tt5I40yaL/Pj3+37W+BN/y06zFDQYkyfZ+Z4EgmXUPCd+fX2 sZoA== X-Gm-Message-State: AIkVDXKECGeP3DjNtPJEmQfb0ihk8BUJn4xNvWOiIIwY0ASZKrReXEmPyj7V/ZKJ5umGdQ== X-Received: by 10.84.129.3 with SMTP id 3mr26952282plb.153.1486482646114; Tue, 07 Feb 2017 07:50:46 -0800 (PST) Received: from localhost.localdomain (c-73-19-0-61.hsd1.wa.comcast.net. [73.19.0.61]) by smtp.gmail.com with ESMTPSA id l22sm12506414pgc.43.2017.02.07.07.50.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Feb 2017 07:50:45 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v4 2/3] PCI: imx6: Allow probe deferal by reset GPIO Date: Tue, 7 Feb 2017 07:50:26 -0800 Message-Id: <20170207155027.7734-3-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170207155027.7734-1-andrew.smirnov@gmail.com> References: <20170207155027.7734-1-andrew.smirnov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170207_075206_935752_B43BAE9D X-CRM114-Status: GOOD ( 12.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrey Smirnov , linux-kernel@vger.kernel.org, Fabio Estevam , Bjorn Helgaas , yurovsky@gmail.com, linux-arm-kernel@lists.infradead.org, Lucas Stach MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some designs implement reset GPIO via a GPIO expander connected to a peripheral bus. One such example would be i.MX7 Sabre board where said GPIO is provided by SPI shift register connected to a bitbanged SPI bus. In order to support such designs allow reset GPIO request to defer probing of the driver. Cc: yurovsky@gmail.com Cc: Lucas Stach Cc: Bjorn Helgaas Cc: Fabio Estevam Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Lucas Stach Signed-off-by: Andrey Smirnov --- drivers/pci/host/pci-imx6.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index 50a1291..3ef8093 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c @@ -611,7 +611,7 @@ static int __init imx6_add_pcie_port(struct imx6_pcie *imx6_pcie, return 0; } -static int __init imx6_pcie_probe(struct platform_device *pdev) +static int imx6_pcie_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct imx6_pcie *imx6_pcie; @@ -653,6 +653,8 @@ static int __init imx6_pcie_probe(struct platform_device *pdev) dev_err(dev, "unable to get reset gpio\n"); return ret; } + } else if (imx6_pcie->reset_gpio == -EPROBE_DEFER) { + return imx6_pcie->reset_gpio; } /* Fetch clocks */ @@ -746,11 +748,12 @@ static struct platform_driver imx6_pcie_driver = { .name = "imx6q-pcie", .of_match_table = imx6_pcie_of_match, }, + .probe = imx6_pcie_probe, .shutdown = imx6_pcie_shutdown, }; static int __init imx6_pcie_init(void) { - return platform_driver_probe(&imx6_pcie_driver, imx6_pcie_probe); + return platform_driver_register(&imx6_pcie_driver); } device_initcall(imx6_pcie_init);