From patchwork Wed Jul 29 09:03:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haibo Chen X-Patchwork-Id: 6890961 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 173F3C05AC for ; Wed, 29 Jul 2015 09:03:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B69B207D8 for ; Wed, 29 Jul 2015 09:03:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 201B1207D9 for ; Wed, 29 Jul 2015 09:03:41 +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 1ZKNFQ-0002nx-5v; Wed, 29 Jul 2015 09:02:00 +0000 Received: from mail-by2on0135.outbound.protection.outlook.com ([207.46.100.135] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZKNF6-0002Xr-Fv for linux-arm-kernel@lists.infradead.org; Wed, 29 Jul 2015 09:01:42 +0000 Received: from BY1PR03MB1385.namprd03.prod.outlook.com (10.162.127.139) by BY1PR03MB1403.namprd03.prod.outlook.com (10.162.127.145) with Microsoft SMTP Server (TLS) id 15.1.219.17; Wed, 29 Jul 2015 09:01:19 +0000 Received: from CH1PR03CA002.namprd03.prod.outlook.com (10.255.156.147) by BY1PR03MB1385.namprd03.prod.outlook.com (10.162.127.139) with Microsoft SMTP Server (TLS) id 15.1.225.19; Wed, 29 Jul 2015 09:01:17 +0000 Received: from BY2FFO11FD053.protection.gbl (10.255.156.132) by CH1PR03CA002.outlook.office365.com (10.255.156.147) with Microsoft SMTP Server (TLS) id 15.1.213.14 via Frontend Transport; Wed, 29 Jul 2015 09:01:17 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD053.mail.protection.outlook.com (10.1.15.190) with Microsoft SMTP Server (TLS) id 15.1.231.11 via Frontend Transport; Wed, 29 Jul 2015 09:01:16 +0000 Received: from b51421-server.ap.freescale.net (b51421-server.ap.freescale.net [10.193.102.57]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t6T90uDt011542; Wed, 29 Jul 2015 02:01:11 -0700 From: Haibo Chen To: , , , , , , , , , Subject: [PATCH v3 2/6] mmc: sdhci-esdhc-imx: add tuning-step seting support Date: Wed, 29 Jul 2015 17:03:53 +0800 Message-ID: <1438160637-28061-3-git-send-email-haibo.chen@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438160637-28061-1-git-send-email-haibo.chen@freescale.com> References: <1438160637-28061-1-git-send-email-haibo.chen@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD053; 1:IremQPJ9mBLroGajZH56tl5oLLkKGU1V6omUOLwBOJLpGlhbVb5VUvqb9k3t6t+WD0cSpgtF/XmSiAuhdm3amxOjEjB1f3SUbuuYps5ogCi54ZiPb8h/+ZGynNxNIA1s+F1cogQoqdedbVB8IAo4GGhx5pFzekC0cRS9YlE6yeHGbu6ZlaaBBaRCtIrae4uUtwZEH1XgOiag/DhLSBJWdgFsOKBfVC3O0krGjf93aqPKXRRHbtkJ1xvloyBKSxI8VcGJMIJgqzy2SMacc9L8BpC1R8THk3mIogGYcWcVy/87MOHClHcEx+FzUfuDsyXwbQnTbZKnEOIl6dzndfsWBw== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(199003)(189002)(48376002)(85426001)(189998001)(106466001)(2950100001)(62966003)(104016003)(46102003)(6806004)(229853001)(19580395003)(87936001)(77096005)(230783001)(77156002)(19580405001)(86362001)(2201001)(47776003)(4001450100002)(92566002)(33646002)(5001960100002)(105606002)(76176999)(50986999)(36756003)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR03MB1385; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1385; 2:20mHKZiAIdAN8vYOg5yXZnrHPGAEqJz54sawIc1c6MWpv/RGjo/anjnl3MqkVK09GaXySQCJIE6dD9Vxy7ip1uP2XDV+EMcFLRMJlqSE87kC2H95Q9csKYBrrbbvcL/V10YbdmSVrMYMqeOGqXy4H02qTEPjPOW0k0QnzgZQ41M=; 3:UDDp2H1tmszLmalp03JsForNkpVWaow4vrZVRZUUVbXqZZHcBzBip78wFNHrbDficG5MIp412F+Pjj0VWxrC9Eo9eHhBZbaewZLNqtZ1Gy0fjyZHTRJtBuT2NPSCOXrEE+F9K/6aw6VARwss8fUXX8sc1hRc7RxCxKHJ0S60vWU5Y2B0Jtl0fygBALXZClI8nFJ25T+zfxfuHPqyj2ScLEHBiGIT5ZJptR8szKvW/2A=; 25:sTVEiLcMrH9bJKudXFQmmlhMlIXUyDSdZN+UI9KT83sCnJXX0w0KERfL0dT5ieqRWp61Cgztiu3GBCVcW6VplNaw5D88XUPcTHdgSS422OUfu8sYGAB2FnfpHXhP9j0+BlsqlSOnhwqSS/qiNIA0h9G4fszoeYtJJw0CqnLxYei/SlQM3hQpbyaYwpUVZRx2ui/ayoqlIvLrOkk4J/m3z6AZRdkDYbFEMkMgiJ6fBuSqb6sSncjCp220G6obepjW X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BY1PR03MB1385; UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BY1PR03MB1403; X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1385; 20:7FpOwkRGSQKp/116PIlezBOEe2ILMTzBQUoVswUYHSHxSCshwR4CXnrx0BRZStLb5El4d01aRrzK9J+1c7uZgqKa0Mn63j3QPldjU8WZAzVmbMpdnBQaEx11Zg+H646QKdLlZw5QwldHHqdwCl8Hj7rX7k5rgiVetsPtGcbVW1eubM/RET0TgvyaNwHAalXJc/JSeBiSoW5RrX4drGgoP4tdf2vKLXuzNp5gMqc49FAhuY9l6O68QjmQ5jYtIfPNoaEqc0A2Vj340ztmDg30ZyBrsf0p3phAjqMhgmLTyiVQoBa2+oxIjgMkpPaHdNXnVfejPAGS1W67+Q1vd9UNjaIdvF/rML9OAQCbkRbkMxE=; 4:NX+0kr/u+BYkC5x7TNRFTu/jxE936LvpmLNgl0bbpnu9MO8X8arxFe9TCu5vsqyStcfzMTcFLPTEAxUoww3oXj61YXvi7a/MEZRWzyZ7Y2GVH+jkrnA7MtjiOnxo8b99WWVAtQXyObECXtpSWZIWjRQous9GEkyR2Ed1RtBqGgjgJvlWsiZuCsW29WrbRYGmv/p5tRixBKiK4Lfuxr+83YPxSv7sR2HobW0EKaZK9dNxv3RPIquwChGmcmJL5kdaYcewfAm+eHaHx1smTMOD4q2PLvDmP35gQd2DnCfqeF0= BY1PR03MB1385: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BY1PR03MB1385; BCL:0; PCL:0; RULEID:; SRVR:BY1PR03MB1385; X-Forefront-PRVS: 0652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X4k0UsVBEjn4nLnYWha2sE3kpf/j9EOiukCs+RDNtoDXp2y2ct822kfDo95g1bqQmVtXsrtknoA==; 24:0y37rxjW92KId8fuIbXkzPMQSbXiIiecaPO1wccuET+hw2/TXhMyY88K375u/jj2+T2F0UDPry8hEJs5M1Go7lvWpBxcNUk2cRVwnhiokXk=; 20:dT8Sfwp/XIjqZWsegrAj9hZuYweICC4onAJ/GwLlKY+POyieRLlPzWioYritoBTOIgDBIEFJKoh4R9dTbGFXCg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2015 09:01:16.9766 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1385 X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1403; 2:a5EaFFomZjDLnqN2C8gIuA0L+noQvRGReNTUki3W4Vu8FQruW8XFTps4h8e8D07M; 3:fPLfX7HAF6ZjWkPAFP++yg/QGO1GUzW/NyKrf9OYGfC2uLUY7AGtayrftq7iK8ZSD2nKtKzQO9zm5yQO+HlRkY+/37ifabKNSvVQWAEdowd8aUhUrnF3BtEZ3iKwkTVQVSQbgHt5nH8LDa5lJGVrZ2uMi+zMglhDSo53e/33f5j4Od9dH2Ru62CjtBsS+04yUKw7vMsG+0S283Z0tPrrBaLI4UkYEF0CENMs9Fov924=; 25:C0pYqlOyJOcGNQbVGx8mqAsUFkDyGBcSqr8s7te44/WeMqw3aUddwIWDbkvrYksCjrccvbo5oo3eUuwInZT258hBX7wasQl5zXi1wgEyvV/PC1BF9+h0LUQjOIx/ykjs6s89xHiP9kRC904vr3Gdj1gNOZ9xzmUnBSZCFiRn4bqaL6WPfizJdHrQ0eVgCOd9dxehruFZGyRP3pWNLFxT4nLXUyMU2kpqa/awhAbfUkeHJVa2xNwien24pT15GA77; 23:i4J9tevtXqGSlfSsHo+KF1671jkHbnD0zw+esEvK2sw1cYtQvFS5YiU1Dvt4PJID3hXeqNTPA8ogoEhmMM3jacmpvruk1/IyHcTKvEf280skBoQ/7jNLjs22opLjsXOP9wfVZZ0zFZ2RjN7MlucOGrxieYSOEEI7G63h3/VDz5/uXVqci6TdKHfELmW78SOYBWIbvLxk33xm5nCe3tZUIfrCN909oAH+lpsBcjKlWLP+FHDORPbnQ1vC2iUeRI3t X-OriginatorOrg: freescale.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150729_020140_755777_30008F30 X-CRM114-Status: GOOD ( 19.91 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fabio.estevam@freescale.com, devicetree@vger.kernel.org, haibo.chen@freescale.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, johan.derycke@barco.com, b29396@freescale.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 tuning-step is the delay cell steps in tuning procedure. The default value of tuning-step is 1. For imx6 series usdhc, tuning procedure can be passed when the tuning-step value is 1. But imx7d usdhc need the tuning-step value as 2, otherwise it can't pass the tuning procedure. So this patch add the tuning-step setting in driver, so that user can set the tuning-step value in dts. Signed-off-by: Haibo Chen --- drivers/mmc/host/sdhci-esdhc-imx.c | 9 +++++++++ include/linux/platform_data/mmc-esdhc-imx.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index b441eed..158f93b 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -75,6 +75,7 @@ #define ESDHC_STD_TUNING_EN (1 << 24) /* NOTE: the minimum valid tuning start tap for mx6sl is 1 */ #define ESDHC_TUNING_START_TAP 0x1 +#define ESDHC_TUNING_STEP_SHIFT 16 /* pinctrl state */ #define ESDHC_PINCTRL_STATE_100MHZ "state_100mhz" @@ -472,6 +473,7 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg) } else if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING) { u32 v = readl(host->ioaddr + SDHCI_ACMD12_ERR); u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL); + u32 tuning_ctrl; if (val & SDHCI_CTRL_TUNED_CLK) { v |= ESDHC_MIX_CTRL_SMPCLK_SEL; } else { @@ -482,6 +484,11 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg) if (val & SDHCI_CTRL_EXEC_TUNING) { v |= ESDHC_MIX_CTRL_EXE_TUNE; m |= ESDHC_MIX_CTRL_FBCLK_SEL; + tuning_ctrl = readl(host->ioaddr + ESDHC_TUNING_CTRL); + tuning_ctrl |= ESDHC_STD_TUNING_EN | ESDHC_TUNING_START_TAP; + if (imx_data->boarddata.tuning_step) + tuning_ctrl |= imx_data->boarddata.tuning_step << ESDHC_TUNING_STEP_SHIFT; + writel(tuning_ctrl, host->ioaddr + ESDHC_TUNING_CTRL); } else { v &= ~ESDHC_MIX_CTRL_EXE_TUNE; } @@ -949,6 +956,8 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, if (gpio_is_valid(boarddata->wp_gpio)) boarddata->wp_type = ESDHC_WP_GPIO; + of_property_read_u32(np, "fsl,tuning-step", &boarddata->tuning_step); + if (of_find_property(np, "no-1-8-v", NULL)) boarddata->support_vsel = false; else diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h index e1571ef..95ccab3 100644 --- a/include/linux/platform_data/mmc-esdhc-imx.h +++ b/include/linux/platform_data/mmc-esdhc-imx.h @@ -45,5 +45,6 @@ struct esdhc_platform_data { int max_bus_width; bool support_vsel; unsigned int delay_line; + unsigned int tuning_step; /* The delay cell steps in tuning procedure */ }; #endif /* __ASM_ARCH_IMX_ESDHC_H */