From patchwork Mon Aug 10 08:18:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haibo Chen X-Patchwork-Id: 6980651 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 34ABA9F6C1 for ; Mon, 10 Aug 2015 08:18:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4689B2060F for ; Mon, 10 Aug 2015 08:18: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 66B1E20618 for ; Mon, 10 Aug 2015 08:18: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 1ZOiG9-0007R7-5c; Mon, 10 Aug 2015 08:16:41 +0000 Received: from mail-bn1bon0110.outbound.protection.outlook.com ([157.56.111.110] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZOiFw-0007Jq-3g for linux-arm-kernel@lists.infradead.org; Mon, 10 Aug 2015 08:16:29 +0000 Received: from BY2PR03CA008.namprd03.prod.outlook.com (10.255.93.25) by DM2PR0301MB1311.namprd03.prod.outlook.com (10.160.222.16) with Microsoft SMTP Server (TLS) id 15.1.225.19; Mon, 10 Aug 2015 08:16:06 +0000 Received: from BY2FFO11FD032.protection.gbl (10.255.93.4) by BY2PR03CA008.outlook.office365.com (10.255.93.25) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Mon, 10 Aug 2015 08:16:04 +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 BY2FFO11FD032.mail.protection.outlook.com (10.1.14.210) with Microsoft SMTP Server (TLS) id 15.1.243.9 via Frontend Transport; Mon, 10 Aug 2015 08:16:05 +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 t7A8FmJj017011; Mon, 10 Aug 2015 01:16:00 -0700 From: Haibo Chen To: , , , , , , , , , Subject: [PATCH v5 2/6] mmc: sdhci-esdhc-imx: add tuning-step seting support Date: Mon, 10 Aug 2015 16:18:04 +0800 Message-ID: <1439194688-18335-3-git-send-email-haibo.chen@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439194688-18335-1-git-send-email-haibo.chen@freescale.com> References: <1439194688-18335-1-git-send-email-haibo.chen@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD032; 1:OkQViXK7qiKtJz1Roc4oZXPwUSJ82xhtITr7f2kbGtWekXMINZZIsvdHEvYdkcF+WIUYPNLzk7mehUmrS4wGWGjPWSqjoyUWfcAvXWUb8HUngndwzfvVK7kc/FNCgB6+/ODtiYTyv+om3u1hQBb7W3bOattJ+xW6cq3Rhi8rndYnAmiuwleL/RCG2S1wNQ95j2FtMztpSBDcIqqzaQICdy/XydG9aUgb203AxNJNR0ypAfWthfTf16KH+a3nJtIL9vPqVygX81ztVdpeksrCIFlVACIBXqsC1XesJPIVY+37WvgHxNNsrJK4ZR9mZDIYVFlAzlDWTig889ANgjHNwQ== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(189002)(199003)(5001960100002)(77156002)(5003940100001)(36756003)(230783001)(92566002)(4001450100002)(5001830100001)(81156007)(5001860100001)(5001770100001)(46102003)(86362001)(4001540100001)(97736004)(189998001)(50986999)(47776003)(87936001)(2950100001)(19580395003)(6806004)(106466001)(105606002)(33646002)(62966003)(104016003)(2201001)(69596002)(48376002)(50226001)(76176999)(85426001)(64706001)(77096005)(50466002)(229853001)(19580405001)(68736005)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0301MB1311; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB1311; 2:JsEN+VOysZ/CQ4vjT9FoLKZts6E9asCvCfYtKzEJ7aInCUDJ1EAWKVoQyM1pij0ZmL+JqMFQ8ovPXH3sdATDFVQAYXQL8drj2LpGSvJAvZ3m6T5lMU2EN/NfaWfP2YuJbQETfXuodxqlh2Vroc0nM3NO5Ih8FUX3eCn0LsBabtw=; 3:alNE3aGrx9Fe56yiTJdAqFuxLMpZCnSYMRHopFPX9AZVOsttpSZGj7IfMoHojDn0GtWXpH2oM4ejsoG7KdK7mxrK1n3JaQH3Osi1HUnLM7rs+6N44xYUE6hV2k93yCqW7jFKfXTQ5d7Jb7GmWAeuNxZSJdbW8/IJen8EJNzrSAAkT2noumdAKJuIif/j0ySMOeDki/i0TDRUbI0WbjVDqLnCWBNEfL2RADeE6M9ZgA8=; 25:vSDcZ6z+Y7BX+nw5O+6PvGQNbSYMSIoxPOEnvjFBfDpYQ6glGdOhar1rc4xm40IqYSTZIr+dCxlKmeahQ9Dn+jABkwP4sAmlV1UeVfaN48nIXxm3IZ2RrDDbk5D3cIQ1RvyMhoQTx6qHAOjwH5Uu31Glimw1uTQAK+pNxWXl8WdLzMbdI2EajR643LbZ5yQk8uVQ/BIOBE3Iu2MSEEUwWOf8SmPPp23tizz6hxU9xZYm4GhK6IUVgZzAgzbiN9vm X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB1311; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB1311; 20:GuBOF/N+tT0yWNXjgHMUJsvLMsmJpZENCbLDNh14aYmVoCdArJiaBiuovzfqtzVd5Q2YmzSHu1wMygYkpCBUq48U/Oaftknqlpjsi7EY5edoq4TGVAcd7UVJOdTHGfTZTK7ESK5m3UpVPHPIVc3KzreNZvAvtRWSuiuvZ7fk9jy7YMV8vABaAfd4/bnJXYlEo0GysUPfUGvb2aTX2LvVRpVOd4zj23Bik6UrXrxIp6NlhfQGRFPUQIWYReg3f3GU7MmIl3uIgNMuBJyORpy2dMrvvu9o9ZPK8Hbp/8EZZXPY05W+J6nwufGA5Y4h50/gpgEALGfGey7tPOnBwPauIVVJ3nQB5w4GgTauTOnBGao=; 4:Bpkx/YlSqEY3blgE8DCaOFE1ZSSsogpPHQDaCy5knzE761a2pDjEsjOnYbkj1u86SF1+uGnlVTy7WHAOzxL+7ZtHrIqLCb+B2k4+oUkyvNDiee4+7ogOzfPF0iy2wJhp9FqcMhOGmwINO3Lzea3UuCfUsnKDkQxKSQYdtsVTxxE44cimNbhYnKitSHipvFpQU79QQZoXIcDR8GjdTpxEGDq5CvIrCTDi250aEtZo+Gse45aTp0RBtqqeNTLd9kxis706/Tt1s0kouIbGAPvPAxV0VZ9Bdo5xCRv6iMS7UDE= 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:DM2PR0301MB1311; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0301MB1311; X-Forefront-PRVS: 06640999CA X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0301MB1311; 23:VXlqGwVn/tl2ZAqrj+GOiR3YcSWokDwh8JWPXaz?= =?us-ascii?Q?uxErPw9YJAZtlb3roMYXI3zq3Xzr6IocVN9t1vmaETeytFnutaf9FCV2zGpM?= =?us-ascii?Q?QU0IkupUkpQAppmJmkra5ydC5tEMTxe9HlM6B3EUDMmAmFz7LqoJ1rxW75HN?= =?us-ascii?Q?xvK3X31DivfVPPKYTjIEIdldEmDeSE80c3AyiyU+uaNmuuCJpkhDuQVvrPPI?= =?us-ascii?Q?WnFRPU4uTaPjelhLb/c5mu6LqgcL43o+D9dkuePlHw1IHmARroyHDI2onbsP?= =?us-ascii?Q?C4soIcnPzqUkL85/k/8yGGNcYiVJAK5ktp3iIeRBAe3mRIdhvmCw63EtrKjj?= =?us-ascii?Q?s26fWO9xBicaTTUiiFFRZloyDL4+xPnsf48fObUS0nT1CBOkJr0Bn0T3evtf?= =?us-ascii?Q?6GvdQr4jdHS5EHY2p3SPkbP4Jz1Ek5jspYztQoKfYtjMZEHh6hAyfmSBW+hy?= =?us-ascii?Q?iPuF5+uDVUA7G1Z5d82xG5IaChqfwznOOqe03V465ype0ijQqRJfuNuW3QL8?= =?us-ascii?Q?gIbfHdx6tTcdNVAfeBwkF9MKHxEEWkV/rMOxR4S9pim7sct7tIqXXifl0oi7?= =?us-ascii?Q?20DZv/xuraU4q7rFFVDX12xH4C10H/spE0U0rRvTYd2RktHWSWgS1s+XWzSz?= =?us-ascii?Q?yXvsUtVrPxdtUtXFwqXLoCSArU88S9EKUjIFa7nxGpTeiFxqS4QJicoNbqYK?= =?us-ascii?Q?fZPWXF/ScIRIrxOfms4vBQl1IB4xgLC5pbJ//4cdoz5DZzs0Is7nJAadIGHq?= =?us-ascii?Q?/LL15gUlMg2OxDD04F140a5PSkerJOEkevista1Jjs3tCa2Faj0mV/OIgF0r?= =?us-ascii?Q?0jP51dV/+9ScjKBbcKjaXIskyesFjcLy3Eqxfec58CcM6KCr3aeUfNSgoBwX?= =?us-ascii?Q?mZ9PLsq5FnGm/ZEG51SwVYijCH60L7kQuJLRTGiWpudOaGmTXFRdfyJoXpu9?= =?us-ascii?Q?pVlOmyYcbbHKomDi1X2F8svuXbDHbscxwm6rTmNDSpbEBRoTJz2aGIjr/SB2?= =?us-ascii?Q?Ljl+mfRTsz5gKWQIKFpNqMt85+krWtGUgKiiVaapjOm5ovkjFZxjdNsdWpDj?= =?us-ascii?Q?EulTS3Xho6r0ZFeJIqx1/zshNY2L54rhJlTXWBb+dueyjvxoQMPZ0xfHablz?= =?us-ascii?Q?NIp6Jh8VMAdb8j0p/J+pTJvT1h921fIvx3/60aLYNKewXQ1c8QFYSkUQWyQ/?= =?us-ascii?Q?N3/s6upiYaYHgONW3X3NiHhgDGt6JVXj4t9Lu?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB1311; 5:QVGlMPHBtgJ9l1wctopY9aEQ/kB/E4Fn9AOb+yMw9niMRb1ZwuzxgOjZGweDYGi/f9tT+JTLD+lOXz0TzGx72zet2/v71NX/vEWmM0GorkCMETadABni3ehmsxt/KT2q+VL02L2qyOCBpHAou2SHhg==; 24:vqLNb32eyQdp3YiTbdDXmnBCelUSPW4gBb9wg/5NZNmnhbBza4d6AuP1WWtFDz2Qa7hun5jIgM2jJrlSI9S9xvI8v66gzO9kSMrXFCpKii4=; 20:nP7GfD8QTqca3TWTKgNatWD18WnBOOKpF1TKpBbVi1J8CaWZWL1WuD0ugRAilAXijPxKi/hT72uWugpZtKCOMg== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2015 08:16:05.0015 (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: DM2PR0301MB1311 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150810_011628_463387_93803521 X-CRM114-Status: GOOD ( 15.09 ) 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, 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.2 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 2a816ad..03c9f33 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; } @@ -965,6 +972,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 */