Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755988AbbHGHt5 (ORCPT ); Fri, 7 Aug 2015 03:49:57 -0400 Received: from mail-bl2on0132.outbound.protection.outlook.com ([65.55.169.132]:3764 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755358AbbHGHty (ORCPT ); Fri, 7 Aug 2015 03:49:54 -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; Date: Fri, 7 Aug 2015 15:40:20 +0800 From: Dong Aisheng To: Haibo Chen CC: , , , , , , , , , , , , , , , , Subject: Re: [PATCH v4 2/6] mmc: sdhci-esdhc-imx: add tuning-step seting support Message-ID: <20150807074019.GB6935@shlinux1.ap.freescale.net> References: <1438771122-8601-1-git-send-email-haibo.chen@freescale.com> <1438771122-8601-3-git-send-email-haibo.chen@freescale.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1438771122-8601-3-git-send-email-haibo.chen@freescale.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD027;1:U0XlYA40Bg3MNs0J+iEpDx/T9on0ZoXYFpoRu5C5Bb8Evzs0mjJH+wsDbzXYy/KZXtKGVUt0591jZ5ljDq7+F/sAEthZ6z6eIwasYaHpUuqbUobfALSsUEF8yBYwOLB/Pmu7JwK8N+WkEehFaz15zEJDC3NyoBKzmMJ50FtCu1sxnYXLLM31tRTiJYv95SD8ZskNLJdg2bbrqRNe1LJENNaNJEFd4yRhvz5Gh+WWbOD/jXaCVQ/dyngEG1TT9B9BR+bBSmdMXlquwKj0QqPJK8lR7/1XAw6BNEKswij25aahKaUuNUjlzgF/zaEjvRsA93algGBGhRktNPRirHnZlg== X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(339900001)(189002)(24454002)(199003)(50986999)(54356999)(33656002)(4001350100001)(110136002)(46406003)(104016003)(5003600100002)(76176999)(189998001)(4001450100002)(69596002)(77156002)(106466001)(62966003)(97756001)(83506001)(85426001)(105606002)(47776003)(6806004)(4001540100001)(46102003)(77096005)(81156007)(2950100001)(68736005)(230783001)(23726002)(64706001)(5001830100001)(5001860100001)(92566002)(86362001)(87936001)(19580405001)(50466002)(19580395003)(97736004)(5001960100002);DIR:OUT;SFP:1102;SCL:1;SRVR:BN3PR03MB1383;H:az84smr01.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN3PR03MB1383;2:M44OqddjCIba+kDTlE+ajSwJAGhfgfM1z2CD3LUkS+8Rn1CPdrHX7GnvIDcY5dbmQoVD2ktmrJK2tep8AjVW5T2pYCj3iLZ0+rii9jAhdB3C1vdUYOUNNvmcCopVLHdJ6k7POOKpt4+hPvbgI5JgrLDnkknHGJwHxk9Fx1z+eb4=;3:EcZZiOZXh9I3aKbttU0HkKm/h3hDq/s3g7nOcBwbxqkWUhnpF5VGcbwvfdaL5qxlARXC9zYTVrshbQis0m8qJ2u+h2buAYCPlXcWU9O1WxWTB5W4S4I9IwJIObVbUCCdSpFC66AW4eV0wXDyeFoSWt34SBUv7h81Qmn9LOpplJDZsIQ2ql12o/X7PiFZAlEWISnDCT5o9ogqa+2FJgwP9+iS+1uW4ueNK8p0UOzvnek=;25:WWcA5mRO2VU3+aK9Y5fyCOQzjKTWXbwkZZIlWIKzvUxfee42wqODat6zJ4J7wK8coJUpvTqTyyB5XCYbPr8qbt/O1oQBpXajesaaIDfa3xENovxWLYv2Mgad7F34Su70Orp1JLnOc2cyNDhFjwWU8Mg9KBbdQZDAhNYanX/oldE/kl92imvTCyCEHkYo+qZUXyQewS1NaxYqfQlTv0cJCC0Z+O1JA9EAAWnE7PMVXk4RqjOmjE17ek0ypjiKkThN X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR03MB1383; X-Microsoft-Exchange-Diagnostics: 1;BN3PR03MB1383;20:vclavjOY4XS/SI/He0aOB7AD3kZeULCFius/8/7ngoiyP+bbhTiNEyrPWaptjtA33Z18IIuIa+cBJVPAByy1LSwFaPNRztj6FFH+0aIm024CCBj8TU+z620qzuP8VdZFNsw3O3fq1ScmYhY4xrEZ4bqpi2mlrxOGue9zDcsd1LGyuwzErnz2MJuQR5e/AIoA11DBrwQxCfeGnLQQyItnRz+aK1fYt8udbp64PHezqmQs0rnVHZ7/N4BjvNr9NXAQS2DMAcC13KjXVZjkxoad0Qdft0uan1Go3h+boCrnMxIXSqIo85KJ7cuTc9NLYdMllX0PE7y/jaUOdeBThC0o1TAuBJF45R2qVLzxgttnf5c=;4:ARyKzHSvDI2vD9gTMYi+9hNmdTROOOg2JxpcV931u1P0KrX+wmCmSCLDjccq4aThhJjQiE1FWHUV6O7fTLv+z3nEnhp/BIXDHeNo0j5/to8E16SihXZG8f9jsqRE++LYfbDaB+QJG+85vZh4tenZfu9bJ45kV9eK235mVgbt+U59KKhfr9zgDmDN9ezFdgPHK1La2yjlUmYBYTyrM2yZ/7ekmBlewlqIpdRmXy4jTJ0D8ITMqdVgKmhs0+7tEDZwL777T5qBWHbn+1WBM/2Ak2N2lKHpGNF991DluC9b4s0= 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:BN3PR03MB1383;BCL:0;PCL:0;RULEID:;SRVR:BN3PR03MB1383; X-Forefront-PRVS: 066153096A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN3PR03MB1383;23:nMUKHhU1O44/CXYM6cNttBcViqwW/E1ziRW7SSwlO?= =?us-ascii?Q?a5nMqYPX+lY1x6qMNoNkccNUU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?Q?2IbRVF0ZLNMtxXwjeT/k2ibqV7D3JyCJm5ZONspaMM6H+LmMmwyG1DVXu6WB?= =?us-ascii?Q?nNcIYl0fVNMnvSba07Pk7BjvPDbgn7Q6tg4dmdp9cdOmhPu+ikiTXNy19tq1?= =?us-ascii?Q?nr46hw1JNp4CJ1OJniqwfaiYlI8Y8/QcSeoiCxyTvzWKlK6KSvL/hQpdsk/b?= =?us-ascii?Q?iD/59J+T4OKquhZ+0O0++7yrM/Qtod0hk0/KNMGGtlcTM+RxjNuqD1+xWWrB?= =?us-ascii?Q?wMG1Fg9K5f5lRnRC2ewXdaYJwlgpvi5UmKZv4njv6uYuViGDjh1cr8qzA=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN3PR03MB1383;5:mXgVORYa3WUpQwaR1rnqkN4gbBTcVt2+/DDt8G+I7cFOfTu4SbJ1W3SCw9+d797SL5yjfIVQI4wIXCbIReKRPXBJB6InyJAbL4A/QDBRQDqfbJdUij2cjFAyFa6mQZdWwDA8yFMtn8Y3L9yzMqbCcA==;24:YBV3sOpvyJCRYQ671Met6GqPHz6Gn0/DX/nE2uMyO9WN17TBrjIowQdeQoaPYIKG81DSy1bH5ueTnIpDWxM+Ct9c/GxLyTSzJcT55mboJEA=;20:L+ng9icSNVdQqqgK/5QLyH31AOmg9tdL+oTSzQZz8b8cSNwtVXyT//Z1Uz2yz6WdXlX9EW/1uDLvUme77Rju3g== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2015 07:49:51.3463 (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: BN3PR03MB1383 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3328 Lines: 82 On Wed, Aug 05, 2015 at 06:38:38PM +0800, Haibo Chen wrote: > 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); Is there a code indent issue here? Otherwise, the patch looks good to me. Regards Dong Aisheng > } 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/