From patchwork Thu Jan 19 16:36:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 9526357 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 EBFCE6020B for ; Thu, 19 Jan 2017 16:40:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE5C5285C9 for ; Thu, 19 Jan 2017 16:40:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1C81285D3; Thu, 19 Jan 2017 16:40:55 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 7B9C2285C9 for ; Thu, 19 Jan 2017 16:40:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753563AbdASQiC (ORCPT ); Thu, 19 Jan 2017 11:38:02 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36629 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753402AbdASQhp (ORCPT ); Thu, 19 Jan 2017 11:37:45 -0500 Received: by mail-pf0-f195.google.com with SMTP id 19so3631634pfo.3; Thu, 19 Jan 2017 08:36:47 -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=n5+ZpFe2wRZjy3U5IVNhszxwV+iXkRjXDTFpd6Enpz4=; b=roL+RAhyH5OEpl6ZIQv8zy+T/H2tQ7IRTYplvrd6vS9HOiV2w6xPLr9676QGO2OUGT nSUNnNOVxYhhGtxPYnaLS+kx475bwW5lD5jgzs2HJ+h/q5VVWirfwxRcXAwvicBpc308 rzx2xujOtdvW+bu+j7/FSx5+D6xUsbOf+w7X03oyd6cYMEnscoLIaHpw/J6yA5UKiyp9 71fvK9spQAXoT2sXCmyrbb1scjb+XH/F8F3XfuLxUMBbbJTrQIZaR/QD6pe/SJDJFZ25 SQjPFckwK82KZ5AA6Rmo364F1vTn41oJ/GdT96gDbKl67cI87UY6SQhlbG3SHjVEOGcD xgww== 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=n5+ZpFe2wRZjy3U5IVNhszxwV+iXkRjXDTFpd6Enpz4=; b=l+gEg65dI/S0/oTbU2IxbT7SEbLC2uZV0v0hTHr4ZUPRf6rfaJGmuk1qXzUhYliBy/ pEB0sHnnXKK7kzBrKUZ+HLOk5NnwNqhnmXdo4Ugi98sMB+ibboIXdHb57oZ48Iv7UUEI O4q3uMpUzRPZfOiUt3XJuktfc9HuPybxMFA2Qb2EF8Hi9aakUBgYKGifTmXoWestMlit AEfJO+K+3ogOUaXSGDXle0MjiBgWFMHO4zxf4Tx5643HCKIyzQ458m7hxtIE0NM0pqyI xICEljiMpMayaV1WSZRc8v+49erbtH+l9DetEyExmn3nAg0FLjdKQKdR/zylkG8UstUk hywQ== X-Gm-Message-State: AIkVDXL1xaZiA47/p/s5VzSuPmPGi3Xl+JQ39r4UshPn4U/QIaJtyuUzMqvRBaL4XDgGkA== X-Received: by 10.98.79.150 with SMTP id f22mr10933238pfj.55.1484843806731; Thu, 19 Jan 2017 08:36: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 s65sm10130051pgb.25.2017.01.19.08.36.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jan 2017 08:36:46 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , yurovsky@gmail.com, Richard Zhu , Lucas Stach , Bjorn Helgaas , Fabio Estevam , Shawn Guo , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] PCI: imx6: Allow probe deferal by reset GPIO Date: Thu, 19 Jan 2017 08:36:30 -0800 Message-Id: <20170119163631.10668-3-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170119163631.10668-1-andrew.smirnov@gmail.com> References: <20170119163631.10668-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: Richard Zhu Cc: Lucas Stach Cc: Bjorn Helgaas Cc: Fabio Estevam Cc: Shawn Guo Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Andrey Smirnov --- drivers/pci/host/pci-imx6.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index 50a1291..574f026 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c @@ -653,6 +653,9 @@ 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) { + dev_info(dev, "probe is defered by reset GPIO\n"); + return imx6_pcie->reset_gpio; } /* Fetch clocks */ @@ -746,11 +749,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);