From patchwork Mon Feb 6 15:17:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 9558195 X-Patchwork-Delegate: bhelgaas@google.com 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 B331C60242 for ; Mon, 6 Feb 2017 15:17:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A451027F93 for ; Mon, 6 Feb 2017 15:17:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 991BE27FA7; Mon, 6 Feb 2017 15:17:50 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D0F127F93 for ; Mon, 6 Feb 2017 15:17:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752158AbdBFPRg (ORCPT ); Mon, 6 Feb 2017 10:17:36 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33146 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751506AbdBFPRe (ORCPT ); Mon, 6 Feb 2017 10:17:34 -0500 Received: by mail-pg0-f67.google.com with SMTP id 194so9346705pgd.0; Mon, 06 Feb 2017 07:17:34 -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=RwobS7n3T2rS0lbZnnxXK1WAtu2vA3R6O/ALv5kD2sg=; b=uwHqk3gWH9eXkGkn4icRMIvqvhtBEPkm2t980RVjLmKaD2Y5EGOPIAePEBt4TUl6AP olHAg9w31PsLczwooeVg+OzoPOIB+z99yu3ZVYOWZwV19FOszcSxB2HgKm+z9xffuMLG kVzyXHnbwlJzU4ilckeeoFpxZmIA4c5Lkp1BtlzfY9bRsl+GQv0m3iwajKL/kwV6x0DC xnMgyiaoj5rky8UEzfcjxwpjQvS8kzI+4FtQdS/ULf9YBrGNsJQHW8tMmjAD5SvsPqsr 9zvDj58UC85zqC6SIIPFz3DufWRp8uhbpvBN3iT9gzbsapdMqbZBsEmVSYDX0k0ZxEoB Nbxg== 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=RwobS7n3T2rS0lbZnnxXK1WAtu2vA3R6O/ALv5kD2sg=; b=pslJgBJTehpJrYqpunorZTZnBh1fSCcO0qgoRJN0r18Zd0/7/J/379KRub+dwAWl3k zbLmfyM9TGuhutqvmNEDzXDoYtGN47JFAwCq/WU5zLqtEbYf4kON95ffRT7XamWbAe4c F5+GF0Fi052z3cFIyduiFNeIyvy17YGSWyzxJk3EtpiVcEY6MOujjqFRoSc/cc3lv1AZ wA3D0z0w3WUCzvF+hQhBA2m00+u/UXENw4xmP+f3WCddij/vTrMN7V5XFyEOEYZe5WO4 cycNBOUFzzYF2Xw2Mpq6GhRqVO6cj9KJmLaMptveeURXIG+Jw84GU5hqTcm9mIlHvElS uUOg== X-Gm-Message-State: AIkVDXLhgm1wxl2aBi+5TFKC5anO16zY7LzyNps1+emIyjGUnCd2THcUjysbj8C8puhq+A== X-Received: by 10.98.74.202 with SMTP id c71mr13705718pfj.28.1486394253656; Mon, 06 Feb 2017 07:17:33 -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 w25sm3555497pge.27.2017.02.06.07.17.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Feb 2017 07:17:32 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , yurovsky@gmail.com, Lucas Stach , Bjorn Helgaas , Fabio Estevam , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] PCI: imx6: Allow probe deferal by reset GPIO Date: Mon, 6 Feb 2017 07:17:15 -0800 Message-Id: <20170206151716.10381-3-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170206151716.10381-1-andrew.smirnov@gmail.com> References: <20170206151716.10381-1-andrew.smirnov@gmail.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.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 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);