From patchwork Sat May 17 12:46:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 4196511 Return-Path: X-Original-To: patchwork-linux-arm@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 49797BEEAB for ; Sat, 17 May 2014 12:49:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 25165203E1 for ; Sat, 17 May 2014 12:49:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D4E73203DF for ; Sat, 17 May 2014 12:49:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wle0f-00020h-TA; Sat, 17 May 2014 12:46:41 +0000 Received: from mail-bn1blp0186.outbound.protection.outlook.com ([207.46.163.186] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wle0Z-0001zq-UP for linux-arm-kernel@lists.infradead.org; Sat, 17 May 2014 12:46:40 +0000 Received: from BLUPR03CA037.namprd03.prod.outlook.com (10.141.30.30) by BLUPR03MB341.namprd03.prod.outlook.com (10.141.48.12) with Microsoft SMTP Server (TLS) id 15.0.944.11; Sat, 17 May 2014 12:46:12 +0000 Received: from BN1AFFO11FD054.protection.gbl (2a01:111:f400:7c10::126) by BLUPR03CA037.outlook.office365.com (2a01:111:e400:879::30) with Microsoft SMTP Server (TLS) id 15.0.949.11 via Frontend Transport; Sat, 17 May 2014 12:46:12 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD054.mail.protection.outlook.com (10.58.53.69) with Microsoft SMTP Server (TLS) id 15.0.939.9 via Frontend Transport; Sat, 17 May 2014 12:46:12 +0000 Received: from dragon.ap.freescale.net ([10.192.185.221]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s4HCk5bg016154; Sat, 17 May 2014 05:46:08 -0700 From: Shawn Guo To: Tejun Heo Subject: [PATCH] ahci: imx: PLL clock needs 100us to settle down Date: Sat, 17 May 2014 20:46:01 +0800 Message-ID: <1400330761-2432-1-git-send-email-shawn.guo@freescale.com> X-Mailer: git-send-email 1.8.3.2 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(979002)(6009001)(189002)(199002)(48376002)(62966002)(6806004)(93916002)(87286001)(50466002)(21056001)(87936001)(81156002)(97736001)(89996001)(79102001)(31966008)(68736004)(69596002)(64706001)(83322001)(80022001)(102836001)(84676001)(19580405001)(47776003)(20776003)(19580395003)(92726001)(44976005)(86362001)(46102001)(88136002)(74662001)(92566001)(74502001)(76482001)(36756003)(77156001)(50986999)(77096999)(81342001)(99396002)(81542001)(83072002)(50226001)(85852003)(4396001)(77982001)(33646001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:; SCL:1; SRVR:BLUPR03MB341; H:az84smr01.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Forefront-PRVS: 0214EB3F68 Received-SPF: Fail (: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=Shawn.Guo@freescale.com; X-OriginatorOrg: freescale.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140517_054636_176734_47EC5986 X-CRM114-Status: UNSURE ( 9.82 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) Cc: linux-ide@vger.kernel.org, Shawn Guo , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,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 The commit e783c51 (ahci: imx: software workaround for phy reset issue in resume) calls imx_sata_phy_reset() to reset phy immediately after SATA MPLL is enabled. It seems working fine mostly, but fails in some case as below. ... ahci-imx 2200000.sata: failed to reset phy: -110 ahci-imx: probe of 2200000.sata failed with error -110 After talking to the designer, we learnt that when enabling i.MX6Q SATA MPLL, we need to wait 100us for it to settle down for safety. Add this required delay to fix above failure. Signed-off-by: Shawn Guo Tested-by: Fabio Estevam --- Tejun, Sorry for that I did not catch it when I was working on the phy reset issue in the first place. I used to test the driver with a 32GiB and 64GiB SanDisk SSDs, and did not run into this issue. But it gets exposed on a 8GiB SSD I got to play recently. Shawn drivers/ata/ahci_imx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index 5824d99..8befeb6 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c @@ -258,6 +258,8 @@ static int imx_sata_enable(struct ahci_host_priv *hpriv) IMX6Q_GPR13_SATA_MPLL_CLK_EN, IMX6Q_GPR13_SATA_MPLL_CLK_EN); + usleep_range(100, 200); + ret = imx_sata_phy_reset(hpriv); if (ret) { dev_err(dev, "failed to reset phy: %d\n", ret);