aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/atmel-mci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/host/atmel-mci.c')
-rw-r--r--drivers/mmc/host/atmel-mci.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 5e10d3663ab5..fc25586b7ee1 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -30,6 +30,7 @@
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/unaligned.h> 31#include <asm/unaligned.h>
32 32
33#include <mach/cpu.h>
33#include <mach/board.h> 34#include <mach/board.h>
34 35
35#include "atmel-mci-regs.h" 36#include "atmel-mci-regs.h"
@@ -210,6 +211,18 @@ struct atmel_mci_slot {
210 set_bit(event, &host->pending_events) 211 set_bit(event, &host->pending_events)
211 212
212/* 213/*
214 * Enable or disable features/registers based on
215 * whether the processor supports them
216 */
217static bool mci_has_rwproof(void)
218{
219 if (cpu_is_at91sam9261() || cpu_is_at91rm9200())
220 return false;
221 else
222 return true;
223}
224
225/*
213 * The debugfs stuff below is mostly optimized away when 226 * The debugfs stuff below is mostly optimized away when
214 * CONFIG_DEBUG_FS is not set. 227 * CONFIG_DEBUG_FS is not set.
215 */ 228 */
@@ -276,8 +289,13 @@ static void atmci_show_status_reg(struct seq_file *s,
276 [3] = "BLKE", 289 [3] = "BLKE",
277 [4] = "DTIP", 290 [4] = "DTIP",
278 [5] = "NOTBUSY", 291 [5] = "NOTBUSY",
292 [6] = "ENDRX",
293 [7] = "ENDTX",
279 [8] = "SDIOIRQA", 294 [8] = "SDIOIRQA",
280 [9] = "SDIOIRQB", 295 [9] = "SDIOIRQB",
296 [12] = "SDIOWAIT",
297 [14] = "RXBUFF",
298 [15] = "TXBUFE",
281 [16] = "RINDE", 299 [16] = "RINDE",
282 [17] = "RDIRE", 300 [17] = "RDIRE",
283 [18] = "RCRCE", 301 [18] = "RCRCE",
@@ -285,6 +303,11 @@ static void atmci_show_status_reg(struct seq_file *s,
285 [20] = "RTOE", 303 [20] = "RTOE",
286 [21] = "DCRCE", 304 [21] = "DCRCE",
287 [22] = "DTOE", 305 [22] = "DTOE",
306 [23] = "CSTOE",
307 [24] = "BLKOVRE",
308 [25] = "DMADONE",
309 [26] = "FIFOEMPTY",
310 [27] = "XFRDONE",
288 [30] = "OVRE", 311 [30] = "OVRE",
289 [31] = "UNRE", 312 [31] = "UNRE",
290 }; 313 };
@@ -856,13 +879,15 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
856 clkdiv = 255; 879 clkdiv = 255;
857 } 880 }
858 881
882 host->mode_reg = MCI_MR_CLKDIV(clkdiv);
883
859 /* 884 /*
860 * WRPROOF and RDPROOF prevent overruns/underruns by 885 * WRPROOF and RDPROOF prevent overruns/underruns by
861 * stopping the clock when the FIFO is full/empty. 886 * stopping the clock when the FIFO is full/empty.
862 * This state is not expected to last for long. 887 * This state is not expected to last for long.
863 */ 888 */
864 host->mode_reg = MCI_MR_CLKDIV(clkdiv) | MCI_MR_WRPROOF 889 if (mci_has_rwproof())
865 | MCI_MR_RDPROOF; 890 host->mode_reg |= (MCI_MR_WRPROOF | MCI_MR_RDPROOF);
866 891
867 if (list_empty(&host->queue)) 892 if (list_empty(&host->queue))
868 mci_writel(host, MR, host->mode_reg); 893 mci_writel(host, MR, host->mode_reg);
@@ -1655,8 +1680,10 @@ static int __init atmci_probe(struct platform_device *pdev)
1655 nr_slots++; 1680 nr_slots++;
1656 } 1681 }
1657 1682
1658 if (!nr_slots) 1683 if (!nr_slots) {
1684 dev_err(&pdev->dev, "init failed: no slot defined\n");
1659 goto err_init_slot; 1685 goto err_init_slot;
1686 }
1660 1687
1661 dev_info(&pdev->dev, 1688 dev_info(&pdev->dev,
1662 "Atmel MCI controller at 0x%08lx irq %d, %u slots\n", 1689 "Atmel MCI controller at 0x%08lx irq %d, %u slots\n",