From patchwork Tue Aug 11 11:38:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haibo Chen X-Patchwork-Id: 6991871 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 CE341C05AD for ; Tue, 11 Aug 2015 11:38:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB7B020656 for ; Tue, 11 Aug 2015 11:38:56 +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 B17C020605 for ; Tue, 11 Aug 2015 11:38:55 +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 1ZP7rV-0000Xu-HY; Tue, 11 Aug 2015 11:36:57 +0000 Received: from mail-bn1on0136.outbound.protection.outlook.com ([157.56.110.136] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZP7rH-0000PK-L7 for linux-arm-kernel@lists.infradead.org; Tue, 11 Aug 2015 11:36:45 +0000 Received: from CO2PR03CA0025.namprd03.prod.outlook.com (10.141.194.152) by BY1PR0301MB1303.namprd03.prod.outlook.com (10.161.206.152) with Microsoft SMTP Server (TLS) id 15.1.225.19; Tue, 11 Aug 2015 11:36:20 +0000 Received: from BY2FFO11FD044.protection.gbl (2a01:111:f400:7c0c::146) by CO2PR03CA0025.outlook.office365.com (2a01:111:e400:1414::24) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Tue, 11 Aug 2015 11:36:20 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) 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.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD044.mail.protection.outlook.com (10.1.14.229) with Microsoft SMTP Server (TLS) id 15.1.243.9 via Frontend Transport; Tue, 11 Aug 2015 11:36:19 +0000 Received: from b51421-server.ap.freescale.net (b51421-server.ap.freescale.net [10.193.102.57]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t7BBZxY4002344; Tue, 11 Aug 2015 04:36:14 -0700 From: Haibo Chen To: , , , , , , , , , Subject: [PATCH v6 2/6] mmc: sdhci-esdhc-imx: add tuning-step setting support Date: Tue, 11 Aug 2015 19:38:27 +0800 Message-ID: <1439293111-21077-3-git-send-email-haibo.chen@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439293111-21077-1-git-send-email-haibo.chen@freescale.com> References: <1439293111-21077-1-git-send-email-haibo.chen@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD044; 1:FlM5UYxIf48w6GvTAg8HEWPNj6XaLrl91m0PKBYSschven4v7b5oTOdjUHRnRbJ6PrZat8y7kPLVkn+r/hx93S/h4gxg/HMM2zeSAvpa8z5f3N65LBZpzLwN03xN5ke2iMzVnBIFB7ZoKg8ntFEwpx0EGoZiWCIWRIr0Nzvkh73cWmsyrHKS+f/fzJIVSVJEsHeHL2lOE4rrbNgtLHQcYlu414LDlxGhldYlSXubFw8b9v2dWmv0HawWA/RakcWp9jLjDtYyCwA9mVLDk82B7G3d1d6P1UJrfnN3K8CsWDdvKB+C1sjM4fVfXr0Tcp4ZHffUsIeHZ4j7EB0822Pb3pVa3lndJz1YDQ7hbvqLYZmoc8UjXOLMJS/EixZUSZBZ X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(3050300001)(199003)(189002)(19580395003)(189998001)(105606002)(62966003)(33646002)(50226001)(97736004)(77156002)(2201001)(230783001)(229853001)(48376002)(104016003)(5001960100002)(77096005)(5003940100001)(46102003)(76176999)(68736005)(50466002)(50986999)(86362001)(64706001)(85426001)(19580405001)(92566002)(5001920100001)(5001860100001)(47776003)(6806004)(4001450100002)(2950100001)(87936001)(81156007)(5001770100001)(4001540100001)(106466001)(36756003)(5001830100001)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR0301MB1303; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1303; 2:ly+/YnkqyAgh4iEU3fxKP7bw8GtORwTzmlF6Mty7jr7F3hswpawfyYjgKyrOhRRHaQF93M9MRr70ZTRBLo/NH8tmFGL0k89653F3kA2yKvjXVaIo11Vo8jl3w43GWF4TRoEG5wo8YCZbPZIyWd/KN5zPTloA8rATTypcoOHHL60=; 3:d6VVXz9FEg47g4QpHDBv+MgXMxIbwReD/xC4MCHcyGvKlq0HPy+dJYXZg2Ab6BEXiIMDXhwYkWHZz+DsaZBf7c5FRiyEblflWdzDWD9NmG77nnpAZB5icOBO5dvyH1QcMA9ucJkaD3DcRbY6QhV68IChWcNPwKTy+qELGxbbEJzxLVxEl+3Fx5TsPoGj4XBUZu6HvY/jFnlPjnI09F5CcceYZEN3f4AGK9VnTEiQ+Ws=; 25:GiDfgHrLp3qN5S5BdGIMVWe0X01WTD933Vf/xAfYG95OP2a7gzNRo6NEY73l9V6Ea0H16+n88vaFfENPWtGXnJKRBNntOeE49reBLakRiECJnv2ly3nLOJ4m1ocsMkdIjDTBOsL+fbTEHfjDlU3D9Ll0QlpsFyUW3QJb0mAwQflEEm3E6UkPJOU+tlViXYzgai6PuaXKlDQ0Ui2clyWB0dC6MY1zalNg2fWPAC3BJUvOPOj3XmG2f8fz6MzbYiNN X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1303; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1303; 20:9Dy+rpfJvM0AQeRwtZ9ThFHWKSBxP5LJwMYMDvIDaJHxNJExdPwYz4Gok/b9ljGI/UvaMDNwS40kpC6MF2QIQbhVPr0jstSULvzEUrVvyf8Job2BegowM2+3x1F5B8+ZD+bqbSz4FbCaEWeLm5XZKdEvvoTSPiumavuB8xOS32wxPm7NwzakDYv6Y6KB8JNcBQnol9y8kDotd+SqNOLMV2VvZN6n5tkCQyhJHzwiUKQzi/AzkDFWmXHYlXBCTjr/6abXcrgLeOfYk8nRfuWJiwFLk4lfDeRfxORDy14xrMWnheK5ZlGw5c+cJbIyjzwGMd6eSYwok+XhmWfB1le7rLYjLaoEAv6qcyPlvGtFAL0=; 4:7wWe+OmU3DF/zQkQ2QLW9nHaok3RaiPCN/mscQcK99bswVhpLJfIKDMnNQJNDtbqF8bGooIKWGtWK8NShB1qEjd1mhyp8Rl4FAFv00UC72aYiE8QfmUd36LcxnJBj3P3jhorOYbrhfXZlLEMzPaOh/ujQ3hj3HvOSKm2JJx7bOVZRjGhcB7K4jSu7W7MKzAAI7BonOE2nKLOJZIQdV+gg1JNGMcLYJ2xosM6OTFqdT0d7Z3U6lqh1Qw5i6kTM0fqs6MC5GBn5bxsN/qIQrudOS9cGiWBZ47on3gMGQdk8gg= 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:BY1PR0301MB1303; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0301MB1303; X-Forefront-PRVS: 066517B35B X-Microsoft-Exchange-Diagnostics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GnsYIKgb+RnCarcGQTH22?= =?us-ascii?Q?nMbOtSa2jECQX/6VfdDzRMzq5s77bK1B2OgdFOvW3EZsF0yft2fDO39XIkYT?= =?us-ascii?Q?su1xhNR2k8GPk0CHFKyftONpHK8KKYfkV6t6LuCLUowfWNVy+V32wpDB5qES?= =?us-ascii?Q?Fya0ivTbKloiKu1XIEJQY74X0NX5ISlqxPfmQKQ3mXGMwurkybfFvjTvLIxL?= =?us-ascii?Q?VaZbkWXCwwLCoe7MEgLw8JTLusfH7QjKvwjZzun/r1kjmwXbZy9iylYs44Fe?= =?us-ascii?Q?LSiRF9lTnAV6IqsF3CtvH6BLzFBg+sIeZJgwh426xoF3xNZSEkoM5ZhjG2fZ?= =?us-ascii?Q?yt5UjSwzaZUn/Z08iHAP9A5e/vvcFp8rc3TnEbdREpVnbQzsExG9ii1BIobi?= =?us-ascii?Q?Q62kNwt0rlZKYKnve0T0=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1303; 5:1X0xlj9jGC65LTxdDednjOw7CS8yGzcGrqlMShug6aoUewKi/YUF2/DJz6HnDS65xIz6RA4sXAaXKoBTvq/oJdLAEH1HIYyOI1pj0b6b+p94awVEbUIrhc7AbeNqN8b/UKvG8bATkqA79iJOR+OXVg==; 24:shcSaKgSvVvRJIgjjDwIks1BYxz7+5eX4PQevnd2WSRHJMjouwxQaTfMeWhxNyOLYbnHOyDl64jG12FZVS9FMxAm3Mzr6j3S7rHdNw6sSRI=; 20:nSZMZtcBHWoIhrL9S7+z5AQasFK/goNc/BXOGqE4SkQSzvCed2/123kDmMFZVUWoiRS2ssNP2YA2fYQxwXzucQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2015 11:36:19.6116 (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.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1303 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150811_043644_160729_1605EE21 X-CRM114-Status: GOOD ( 18.85 ) 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.4 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 b8b7e88..298551d 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; } @@ -963,6 +970,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 */