aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci-esdhc-imx.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2013-06-12 19:26:33 -0400
committerOlof Johansson <olof@lixom.net>2013-06-12 19:27:21 -0400
commit1e76c7cb3c1d281be2e452e780e53859abc7c145 (patch)
tree5199604868c08ab76ea17c860f1f2ab553670360 /drivers/mmc/host/sdhci-esdhc-imx.c
parent18c0e596791a1014781202a3af649f42a6d8495d (diff)
parenta38089057fa450944f2e2d07885d76fd727c8d16 (diff)
Merge tag 'exynos-dt-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung into next/dt
From Kukjin Kim: Update exynos DT for - usb3phy and dwc3 for exynos5250 - keypad for exynos4412 - TMU clock for exynos4210 - MFC clock for exynos4 - DP controller for exynos5250 - G2D clock for exynos4 - some exynos boards * tag 'exynos-dt-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung: (456 commits) ARM: dts: add ohci and ehci controller nodes for EXYNOS5440 ARM: dts: Update G2D documentation for clock entries ARM: dts: Add clock entries to G2D node for exynos4x12 ARM: dts: Add clock entries to G2D node for exynos4210 ARM: dts: Remove duplicate and add missing G2D nodes clk: exynos4: Add additional G2D clocks ARM: dts: Document DP clock in samsung,exynos5-dp binding ARM: dts: add pin state information for DP HPD support to Exynos5250 ARM: dts: add dts node for the ahci sata exynos5440 ARM: dts: add vmmc regulator support for ODROID-X ARM: dts: add max77686 node entry for ODROID-X ARM: dts: Enable RTC by default on EXYNOS5440 ARM: dts: Add display timing node to exynos5250-arndale.dts ARM: dts: Add clock provider information for DP controller in Exynos5250 SoC ARM: dts: Add DT node for DP controller for Arndale Board ARM: dts: Remove combiner IRQ node from exynos4x12.dtsi ARM: dts: add max8997 device node for exynos4210-origen board ARM: dts: Enable TMU on Origen4210 board ARM: dts: Add TMU clock entries to exynos4210.dtsi ARM: dts: Update MFC documentation for clock entries ... Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/mmc/host/sdhci-esdhc-imx.c')
-rw-r--r--drivers/mmc/host/sdhci-esdhc-imx.c41
1 files changed, 37 insertions, 4 deletions
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 67d6dde2ff19..d5f0d59e1310 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -85,6 +85,12 @@ struct pltfm_imx_data {
85 struct clk *clk_ipg; 85 struct clk *clk_ipg;
86 struct clk *clk_ahb; 86 struct clk *clk_ahb;
87 struct clk *clk_per; 87 struct clk *clk_per;
88 enum {
89 NO_CMD_PENDING, /* no multiblock command pending*/
90 MULTIBLK_IN_PROCESS, /* exact multiblock cmd in process */
91 WAIT_FOR_INT, /* sent CMD12, waiting for response INT */
92 } multiblock_status;
93
88}; 94};
89 95
90static struct platform_device_id imx_esdhc_devtype[] = { 96static struct platform_device_id imx_esdhc_devtype[] = {
@@ -154,6 +160,8 @@ static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, i
154 160
155static u32 esdhc_readl_le(struct sdhci_host *host, int reg) 161static u32 esdhc_readl_le(struct sdhci_host *host, int reg)
156{ 162{
163 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
164 struct pltfm_imx_data *imx_data = pltfm_host->priv;
157 u32 val = readl(host->ioaddr + reg); 165 u32 val = readl(host->ioaddr + reg);
158 166
159 if (unlikely(reg == SDHCI_CAPABILITIES)) { 167 if (unlikely(reg == SDHCI_CAPABILITIES)) {
@@ -175,6 +183,18 @@ static u32 esdhc_readl_le(struct sdhci_host *host, int reg)
175 val &= ~ESDHC_INT_VENDOR_SPEC_DMA_ERR; 183 val &= ~ESDHC_INT_VENDOR_SPEC_DMA_ERR;
176 val |= SDHCI_INT_ADMA_ERROR; 184 val |= SDHCI_INT_ADMA_ERROR;
177 } 185 }
186
187 /*
188 * mask off the interrupt we get in response to the manually
189 * sent CMD12
190 */
191 if ((imx_data->multiblock_status == WAIT_FOR_INT) &&
192 ((val & SDHCI_INT_RESPONSE) == SDHCI_INT_RESPONSE)) {
193 val &= ~SDHCI_INT_RESPONSE;
194 writel(SDHCI_INT_RESPONSE, host->ioaddr +
195 SDHCI_INT_STATUS);
196 imx_data->multiblock_status = NO_CMD_PENDING;
197 }
178 } 198 }
179 199
180 return val; 200 return val;
@@ -211,6 +231,15 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
211 v = readl(host->ioaddr + ESDHC_VENDOR_SPEC); 231 v = readl(host->ioaddr + ESDHC_VENDOR_SPEC);
212 v &= ~ESDHC_VENDOR_SPEC_SDIO_QUIRK; 232 v &= ~ESDHC_VENDOR_SPEC_SDIO_QUIRK;
213 writel(v, host->ioaddr + ESDHC_VENDOR_SPEC); 233 writel(v, host->ioaddr + ESDHC_VENDOR_SPEC);
234
235 if (imx_data->multiblock_status == MULTIBLK_IN_PROCESS)
236 {
237 /* send a manual CMD12 with RESPTYP=none */
238 data = MMC_STOP_TRANSMISSION << 24 |
239 SDHCI_CMD_ABORTCMD << 16;
240 writel(data, host->ioaddr + SDHCI_TRANSFER_MODE);
241 imx_data->multiblock_status = WAIT_FOR_INT;
242 }
214 } 243 }
215 244
216 if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)) { 245 if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)) {
@@ -277,11 +306,13 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
277 } 306 }
278 return; 307 return;
279 case SDHCI_COMMAND: 308 case SDHCI_COMMAND:
280 if ((host->cmd->opcode == MMC_STOP_TRANSMISSION || 309 if (host->cmd->opcode == MMC_STOP_TRANSMISSION)
281 host->cmd->opcode == MMC_SET_BLOCK_COUNT) &&
282 (imx_data->flags & ESDHC_FLAG_MULTIBLK_NO_INT))
283 val |= SDHCI_CMD_ABORTCMD; 310 val |= SDHCI_CMD_ABORTCMD;
284 311
312 if ((host->cmd->opcode == MMC_SET_BLOCK_COUNT) &&
313 (imx_data->flags & ESDHC_FLAG_MULTIBLK_NO_INT))
314 imx_data->multiblock_status = MULTIBLK_IN_PROCESS;
315
285 if (is_imx6q_usdhc(imx_data)) 316 if (is_imx6q_usdhc(imx_data))
286 writel(val << 16, 317 writel(val << 16,
287 host->ioaddr + SDHCI_TRANSFER_MODE); 318 host->ioaddr + SDHCI_TRANSFER_MODE);
@@ -324,8 +355,10 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
324 /* 355 /*
325 * Do not touch buswidth bits here. This is done in 356 * Do not touch buswidth bits here. This is done in
326 * esdhc_pltfm_bus_width. 357 * esdhc_pltfm_bus_width.
358 * Do not touch the D3CD bit either which is used for the
359 * SDIO interrupt errata workaround.
327 */ 360 */
328 mask = 0xffff & ~ESDHC_CTRL_BUSWIDTH_MASK; 361 mask = 0xffff & ~(ESDHC_CTRL_BUSWIDTH_MASK | ESDHC_CTRL_D3CD);
329 362
330 esdhc_clrset_le(host, mask, new_val, reg); 363 esdhc_clrset_le(host, mask, new_val, reg);
331 return; 364 return;