From patchwork Wed Aug 5 10:38:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haibo Chen X-Patchwork-Id: 6948021 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 1A93DC05AC for ; Wed, 5 Aug 2015 10:38:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3327820425 for ; Wed, 5 Aug 2015 10:38:52 +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 43F97203F1 for ; Wed, 5 Aug 2015 10:38:51 +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 1ZMw4A-0008SM-JF; Wed, 05 Aug 2015 10:36:58 +0000 Received: from mail-bl2on0148.outbound.protection.outlook.com ([65.55.169.148] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZMw3j-00085b-Mg for linux-arm-kernel@lists.infradead.org; Wed, 05 Aug 2015 10:36:35 +0000 Received: from BN3PR0301CA0041.namprd03.prod.outlook.com (10.160.180.179) by BY1PR0301MB1301.namprd03.prod.outlook.com (10.161.206.150) with Microsoft SMTP Server (TLS) id 15.1.225.19; Wed, 5 Aug 2015 10:36:08 +0000 Received: from BN1AFFO11FD019.protection.gbl (2a01:111:f400:7c10::109) by BN3PR0301CA0041.outlook.office365.com (2a01:111:e400:4000::51) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Wed, 5 Aug 2015 10:36:07 +0000 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; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD019.mail.protection.outlook.com (10.58.52.79) with Microsoft SMTP Server (TLS) id 15.1.243.9 via Frontend Transport; Wed, 5 Aug 2015 10:36:06 +0000 Received: from b51421-server.ap.freescale.net (b51421-server.ap.freescale.net [10.193.102.57]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t75AZe9I026522; Wed, 5 Aug 2015 03:35:55 -0700 From: Haibo Chen To: , , , , , , , , , 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 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?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ORgu8BNeH?= =?us-ascii?Q?PrAb5oH7iO9UtKA7tSbQD5ZN2ddoBLFk1WjW3jHyWApu5A9V9t8SOPs/roW5?= =?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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150805_033632_292434_9AA5B824 X-CRM114-Status: GOOD ( 16.13 ) 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, mkl@pengutronix.de, 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=-4.3 required=5.0 tests=BAD_ENC_HEADER,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. 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 */