diff options
author | Nicolas Ferre <nicolas.ferre@atmel.com> | 2010-03-05 16:43:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-06 14:26:43 -0500 |
commit | 5b27a1a566c5a4cce81d75107a0f130e43c6a5f8 (patch) | |
tree | 483e14773fb97e42476cfd0088abf7b9fff27d7a /drivers/mmc/host/at91_mci.c | |
parent | 541e7ef0399c6c5753cc8d3e8f371dcb3627e8a4 (diff) |
mmc: at91_mci: introduce per-mci-revision conditional code
We used to manage features and differences on a per-cpu basis. As several
cpus share the same mci revision, this patch aggregates cpus that have the
same IP revision in one defined constant. We use the
at91mci_is_mci1rev2xx() funtion name not to mess with newer Atmel sd/mmc
IP called "MCI2". _rev2 naming could have been confusing...
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Wolfgang Muees <wolfgang.mues@auerswald.de>
Cc: Andrew Victor <avictor.za@gmail.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/mmc/host/at91_mci.c')
-rw-r--r-- | drivers/mmc/host/at91_mci.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index 8327daebb396..55507dacb789 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -78,6 +78,17 @@ | |||
78 | 78 | ||
79 | #define DRIVER_NAME "at91_mci" | 79 | #define DRIVER_NAME "at91_mci" |
80 | 80 | ||
81 | static inline int at91mci_is_mci1rev2xx(void) | ||
82 | { | ||
83 | return ( cpu_is_at91sam9260() | ||
84 | || cpu_is_at91sam9263() | ||
85 | || cpu_is_at91cap9() | ||
86 | || cpu_is_at91sam9rl() | ||
87 | || cpu_is_at91sam9g10() | ||
88 | || cpu_is_at91sam9g20() | ||
89 | ); | ||
90 | } | ||
91 | |||
81 | #define FL_SENT_COMMAND (1 << 0) | 92 | #define FL_SENT_COMMAND (1 << 0) |
82 | #define FL_SENT_STOP (1 << 1) | 93 | #define FL_SENT_STOP (1 << 1) |
83 | 94 | ||
@@ -204,8 +215,8 @@ static inline void at91_mci_sg_to_dma(struct at91mci_host *host, struct mmc_data | |||
204 | size = data->blksz * data->blocks; | 215 | size = data->blksz * data->blocks; |
205 | len = data->sg_len; | 216 | len = data->sg_len; |
206 | 217 | ||
207 | /* AT91SAM926[0/3] Data Write Operation and number of bytes erratum */ | 218 | /* MCI1 rev2xx Data Write Operation and number of bytes erratum */ |
208 | if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) | 219 | if (at91mci_is_mci1rev2xx()) |
209 | if (host->total_length == 12) | 220 | if (host->total_length == 12) |
210 | memset(dmabuf, 0, 12); | 221 | memset(dmabuf, 0, 12); |
211 | 222 | ||
@@ -398,7 +409,7 @@ static void at91_mci_enable(struct at91mci_host *host) | |||
398 | at91_mci_write(host, AT91_MCI_DTOR, AT91_MCI_DTOMUL_1M | AT91_MCI_DTOCYC); | 409 | at91_mci_write(host, AT91_MCI_DTOR, AT91_MCI_DTOMUL_1M | AT91_MCI_DTOCYC); |
399 | mr = AT91_MCI_PDCMODE | 0x34a; | 410 | mr = AT91_MCI_PDCMODE | 0x34a; |
400 | 411 | ||
401 | if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) | 412 | if (at91mci_is_mci1rev2xx()) |
402 | mr |= AT91_MCI_RDPROOF | AT91_MCI_WRPROOF; | 413 | mr |= AT91_MCI_RDPROOF | AT91_MCI_WRPROOF; |
403 | 414 | ||
404 | at91_mci_write(host, AT91_MCI_MR, mr); | 415 | at91_mci_write(host, AT91_MCI_MR, mr); |
@@ -555,10 +566,10 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command | |||
555 | */ | 566 | */ |
556 | host->total_length = block_length * blocks; | 567 | host->total_length = block_length * blocks; |
557 | /* | 568 | /* |
558 | * AT91SAM926[0/3] Data Write Operation and | 569 | * MCI1 rev2xx Data Write Operation and |
559 | * number of bytes erratum | 570 | * number of bytes erratum |
560 | */ | 571 | */ |
561 | if (cpu_is_at91sam9260 () || cpu_is_at91sam9263()) | 572 | if (at91mci_is_mci1rev2xx()) |
562 | if (host->total_length < 12) | 573 | if (host->total_length < 12) |
563 | host->total_length = 12; | 574 | host->total_length = 12; |
564 | 575 | ||
@@ -943,7 +954,7 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
943 | host->bus_mode = 0; | 954 | host->bus_mode = 0; |
944 | host->board = pdev->dev.platform_data; | 955 | host->board = pdev->dev.platform_data; |
945 | if (host->board->wire4) { | 956 | if (host->board->wire4) { |
946 | if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) | 957 | if (at91mci_is_mci1rev2xx()) |
947 | mmc->caps |= MMC_CAP_4_BIT_DATA; | 958 | mmc->caps |= MMC_CAP_4_BIT_DATA; |
948 | else | 959 | else |
949 | dev_warn(&pdev->dev, "4 wire bus mode not supported" | 960 | dev_warn(&pdev->dev, "4 wire bus mode not supported" |
@@ -959,8 +970,8 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
959 | } | 970 | } |
960 | 971 | ||
961 | /* Add SDIO capability when available */ | 972 | /* Add SDIO capability when available */ |
962 | if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) { | 973 | if (at91mci_is_mci1rev2xx()) { |
963 | /* AT91SAM9260/9263 erratum */ | 974 | /* at91mci MCI1 rev2xx sdio interrupt erratum */ |
964 | if (host->board->wire4 || !host->board->slot_b) | 975 | if (host->board->wire4 || !host->board->slot_b) |
965 | mmc->caps |= MMC_CAP_SDIO_IRQ; | 976 | mmc->caps |= MMC_CAP_SDIO_IRQ; |
966 | } | 977 | } |