Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932980AbbFWMBu (ORCPT ); Tue, 23 Jun 2015 08:01:50 -0400 Received: from mail-by2on0127.outbound.protection.outlook.com ([207.46.100.127]:5178 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932828AbbFWMBW (ORCPT ); Tue, 23 Jun 2015 08:01:22 -0400 X-Greylist: delayed 955 seconds by postgrey-1.27 at vger.kernel.org; Tue, 23 Jun 2015 08:01:21 EDT Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; From: Haibo Chen To: , , , , , CC: , Subject: [PATCH v2 2/4] mmc: sdhci-esdhc-imx: add tuning-step seting support Date: Tue, 23 Jun 2015 19:48:01 +0800 Message-ID: <1435060083-2606-3-git-send-email-haibo.chen@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435060083-2606-1-git-send-email-haibo.chen@freescale.com> References: <1435060083-2606-1-git-send-email-haibo.chen@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD040;1:t/a65TIZtYfPlDryRNF4f0SDV3bg9QflwcAVeT6bT0SQBdTUOkLmxEkXygPwTAi7vlVgCF+7k7Xe+bg8d1FSxJ8tjBqXtoiWjopGq6TPpndW8eSX8Wdu1jMKTIhTB+rkfxnl9+d/Dr+Gk2wttcDWc+wOjdPcPGQYJQ7jp9Bu9P+cx9jJoVHgqFtMQKJbk/ea44VcGTF+Ap0HCPiNCHDU1Nk5MWN6kO9tj4YScGxQ601WhYugK0CPSZTyi13JezHXrPS3Luqz88YYOt3Ra9oSeSsjR+dv1y1H6kuJbBiu2SvsR/ajFZ/7Pelz3hQSB8l3pjCEhHxUsBNvP9KxUiw13Q== X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(979002)(6009001)(2980300002)(339900001)(189002)(199003)(229853001)(189998001)(77096005)(2950100001)(48376002)(47776003)(92566002)(104016003)(6806004)(19580405001)(62966003)(77156002)(76176999)(106466001)(50986999)(86362001)(36756003)(2201001)(19580395003)(5001960100002)(107886002)(46102003)(33646002)(85426001)(105606002)(230783001)(5001770100001)(50226001)(87936001)(50466002)(4001430100001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR03MB255;H:az84smr01.freescale.net;FPR:;SPF:Fail;MLV:ovrnspm;MX:1;A:1;PTR:InfoDomainNonexistent;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB255;2:W/4naCsCzO3V0xIDWqlQ2oOUUCcgc5ZalGFSkyNWlGnPNlBh2FzZbjz40R5tevSv;3:a5vsEbFUV33sTEoxIAaUDe1MkWm20JhDGPAa47KL7/Wlf4PastEzrYh7iOItv/AzHv8RevJBJLnVd8N6qhoivWARMg09L6UGsu2F8y57pfWmDKkA/m+v7IHK1ITnF5qWwqyVRDqdPqvQCVHBdf0PseH6nCVZpvFmBiPtH9B3ADGGI7PeKv8M5c7uDdYR+gf58nJybmKr4XL6x7+bP69nrj8iZryYxRqdGYjJDRS4ajQ=;20:H0v/dwGoUQ4piXREcmtsVKMESZ/3ST2Kzs3Lnl/mm4IWt8GJ5UVuKnfdWHCx73VL9SmbuKAi9g+pRf+kZVEp585mylerk+6jkKJvj8FQ6xoSOTR3AZ23wQwVO225eUd/5mmAsqa6ujgn3+cAed3K5Fxp9AkckniqaCZCqvcUobcWivyxH0QGv+Y1DM5sX3QgOciIWS2w56QISrTFfMwlCZHsVxVmDg516hfY0lF0F8EDlNr7eJdGk0ipal8+7IxP1XV32Aco0vjQLaFk0EnXqN7RT4kJokr8BO+qFk0hMO64U0QJWjUS1JA6Bx72Enhs3dW8tIuD3LF295s/dMxfBISq2RtKUL/gSjwhedFsi68=;4:w+PS2HHMZ190CbWRkQKp/IDVDheiSpv2xb07H4gLr0//+xXow/u1iU820zKbUKigNe6TXkCVIUNnDqllD2o4ioksO1BC+i7MGWXHVhwiVdAqaVmMzW4EwfebdZ+VLIQ6F8HC7hUuvS28O09mAj71bm9Jq6ipmeSc8i8dnhaauQ260WDiGRtdzHVvHem743NybuAP0/7ZOOzKt/ZIlHgeCXkHSqTZ6AMYDQgsjZVipmYFpe7f6ZUJG5c/Z+qf1xMgfwK2Vnwiv7uAA8i/DHy2g3hdBNqARxldSBbJ2oa9mtI= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB255; 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:BY2PR03MB255;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB255; X-Forefront-PRVS: 06167FAD59 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR03MB255;23:TLWYYdEvrTsHKNnqirCed5k4bzwDKVg5QQDv3eizrX?= =?us-ascii?Q?VRfcuFeuq8hdsKI89ZZz0ZUINjNt8DbOXL33Lr4upQ3kKRL9jyXhO1WnF/rO?= =?us-ascii?Q?j+OVuKGB+UNd4FRs6b2gpnpSZbujKYAb5OJ9f0dj40cOehhfauIwwvS5qa2y?= =?us-ascii?Q?Db4igaqQMgWAIt9SCiYDFtIk0sg/pWC9xo52kpbSSsfs/y5Lihat0lSCn4lc?= =?us-ascii?Q?o4kZSB5QzUTQcEu1YUlCnHPEhRBSZYAEPbSZFCLbokV7cJO5M3twZ3kFFKcR?= =?us-ascii?Q?Pi00zasmWVSZmzlJ9NGKbHMZHvejLw51W6/4LWO7cl0eL0myvH78rqqckrSo?= =?us-ascii?Q?+IlfOq3FWO+o3jOd4KM/oNDQF4EErkZ4GjTRDrmgsrodZalqL4JlTyYfcwIt?= =?us-ascii?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eALlScI8zhrUU0NCbg9eh/V5vUiRoxbd2+Tgh+MVF2VX/zTkBvtyM6aSVfLi3U=;20:rjeAbbM+Vfvu4TSUhdkF00VtExJJynexy/6zKPVxy8kgWnV+BWs5um8YEPNnRP2WMHQhm2p7xa+BEcjWI7Q/VA== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2015 11:45:23.4092 (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.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB255 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3010 Lines: 74 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. 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 763b928..f7ec66e 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; } @@ -969,6 +976,8 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, of_property_read_u32(np, "max-frequency", &boarddata->f_max); + of_property_read_u32(np, "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 75f70f6..cedbf8e 100644 --- a/include/linux/platform_data/mmc-esdhc-imx.h +++ b/include/linux/platform_data/mmc-esdhc-imx.h @@ -46,5 +46,6 @@ struct esdhc_platform_data { unsigned int f_max; bool support_vsel; unsigned int delay_line; + unsigned int tuning_step; /* The delay cell steps in tuning procedure */ }; #endif /* __ASM_ARCH_IMX_ESDHC_H */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/