diff options
Diffstat (limited to 'arch/arm/mach-shmobile/board-armadillo800eva.c')
-rw-r--r-- | arch/arm/mach-shmobile/board-armadillo800eva.c | 148 |
1 files changed, 124 insertions, 24 deletions
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c index 80d5c2f5c09c..4dfe32262eb7 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c | |||
@@ -29,8 +29,10 @@ | |||
29 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
30 | #include <linux/gpio.h> | 30 | #include <linux/gpio.h> |
31 | #include <linux/gpio_keys.h> | 31 | #include <linux/gpio_keys.h> |
32 | #include <linux/regulator/driver.h> | ||
32 | #include <linux/pinctrl/machine.h> | 33 | #include <linux/pinctrl/machine.h> |
33 | #include <linux/regulator/fixed.h> | 34 | #include <linux/regulator/fixed.h> |
35 | #include <linux/regulator/gpio-regulator.h> | ||
34 | #include <linux/regulator/machine.h> | 36 | #include <linux/regulator/machine.h> |
35 | #include <linux/sh_eth.h> | 37 | #include <linux/sh_eth.h> |
36 | #include <linux/videodev2.h> | 38 | #include <linux/videodev2.h> |
@@ -560,15 +562,119 @@ static struct platform_device gpio_keys_device = { | |||
560 | }, | 562 | }, |
561 | }; | 563 | }; |
562 | 564 | ||
563 | /* Fixed 3.3V regulator to be used by SDHI0, SDHI1, MMCIF */ | 565 | /* Fixed 3.3V regulator to be used by SDHI1, MMCIF */ |
564 | static struct regulator_consumer_supply fixed3v3_power_consumers[] = | 566 | static struct regulator_consumer_supply fixed3v3_power_consumers[] = { |
565 | { | 567 | REGULATOR_SUPPLY("vmmc", "sh_mmcif"), |
568 | REGULATOR_SUPPLY("vqmmc", "sh_mmcif"), | ||
569 | }; | ||
570 | |||
571 | /* Fixed 3.3V regulator to be used by SDHI0 */ | ||
572 | static struct regulator_consumer_supply vcc_sdhi0_consumers[] = { | ||
566 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), | 573 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), |
574 | }; | ||
575 | |||
576 | static struct regulator_init_data vcc_sdhi0_init_data = { | ||
577 | .constraints = { | ||
578 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
579 | }, | ||
580 | .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers), | ||
581 | .consumer_supplies = vcc_sdhi0_consumers, | ||
582 | }; | ||
583 | |||
584 | static struct fixed_voltage_config vcc_sdhi0_info = { | ||
585 | .supply_name = "SDHI0 Vcc", | ||
586 | .microvolts = 3300000, | ||
587 | .gpio = GPIO_PORT75, | ||
588 | .enable_high = 1, | ||
589 | .init_data = &vcc_sdhi0_init_data, | ||
590 | }; | ||
591 | |||
592 | static struct platform_device vcc_sdhi0 = { | ||
593 | .name = "reg-fixed-voltage", | ||
594 | .id = 1, | ||
595 | .dev = { | ||
596 | .platform_data = &vcc_sdhi0_info, | ||
597 | }, | ||
598 | }; | ||
599 | |||
600 | /* 1.8 / 3.3V SDHI0 VccQ regulator */ | ||
601 | static struct regulator_consumer_supply vccq_sdhi0_consumers[] = { | ||
567 | REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"), | 602 | REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"), |
603 | }; | ||
604 | |||
605 | static struct regulator_init_data vccq_sdhi0_init_data = { | ||
606 | .constraints = { | ||
607 | .input_uV = 3300000, | ||
608 | .min_uV = 1800000, | ||
609 | .max_uV = 3300000, | ||
610 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
611 | REGULATOR_CHANGE_STATUS, | ||
612 | }, | ||
613 | .num_consumer_supplies = ARRAY_SIZE(vccq_sdhi0_consumers), | ||
614 | .consumer_supplies = vccq_sdhi0_consumers, | ||
615 | }; | ||
616 | |||
617 | static struct gpio vccq_sdhi0_gpios[] = { | ||
618 | {GPIO_PORT17, GPIOF_OUT_INIT_LOW, "vccq-sdhi0" }, | ||
619 | }; | ||
620 | |||
621 | static struct gpio_regulator_state vccq_sdhi0_states[] = { | ||
622 | { .value = 3300000, .gpios = (0 << 0) }, | ||
623 | { .value = 1800000, .gpios = (1 << 0) }, | ||
624 | }; | ||
625 | |||
626 | static struct gpio_regulator_config vccq_sdhi0_info = { | ||
627 | .supply_name = "vqmmc", | ||
628 | |||
629 | .enable_gpio = GPIO_PORT74, | ||
630 | .enable_high = 1, | ||
631 | .enabled_at_boot = 0, | ||
632 | |||
633 | .gpios = vccq_sdhi0_gpios, | ||
634 | .nr_gpios = ARRAY_SIZE(vccq_sdhi0_gpios), | ||
635 | |||
636 | .states = vccq_sdhi0_states, | ||
637 | .nr_states = ARRAY_SIZE(vccq_sdhi0_states), | ||
638 | |||
639 | .type = REGULATOR_VOLTAGE, | ||
640 | .init_data = &vccq_sdhi0_init_data, | ||
641 | }; | ||
642 | |||
643 | static struct platform_device vccq_sdhi0 = { | ||
644 | .name = "gpio-regulator", | ||
645 | .id = -1, | ||
646 | .dev = { | ||
647 | .platform_data = &vccq_sdhi0_info, | ||
648 | }, | ||
649 | }; | ||
650 | |||
651 | /* Fixed 3.3V regulator to be used by SDHI1 */ | ||
652 | static struct regulator_consumer_supply vcc_sdhi1_consumers[] = { | ||
568 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"), | 653 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"), |
569 | REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"), | 654 | }; |
570 | REGULATOR_SUPPLY("vmmc", "sh_mmcif"), | 655 | |
571 | REGULATOR_SUPPLY("vqmmc", "sh_mmcif"), | 656 | static struct regulator_init_data vcc_sdhi1_init_data = { |
657 | .constraints = { | ||
658 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
659 | }, | ||
660 | .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi1_consumers), | ||
661 | .consumer_supplies = vcc_sdhi1_consumers, | ||
662 | }; | ||
663 | |||
664 | static struct fixed_voltage_config vcc_sdhi1_info = { | ||
665 | .supply_name = "SDHI1 Vcc", | ||
666 | .microvolts = 3300000, | ||
667 | .gpio = GPIO_PORT16, | ||
668 | .enable_high = 1, | ||
669 | .init_data = &vcc_sdhi1_init_data, | ||
670 | }; | ||
671 | |||
672 | static struct platform_device vcc_sdhi1 = { | ||
673 | .name = "reg-fixed-voltage", | ||
674 | .id = 2, | ||
675 | .dev = { | ||
676 | .platform_data = &vcc_sdhi1_info, | ||
677 | }, | ||
572 | }; | 678 | }; |
573 | 679 | ||
574 | /* SDHI0 */ | 680 | /* SDHI0 */ |
@@ -584,10 +690,10 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[] = | |||
584 | static struct sh_mobile_sdhi_info sdhi0_info = { | 690 | static struct sh_mobile_sdhi_info sdhi0_info = { |
585 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, | 691 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, |
586 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, | 692 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, |
587 | .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |\ | 693 | .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | |
588 | MMC_CAP_NEEDS_POLL, | 694 | MMC_CAP_POWER_OFF_CARD, |
589 | .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, | 695 | .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD, |
590 | .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, | 696 | .cd_gpio = GPIO_PORT167, |
591 | }; | 697 | }; |
592 | 698 | ||
593 | static struct resource sdhi0_resources[] = { | 699 | static struct resource sdhi0_resources[] = { |
@@ -626,9 +732,11 @@ static struct platform_device sdhi0_device = { | |||
626 | static struct sh_mobile_sdhi_info sdhi1_info = { | 732 | static struct sh_mobile_sdhi_info sdhi1_info = { |
627 | .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, | 733 | .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, |
628 | .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, | 734 | .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, |
629 | .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, | 735 | .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | |
630 | .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, | 736 | MMC_CAP_POWER_OFF_CARD, |
631 | .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, | 737 | .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD, |
738 | /* Port72 cannot generate IRQs, will be used in polling mode. */ | ||
739 | .cd_gpio = GPIO_PORT72, | ||
632 | }; | 740 | }; |
633 | 741 | ||
634 | static struct resource sdhi1_resources[] = { | 742 | static struct resource sdhi1_resources[] = { |
@@ -676,7 +784,6 @@ static const struct pinctrl_map eva_sdhi1_pinctrl_map[] = { | |||
676 | /* MMCIF */ | 784 | /* MMCIF */ |
677 | static struct sh_mmcif_plat_data sh_mmcif_plat = { | 785 | static struct sh_mmcif_plat_data sh_mmcif_plat = { |
678 | .sup_pclk = 0, | 786 | .sup_pclk = 0, |
679 | .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, | ||
680 | .caps = MMC_CAP_4_BIT_DATA | | 787 | .caps = MMC_CAP_4_BIT_DATA | |
681 | MMC_CAP_8_BIT_DATA | | 788 | MMC_CAP_8_BIT_DATA | |
682 | MMC_CAP_NONREMOVABLE, | 789 | MMC_CAP_NONREMOVABLE, |
@@ -924,6 +1031,8 @@ static struct platform_device *eva_devices[] __initdata = { | |||
924 | &lcdc0_device, | 1031 | &lcdc0_device, |
925 | &gpio_keys_device, | 1032 | &gpio_keys_device, |
926 | &sh_eth_device, | 1033 | &sh_eth_device, |
1034 | &vcc_sdhi0, | ||
1035 | &vccq_sdhi0, | ||
927 | &sdhi0_device, | 1036 | &sdhi0_device, |
928 | &sh_mmcif_device, | 1037 | &sh_mmcif_device, |
929 | &hdmi_device, | 1038 | &hdmi_device, |
@@ -1067,13 +1176,6 @@ static void __init eva_init(void) | |||
1067 | usb = &usbhsf_device; | 1176 | usb = &usbhsf_device; |
1068 | } | 1177 | } |
1069 | 1178 | ||
1070 | /* SDHI0 */ | ||
1071 | gpio_request_one(17, GPIOF_OUT_INIT_LOW, NULL); /* SDHI0_18/33_B */ | ||
1072 | gpio_request_one(74, GPIOF_OUT_INIT_HIGH, NULL); /* SDHI0_PON */ | ||
1073 | gpio_request_one(75, GPIOF_OUT_INIT_HIGH, NULL); /* SDSLOT1_PON */ | ||
1074 | |||
1075 | /* we can use GPIO_FN_IRQ31_PORT167 here for SDHI0 CD irq */ | ||
1076 | |||
1077 | /* CEU0 */ | 1179 | /* CEU0 */ |
1078 | gpio_request(GPIO_FN_VIO0_D7, NULL); | 1180 | gpio_request(GPIO_FN_VIO0_D7, NULL); |
1079 | gpio_request(GPIO_FN_VIO0_D6, NULL); | 1181 | gpio_request(GPIO_FN_VIO0_D6, NULL); |
@@ -1134,9 +1236,7 @@ static void __init eva_init(void) | |||
1134 | pinctrl_register_mappings(eva_sdhi1_pinctrl_map, | 1236 | pinctrl_register_mappings(eva_sdhi1_pinctrl_map, |
1135 | ARRAY_SIZE(eva_sdhi1_pinctrl_map)); | 1237 | ARRAY_SIZE(eva_sdhi1_pinctrl_map)); |
1136 | 1238 | ||
1137 | /* SDSLOT2_PON */ | 1239 | platform_device_register(&vcc_sdhi1); |
1138 | gpio_request_one(16, GPIOF_OUT_INIT_HIGH, NULL); | ||
1139 | |||
1140 | platform_device_register(&sdhi1_device); | 1240 | platform_device_register(&sdhi1_device); |
1141 | } | 1241 | } |
1142 | 1242 | ||