From patchwork Tue Sep 23 04:11:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhu X-Patchwork-Id: 4952861 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C90C3BEEA5 for ; Tue, 23 Sep 2014 04:39:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 865DF201C0 for ; Tue, 23 Sep 2014 04:39:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 55B4A2015A for ; Tue, 23 Sep 2014 04:39:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751325AbaIWEjj (ORCPT ); Tue, 23 Sep 2014 00:39:39 -0400 Received: from mail-by2on0139.outbound.protection.outlook.com ([207.46.100.139]:53504 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751183AbaIWEji (ORCPT ); Tue, 23 Sep 2014 00:39:38 -0400 Received: from BY1PR0301MB0856.namprd03.prod.outlook.com (25.160.193.15) by BY1PR0301MB0838.namprd03.prod.outlook.com (25.160.193.144) with Microsoft SMTP Server (TLS) id 15.0.1034.13; Tue, 23 Sep 2014 04:39:37 +0000 Received: from BN3PR0301CA0012.namprd03.prod.outlook.com (25.160.180.150) by BY1PR0301MB0856.namprd03.prod.outlook.com (25.160.193.15) with Microsoft SMTP Server (TLS) id 15.0.1034.13; Tue, 23 Sep 2014 04:39:35 +0000 Received: from BL2FFO11FD006.protection.gbl (2a01:111:f400:7c09::167) by BN3PR0301CA0012.outlook.office365.com (2a01:111:e400:4000::22) with Microsoft SMTP Server (TLS) id 15.0.1034.13 via Frontend Transport; Tue, 23 Sep 2014 04:39:34 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11FD006.mail.protection.outlook.com (10.173.161.2) with Microsoft SMTP Server (TLS) id 15.0.1029.15 via Frontend Transport; Tue, 23 Sep 2014 04:39:34 +0000 Received: from shlinux1.ap.freescale.net (shlinux1.ap.freescale.net [10.192.225.216]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s8N4dW0m020481; Mon, 22 Sep 2014 21:39:33 -0700 Received: by shlinux1.ap.freescale.net (Postfix, from userid 1003) id B7AA31AE1FF; Tue, 23 Sep 2014 12:11:39 +0800 (CST) From: Richard Zhu To: CC: , , , , , Richard Zhu Subject: [PATCH v2 2/5] PCI: imx6: wait the clocks to stabilize after ref_en Date: Tue, 23 Sep 2014 12:11:35 +0800 Message-ID: <1411445498-20250-3-git-send-email-r65037@freescale.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1411445498-20250-1-git-send-email-r65037@freescale.com> References: <1411445498-20250-1-git-send-email-r65037@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(428002)(189002)(199003)(42186005)(103686003)(85852003)(50466002)(44976005)(81342003)(93916002)(83322001)(92566001)(19580405001)(85306004)(79102003)(74502003)(74662003)(92726001)(120916001)(77982003)(84676001)(83072002)(87286001)(62966002)(69596002)(104166001)(33646002)(80022003)(46102003)(19580395003)(110136001)(81542003)(36756003)(68736004)(90102001)(77156001)(99396002)(4396001)(95666004)(50986999)(81156004)(64706001)(2351001)(102836001)(87936001)(46386002)(97736003)(52956003)(76482002)(20776003)(16796002)(50226001)(229853001)(77096002)(6806004)(48376002)(105586002)(76176999)(89996001)(88136002)(45336002)(106466001)(107046002)(21056001)(101416001)(10300001)(31966008)(47776003)(90966001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR0301MB0856; H:az84smr01.freescale.net; FPR:; MLV:sfv; PTR:InfoDomainNonexistent; MX:1; A:0; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB0856; X-Forefront-PRVS: 0343AC1D30 Received-SPF: None (protection.outlook.com: shlinux1.ap.freescale.net does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is 192.88.158.2) smtp.mailfrom=r65037@shlinux1.ap.freescale.net; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB0838; X-OriginatorOrg: freescale.com 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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 - a while delay is mandatory required after pcie_ref_clk_en is set. Otherwise, the system would be hang on imx6qdl ard boards, because that imx6qdl boards don't have the reset_gpio. - the clocks should be stable already after the "clk_prepare_enable" is return. So I think it's ok to move the usleep delay after the pcie_ref_en is set. Signed-off-by: Richard Zhu Tested-by: Tim Harvey Tested-by: Fabio Estevam --- drivers/pci/host/pci-imx6.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index 233fe8a..bc4222b 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c @@ -275,15 +275,15 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp) goto err_pcie; } - /* allow the clocks to stabilize */ - usleep_range(200, 500); - /* power up core phy and enable ref clock */ regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18); regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); + /* allow the clocks to stabilize */ + usleep_range(200, 500); + /* Some boards don't have PCIe reset GPIO. */ if (gpio_is_valid(imx6_pcie->reset_gpio)) { gpio_set_value(imx6_pcie->reset_gpio, 0);