diff options
author | Yusuke Goda <yusuke.goda.sx@renesas.com> | 2010-12-14 00:18:03 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-12-14 04:15:17 -0500 |
commit | 6dff7da2adbba9c5cd1b3a3f67191fe3471c663c (patch) | |
tree | 25cc735bb9d948112042b4f83a429dd5df75a786 /arch | |
parent | cd8ab0041d131e8e210c4b5ded7257da50473dcb (diff) |
ARM: mach-shmobile: mackerel: Add sdhi support
Signed-off-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-shmobile/board-mackerel.c | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 3e30a5250414..f62f9b9ea5f2 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -31,6 +31,9 @@ | |||
31 | #include <linux/io.h> | 31 | #include <linux/io.h> |
32 | #include <linux/i2c.h> | 32 | #include <linux/i2c.h> |
33 | #include <linux/leds.h> | 33 | #include <linux/leds.h> |
34 | #include <linux/mfd/sh_mobile_sdhi.h> | ||
35 | #include <linux/mfd/tmio.h> | ||
36 | #include <linux/mmc/host.h> | ||
34 | #include <linux/mtd/mtd.h> | 37 | #include <linux/mtd/mtd.h> |
35 | #include <linux/mtd/partitions.h> | 38 | #include <linux/mtd/partitions.h> |
36 | #include <linux/mtd/physmap.h> | 39 | #include <linux/mtd/physmap.h> |
@@ -139,6 +142,38 @@ | |||
139 | */ | 142 | */ |
140 | 143 | ||
141 | /* | 144 | /* |
145 | * SDHI0 (CN12) | ||
146 | * | ||
147 | * SW56 : OFF | ||
148 | * | ||
149 | */ | ||
150 | |||
151 | /* MMC /SDHI1 (CN7) | ||
152 | * | ||
153 | * I/O voltage : 1.8v | ||
154 | * | ||
155 | * Power voltage : 1.8v or 3.3v | ||
156 | * J22 : select power voltage | ||
157 | * 1-2 pin : 1.8v | ||
158 | * 2-3 pin : 3.3v | ||
159 | * | ||
160 | * SW1 | SW33 | ||
161 | * | bit1 | bit2 | bit3 | bit4 | ||
162 | * -------------+------+------+------+------- | ||
163 | * MMC0 OFF | OFF | ON | ON | X | ||
164 | * MMC1 ON | OFF | ON | X | ON | ||
165 | * SDHI1 OFF | ON | X | OFF | ON | ||
166 | * | ||
167 | */ | ||
168 | |||
169 | /* | ||
170 | * SDHI2 (CN23) | ||
171 | * | ||
172 | * microSD card sloct | ||
173 | * | ||
174 | */ | ||
175 | |||
176 | /* | ||
142 | * FIXME !! | 177 | * FIXME !! |
143 | * | 178 | * |
144 | * gpio_no_direction | 179 | * gpio_no_direction |
@@ -404,6 +439,114 @@ static struct platform_device fsi_ak4643_device = { | |||
404 | .name = "sh_fsi2_a_ak4643", | 439 | .name = "sh_fsi2_a_ak4643", |
405 | }; | 440 | }; |
406 | 441 | ||
442 | /* | ||
443 | * The card detect pin of the top SD/MMC slot (CN7) is active low and is | ||
444 | * connected to GPIO A22 of SH7372 (GPIO_PORT41). | ||
445 | */ | ||
446 | static int slot_cn7_get_cd(struct platform_device *pdev) | ||
447 | { | ||
448 | if (gpio_is_valid(GPIO_PORT41)) | ||
449 | return !gpio_get_value(GPIO_PORT41); | ||
450 | else | ||
451 | return -ENXIO; | ||
452 | } | ||
453 | |||
454 | /* SDHI0 */ | ||
455 | static struct sh_mobile_sdhi_info sdhi0_info = { | ||
456 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, | ||
457 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, | ||
458 | .tmio_caps = MMC_CAP_SD_HIGHSPEED, | ||
459 | }; | ||
460 | |||
461 | static struct resource sdhi0_resources[] = { | ||
462 | [0] = { | ||
463 | .name = "SDHI0", | ||
464 | .start = 0xe6850000, | ||
465 | .end = 0xe68501ff, | ||
466 | .flags = IORESOURCE_MEM, | ||
467 | }, | ||
468 | [1] = { | ||
469 | .start = evt2irq(0x0e00) /* SDHI0 */, | ||
470 | .flags = IORESOURCE_IRQ, | ||
471 | }, | ||
472 | }; | ||
473 | |||
474 | static struct platform_device sdhi0_device = { | ||
475 | .name = "sh_mobile_sdhi", | ||
476 | .num_resources = ARRAY_SIZE(sdhi0_resources), | ||
477 | .resource = sdhi0_resources, | ||
478 | .id = 0, | ||
479 | .dev = { | ||
480 | .platform_data = &sdhi0_info, | ||
481 | }, | ||
482 | }; | ||
483 | |||
484 | /* SDHI1 */ | ||
485 | static struct sh_mobile_sdhi_info sdhi1_info = { | ||
486 | .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, | ||
487 | .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, | ||
488 | .tmio_ocr_mask = MMC_VDD_165_195, | ||
489 | .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE, | ||
490 | .tmio_caps = MMC_CAP_SD_HIGHSPEED | | ||
491 | MMC_CAP_NEEDS_POLL, | ||
492 | .get_cd = slot_cn7_get_cd, | ||
493 | }; | ||
494 | |||
495 | static struct resource sdhi1_resources[] = { | ||
496 | [0] = { | ||
497 | .name = "SDHI1", | ||
498 | .start = 0xe6860000, | ||
499 | .end = 0xe68601ff, | ||
500 | .flags = IORESOURCE_MEM, | ||
501 | }, | ||
502 | [1] = { | ||
503 | .start = evt2irq(0x0e80), | ||
504 | .flags = IORESOURCE_IRQ, | ||
505 | }, | ||
506 | }; | ||
507 | |||
508 | static struct platform_device sdhi1_device = { | ||
509 | .name = "sh_mobile_sdhi", | ||
510 | .num_resources = ARRAY_SIZE(sdhi1_resources), | ||
511 | .resource = sdhi1_resources, | ||
512 | .id = 1, | ||
513 | .dev = { | ||
514 | .platform_data = &sdhi1_info, | ||
515 | }, | ||
516 | }; | ||
517 | |||
518 | /* SDHI2 */ | ||
519 | static struct sh_mobile_sdhi_info sdhi2_info = { | ||
520 | .dma_slave_tx = SHDMA_SLAVE_SDHI2_TX, | ||
521 | .dma_slave_rx = SHDMA_SLAVE_SDHI2_RX, | ||
522 | .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE, | ||
523 | .tmio_caps = MMC_CAP_SD_HIGHSPEED | | ||
524 | MMC_CAP_NEEDS_POLL, | ||
525 | }; | ||
526 | |||
527 | static struct resource sdhi2_resources[] = { | ||
528 | [0] = { | ||
529 | .name = "SDHI2", | ||
530 | .start = 0xe6870000, | ||
531 | .end = 0xe68701ff, | ||
532 | .flags = IORESOURCE_MEM, | ||
533 | }, | ||
534 | [1] = { | ||
535 | .start = evt2irq(0x1200), | ||
536 | .flags = IORESOURCE_IRQ, | ||
537 | }, | ||
538 | }; | ||
539 | |||
540 | static struct platform_device sdhi2_device = { | ||
541 | .name = "sh_mobile_sdhi", | ||
542 | .num_resources = ARRAY_SIZE(sdhi2_resources), | ||
543 | .resource = sdhi2_resources, | ||
544 | .id = 2, | ||
545 | .dev = { | ||
546 | .platform_data = &sdhi2_info, | ||
547 | }, | ||
548 | }; | ||
549 | |||
407 | static struct platform_device *mackerel_devices[] __initdata = { | 550 | static struct platform_device *mackerel_devices[] __initdata = { |
408 | &nor_flash_device, | 551 | &nor_flash_device, |
409 | &smc911x_device, | 552 | &smc911x_device, |
@@ -412,6 +555,9 @@ static struct platform_device *mackerel_devices[] __initdata = { | |||
412 | &leds_device, | 555 | &leds_device, |
413 | &fsi_device, | 556 | &fsi_device, |
414 | &fsi_ak4643_device, | 557 | &fsi_ak4643_device, |
558 | &sdhi0_device, | ||
559 | &sdhi1_device, | ||
560 | &sdhi2_device, | ||
415 | }; | 561 | }; |
416 | 562 | ||
417 | /* Keypad Initialization */ | 563 | /* Keypad Initialization */ |
@@ -567,6 +713,35 @@ static void __init mackerel_init(void) | |||
567 | gpio_request(GPIO_FN_IRQ21, NULL); | 713 | gpio_request(GPIO_FN_IRQ21, NULL); |
568 | set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH); | 714 | set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH); |
569 | 715 | ||
716 | /* enable SDHI0 */ | ||
717 | gpio_request(GPIO_FN_SDHICD0, NULL); | ||
718 | gpio_request(GPIO_FN_SDHIWP0, NULL); | ||
719 | gpio_request(GPIO_FN_SDHICMD0, NULL); | ||
720 | gpio_request(GPIO_FN_SDHICLK0, NULL); | ||
721 | gpio_request(GPIO_FN_SDHID0_3, NULL); | ||
722 | gpio_request(GPIO_FN_SDHID0_2, NULL); | ||
723 | gpio_request(GPIO_FN_SDHID0_1, NULL); | ||
724 | gpio_request(GPIO_FN_SDHID0_0, NULL); | ||
725 | |||
726 | /* enable SDHI1 */ | ||
727 | gpio_request(GPIO_FN_SDHICMD1, NULL); | ||
728 | gpio_request(GPIO_FN_SDHICLK1, NULL); | ||
729 | gpio_request(GPIO_FN_SDHID1_3, NULL); | ||
730 | gpio_request(GPIO_FN_SDHID1_2, NULL); | ||
731 | gpio_request(GPIO_FN_SDHID1_1, NULL); | ||
732 | gpio_request(GPIO_FN_SDHID1_0, NULL); | ||
733 | /* card detect pin for MMC slot (CN7) */ | ||
734 | gpio_request(GPIO_PORT41, NULL); | ||
735 | gpio_direction_input(GPIO_PORT41); | ||
736 | |||
737 | /* enable SDHI2 */ | ||
738 | gpio_request(GPIO_FN_SDHICMD2, NULL); | ||
739 | gpio_request(GPIO_FN_SDHICLK2, NULL); | ||
740 | gpio_request(GPIO_FN_SDHID2_3, NULL); | ||
741 | gpio_request(GPIO_FN_SDHID2_2, NULL); | ||
742 | gpio_request(GPIO_FN_SDHID2_1, NULL); | ||
743 | gpio_request(GPIO_FN_SDHID2_0, NULL); | ||
744 | |||
570 | i2c_register_board_info(0, i2c0_devices, | 745 | i2c_register_board_info(0, i2c0_devices, |
571 | ARRAY_SIZE(i2c0_devices)); | 746 | ARRAY_SIZE(i2c0_devices)); |
572 | i2c_register_board_info(1, i2c1_devices, | 747 | i2c_register_board_info(1, i2c1_devices, |