Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752731AbbHEKiG (ORCPT ); Wed, 5 Aug 2015 06:38:06 -0400 Received: from mail-bn1bn0102.outbound.protection.outlook.com ([157.56.110.102]:53952 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751756AbbHEKgM (ORCPT ); Wed, 5 Aug 2015 06:36:12 -0400 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none; From: Haibo Chen To: , , , , , , , , , CC: , , , , , , , , Subject: [PATCH v4 2/6] mmc: sdhci-esdhc-imx: add tuning-step seting support Date: Wed, 5 Aug 2015 18:38:38 +0800 Message-ID: <1438771122-8601-3-git-send-email-haibo.chen@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438771122-8601-1-git-send-email-haibo.chen@freescale.com> References: <1438771122-8601-1-git-send-email-haibo.chen@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD019;1:6c9c8QKzprN9K1ZSuVxT6lh0Iocy7oc80tZopmxgXqKAgwkqA+g3/TgdxqemN0oZwX3igkOsexZ2sx0+dTHr4JFjEGA/dDZBoutVbcKQmTa6FcPWKfLb6yS84OuPRhKYpJBzwW4ltw1f1l9yOZ2ArGjEY2XEeMtf2a4eHNPo5Y7rfsytq9v1erzqzCxg4e5X17xhBrXIS3jJEYkTE8VZkyFLcALmQgJdffrsiksxgBbdqIHYWje+Fk01bTdakW0vqw/C09uysUynhg3jomBwwhxDUAKG4C2WzpAQFm4wqQ8OUzznkrX0fMxYFpaEgubCbvdjimpI/peT6GDtnnGU/A== X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(339900001)(189002)(199003)(81156007)(229853001)(77096005)(5001770100001)(50466002)(36756003)(105606002)(230783001)(4001540100001)(76176999)(46102003)(104016003)(19580395003)(69596002)(4001450100002)(2950100001)(5003940100001)(19580405001)(6806004)(97736004)(5001960100002)(50986999)(85426001)(5001860100001)(5001830100001)(48376002)(68736005)(87936001)(106466001)(64706001)(2201001)(92566002)(50226001)(47776003)(33646002)(189998001)(62966003)(86362001)(77156002)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR0301MB1301;H:az84smr01.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1301;2:lNfplaCLCGcVGOZPYcZp2y/S9p/9BwA0rSeP3KGCnu5RmP/iOPfbLG+aTOF7crsG5z5ivQ9bRefsBLoxHnBBrSv9otwZOPl96R5ia4WqVU0Ies4XnlLK/pHBRnbO0S2RMkZth1DxE6uFmMdBpXjIWwR26d/N1Org/cXIK0gp548=;3:Y922vE9tl0uRMaqV0k4TTE7iHTPhdlVPlZCREBLylo50PE89EyLMWbIcVEaE+qP/EW532dSNz0lG2O6w7TI4GTnfUQ9VuqkUK3PUAgliECRU/ghB6w7ok2qMckAm5jcXQ9H/KTrmZ8xqz5U2yyIoRlIkXiOw0+9c9GNKRpitsSN7ZqlXOOiB48nDsHnkDlKGhgu/2jgLy/i3ui4HYeVc/O6KCaHsY5QsMHpjeRyvIuY=;25:2WSVQbdZZOIcIA51bOhnq1HdLXgiHiaZmzSNEAS20T+0lDcbW8kgaxZo15ZfJGGFUM57z0XlIrpQVuLtHYsbEoAb+KBfJeruY4B68G9CjS2VDK2bfa3BXflRDn869Dkh6TNAN6t34lUvqpzyvd6naB4WmEYOjwn0E0HsIruIhs7Yu6dotpKsFgLwG3CrE3mlFlysd4litrK9V6nvNKwf/ehBRnjjhfSB1qKCuEnVL67mMCaf3FhoHU4XWUOdzCSW X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1301; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1301;20:nrJdx5gLeNBmBfn6po9gzj8i11OEMki6WVRhvJ1+IfSlhrqG+X/yk15RJzb7cXtbU6Jom7cUkhjDyC6135616AwV0VgnRG2x7/yhr7Ck9qS/6f9qR6mnVMwt71FvcD2blmyrRT16huxfpoRcmqiYjKX0SA04AtH33Nw76/gv0yYgJ21793F857Ot7NCIT9FiIIJ7+pelhgRpTmDkRrOgJBr1jO0lcN0+p6zWb5doENCYOy5EfJt7o+I84tLOcV6B55cU6A58A5XPc1CXbczc2yybN5M6EwwE79vs75O64FezSMJj0z+/MhIdG13p83oycwv6AiL8eqc2f2tdfv34MOseFUeK9vwv6efTEY0uIn8=;4:n5uIE0DYwaw1ysziUnzN7dcjNEUUt8Iio4Kv6iR8Fvt9fgnaUruwhvG+eNDdec2dLshA2yqMiNX/oi5zmzSx52okvPIW2kVvTEqVd0Dnf9wCydhG5AH0YiebEvTbFcL1fHbQDsOaCInBCDo8rQCauQkFGeB1maWWGqdBQuPVZN5XbLoWGYLjginjdNMRrVFjXtiCeQ9Cj9Tq9iMG8vvuRbpjCtgjhtyxnv3czVQpKbPp9cDKXrRB7SkS0C2nnkeDEY2NnDP9MPYrQDXtttrpLVJXKHW8V6K5Yxgva0g3JM8= 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:BY1PR0301MB1301;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1301; X-Forefront-PRVS: 06592CCE58 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY1PR0301MB1301;23:0HbQRIa/jQqSIlnvh87R48zlV2wJ67jFGbOtQn7?= =?us-ascii?Q?yM7jReRcJHrpyg8xxpvfXJbasL0aeDPfrsBh5dU3r8fJUTKRVy2DRx4fdVtV?= =?us-ascii?Q?YTW7/WI64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5?= =?us-ascii?Q?D90osy9ZMeD623uY3dJ++CXd/hiBRUeuVlBW8nYk7noVWBUvdmhP1RWqFkE+?= =?us-ascii?Q?gzJVNuDk12Qk1nDFYl/IAD+Lnbfv3xxH4U9Rqg19qP/p3FwscHEmrXg9DdLp?= =?us-ascii?Q?qy4g/rhsSrFY8+l27WgEoQtfM/dMK2/exFjXD73vk94ohSOEM7vhj2KJpejo?= =?us-ascii?Q?SZYLifHGn92+QOJjegs9g7/Mvwuo82NqlyVFQ?= X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1301;5:neE0TCeA557W9YCdjc7ebIVXn+DWG4zX2CO3ZUFs1NtcVfXhzwfsNcOXaj7quQasLDZ6RNmlJtkyWPbEqPHUwBIxapfyWARfYFbrYNaCWq2VJIaEfwqI6D7LR1m6qOOhEp2ZUQYKbIat4sF28bY41g==;24:92+fe64OhBRWgcmB+cZ7DWg1bXK9kky11X2XUzXa3R/N9k0h0dHkQxG0F98MyOr5SfcVI2M+vw1bXXLIakihZQbk9b+luHPsHSFJj1ARxew=;20:eGA5up/dGlcv/ATGyLj4yg2FMpFe48bvghGGkrcJuPsEu+PJFG+ZHab6An4ETWFEkUTrFYwhQSHyCL/OcmfgYQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2015 10:36:06.1522 (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: BY1PR0301MB1301 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3032 Lines: 74 tuning-step is the delay cell steps in tuning procedure. The default value of tuning-step is 1. Some boards or cards need another value to pass the tuning procedure. For example, imx7d-sdb board 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 48f009c..803d24f 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" @@ -474,6 +475,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 { @@ -484,6 +486,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; } @@ -964,6 +971,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 */ -- 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/