blob: d85a6a6f9e29849e4556de99114b8a66b06524a4 [file] [log] [blame]
Wolfram Sang95f25ef2010-10-15 12:21:04 +02001/*
2 * Freescale eSDHC i.MX controller driver for the platform bus.
3 *
4 * derived from the OF-version.
5 *
6 * Copyright (c) 2010 Pengutronix e.K.
7 * Author: Wolfram Sang <w.sang@pengutronix.de>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License.
12 */
13
14#include <linux/io.h>
15#include <linux/delay.h>
16#include <linux/err.h>
17#include <linux/clk.h>
Wolfram Sang0c6d49c2011-02-26 14:44:39 +010018#include <linux/gpio.h>
Shawn Guo66506f72011-08-15 10:28:18 +080019#include <linux/module.h>
Richard Zhue1498602011-03-25 09:18:27 -040020#include <linux/slab.h>
Wolfram Sang95f25ef2010-10-15 12:21:04 +020021#include <linux/mmc/host.h>
Richard Zhu58ac8172011-03-21 13:22:16 +080022#include <linux/mmc/mmc.h>
23#include <linux/mmc/sdio.h>
Shawn Guofbe5fdd2012-12-11 22:32:20 +080024#include <linux/mmc/slot-gpio.h>
Shawn Guoabfafc22011-06-30 15:44:44 +080025#include <linux/of.h>
26#include <linux/of_device.h>
27#include <linux/of_gpio.h>
Dong Aishenge62d8b82012-05-11 14:56:01 +080028#include <linux/pinctrl/consumer.h>
Arnd Bergmann82906b12012-08-24 15:14:29 +020029#include <linux/platform_data/mmc-esdhc-imx.h>
Wolfram Sang95f25ef2010-10-15 12:21:04 +020030#include "sdhci-pltfm.h"
31#include "sdhci-esdhc.h"
32
Shawn Guo60bf6392013-01-15 23:36:53 +080033#define ESDHC_CTRL_D3CD 0x08
Richard Zhu58ac8172011-03-21 13:22:16 +080034/* VENDOR SPEC register */
Shawn Guo60bf6392013-01-15 23:36:53 +080035#define ESDHC_VENDOR_SPEC 0xc0
36#define ESDHC_VENDOR_SPEC_SDIO_QUIRK (1 << 1)
Dong Aisheng03221912013-09-13 19:11:34 +080037#define ESDHC_VENDOR_SPEC_VSELECT (1 << 1)
Dong Aishengfed2f6e2013-09-13 19:11:33 +080038#define ESDHC_VENDOR_SPEC_FRC_SDCLK_ON (1 << 8)
Shawn Guo60bf6392013-01-15 23:36:53 +080039#define ESDHC_WTMK_LVL 0x44
40#define ESDHC_MIX_CTRL 0x48
Dong Aishengde5bdbf2013-10-18 19:48:46 +080041#define ESDHC_MIX_CTRL_DDREN (1 << 3)
Shawn Guo2a15f982013-01-21 19:02:26 +080042#define ESDHC_MIX_CTRL_AC23EN (1 << 7)
Dong Aisheng03221912013-09-13 19:11:34 +080043#define ESDHC_MIX_CTRL_EXE_TUNE (1 << 22)
44#define ESDHC_MIX_CTRL_SMPCLK_SEL (1 << 23)
45#define ESDHC_MIX_CTRL_FBCLK_SEL (1 << 25)
Shawn Guo2a15f982013-01-21 19:02:26 +080046/* Bits 3 and 6 are not SDHCI standard definitions */
47#define ESDHC_MIX_CTRL_SDHCI_MASK 0xb7
Dong Aishengd131a712013-11-04 16:38:26 +080048/* Tuning bits */
49#define ESDHC_MIX_CTRL_TUNING_MASK 0x03c00000
Richard Zhu58ac8172011-03-21 13:22:16 +080050
Dong Aisheng602519b2013-10-18 19:48:47 +080051/* dll control register */
52#define ESDHC_DLL_CTRL 0x60
53#define ESDHC_DLL_OVERRIDE_VAL_SHIFT 9
54#define ESDHC_DLL_OVERRIDE_EN_SHIFT 8
55
Dong Aisheng03221912013-09-13 19:11:34 +080056/* tune control register */
57#define ESDHC_TUNE_CTRL_STATUS 0x68
58#define ESDHC_TUNE_CTRL_STEP 1
59#define ESDHC_TUNE_CTRL_MIN 0
60#define ESDHC_TUNE_CTRL_MAX ((1 << 7) - 1)
61
Dong Aisheng6e9fd282013-10-18 19:48:43 +080062#define ESDHC_TUNING_CTRL 0xcc
63#define ESDHC_STD_TUNING_EN (1 << 24)
64/* NOTE: the minimum valid tuning start tap for mx6sl is 1 */
65#define ESDHC_TUNING_START_TAP 0x1
66
Dong Aisheng03221912013-09-13 19:11:34 +080067#define ESDHC_TUNING_BLOCK_PATTERN_LEN 64
68
Dong Aishengad932202013-09-13 19:11:35 +080069/* pinctrl state */
70#define ESDHC_PINCTRL_STATE_100MHZ "state_100mhz"
71#define ESDHC_PINCTRL_STATE_200MHZ "state_200mhz"
72
Richard Zhu58ac8172011-03-21 13:22:16 +080073/*
Sascha Haueraf510792013-01-21 19:02:28 +080074 * Our interpretation of the SDHCI_HOST_CONTROL register
75 */
76#define ESDHC_CTRL_4BITBUS (0x1 << 1)
77#define ESDHC_CTRL_8BITBUS (0x2 << 1)
78#define ESDHC_CTRL_BUSWIDTH_MASK (0x3 << 1)
79
80/*
Richard Zhu97e4ba62011-08-11 16:51:46 -040081 * There is an INT DMA ERR mis-match between eSDHC and STD SDHC SPEC:
82 * Bit25 is used in STD SPEC, and is reserved in fsl eSDHC design,
83 * but bit28 is used as the INT DMA ERR in fsl eSDHC design.
84 * Define this macro DMA error INT for fsl eSDHC
85 */
Shawn Guo60bf6392013-01-15 23:36:53 +080086#define ESDHC_INT_VENDOR_SPEC_DMA_ERR (1 << 28)
Richard Zhu97e4ba62011-08-11 16:51:46 -040087
88/*
Richard Zhu58ac8172011-03-21 13:22:16 +080089 * The CMDTYPE of the CMD register (offset 0xE) should be set to
90 * "11" when the STOP CMD12 is issued on imx53 to abort one
91 * open ended multi-blk IO. Otherwise the TC INT wouldn't
92 * be generated.
93 * In exact block transfer, the controller doesn't complete the
94 * operations automatically as required at the end of the
95 * transfer and remains on hold if the abort command is not sent.
96 * As a result, the TC flag is not asserted and SW received timeout
97 * exeception. Bit1 of Vendor Spec registor is used to fix it.
98 */
Shawn Guo31fbb302013-10-17 15:19:44 +080099#define ESDHC_FLAG_MULTIBLK_NO_INT BIT(1)
100/*
101 * The flag enables the workaround for ESDHC errata ENGcm07207 which
102 * affects i.MX25 and i.MX35.
103 */
104#define ESDHC_FLAG_ENGCM07207 BIT(2)
Shawn Guo9d61c002013-10-17 15:19:45 +0800105/*
106 * The flag tells that the ESDHC controller is an USDHC block that is
107 * integrated on the i.MX6 series.
108 */
109#define ESDHC_FLAG_USDHC BIT(3)
Dong Aisheng6e9fd282013-10-18 19:48:43 +0800110/* The IP supports manual tuning process */
111#define ESDHC_FLAG_MAN_TUNING BIT(4)
112/* The IP supports standard tuning process */
113#define ESDHC_FLAG_STD_TUNING BIT(5)
114/* The IP has SDHCI_CAPABILITIES_1 register */
115#define ESDHC_FLAG_HAVE_CAP1 BIT(6)
Richard Zhue1498602011-03-25 09:18:27 -0400116
Shawn Guof47c4bb2013-10-17 15:19:47 +0800117struct esdhc_soc_data {
118 u32 flags;
119};
120
121static struct esdhc_soc_data esdhc_imx25_data = {
122 .flags = ESDHC_FLAG_ENGCM07207,
123};
124
125static struct esdhc_soc_data esdhc_imx35_data = {
126 .flags = ESDHC_FLAG_ENGCM07207,
127};
128
129static struct esdhc_soc_data esdhc_imx51_data = {
130 .flags = 0,
131};
132
133static struct esdhc_soc_data esdhc_imx53_data = {
134 .flags = ESDHC_FLAG_MULTIBLK_NO_INT,
135};
136
137static struct esdhc_soc_data usdhc_imx6q_data = {
Dong Aisheng6e9fd282013-10-18 19:48:43 +0800138 .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_MAN_TUNING,
139};
140
141static struct esdhc_soc_data usdhc_imx6sl_data = {
142 .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING
143 | ESDHC_FLAG_HAVE_CAP1,
Shawn Guo57ed3312011-06-30 09:24:26 +0800144};
145
Richard Zhue1498602011-03-25 09:18:27 -0400146struct pltfm_imx_data {
Richard Zhue1498602011-03-25 09:18:27 -0400147 u32 scratchpad;
Dong Aishenge62d8b82012-05-11 14:56:01 +0800148 struct pinctrl *pinctrl;
Dong Aishengad932202013-09-13 19:11:35 +0800149 struct pinctrl_state *pins_default;
150 struct pinctrl_state *pins_100mhz;
151 struct pinctrl_state *pins_200mhz;
Shawn Guof47c4bb2013-10-17 15:19:47 +0800152 const struct esdhc_soc_data *socdata;
Shawn Guo842afc02011-07-06 22:57:48 +0800153 struct esdhc_platform_data boarddata;
Sascha Hauer52dac612012-03-07 09:31:34 +0100154 struct clk *clk_ipg;
155 struct clk *clk_ahb;
156 struct clk *clk_per;
Lucas Stach361b8482013-03-15 09:49:26 +0100157 enum {
158 NO_CMD_PENDING, /* no multiblock command pending*/
159 MULTIBLK_IN_PROCESS, /* exact multiblock cmd in process */
160 WAIT_FOR_INT, /* sent CMD12, waiting for response INT */
161 } multiblock_status;
Dong Aisheng03221912013-09-13 19:11:34 +0800162 u32 uhs_mode;
Dong Aishengde5bdbf2013-10-18 19:48:46 +0800163 u32 is_ddr;
Richard Zhue1498602011-03-25 09:18:27 -0400164};
165
Shawn Guo57ed3312011-06-30 09:24:26 +0800166static struct platform_device_id imx_esdhc_devtype[] = {
167 {
168 .name = "sdhci-esdhc-imx25",
Shawn Guof47c4bb2013-10-17 15:19:47 +0800169 .driver_data = (kernel_ulong_t) &esdhc_imx25_data,
Shawn Guo57ed3312011-06-30 09:24:26 +0800170 }, {
171 .name = "sdhci-esdhc-imx35",
Shawn Guof47c4bb2013-10-17 15:19:47 +0800172 .driver_data = (kernel_ulong_t) &esdhc_imx35_data,
Shawn Guo57ed3312011-06-30 09:24:26 +0800173 }, {
174 .name = "sdhci-esdhc-imx51",
Shawn Guof47c4bb2013-10-17 15:19:47 +0800175 .driver_data = (kernel_ulong_t) &esdhc_imx51_data,
Shawn Guo57ed3312011-06-30 09:24:26 +0800176 }, {
Shawn Guo57ed3312011-06-30 09:24:26 +0800177 /* sentinel */
178 }
179};
180MODULE_DEVICE_TABLE(platform, imx_esdhc_devtype);
181
Shawn Guoabfafc22011-06-30 15:44:44 +0800182static const struct of_device_id imx_esdhc_dt_ids[] = {
Shawn Guof47c4bb2013-10-17 15:19:47 +0800183 { .compatible = "fsl,imx25-esdhc", .data = &esdhc_imx25_data, },
184 { .compatible = "fsl,imx35-esdhc", .data = &esdhc_imx35_data, },
185 { .compatible = "fsl,imx51-esdhc", .data = &esdhc_imx51_data, },
186 { .compatible = "fsl,imx53-esdhc", .data = &esdhc_imx53_data, },
Dong Aisheng6e9fd282013-10-18 19:48:43 +0800187 { .compatible = "fsl,imx6sl-usdhc", .data = &usdhc_imx6sl_data, },
Shawn Guof47c4bb2013-10-17 15:19:47 +0800188 { .compatible = "fsl,imx6q-usdhc", .data = &usdhc_imx6q_data, },
Shawn Guoabfafc22011-06-30 15:44:44 +0800189 { /* sentinel */ }
190};
191MODULE_DEVICE_TABLE(of, imx_esdhc_dt_ids);
192
Shawn Guo57ed3312011-06-30 09:24:26 +0800193static inline int is_imx25_esdhc(struct pltfm_imx_data *data)
194{
Shawn Guof47c4bb2013-10-17 15:19:47 +0800195 return data->socdata == &esdhc_imx25_data;
Shawn Guo57ed3312011-06-30 09:24:26 +0800196}
197
198static inline int is_imx53_esdhc(struct pltfm_imx_data *data)
199{
Shawn Guof47c4bb2013-10-17 15:19:47 +0800200 return data->socdata == &esdhc_imx53_data;
Shawn Guo57ed3312011-06-30 09:24:26 +0800201}
202
Shawn Guo95a24822011-09-19 17:32:21 +0800203static inline int is_imx6q_usdhc(struct pltfm_imx_data *data)
204{
Shawn Guof47c4bb2013-10-17 15:19:47 +0800205 return data->socdata == &usdhc_imx6q_data;
Shawn Guo95a24822011-09-19 17:32:21 +0800206}
207
Shawn Guo9d61c002013-10-17 15:19:45 +0800208static inline int esdhc_is_usdhc(struct pltfm_imx_data *data)
209{
Shawn Guof47c4bb2013-10-17 15:19:47 +0800210 return !!(data->socdata->flags & ESDHC_FLAG_USDHC);
Shawn Guo9d61c002013-10-17 15:19:45 +0800211}
212
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200213static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, int reg)
214{
215 void __iomem *base = host->ioaddr + (reg & ~0x3);
216 u32 shift = (reg & 0x3) * 8;
217
218 writel(((readl(base) & ~(mask << shift)) | (val << shift)), base);
219}
220
Wolfram Sang7e29c302011-02-26 14:44:41 +0100221static u32 esdhc_readl_le(struct sdhci_host *host, int reg)
222{
Lucas Stach361b8482013-03-15 09:49:26 +0100223 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
224 struct pltfm_imx_data *imx_data = pltfm_host->priv;
Wolfram Sang7e29c302011-02-26 14:44:41 +0100225 u32 val = readl(host->ioaddr + reg);
226
Dong Aisheng03221912013-09-13 19:11:34 +0800227 if (unlikely(reg == SDHCI_PRESENT_STATE)) {
228 u32 fsl_prss = val;
229 /* save the least 20 bits */
230 val = fsl_prss & 0x000FFFFF;
231 /* move dat[0-3] bits */
232 val |= (fsl_prss & 0x0F000000) >> 4;
233 /* move cmd line bit */
234 val |= (fsl_prss & 0x00800000) << 1;
235 }
236
Richard Zhu97e4ba62011-08-11 16:51:46 -0400237 if (unlikely(reg == SDHCI_CAPABILITIES)) {
Dong Aisheng6b4fb6712a2013-10-18 19:48:44 +0800238 /* ignore bit[0-15] as it stores cap_1 register val for mx6sl */
239 if (imx_data->socdata->flags & ESDHC_FLAG_HAVE_CAP1)
240 val &= 0xffff0000;
241
Richard Zhu97e4ba62011-08-11 16:51:46 -0400242 /* In FSL esdhc IC module, only bit20 is used to indicate the
243 * ADMA2 capability of esdhc, but this bit is messed up on
244 * some SOCs (e.g. on MX25, MX35 this bit is set, but they
245 * don't actually support ADMA2). So set the BROKEN_ADMA
246 * uirk on MX25/35 platforms.
247 */
248
249 if (val & SDHCI_CAN_DO_ADMA1) {
250 val &= ~SDHCI_CAN_DO_ADMA1;
251 val |= SDHCI_CAN_DO_ADMA2;
252 }
253 }
254
Dong Aisheng6e9fd282013-10-18 19:48:43 +0800255 if (unlikely(reg == SDHCI_CAPABILITIES_1)) {
256 if (esdhc_is_usdhc(imx_data)) {
257 if (imx_data->socdata->flags & ESDHC_FLAG_HAVE_CAP1)
258 val = readl(host->ioaddr + SDHCI_CAPABILITIES) & 0xFFFF;
259 else
260 /* imx6q/dl does not have cap_1 register, fake one */
261 val = SDHCI_SUPPORT_DDR50 | SDHCI_SUPPORT_SDR104
Dong Aisheng888824b2013-10-18 19:48:48 +0800262 | SDHCI_SUPPORT_SDR50
263 | SDHCI_USE_SDR50_TUNING;
Dong Aisheng6e9fd282013-10-18 19:48:43 +0800264 }
265 }
Dong Aisheng03221912013-09-13 19:11:34 +0800266
Shawn Guo9d61c002013-10-17 15:19:45 +0800267 if (unlikely(reg == SDHCI_MAX_CURRENT) && esdhc_is_usdhc(imx_data)) {
Dong Aisheng03221912013-09-13 19:11:34 +0800268 val = 0;
269 val |= 0xFF << SDHCI_MAX_CURRENT_330_SHIFT;
270 val |= 0xFF << SDHCI_MAX_CURRENT_300_SHIFT;
271 val |= 0xFF << SDHCI_MAX_CURRENT_180_SHIFT;
272 }
273
Richard Zhu97e4ba62011-08-11 16:51:46 -0400274 if (unlikely(reg == SDHCI_INT_STATUS)) {
Shawn Guo60bf6392013-01-15 23:36:53 +0800275 if (val & ESDHC_INT_VENDOR_SPEC_DMA_ERR) {
276 val &= ~ESDHC_INT_VENDOR_SPEC_DMA_ERR;
Richard Zhu97e4ba62011-08-11 16:51:46 -0400277 val |= SDHCI_INT_ADMA_ERROR;
278 }
Lucas Stach361b8482013-03-15 09:49:26 +0100279
280 /*
281 * mask off the interrupt we get in response to the manually
282 * sent CMD12
283 */
284 if ((imx_data->multiblock_status == WAIT_FOR_INT) &&
285 ((val & SDHCI_INT_RESPONSE) == SDHCI_INT_RESPONSE)) {
286 val &= ~SDHCI_INT_RESPONSE;
287 writel(SDHCI_INT_RESPONSE, host->ioaddr +
288 SDHCI_INT_STATUS);
289 imx_data->multiblock_status = NO_CMD_PENDING;
290 }
Richard Zhu97e4ba62011-08-11 16:51:46 -0400291 }
292
Wolfram Sang7e29c302011-02-26 14:44:41 +0100293 return val;
294}
295
296static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
297{
Richard Zhue1498602011-03-25 09:18:27 -0400298 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
299 struct pltfm_imx_data *imx_data = pltfm_host->priv;
Tony Lin0d588642011-08-11 16:45:59 -0400300 u32 data;
Richard Zhue1498602011-03-25 09:18:27 -0400301
Tony Lin0d588642011-08-11 16:45:59 -0400302 if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)) {
Tony Lin0d588642011-08-11 16:45:59 -0400303 if (val & SDHCI_INT_CARD_INT) {
304 /*
305 * Clear and then set D3CD bit to avoid missing the
306 * card interrupt. This is a eSDHC controller problem
307 * so we need to apply the following workaround: clear
308 * and set D3CD bit will make eSDHC re-sample the card
309 * interrupt. In case a card interrupt was lost,
310 * re-sample it by the following steps.
311 */
312 data = readl(host->ioaddr + SDHCI_HOST_CONTROL);
Shawn Guo60bf6392013-01-15 23:36:53 +0800313 data &= ~ESDHC_CTRL_D3CD;
Tony Lin0d588642011-08-11 16:45:59 -0400314 writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
Shawn Guo60bf6392013-01-15 23:36:53 +0800315 data |= ESDHC_CTRL_D3CD;
Tony Lin0d588642011-08-11 16:45:59 -0400316 writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
317 }
318 }
Wolfram Sang7e29c302011-02-26 14:44:41 +0100319
Shawn Guof47c4bb2013-10-17 15:19:47 +0800320 if (unlikely((imx_data->socdata->flags & ESDHC_FLAG_MULTIBLK_NO_INT)
Richard Zhu58ac8172011-03-21 13:22:16 +0800321 && (reg == SDHCI_INT_STATUS)
322 && (val & SDHCI_INT_DATA_END))) {
323 u32 v;
Shawn Guo60bf6392013-01-15 23:36:53 +0800324 v = readl(host->ioaddr + ESDHC_VENDOR_SPEC);
325 v &= ~ESDHC_VENDOR_SPEC_SDIO_QUIRK;
326 writel(v, host->ioaddr + ESDHC_VENDOR_SPEC);
Lucas Stach361b8482013-03-15 09:49:26 +0100327
328 if (imx_data->multiblock_status == MULTIBLK_IN_PROCESS)
329 {
330 /* send a manual CMD12 with RESPTYP=none */
331 data = MMC_STOP_TRANSMISSION << 24 |
332 SDHCI_CMD_ABORTCMD << 16;
333 writel(data, host->ioaddr + SDHCI_TRANSFER_MODE);
334 imx_data->multiblock_status = WAIT_FOR_INT;
335 }
Richard Zhu58ac8172011-03-21 13:22:16 +0800336 }
337
Richard Zhu97e4ba62011-08-11 16:51:46 -0400338 if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)) {
339 if (val & SDHCI_INT_ADMA_ERROR) {
340 val &= ~SDHCI_INT_ADMA_ERROR;
Shawn Guo60bf6392013-01-15 23:36:53 +0800341 val |= ESDHC_INT_VENDOR_SPEC_DMA_ERR;
Richard Zhu97e4ba62011-08-11 16:51:46 -0400342 }
343 }
344
Wolfram Sang7e29c302011-02-26 14:44:41 +0100345 writel(val, host->ioaddr + reg);
346}
347
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200348static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
349{
Shawn Guoef4d0882013-01-15 23:30:27 +0800350 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
351 struct pltfm_imx_data *imx_data = pltfm_host->priv;
Dong Aisheng03221912013-09-13 19:11:34 +0800352 u16 ret = 0;
353 u32 val;
Shawn Guoef4d0882013-01-15 23:30:27 +0800354
Shawn Guo95a24822011-09-19 17:32:21 +0800355 if (unlikely(reg == SDHCI_HOST_VERSION)) {
Shawn Guoef4d0882013-01-15 23:30:27 +0800356 reg ^= 2;
Shawn Guo9d61c002013-10-17 15:19:45 +0800357 if (esdhc_is_usdhc(imx_data)) {
Shawn Guoef4d0882013-01-15 23:30:27 +0800358 /*
359 * The usdhc register returns a wrong host version.
360 * Correct it here.
361 */
362 return SDHCI_SPEC_300;
363 }
Shawn Guo95a24822011-09-19 17:32:21 +0800364 }
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200365
Dong Aisheng03221912013-09-13 19:11:34 +0800366 if (unlikely(reg == SDHCI_HOST_CONTROL2)) {
367 val = readl(host->ioaddr + ESDHC_VENDOR_SPEC);
368 if (val & ESDHC_VENDOR_SPEC_VSELECT)
369 ret |= SDHCI_CTRL_VDD_180;
370
Shawn Guo9d61c002013-10-17 15:19:45 +0800371 if (esdhc_is_usdhc(imx_data)) {
Dong Aisheng6e9fd282013-10-18 19:48:43 +0800372 if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING)
373 val = readl(host->ioaddr + ESDHC_MIX_CTRL);
374 else if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING)
375 /* the std tuning bits is in ACMD12_ERR for imx6sl */
376 val = readl(host->ioaddr + SDHCI_ACMD12_ERR);
Dong Aisheng03221912013-09-13 19:11:34 +0800377 }
378
Dong Aisheng6e9fd282013-10-18 19:48:43 +0800379 if (val & ESDHC_MIX_CTRL_EXE_TUNE)
380 ret |= SDHCI_CTRL_EXEC_TUNING;
381 if (val & ESDHC_MIX_CTRL_SMPCLK_SEL)
382 ret |= SDHCI_CTRL_TUNED_CLK;
383
Dong Aisheng03221912013-09-13 19:11:34 +0800384 ret |= (imx_data->uhs_mode & SDHCI_CTRL_UHS_MASK);
385 ret &= ~SDHCI_CTRL_PRESET_VAL_ENABLE;
386
387 return ret;
388 }
389
Dong Aisheng7dd109e2013-10-30 22:09:49 +0800390 if (unlikely(reg == SDHCI_TRANSFER_MODE)) {
391 if (esdhc_is_usdhc(imx_data)) {
392 u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL);
393 ret = m & ESDHC_MIX_CTRL_SDHCI_MASK;
394 /* Swap AC23 bit */
395 if (m & ESDHC_MIX_CTRL_AC23EN) {
396 ret &= ~ESDHC_MIX_CTRL_AC23EN;
397 ret |= SDHCI_TRNS_AUTO_CMD23;
398 }
399 } else {
400 ret = readw(host->ioaddr + SDHCI_TRANSFER_MODE);
401 }
402
403 return ret;
404 }
405
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200406 return readw(host->ioaddr + reg);
407}
408
409static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
410{
411 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
Richard Zhue1498602011-03-25 09:18:27 -0400412 struct pltfm_imx_data *imx_data = pltfm_host->priv;
Dong Aisheng03221912013-09-13 19:11:34 +0800413 u32 new_val = 0;
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200414
415 switch (reg) {
Dong Aisheng03221912013-09-13 19:11:34 +0800416 case SDHCI_CLOCK_CONTROL:
417 new_val = readl(host->ioaddr + ESDHC_VENDOR_SPEC);
418 if (val & SDHCI_CLOCK_CARD_EN)
419 new_val |= ESDHC_VENDOR_SPEC_FRC_SDCLK_ON;
420 else
421 new_val &= ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON;
422 writel(new_val, host->ioaddr + ESDHC_VENDOR_SPEC);
423 return;
424 case SDHCI_HOST_CONTROL2:
425 new_val = readl(host->ioaddr + ESDHC_VENDOR_SPEC);
426 if (val & SDHCI_CTRL_VDD_180)
427 new_val |= ESDHC_VENDOR_SPEC_VSELECT;
428 else
429 new_val &= ~ESDHC_VENDOR_SPEC_VSELECT;
430 writel(new_val, host->ioaddr + ESDHC_VENDOR_SPEC);
431 imx_data->uhs_mode = val & SDHCI_CTRL_UHS_MASK;
Dong Aisheng6e9fd282013-10-18 19:48:43 +0800432 if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING) {
433 new_val = readl(host->ioaddr + ESDHC_MIX_CTRL);
434 if (val & SDHCI_CTRL_TUNED_CLK)
435 new_val |= ESDHC_MIX_CTRL_SMPCLK_SEL;
436 else
437 new_val &= ~ESDHC_MIX_CTRL_SMPCLK_SEL;
438 writel(new_val , host->ioaddr + ESDHC_MIX_CTRL);
439 } else if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING) {
440 u32 v = readl(host->ioaddr + SDHCI_ACMD12_ERR);
441 u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL);
442 new_val = readl(host->ioaddr + ESDHC_TUNING_CTRL);
443 if (val & SDHCI_CTRL_EXEC_TUNING) {
444 new_val |= ESDHC_STD_TUNING_EN |
445 ESDHC_TUNING_START_TAP;
446 v |= ESDHC_MIX_CTRL_EXE_TUNE;
447 m |= ESDHC_MIX_CTRL_FBCLK_SEL;
448 } else {
449 new_val &= ~ESDHC_STD_TUNING_EN;
450 v &= ~ESDHC_MIX_CTRL_EXE_TUNE;
451 m &= ~ESDHC_MIX_CTRL_FBCLK_SEL;
452 }
453
454 if (val & SDHCI_CTRL_TUNED_CLK)
455 v |= ESDHC_MIX_CTRL_SMPCLK_SEL;
456 else
457 v &= ~ESDHC_MIX_CTRL_SMPCLK_SEL;
458
459 writel(new_val, host->ioaddr + ESDHC_TUNING_CTRL);
460 writel(v, host->ioaddr + SDHCI_ACMD12_ERR);
461 writel(m, host->ioaddr + ESDHC_MIX_CTRL);
462 }
Dong Aisheng03221912013-09-13 19:11:34 +0800463 return;
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200464 case SDHCI_TRANSFER_MODE:
Shawn Guof47c4bb2013-10-17 15:19:47 +0800465 if ((imx_data->socdata->flags & ESDHC_FLAG_MULTIBLK_NO_INT)
Richard Zhu58ac8172011-03-21 13:22:16 +0800466 && (host->cmd->opcode == SD_IO_RW_EXTENDED)
467 && (host->cmd->data->blocks > 1)
468 && (host->cmd->data->flags & MMC_DATA_READ)) {
469 u32 v;
Shawn Guo60bf6392013-01-15 23:36:53 +0800470 v = readl(host->ioaddr + ESDHC_VENDOR_SPEC);
471 v |= ESDHC_VENDOR_SPEC_SDIO_QUIRK;
472 writel(v, host->ioaddr + ESDHC_VENDOR_SPEC);
Richard Zhu58ac8172011-03-21 13:22:16 +0800473 }
Shawn Guo69f54692013-01-21 19:02:24 +0800474
Shawn Guo9d61c002013-10-17 15:19:45 +0800475 if (esdhc_is_usdhc(imx_data)) {
Shawn Guo69f54692013-01-21 19:02:24 +0800476 u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL);
Shawn Guo2a15f982013-01-21 19:02:26 +0800477 /* Swap AC23 bit */
478 if (val & SDHCI_TRNS_AUTO_CMD23) {
479 val &= ~SDHCI_TRNS_AUTO_CMD23;
480 val |= ESDHC_MIX_CTRL_AC23EN;
481 }
482 m = val | (m & ~ESDHC_MIX_CTRL_SDHCI_MASK);
Shawn Guo69f54692013-01-21 19:02:24 +0800483 writel(m, host->ioaddr + ESDHC_MIX_CTRL);
484 } else {
485 /*
486 * Postpone this write, we must do it together with a
487 * command write that is down below.
488 */
489 imx_data->scratchpad = val;
490 }
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200491 return;
492 case SDHCI_COMMAND:
Lucas Stach361b8482013-03-15 09:49:26 +0100493 if (host->cmd->opcode == MMC_STOP_TRANSMISSION)
Richard Zhu58ac8172011-03-21 13:22:16 +0800494 val |= SDHCI_CMD_ABORTCMD;
Shawn Guo95a24822011-09-19 17:32:21 +0800495
Lucas Stach361b8482013-03-15 09:49:26 +0100496 if ((host->cmd->opcode == MMC_SET_BLOCK_COUNT) &&
Shawn Guof47c4bb2013-10-17 15:19:47 +0800497 (imx_data->socdata->flags & ESDHC_FLAG_MULTIBLK_NO_INT))
Lucas Stach361b8482013-03-15 09:49:26 +0100498 imx_data->multiblock_status = MULTIBLK_IN_PROCESS;
499
Shawn Guo9d61c002013-10-17 15:19:45 +0800500 if (esdhc_is_usdhc(imx_data))
Shawn Guo95a24822011-09-19 17:32:21 +0800501 writel(val << 16,
502 host->ioaddr + SDHCI_TRANSFER_MODE);
Shawn Guo69f54692013-01-21 19:02:24 +0800503 else
Shawn Guo95a24822011-09-19 17:32:21 +0800504 writel(val << 16 | imx_data->scratchpad,
505 host->ioaddr + SDHCI_TRANSFER_MODE);
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200506 return;
507 case SDHCI_BLOCK_SIZE:
508 val &= ~SDHCI_MAKE_BLKSZ(0x7, 0);
509 break;
510 }
511 esdhc_clrset_le(host, 0xffff, val, reg);
512}
513
514static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
515{
Wilson Callan9a0985b2012-07-19 02:49:16 -0400516 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
517 struct pltfm_imx_data *imx_data = pltfm_host->priv;
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200518 u32 new_val;
Sascha Haueraf510792013-01-21 19:02:28 +0800519 u32 mask;
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200520
521 switch (reg) {
522 case SDHCI_POWER_CONTROL:
523 /*
524 * FSL put some DMA bits here
525 * If your board has a regulator, code should be here
526 */
527 return;
528 case SDHCI_HOST_CONTROL:
Shawn Guo6b40d182013-01-15 23:36:52 +0800529 /* FSL messed up here, so we need to manually compose it. */
Sascha Haueraf510792013-01-21 19:02:28 +0800530 new_val = val & SDHCI_CTRL_LED;
Masanari Iida7122bbb2012-08-05 23:25:40 +0900531 /* ensure the endianness */
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200532 new_val |= ESDHC_HOST_CONTROL_LE;
Wilson Callan9a0985b2012-07-19 02:49:16 -0400533 /* bits 8&9 are reserved on mx25 */
534 if (!is_imx25_esdhc(imx_data)) {
535 /* DMA mode bits are shifted */
536 new_val |= (val & SDHCI_CTRL_DMA_MASK) << 5;
537 }
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200538
Sascha Haueraf510792013-01-21 19:02:28 +0800539 /*
540 * Do not touch buswidth bits here. This is done in
541 * esdhc_pltfm_bus_width.
Martin Fuzzeyf6825742013-04-15 17:08:35 +0200542 * Do not touch the D3CD bit either which is used for the
543 * SDIO interrupt errata workaround.
Sascha Haueraf510792013-01-21 19:02:28 +0800544 */
Martin Fuzzeyf6825742013-04-15 17:08:35 +0200545 mask = 0xffff & ~(ESDHC_CTRL_BUSWIDTH_MASK | ESDHC_CTRL_D3CD);
Sascha Haueraf510792013-01-21 19:02:28 +0800546
547 esdhc_clrset_le(host, mask, new_val, reg);
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200548 return;
549 }
550 esdhc_clrset_le(host, 0xff, val, reg);
Shawn Guo913413c2011-06-21 22:41:51 +0800551
552 /*
553 * The esdhc has a design violation to SDHC spec which tells
554 * that software reset should not affect card detection circuit.
555 * But esdhc clears its SYSCTL register bits [0..2] during the
556 * software reset. This will stop those clocks that card detection
557 * circuit relies on. To work around it, we turn the clocks on back
558 * to keep card detection circuit functional.
559 */
Shawn Guo58c8c4f2013-01-21 19:02:25 +0800560 if ((reg == SDHCI_SOFTWARE_RESET) && (val & 1)) {
Shawn Guo913413c2011-06-21 22:41:51 +0800561 esdhc_clrset_le(host, 0x7, 0x7, ESDHC_SYSTEM_CONTROL);
Shawn Guo58c8c4f2013-01-21 19:02:25 +0800562 /*
563 * The reset on usdhc fails to clear MIX_CTRL register.
564 * Do it manually here.
565 */
Dong Aishengde5bdbf2013-10-18 19:48:46 +0800566 if (esdhc_is_usdhc(imx_data)) {
Dong Aishengd131a712013-11-04 16:38:26 +0800567 /* the tuning bits should be kept during reset */
568 new_val = readl(host->ioaddr + ESDHC_MIX_CTRL);
569 writel(new_val & ESDHC_MIX_CTRL_TUNING_MASK,
570 host->ioaddr + ESDHC_MIX_CTRL);
Dong Aishengde5bdbf2013-10-18 19:48:46 +0800571 imx_data->is_ddr = 0;
572 }
Shawn Guo58c8c4f2013-01-21 19:02:25 +0800573 }
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200574}
575
Lucas Stach0ddf03c2013-06-05 15:13:26 +0200576static unsigned int esdhc_pltfm_get_max_clock(struct sdhci_host *host)
577{
578 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
579 struct pltfm_imx_data *imx_data = pltfm_host->priv;
580 struct esdhc_platform_data *boarddata = &imx_data->boarddata;
581
582 u32 f_host = clk_get_rate(pltfm_host->clk);
583
584 if (boarddata->f_max && (boarddata->f_max < f_host))
585 return boarddata->f_max;
586 else
587 return f_host;
588}
589
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200590static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host)
591{
592 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
593
594 return clk_get_rate(pltfm_host->clk) / 256 / 16;
595}
596
Lucas Stach8ba95802013-06-05 15:13:25 +0200597static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
598 unsigned int clock)
599{
600 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
Dong Aishengfed2f6e2013-09-13 19:11:33 +0800601 struct pltfm_imx_data *imx_data = pltfm_host->priv;
Dong Aishengd31fc002013-09-13 19:11:32 +0800602 unsigned int host_clock = clk_get_rate(pltfm_host->clk);
603 int pre_div = 2;
604 int div = 1;
Dong Aishengfed2f6e2013-09-13 19:11:33 +0800605 u32 temp, val;
Lucas Stach8ba95802013-06-05 15:13:25 +0200606
Dong Aishengfed2f6e2013-09-13 19:11:33 +0800607 if (clock == 0) {
Shawn Guo9d61c002013-10-17 15:19:45 +0800608 if (esdhc_is_usdhc(imx_data)) {
Dong Aishengfed2f6e2013-09-13 19:11:33 +0800609 val = readl(host->ioaddr + ESDHC_VENDOR_SPEC);
610 writel(val & ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON,
611 host->ioaddr + ESDHC_VENDOR_SPEC);
612 }
Dong Aishengd31fc002013-09-13 19:11:32 +0800613 goto out;
Dong Aishengfed2f6e2013-09-13 19:11:33 +0800614 }
Dong Aishengd31fc002013-09-13 19:11:32 +0800615
Dong Aishengde5bdbf2013-10-18 19:48:46 +0800616 if (esdhc_is_usdhc(imx_data) && !imx_data->is_ddr)
Dong Aisheng5f7886c2013-09-13 19:11:36 +0800617 pre_div = 1;
618
Dong Aishengd31fc002013-09-13 19:11:32 +0800619 temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL);
620 temp &= ~(ESDHC_CLOCK_IPGEN | ESDHC_CLOCK_HCKEN | ESDHC_CLOCK_PEREN
621 | ESDHC_CLOCK_MASK);
622 sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL);
623
624 while (host_clock / pre_div / 16 > clock && pre_div < 256)
625 pre_div *= 2;
626
627 while (host_clock / pre_div / div > clock && div < 16)
628 div++;
629
Dong Aishenge76b8552013-09-13 19:11:37 +0800630 host->mmc->actual_clock = host_clock / pre_div / div;
Dong Aishengd31fc002013-09-13 19:11:32 +0800631 dev_dbg(mmc_dev(host->mmc), "desired SD clock: %d, actual: %d\n",
Dong Aishenge76b8552013-09-13 19:11:37 +0800632 clock, host->mmc->actual_clock);
Dong Aishengd31fc002013-09-13 19:11:32 +0800633
Dong Aishengde5bdbf2013-10-18 19:48:46 +0800634 if (imx_data->is_ddr)
635 pre_div >>= 2;
636 else
637 pre_div >>= 1;
Dong Aishengd31fc002013-09-13 19:11:32 +0800638 div--;
639
640 temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL);
641 temp |= (ESDHC_CLOCK_IPGEN | ESDHC_CLOCK_HCKEN | ESDHC_CLOCK_PEREN
642 | (div << ESDHC_DIVIDER_SHIFT)
643 | (pre_div << ESDHC_PREDIV_SHIFT));
644 sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL);
Dong Aishengfed2f6e2013-09-13 19:11:33 +0800645
Shawn Guo9d61c002013-10-17 15:19:45 +0800646 if (esdhc_is_usdhc(imx_data)) {
Dong Aishengfed2f6e2013-09-13 19:11:33 +0800647 val = readl(host->ioaddr + ESDHC_VENDOR_SPEC);
648 writel(val | ESDHC_VENDOR_SPEC_FRC_SDCLK_ON,
649 host->ioaddr + ESDHC_VENDOR_SPEC);
650 }
651
Dong Aishengd31fc002013-09-13 19:11:32 +0800652 mdelay(1);
653out:
654 host->clock = clock;
Lucas Stach8ba95802013-06-05 15:13:25 +0200655}
656
Shawn Guo913413c2011-06-21 22:41:51 +0800657static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host)
658{
Shawn Guo842afc02011-07-06 22:57:48 +0800659 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
660 struct pltfm_imx_data *imx_data = pltfm_host->priv;
661 struct esdhc_platform_data *boarddata = &imx_data->boarddata;
Shawn Guo913413c2011-06-21 22:41:51 +0800662
663 switch (boarddata->wp_type) {
664 case ESDHC_WP_GPIO:
Shawn Guofbe5fdd2012-12-11 22:32:20 +0800665 return mmc_gpio_get_ro(host->mmc);
Shawn Guo913413c2011-06-21 22:41:51 +0800666 case ESDHC_WP_CONTROLLER:
667 return !(readl(host->ioaddr + SDHCI_PRESENT_STATE) &
668 SDHCI_WRITE_PROTECT);
669 case ESDHC_WP_NONE:
670 break;
671 }
672
673 return -ENOSYS;
674}
675
Sascha Haueraf510792013-01-21 19:02:28 +0800676static int esdhc_pltfm_bus_width(struct sdhci_host *host, int width)
677{
678 u32 ctrl;
679
680 switch (width) {
681 case MMC_BUS_WIDTH_8:
682 ctrl = ESDHC_CTRL_8BITBUS;
683 break;
684 case MMC_BUS_WIDTH_4:
685 ctrl = ESDHC_CTRL_4BITBUS;
686 break;
687 default:
688 ctrl = 0;
689 break;
690 }
691
692 esdhc_clrset_le(host, ESDHC_CTRL_BUSWIDTH_MASK, ctrl,
693 SDHCI_HOST_CONTROL);
694
695 return 0;
696}
697
Dong Aisheng03221912013-09-13 19:11:34 +0800698static void esdhc_prepare_tuning(struct sdhci_host *host, u32 val)
699{
700 u32 reg;
701
702 /* FIXME: delay a bit for card to be ready for next tuning due to errors */
703 mdelay(1);
704
705 reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
706 reg |= ESDHC_MIX_CTRL_EXE_TUNE | ESDHC_MIX_CTRL_SMPCLK_SEL |
707 ESDHC_MIX_CTRL_FBCLK_SEL;
708 writel(reg, host->ioaddr + ESDHC_MIX_CTRL);
709 writel(val << 8, host->ioaddr + ESDHC_TUNE_CTRL_STATUS);
710 dev_dbg(mmc_dev(host->mmc),
711 "tunning with delay 0x%x ESDHC_TUNE_CTRL_STATUS 0x%x\n",
712 val, readl(host->ioaddr + ESDHC_TUNE_CTRL_STATUS));
713}
714
715static void esdhc_request_done(struct mmc_request *mrq)
716{
717 complete(&mrq->completion);
718}
719
720static int esdhc_send_tuning_cmd(struct sdhci_host *host, u32 opcode)
721{
722 struct mmc_command cmd = {0};
723 struct mmc_request mrq = {0};
724 struct mmc_data data = {0};
725 struct scatterlist sg;
726 char tuning_pattern[ESDHC_TUNING_BLOCK_PATTERN_LEN];
727
728 cmd.opcode = opcode;
729 cmd.arg = 0;
730 cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
731
732 data.blksz = ESDHC_TUNING_BLOCK_PATTERN_LEN;
733 data.blocks = 1;
734 data.flags = MMC_DATA_READ;
735 data.sg = &sg;
736 data.sg_len = 1;
737
738 sg_init_one(&sg, tuning_pattern, sizeof(tuning_pattern));
739
740 mrq.cmd = &cmd;
741 mrq.cmd->mrq = &mrq;
742 mrq.data = &data;
743 mrq.data->mrq = &mrq;
744 mrq.cmd->data = mrq.data;
745
746 mrq.done = esdhc_request_done;
747 init_completion(&(mrq.completion));
748
749 disable_irq(host->irq);
750 spin_lock(&host->lock);
751 host->mrq = &mrq;
752
753 sdhci_send_command(host, mrq.cmd);
754
755 spin_unlock(&host->lock);
756 enable_irq(host->irq);
757
758 wait_for_completion(&mrq.completion);
759
760 if (cmd.error)
761 return cmd.error;
762 if (data.error)
763 return data.error;
764
765 return 0;
766}
767
768static void esdhc_post_tuning(struct sdhci_host *host)
769{
770 u32 reg;
771
772 reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
773 reg &= ~ESDHC_MIX_CTRL_EXE_TUNE;
774 writel(reg, host->ioaddr + ESDHC_MIX_CTRL);
775}
776
777static int esdhc_executing_tuning(struct sdhci_host *host, u32 opcode)
778{
779 int min, max, avg, ret;
780
781 /* find the mininum delay first which can pass tuning */
782 min = ESDHC_TUNE_CTRL_MIN;
783 while (min < ESDHC_TUNE_CTRL_MAX) {
784 esdhc_prepare_tuning(host, min);
785 if (!esdhc_send_tuning_cmd(host, opcode))
786 break;
787 min += ESDHC_TUNE_CTRL_STEP;
788 }
789
790 /* find the maxinum delay which can not pass tuning */
791 max = min + ESDHC_TUNE_CTRL_STEP;
792 while (max < ESDHC_TUNE_CTRL_MAX) {
793 esdhc_prepare_tuning(host, max);
794 if (esdhc_send_tuning_cmd(host, opcode)) {
795 max -= ESDHC_TUNE_CTRL_STEP;
796 break;
797 }
798 max += ESDHC_TUNE_CTRL_STEP;
799 }
800
801 /* use average delay to get the best timing */
802 avg = (min + max) / 2;
803 esdhc_prepare_tuning(host, avg);
804 ret = esdhc_send_tuning_cmd(host, opcode);
805 esdhc_post_tuning(host);
806
807 dev_dbg(mmc_dev(host->mmc), "tunning %s at 0x%x ret %d\n",
808 ret ? "failed" : "passed", avg, ret);
809
810 return ret;
811}
812
Dong Aishengad932202013-09-13 19:11:35 +0800813static int esdhc_change_pinstate(struct sdhci_host *host,
814 unsigned int uhs)
815{
816 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
817 struct pltfm_imx_data *imx_data = pltfm_host->priv;
818 struct pinctrl_state *pinctrl;
819
820 dev_dbg(mmc_dev(host->mmc), "change pinctrl state for uhs %d\n", uhs);
821
822 if (IS_ERR(imx_data->pinctrl) ||
823 IS_ERR(imx_data->pins_default) ||
824 IS_ERR(imx_data->pins_100mhz) ||
825 IS_ERR(imx_data->pins_200mhz))
826 return -EINVAL;
827
828 switch (uhs) {
829 case MMC_TIMING_UHS_SDR50:
830 pinctrl = imx_data->pins_100mhz;
831 break;
832 case MMC_TIMING_UHS_SDR104:
Dong Aisheng429a5b42013-10-30 22:10:42 +0800833 case MMC_TIMING_MMC_HS200:
Dong Aishengad932202013-09-13 19:11:35 +0800834 pinctrl = imx_data->pins_200mhz;
835 break;
836 default:
837 /* back to default state for other legacy timing */
838 pinctrl = imx_data->pins_default;
839 }
840
841 return pinctrl_select_state(imx_data->pinctrl, pinctrl);
842}
843
844static int esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs)
845{
846 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
847 struct pltfm_imx_data *imx_data = pltfm_host->priv;
Dong Aisheng602519b2013-10-18 19:48:47 +0800848 struct esdhc_platform_data *boarddata = &imx_data->boarddata;
Dong Aishengad932202013-09-13 19:11:35 +0800849
850 switch (uhs) {
851 case MMC_TIMING_UHS_SDR12:
852 imx_data->uhs_mode = SDHCI_CTRL_UHS_SDR12;
853 break;
854 case MMC_TIMING_UHS_SDR25:
855 imx_data->uhs_mode = SDHCI_CTRL_UHS_SDR25;
856 break;
857 case MMC_TIMING_UHS_SDR50:
858 imx_data->uhs_mode = SDHCI_CTRL_UHS_SDR50;
859 break;
860 case MMC_TIMING_UHS_SDR104:
Dong Aisheng429a5b42013-10-30 22:10:42 +0800861 case MMC_TIMING_MMC_HS200:
Dong Aishengad932202013-09-13 19:11:35 +0800862 imx_data->uhs_mode = SDHCI_CTRL_UHS_SDR104;
863 break;
864 case MMC_TIMING_UHS_DDR50:
865 imx_data->uhs_mode = SDHCI_CTRL_UHS_DDR50;
Dong Aishengde5bdbf2013-10-18 19:48:46 +0800866 writel(readl(host->ioaddr + ESDHC_MIX_CTRL) |
867 ESDHC_MIX_CTRL_DDREN,
868 host->ioaddr + ESDHC_MIX_CTRL);
869 imx_data->is_ddr = 1;
Dong Aisheng602519b2013-10-18 19:48:47 +0800870 if (boarddata->delay_line) {
871 u32 v;
872 v = boarddata->delay_line <<
873 ESDHC_DLL_OVERRIDE_VAL_SHIFT |
874 (1 << ESDHC_DLL_OVERRIDE_EN_SHIFT);
875 if (is_imx53_esdhc(imx_data))
876 v <<= 1;
877 writel(v, host->ioaddr + ESDHC_DLL_CTRL);
878 }
Dong Aishengad932202013-09-13 19:11:35 +0800879 break;
880 }
881
882 return esdhc_change_pinstate(host, uhs);
883}
884
Dong Aisheng6e9fd282013-10-18 19:48:43 +0800885static struct sdhci_ops sdhci_esdhc_ops = {
Richard Zhue1498602011-03-25 09:18:27 -0400886 .read_l = esdhc_readl_le,
Wolfram Sang0c6d49c2011-02-26 14:44:39 +0100887 .read_w = esdhc_readw_le,
Richard Zhue1498602011-03-25 09:18:27 -0400888 .write_l = esdhc_writel_le,
Wolfram Sang0c6d49c2011-02-26 14:44:39 +0100889 .write_w = esdhc_writew_le,
890 .write_b = esdhc_writeb_le,
Lucas Stach8ba95802013-06-05 15:13:25 +0200891 .set_clock = esdhc_pltfm_set_clock,
Lucas Stach0ddf03c2013-06-05 15:13:26 +0200892 .get_max_clock = esdhc_pltfm_get_max_clock,
Wolfram Sang0c6d49c2011-02-26 14:44:39 +0100893 .get_min_clock = esdhc_pltfm_get_min_clock,
Shawn Guo913413c2011-06-21 22:41:51 +0800894 .get_ro = esdhc_pltfm_get_ro,
Sascha Haueraf510792013-01-21 19:02:28 +0800895 .platform_bus_width = esdhc_pltfm_bus_width,
Dong Aishengad932202013-09-13 19:11:35 +0800896 .set_uhs_signaling = esdhc_set_uhs_signaling,
Wolfram Sang0c6d49c2011-02-26 14:44:39 +0100897};
898
Lars-Peter Clausen1db5eeb2013-03-13 19:26:03 +0100899static const struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = {
Richard Zhu97e4ba62011-08-11 16:51:46 -0400900 .quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_NO_HISPD_BIT
901 | SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC
902 | SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC
Shawn Guo85d65092011-05-27 23:48:12 +0800903 | SDHCI_QUIRK_BROKEN_CARD_DETECTION,
Shawn Guo85d65092011-05-27 23:48:12 +0800904 .ops = &sdhci_esdhc_ops,
905};
906
Shawn Guoabfafc22011-06-30 15:44:44 +0800907#ifdef CONFIG_OF
Bill Pembertonc3be1ef2012-11-19 13:23:06 -0500908static int
Shawn Guoabfafc22011-06-30 15:44:44 +0800909sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
910 struct esdhc_platform_data *boarddata)
911{
912 struct device_node *np = pdev->dev.of_node;
913
914 if (!np)
915 return -ENODEV;
916
Arnd Bergmann7f217792012-05-13 00:14:24 -0400917 if (of_get_property(np, "non-removable", NULL))
Shawn Guoabfafc22011-06-30 15:44:44 +0800918 boarddata->cd_type = ESDHC_CD_PERMANENT;
919
920 if (of_get_property(np, "fsl,cd-controller", NULL))
921 boarddata->cd_type = ESDHC_CD_CONTROLLER;
922
923 if (of_get_property(np, "fsl,wp-controller", NULL))
924 boarddata->wp_type = ESDHC_WP_CONTROLLER;
925
926 boarddata->cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
927 if (gpio_is_valid(boarddata->cd_gpio))
928 boarddata->cd_type = ESDHC_CD_GPIO;
929
930 boarddata->wp_gpio = of_get_named_gpio(np, "wp-gpios", 0);
931 if (gpio_is_valid(boarddata->wp_gpio))
932 boarddata->wp_type = ESDHC_WP_GPIO;
933
Sascha Haueraf510792013-01-21 19:02:28 +0800934 of_property_read_u32(np, "bus-width", &boarddata->max_bus_width);
935
Lucas Stach0ddf03c2013-06-05 15:13:26 +0200936 of_property_read_u32(np, "max-frequency", &boarddata->f_max);
937
Dong Aishengad932202013-09-13 19:11:35 +0800938 if (of_find_property(np, "no-1-8-v", NULL))
939 boarddata->support_vsel = false;
940 else
941 boarddata->support_vsel = true;
942
Dong Aisheng602519b2013-10-18 19:48:47 +0800943 if (of_property_read_u32(np, "fsl,delay-line", &boarddata->delay_line))
944 boarddata->delay_line = 0;
945
Shawn Guoabfafc22011-06-30 15:44:44 +0800946 return 0;
947}
948#else
949static inline int
950sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
951 struct esdhc_platform_data *boarddata)
952{
953 return -ENODEV;
954}
955#endif
956
Bill Pembertonc3be1ef2012-11-19 13:23:06 -0500957static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200958{
Shawn Guoabfafc22011-06-30 15:44:44 +0800959 const struct of_device_id *of_id =
960 of_match_device(imx_esdhc_dt_ids, &pdev->dev);
Shawn Guo85d65092011-05-27 23:48:12 +0800961 struct sdhci_pltfm_host *pltfm_host;
962 struct sdhci_host *host;
963 struct esdhc_platform_data *boarddata;
Wolfram Sang0c6d49c2011-02-26 14:44:39 +0100964 int err;
Richard Zhue1498602011-03-25 09:18:27 -0400965 struct pltfm_imx_data *imx_data;
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200966
Christian Daudt0e748232013-05-29 13:50:05 -0700967 host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata, 0);
Shawn Guo85d65092011-05-27 23:48:12 +0800968 if (IS_ERR(host))
969 return PTR_ERR(host);
970
971 pltfm_host = sdhci_priv(host);
972
Shawn Guoe3af31c2012-11-26 14:39:43 +0800973 imx_data = devm_kzalloc(&pdev->dev, sizeof(*imx_data), GFP_KERNEL);
Shawn Guoabfafc22011-06-30 15:44:44 +0800974 if (!imx_data) {
975 err = -ENOMEM;
Shawn Guoe3af31c2012-11-26 14:39:43 +0800976 goto free_sdhci;
Shawn Guoabfafc22011-06-30 15:44:44 +0800977 }
Shawn Guo57ed3312011-06-30 09:24:26 +0800978
Shawn Guof47c4bb2013-10-17 15:19:47 +0800979 imx_data->socdata = of_id ? of_id->data : (struct esdhc_soc_data *)
980 pdev->id_entry->driver_data;
Shawn Guo85d65092011-05-27 23:48:12 +0800981 pltfm_host->priv = imx_data;
982
Sascha Hauer52dac612012-03-07 09:31:34 +0100983 imx_data->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
984 if (IS_ERR(imx_data->clk_ipg)) {
985 err = PTR_ERR(imx_data->clk_ipg);
Shawn Guoe3af31c2012-11-26 14:39:43 +0800986 goto free_sdhci;
Wolfram Sang95f25ef2010-10-15 12:21:04 +0200987 }
Sascha Hauer52dac612012-03-07 09:31:34 +0100988
989 imx_data->clk_ahb = devm_clk_get(&pdev->dev, "ahb");
990 if (IS_ERR(imx_data->clk_ahb)) {
991 err = PTR_ERR(imx_data->clk_ahb);
Shawn Guoe3af31c2012-11-26 14:39:43 +0800992 goto free_sdhci;
Sascha Hauer52dac612012-03-07 09:31:34 +0100993 }
994
995 imx_data->clk_per = devm_clk_get(&pdev->dev, "per");
996 if (IS_ERR(imx_data->clk_per)) {
997 err = PTR_ERR(imx_data->clk_per);
Shawn Guoe3af31c2012-11-26 14:39:43 +0800998 goto free_sdhci;
Sascha Hauer52dac612012-03-07 09:31:34 +0100999 }
1000
1001 pltfm_host->clk = imx_data->clk_per;
1002
1003 clk_prepare_enable(imx_data->clk_per);
1004 clk_prepare_enable(imx_data->clk_ipg);
1005 clk_prepare_enable(imx_data->clk_ahb);
Wolfram Sang95f25ef2010-10-15 12:21:04 +02001006
Dong Aishengad932202013-09-13 19:11:35 +08001007 imx_data->pinctrl = devm_pinctrl_get(&pdev->dev);
Dong Aishenge62d8b82012-05-11 14:56:01 +08001008 if (IS_ERR(imx_data->pinctrl)) {
1009 err = PTR_ERR(imx_data->pinctrl);
Shawn Guoe3af31c2012-11-26 14:39:43 +08001010 goto disable_clk;
Dong Aishenge62d8b82012-05-11 14:56:01 +08001011 }
1012
Dong Aishengad932202013-09-13 19:11:35 +08001013 imx_data->pins_default = pinctrl_lookup_state(imx_data->pinctrl,
1014 PINCTRL_STATE_DEFAULT);
1015 if (IS_ERR(imx_data->pins_default)) {
1016 err = PTR_ERR(imx_data->pins_default);
1017 dev_err(mmc_dev(host->mmc), "could not get default state\n");
1018 goto disable_clk;
1019 }
1020
Eric Bénardb89152822012-04-18 02:30:20 +02001021 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
Eric Bénard37865fe2010-10-23 01:57:21 +02001022
Shawn Guof47c4bb2013-10-17 15:19:47 +08001023 if (imx_data->socdata->flags & ESDHC_FLAG_ENGCM07207)
Wolfram Sang0c6d49c2011-02-26 14:44:39 +01001024 /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */
Richard Zhu97e4ba62011-08-11 16:51:46 -04001025 host->quirks |= SDHCI_QUIRK_NO_MULTIBLOCK
1026 | SDHCI_QUIRK_BROKEN_ADMA;
Wolfram Sang0c6d49c2011-02-26 14:44:39 +01001027
Shawn Guof750ba92011-11-10 16:39:32 +08001028 /*
1029 * The imx6q ROM code will change the default watermark level setting
1030 * to something insane. Change it back here.
1031 */
Dong Aisheng69ed60e2013-10-18 19:48:49 +08001032 if (esdhc_is_usdhc(imx_data)) {
Shawn Guo60bf6392013-01-15 23:36:53 +08001033 writel(0x08100810, host->ioaddr + ESDHC_WTMK_LVL);
Dong Aisheng69ed60e2013-10-18 19:48:49 +08001034 host->quirks2 |= SDHCI_QUIRK2_PRESET_VALUE_BROKEN;
Dong Aishenge2997c92013-10-30 22:09:52 +08001035 host->mmc->caps |= MMC_CAP_1_8V_DDR;
Dong Aisheng69ed60e2013-10-18 19:48:49 +08001036 }
Shawn Guof750ba92011-11-10 16:39:32 +08001037
Dong Aisheng6e9fd282013-10-18 19:48:43 +08001038 if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING)
1039 sdhci_esdhc_ops.platform_execute_tuning =
1040 esdhc_executing_tuning;
Shawn Guo842afc02011-07-06 22:57:48 +08001041 boarddata = &imx_data->boarddata;
Shawn Guoabfafc22011-06-30 15:44:44 +08001042 if (sdhci_esdhc_imx_probe_dt(pdev, boarddata) < 0) {
1043 if (!host->mmc->parent->platform_data) {
1044 dev_err(mmc_dev(host->mmc), "no board data!\n");
1045 err = -EINVAL;
Shawn Guoe3af31c2012-11-26 14:39:43 +08001046 goto disable_clk;
Shawn Guoabfafc22011-06-30 15:44:44 +08001047 }
1048 imx_data->boarddata = *((struct esdhc_platform_data *)
1049 host->mmc->parent->platform_data);
1050 }
Shawn Guo913413c2011-06-21 22:41:51 +08001051
1052 /* write_protect */
1053 if (boarddata->wp_type == ESDHC_WP_GPIO) {
Shawn Guofbe5fdd2012-12-11 22:32:20 +08001054 err = mmc_gpio_request_ro(host->mmc, boarddata->wp_gpio);
Wolfram Sang0c6d49c2011-02-26 14:44:39 +01001055 if (err) {
Shawn Guofbe5fdd2012-12-11 22:32:20 +08001056 dev_err(mmc_dev(host->mmc),
1057 "failed to request write-protect gpio!\n");
1058 goto disable_clk;
Wolfram Sang0c6d49c2011-02-26 14:44:39 +01001059 }
Shawn Guofbe5fdd2012-12-11 22:32:20 +08001060 host->mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
Shawn Guo913413c2011-06-21 22:41:51 +08001061 }
Wolfram Sang7e29c302011-02-26 14:44:41 +01001062
Shawn Guo913413c2011-06-21 22:41:51 +08001063 /* card_detect */
Shawn Guo913413c2011-06-21 22:41:51 +08001064 switch (boarddata->cd_type) {
1065 case ESDHC_CD_GPIO:
Laurent Pinchart214fc302013-08-08 12:38:31 +02001066 err = mmc_gpio_request_cd(host->mmc, boarddata->cd_gpio, 0);
Wolfram Sang7e29c302011-02-26 14:44:41 +01001067 if (err) {
Shawn Guo913413c2011-06-21 22:41:51 +08001068 dev_err(mmc_dev(host->mmc),
Shawn Guofbe5fdd2012-12-11 22:32:20 +08001069 "failed to request card-detect gpio!\n");
Shawn Guoe3af31c2012-11-26 14:39:43 +08001070 goto disable_clk;
Wolfram Sang7e29c302011-02-26 14:44:41 +01001071 }
Shawn Guo913413c2011-06-21 22:41:51 +08001072 /* fall through */
Wolfram Sang7e29c302011-02-26 14:44:41 +01001073
Shawn Guo913413c2011-06-21 22:41:51 +08001074 case ESDHC_CD_CONTROLLER:
1075 /* we have a working card_detect back */
Wolfram Sang7e29c302011-02-26 14:44:41 +01001076 host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
Shawn Guo913413c2011-06-21 22:41:51 +08001077 break;
1078
1079 case ESDHC_CD_PERMANENT:
Dong Aishenge5260032013-10-30 22:09:51 +08001080 host->mmc->caps |= MMC_CAP_NONREMOVABLE;
Shawn Guo913413c2011-06-21 22:41:51 +08001081 break;
1082
1083 case ESDHC_CD_NONE:
1084 break;
Wolfram Sang0c6d49c2011-02-26 14:44:39 +01001085 }
Eric Bénard16a790b2010-10-23 01:57:22 +02001086
Sascha Haueraf510792013-01-21 19:02:28 +08001087 switch (boarddata->max_bus_width) {
1088 case 8:
1089 host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA;
1090 break;
1091 case 4:
1092 host->mmc->caps |= MMC_CAP_4_BIT_DATA;
1093 break;
1094 case 1:
1095 default:
1096 host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA;
1097 break;
1098 }
1099
Dong Aishengad932202013-09-13 19:11:35 +08001100 /* sdr50 and sdr104 needs work on 1.8v signal voltage */
Shawn Guo9d61c002013-10-17 15:19:45 +08001101 if ((boarddata->support_vsel) && esdhc_is_usdhc(imx_data)) {
Dong Aishengad932202013-09-13 19:11:35 +08001102 imx_data->pins_100mhz = pinctrl_lookup_state(imx_data->pinctrl,
1103 ESDHC_PINCTRL_STATE_100MHZ);
1104 imx_data->pins_200mhz = pinctrl_lookup_state(imx_data->pinctrl,
1105 ESDHC_PINCTRL_STATE_200MHZ);
1106 if (IS_ERR(imx_data->pins_100mhz) ||
1107 IS_ERR(imx_data->pins_200mhz)) {
1108 dev_warn(mmc_dev(host->mmc),
1109 "could not get ultra high speed state, work on normal mode\n");
1110 /* fall back to not support uhs by specify no 1.8v quirk */
1111 host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
1112 }
1113 } else {
1114 host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
1115 }
1116
Shawn Guo85d65092011-05-27 23:48:12 +08001117 err = sdhci_add_host(host);
1118 if (err)
Shawn Guoe3af31c2012-11-26 14:39:43 +08001119 goto disable_clk;
Shawn Guo85d65092011-05-27 23:48:12 +08001120
Wolfram Sang95f25ef2010-10-15 12:21:04 +02001121 return 0;
Wolfram Sang7e29c302011-02-26 14:44:41 +01001122
Shawn Guoe3af31c2012-11-26 14:39:43 +08001123disable_clk:
Sascha Hauer52dac612012-03-07 09:31:34 +01001124 clk_disable_unprepare(imx_data->clk_per);
1125 clk_disable_unprepare(imx_data->clk_ipg);
1126 clk_disable_unprepare(imx_data->clk_ahb);
Shawn Guoe3af31c2012-11-26 14:39:43 +08001127free_sdhci:
Shawn Guo85d65092011-05-27 23:48:12 +08001128 sdhci_pltfm_free(pdev);
1129 return err;
Wolfram Sang95f25ef2010-10-15 12:21:04 +02001130}
1131
Bill Pemberton6e0ee712012-11-19 13:26:03 -05001132static int sdhci_esdhc_imx_remove(struct platform_device *pdev)
Wolfram Sang95f25ef2010-10-15 12:21:04 +02001133{
Shawn Guo85d65092011-05-27 23:48:12 +08001134 struct sdhci_host *host = platform_get_drvdata(pdev);
Wolfram Sang95f25ef2010-10-15 12:21:04 +02001135 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
Richard Zhue1498602011-03-25 09:18:27 -04001136 struct pltfm_imx_data *imx_data = pltfm_host->priv;
Shawn Guo85d65092011-05-27 23:48:12 +08001137 int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
1138
1139 sdhci_remove_host(host, dead);
Wolfram Sang0c6d49c2011-02-26 14:44:39 +01001140
Sascha Hauer52dac612012-03-07 09:31:34 +01001141 clk_disable_unprepare(imx_data->clk_per);
1142 clk_disable_unprepare(imx_data->clk_ipg);
1143 clk_disable_unprepare(imx_data->clk_ahb);
1144
Shawn Guo85d65092011-05-27 23:48:12 +08001145 sdhci_pltfm_free(pdev);
1146
1147 return 0;
Wolfram Sang95f25ef2010-10-15 12:21:04 +02001148}
1149
Shawn Guo85d65092011-05-27 23:48:12 +08001150static struct platform_driver sdhci_esdhc_imx_driver = {
1151 .driver = {
1152 .name = "sdhci-esdhc-imx",
1153 .owner = THIS_MODULE,
Shawn Guoabfafc22011-06-30 15:44:44 +08001154 .of_match_table = imx_esdhc_dt_ids,
Manuel Lauss29495aa2011-11-03 11:09:45 +01001155 .pm = SDHCI_PLTFM_PMOPS,
Shawn Guo85d65092011-05-27 23:48:12 +08001156 },
Shawn Guo57ed3312011-06-30 09:24:26 +08001157 .id_table = imx_esdhc_devtype,
Shawn Guo85d65092011-05-27 23:48:12 +08001158 .probe = sdhci_esdhc_imx_probe,
Bill Pemberton0433c142012-11-19 13:20:26 -05001159 .remove = sdhci_esdhc_imx_remove,
Wolfram Sang95f25ef2010-10-15 12:21:04 +02001160};
Shawn Guo85d65092011-05-27 23:48:12 +08001161
Axel Lind1f81a62011-11-26 12:55:43 +08001162module_platform_driver(sdhci_esdhc_imx_driver);
Shawn Guo85d65092011-05-27 23:48:12 +08001163
1164MODULE_DESCRIPTION("SDHCI driver for Freescale i.MX eSDHC");
1165MODULE_AUTHOR("Wolfram Sang <w.sang@pengutronix.de>");
1166MODULE_LICENSE("GPL v2");