diff options
author | Yusuke Goda <yusuke.goda.sx@renesas.com> | 2010-04-27 06:15:32 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-05-31 00:10:09 -0400 |
commit | 1238c684325d9710544af6f0d11bf7cd6efd5925 (patch) | |
tree | f1c01d46f5d4d3237983863a9ba8a60718d1062c /arch/sh/boards/mach-ecovec24/setup.c | |
parent | 8fa76f7e61ef4e5bc97207143ea4e198b22487bc (diff) |
sh: Add support MMCIF for ecovec
This patch adds MMCIF platform data for the Ecovec board.
Signed-off-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards/mach-ecovec24/setup.c')
-rw-r--r-- | arch/sh/boards/mach-ecovec24/setup.c | 86 |
1 files changed, 84 insertions, 2 deletions
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 3845258242ac..778eb7cb9873 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c | |||
@@ -12,6 +12,8 @@ | |||
12 | #include <linux/device.h> | 12 | #include <linux/device.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/mfd/sh_mobile_sdhi.h> | 14 | #include <linux/mfd/sh_mobile_sdhi.h> |
15 | #include <linux/mmc/host.h> | ||
16 | #include <linux/mmc/sh_mmcif.h> | ||
15 | #include <linux/mtd/physmap.h> | 17 | #include <linux/mtd/physmap.h> |
16 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
17 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
@@ -435,7 +437,7 @@ static struct i2c_board_info ts_i2c_clients = { | |||
435 | }; | 437 | }; |
436 | 438 | ||
437 | #ifdef CONFIG_MFD_SH_MOBILE_SDHI | 439 | #ifdef CONFIG_MFD_SH_MOBILE_SDHI |
438 | /* SHDI0 */ | 440 | /* SDHI0 */ |
439 | static void sdhi0_set_pwr(struct platform_device *pdev, int state) | 441 | static void sdhi0_set_pwr(struct platform_device *pdev, int state) |
440 | { | 442 | { |
441 | gpio_set_value(GPIO_PTB6, state); | 443 | gpio_set_value(GPIO_PTB6, state); |
@@ -473,7 +475,8 @@ static struct platform_device sdhi0_device = { | |||
473 | }, | 475 | }, |
474 | }; | 476 | }; |
475 | 477 | ||
476 | /* SHDI1 */ | 478 | #if !defined(CONFIG_MMC_SH_MMCIF) |
479 | /* SDHI1 */ | ||
477 | static void sdhi1_set_pwr(struct platform_device *pdev, int state) | 480 | static void sdhi1_set_pwr(struct platform_device *pdev, int state) |
478 | { | 481 | { |
479 | gpio_set_value(GPIO_PTB7, state); | 482 | gpio_set_value(GPIO_PTB7, state); |
@@ -510,6 +513,7 @@ static struct platform_device sdhi1_device = { | |||
510 | .hwblk_id = HWBLK_SDHI1, | 513 | .hwblk_id = HWBLK_SDHI1, |
511 | }, | 514 | }, |
512 | }; | 515 | }; |
516 | #endif /* CONFIG_MMC_SH_MMCIF */ | ||
513 | 517 | ||
514 | #else | 518 | #else |
515 | 519 | ||
@@ -818,6 +822,58 @@ static struct platform_device vou_device = { | |||
818 | }, | 822 | }, |
819 | }; | 823 | }; |
820 | 824 | ||
825 | #if defined(CONFIG_MMC_SH_MMCIF) | ||
826 | /* SH_MMCIF */ | ||
827 | static void mmcif_set_pwr(struct platform_device *pdev, int state) | ||
828 | { | ||
829 | gpio_set_value(GPIO_PTB7, state); | ||
830 | } | ||
831 | |||
832 | static void mmcif_down_pwr(struct platform_device *pdev) | ||
833 | { | ||
834 | gpio_set_value(GPIO_PTB7, 0); | ||
835 | } | ||
836 | |||
837 | static struct resource sh_mmcif_resources[] = { | ||
838 | [0] = { | ||
839 | .name = "SH_MMCIF", | ||
840 | .start = 0xA4CA0000, | ||
841 | .end = 0xA4CA00FF, | ||
842 | .flags = IORESOURCE_MEM, | ||
843 | }, | ||
844 | [1] = { | ||
845 | /* MMC2I */ | ||
846 | .start = 29, | ||
847 | .flags = IORESOURCE_IRQ, | ||
848 | }, | ||
849 | [2] = { | ||
850 | /* MMC3I */ | ||
851 | .start = 30, | ||
852 | .flags = IORESOURCE_IRQ, | ||
853 | }, | ||
854 | }; | ||
855 | |||
856 | struct sh_mmcif_plat_data sh_mmcif_plat = { | ||
857 | .set_pwr = mmcif_set_pwr, | ||
858 | .down_pwr = mmcif_down_pwr, | ||
859 | .sup_pclk = 0, /* SH7724: Max Pclk/2 */ | ||
860 | .caps = MMC_CAP_4_BIT_DATA | | ||
861 | MMC_CAP_8_BIT_DATA | | ||
862 | MMC_CAP_NEEDS_POLL, | ||
863 | .ocr = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
864 | }; | ||
865 | |||
866 | static struct platform_device sh_mmcif_device = { | ||
867 | .name = "sh_mmcif", | ||
868 | .id = 0, | ||
869 | .dev = { | ||
870 | .platform_data = &sh_mmcif_plat, | ||
871 | }, | ||
872 | .num_resources = ARRAY_SIZE(sh_mmcif_resources), | ||
873 | .resource = sh_mmcif_resources, | ||
874 | }; | ||
875 | #endif | ||
876 | |||
821 | static struct platform_device *ecovec_devices[] __initdata = { | 877 | static struct platform_device *ecovec_devices[] __initdata = { |
822 | &heartbeat_device, | 878 | &heartbeat_device, |
823 | &nor_flash_device, | 879 | &nor_flash_device, |
@@ -830,7 +886,9 @@ static struct platform_device *ecovec_devices[] __initdata = { | |||
830 | &keysc_device, | 886 | &keysc_device, |
831 | #ifdef CONFIG_MFD_SH_MOBILE_SDHI | 887 | #ifdef CONFIG_MFD_SH_MOBILE_SDHI |
832 | &sdhi0_device, | 888 | &sdhi0_device, |
889 | #if !defined(CONFIG_MMC_SH_MMCIF) | ||
833 | &sdhi1_device, | 890 | &sdhi1_device, |
891 | #endif | ||
834 | #else | 892 | #else |
835 | &msiof0_device, | 893 | &msiof0_device, |
836 | #endif | 894 | #endif |
@@ -840,6 +898,9 @@ static struct platform_device *ecovec_devices[] __initdata = { | |||
840 | &fsi_device, | 898 | &fsi_device, |
841 | &irda_device, | 899 | &irda_device, |
842 | &vou_device, | 900 | &vou_device, |
901 | #if defined(CONFIG_MMC_SH_MMCIF) | ||
902 | &sh_mmcif_device, | ||
903 | #endif | ||
843 | }; | 904 | }; |
844 | 905 | ||
845 | #ifdef CONFIG_I2C | 906 | #ifdef CONFIG_I2C |
@@ -1133,6 +1194,7 @@ static int __init arch_setup(void) | |||
1133 | gpio_request(GPIO_PTB6, NULL); | 1194 | gpio_request(GPIO_PTB6, NULL); |
1134 | gpio_direction_output(GPIO_PTB6, 0); | 1195 | gpio_direction_output(GPIO_PTB6, 0); |
1135 | 1196 | ||
1197 | #if !defined(CONFIG_MMC_SH_MMCIF) | ||
1136 | /* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */ | 1198 | /* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */ |
1137 | gpio_request(GPIO_FN_SDHI1CD, NULL); | 1199 | gpio_request(GPIO_FN_SDHI1CD, NULL); |
1138 | gpio_request(GPIO_FN_SDHI1WP, NULL); | 1200 | gpio_request(GPIO_FN_SDHI1WP, NULL); |
@@ -1147,6 +1209,7 @@ static int __init arch_setup(void) | |||
1147 | 1209 | ||
1148 | /* I/O buffer drive ability is high for SDHI1 */ | 1210 | /* I/O buffer drive ability is high for SDHI1 */ |
1149 | __raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA); | 1211 | __raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA); |
1212 | #endif /* CONFIG_MMC_SH_MMCIF */ | ||
1150 | #else | 1213 | #else |
1151 | /* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */ | 1214 | /* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */ |
1152 | gpio_request(GPIO_FN_MSIOF0_TXD, NULL); | 1215 | gpio_request(GPIO_FN_MSIOF0_TXD, NULL); |
@@ -1222,6 +1285,25 @@ static int __init arch_setup(void) | |||
1222 | gpio_request(GPIO_PTU5, NULL); | 1285 | gpio_request(GPIO_PTU5, NULL); |
1223 | gpio_direction_output(GPIO_PTU5, 0); | 1286 | gpio_direction_output(GPIO_PTU5, 0); |
1224 | 1287 | ||
1288 | #if defined(CONFIG_MMC_SH_MMCIF) | ||
1289 | /* enable MMCIF (needs DS2.6,7 set to OFF,ON) */ | ||
1290 | gpio_request(GPIO_FN_MMC_D7, NULL); | ||
1291 | gpio_request(GPIO_FN_MMC_D6, NULL); | ||
1292 | gpio_request(GPIO_FN_MMC_D5, NULL); | ||
1293 | gpio_request(GPIO_FN_MMC_D4, NULL); | ||
1294 | gpio_request(GPIO_FN_MMC_D3, NULL); | ||
1295 | gpio_request(GPIO_FN_MMC_D2, NULL); | ||
1296 | gpio_request(GPIO_FN_MMC_D1, NULL); | ||
1297 | gpio_request(GPIO_FN_MMC_D0, NULL); | ||
1298 | gpio_request(GPIO_FN_MMC_CLK, NULL); | ||
1299 | gpio_request(GPIO_FN_MMC_CMD, NULL); | ||
1300 | gpio_request(GPIO_PTB7, NULL); | ||
1301 | gpio_direction_output(GPIO_PTB7, 0); | ||
1302 | |||
1303 | /* I/O buffer drive ability is high for MMCIF */ | ||
1304 | __raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA); | ||
1305 | #endif | ||
1306 | |||
1225 | /* enable I2C device */ | 1307 | /* enable I2C device */ |
1226 | i2c_register_board_info(0, i2c0_devices, | 1308 | i2c_register_board_info(0, i2c0_devices, |
1227 | ARRAY_SIZE(i2c0_devices)); | 1309 | ARRAY_SIZE(i2c0_devices)); |