Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754248AbbHJIQP (ORCPT ); Mon, 10 Aug 2015 04:16:15 -0400 Received: from mail-bn1bon0143.outbound.protection.outlook.com ([157.56.111.143]:23925 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753584AbbHJIQI (ORCPT ); Mon, 10 Aug 2015 04:16:08 -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 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 Content-Type: text/plain 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?=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z2aGIjr/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 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 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 */ -- 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/