diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2010-08-09 09:48:17 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@stericsson.com> | 2010-12-08 07:13:51 -0500 |
commit | b8410a150fbc4e61a28032637dc0ae7e8609131d (patch) | |
tree | 3e3a3dde5feada0c540ebe4fac6d2d595f6f42f5 /arch | |
parent | e8a7e48bb248a1196484d3f8afa53bded2b24e71 (diff) |
ux500: mop500: add TC35892 and MicroSD slot support
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-ux500/board-mop500-sdi.c | 63 | ||||
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.c | 34 | ||||
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.h | 8 | ||||
-rw-r--r-- | arch/arm/mach-ux500/include/mach/irqs-board-mop500.h | 14 |
4 files changed, 118 insertions, 1 deletions
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c index bac995665b58..f0095ffee438 100644 --- a/arch/arm/mach-ux500/board-mop500-sdi.c +++ b/arch/arm/mach-ux500/board-mop500-sdi.c | |||
@@ -20,6 +20,19 @@ | |||
20 | #include "board-mop500.h" | 20 | #include "board-mop500.h" |
21 | 21 | ||
22 | static pin_cfg_t mop500_sdi_pins[] = { | 22 | static pin_cfg_t mop500_sdi_pins[] = { |
23 | /* SDI0 (MicroSD slot) */ | ||
24 | GPIO18_MC0_CMDDIR, | ||
25 | GPIO19_MC0_DAT0DIR, | ||
26 | GPIO20_MC0_DAT2DIR, | ||
27 | GPIO21_MC0_DAT31DIR, | ||
28 | GPIO22_MC0_FBCLK, | ||
29 | GPIO23_MC0_CLK, | ||
30 | GPIO24_MC0_CMD, | ||
31 | GPIO25_MC0_DAT0, | ||
32 | GPIO26_MC0_DAT1, | ||
33 | GPIO27_MC0_DAT2, | ||
34 | GPIO28_MC0_DAT3, | ||
35 | |||
23 | /* SDI4 (on-board eMMC) */ | 36 | /* SDI4 (on-board eMMC) */ |
24 | GPIO197_MC4_DAT3, | 37 | GPIO197_MC4_DAT3, |
25 | GPIO198_MC4_DAT2, | 38 | GPIO198_MC4_DAT2, |
@@ -50,6 +63,55 @@ static pin_cfg_t mop500_sdi2_pins[] = { | |||
50 | }; | 63 | }; |
51 | 64 | ||
52 | /* | 65 | /* |
66 | * SDI 0 (MicroSD slot) | ||
67 | */ | ||
68 | |||
69 | /* MMCIPOWER bits */ | ||
70 | #define MCI_DATA2DIREN (1 << 2) | ||
71 | #define MCI_CMDDIREN (1 << 3) | ||
72 | #define MCI_DATA0DIREN (1 << 4) | ||
73 | #define MCI_DATA31DIREN (1 << 5) | ||
74 | #define MCI_FBCLKEN (1 << 7) | ||
75 | |||
76 | static u32 mop500_sdi0_vdd_handler(struct device *dev, unsigned int vdd, | ||
77 | unsigned char power_mode) | ||
78 | { | ||
79 | if (power_mode == MMC_POWER_UP) | ||
80 | gpio_set_value(GPIO_SDMMC_EN, 1); | ||
81 | else if (power_mode == MMC_POWER_OFF) | ||
82 | gpio_set_value(GPIO_SDMMC_EN, 0); | ||
83 | |||
84 | return MCI_FBCLKEN | MCI_CMDDIREN | MCI_DATA0DIREN | | ||
85 | MCI_DATA2DIREN | MCI_DATA31DIREN; | ||
86 | } | ||
87 | |||
88 | static struct mmci_platform_data mop500_sdi0_data = { | ||
89 | .vdd_handler = mop500_sdi0_vdd_handler, | ||
90 | .ocr_mask = MMC_VDD_29_30, | ||
91 | .f_max = 100000000, | ||
92 | .capabilities = MMC_CAP_4_BIT_DATA, | ||
93 | .gpio_cd = GPIO_SDMMC_CD, | ||
94 | .gpio_wp = -1, | ||
95 | }; | ||
96 | |||
97 | void mop500_sdi_tc35892_init(void) | ||
98 | { | ||
99 | int ret; | ||
100 | |||
101 | ret = gpio_request(GPIO_SDMMC_EN, "SDMMC_EN"); | ||
102 | if (!ret) | ||
103 | ret = gpio_request(GPIO_SDMMC_1V8_3V_SEL, | ||
104 | "GPIO_SDMMC_1V8_3V_SEL"); | ||
105 | if (ret) | ||
106 | return; | ||
107 | |||
108 | gpio_direction_output(GPIO_SDMMC_1V8_3V_SEL, 1); | ||
109 | gpio_direction_output(GPIO_SDMMC_EN, 0); | ||
110 | |||
111 | amba_device_register(&u8500_sdi0_device, &iomem_resource); | ||
112 | } | ||
113 | |||
114 | /* | ||
53 | * SDI 2 (POP eMMC, not on DB8500ed) | 115 | * SDI 2 (POP eMMC, not on DB8500ed) |
54 | */ | 116 | */ |
55 | 117 | ||
@@ -78,6 +140,7 @@ void mop500_sdi_init(void) | |||
78 | { | 140 | { |
79 | nmk_config_pins(mop500_sdi_pins, ARRAY_SIZE(mop500_sdi_pins)); | 141 | nmk_config_pins(mop500_sdi_pins, ARRAY_SIZE(mop500_sdi_pins)); |
80 | 142 | ||
143 | u8500_sdi0_device.dev.platform_data = &mop500_sdi0_data; | ||
81 | u8500_sdi2_device.dev.platform_data = &mop500_sdi2_data; | 144 | u8500_sdi2_device.dev.platform_data = &mop500_sdi2_data; |
82 | u8500_sdi4_device.dev.platform_data = &mop500_sdi4_data; | 145 | u8500_sdi4_device.dev.platform_data = &mop500_sdi4_data; |
83 | 146 | ||
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index cac83a694880..9aeefc403f35 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c | |||
@@ -13,11 +13,13 @@ | |||
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <linux/i2c.h> | ||
16 | #include <linux/gpio.h> | 17 | #include <linux/gpio.h> |
17 | #include <linux/amba/bus.h> | 18 | #include <linux/amba/bus.h> |
18 | #include <linux/amba/pl022.h> | 19 | #include <linux/amba/pl022.h> |
19 | #include <linux/spi/spi.h> | 20 | #include <linux/spi/spi.h> |
20 | #include <linux/mfd/ab8500.h> | 21 | #include <linux/mfd/ab8500.h> |
22 | #include <linux/mfd/tc35892.h> | ||
21 | #include <linux/input/matrix_keypad.h> | 23 | #include <linux/input/matrix_keypad.h> |
22 | 24 | ||
23 | #include <asm/mach-types.h> | 25 | #include <asm/mach-types.h> |
@@ -69,6 +71,8 @@ static pin_cfg_t mop500_pins[] = { | |||
69 | GPIO166_KP_O2, | 71 | GPIO166_KP_O2, |
70 | GPIO167_KP_O1, | 72 | GPIO167_KP_O1, |
71 | GPIO168_KP_O0, | 73 | GPIO168_KP_O0, |
74 | |||
75 | GPIO217_GPIO, /* GPIO_EXP_INT */ | ||
72 | }; | 76 | }; |
73 | 77 | ||
74 | static void ab4500_spi_cs_control(u32 command) | 78 | static void ab4500_spi_cs_control(u32 command) |
@@ -132,6 +136,33 @@ static struct pl022_ssp_controller ssp0_platform_data = { | |||
132 | .num_chipselect = 5, | 136 | .num_chipselect = 5, |
133 | }; | 137 | }; |
134 | 138 | ||
139 | /* | ||
140 | * TC35892 | ||
141 | */ | ||
142 | |||
143 | static void mop500_tc35892_init(struct tc35892 *tc35892, unsigned int base) | ||
144 | { | ||
145 | mop500_sdi_tc35892_init(); | ||
146 | } | ||
147 | |||
148 | static struct tc35892_gpio_platform_data mop500_tc35892_gpio_data = { | ||
149 | .gpio_base = MOP500_EGPIO(0), | ||
150 | .setup = mop500_tc35892_init, | ||
151 | }; | ||
152 | |||
153 | static struct tc35892_platform_data mop500_tc35892_data = { | ||
154 | .gpio = &mop500_tc35892_gpio_data, | ||
155 | .irq_base = MOP500_EGPIO_IRQ_BASE, | ||
156 | }; | ||
157 | |||
158 | static struct i2c_board_info mop500_i2c0_devices[] = { | ||
159 | { | ||
160 | I2C_BOARD_INFO("tc35892", 0x42), | ||
161 | .irq = NOMADIK_GPIO_TO_IRQ(217), | ||
162 | .platform_data = &mop500_tc35892_data, | ||
163 | }, | ||
164 | }; | ||
165 | |||
135 | #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \ | 166 | #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \ |
136 | static struct nmk_i2c_controller u8500_i2c##id##_data = { \ | 167 | static struct nmk_i2c_controller u8500_i2c##id##_data = { \ |
137 | /* \ | 168 | /* \ |
@@ -314,6 +345,9 @@ static void __init u8500_init_machine(void) | |||
314 | ARRAY_SIZE(ab8500_spi_devices)); | 345 | ARRAY_SIZE(ab8500_spi_devices)); |
315 | else /* If HW is v.1.1 or later use I2C to access AB8500 */ | 346 | else /* If HW is v.1.1 or later use I2C to access AB8500 */ |
316 | platform_device_register(&ab8500_device); | 347 | platform_device_register(&ab8500_device); |
348 | |||
349 | i2c_register_board_info(0, mop500_i2c0_devices, | ||
350 | ARRAY_SIZE(mop500_i2c0_devices)); | ||
317 | } | 351 | } |
318 | 352 | ||
319 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") | 353 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") |
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h index 2d240322fa6f..3a338e6850a4 100644 --- a/arch/arm/mach-ux500/board-mop500.h +++ b/arch/arm/mach-ux500/board-mop500.h | |||
@@ -7,6 +7,14 @@ | |||
7 | #ifndef __BOARD_MOP500_H | 7 | #ifndef __BOARD_MOP500_H |
8 | #define __BOARD_MOP500_H | 8 | #define __BOARD_MOP500_H |
9 | 9 | ||
10 | #define MOP500_EGPIO(x) (NOMADIK_NR_GPIO + (x)) | ||
11 | |||
12 | /* GPIOs on the TC35892 expander */ | ||
13 | #define GPIO_SDMMC_CD MOP500_EGPIO(3) | ||
14 | #define GPIO_SDMMC_EN MOP500_EGPIO(17) | ||
15 | #define GPIO_SDMMC_1V8_3V_SEL MOP500_EGPIO(18) | ||
16 | |||
10 | extern void mop500_sdi_init(void); | 17 | extern void mop500_sdi_init(void); |
18 | extern void mop500_sdi_tc35892_init(void); | ||
11 | 19 | ||
12 | #endif | 20 | #endif |
diff --git a/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h b/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h index cca4f705601e..7ee8aaae66a4 100644 --- a/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h +++ b/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h | |||
@@ -13,7 +13,19 @@ | |||
13 | #define MOP500_AB8500_IRQ_BASE IRQ_BOARD_START | 13 | #define MOP500_AB8500_IRQ_BASE IRQ_BOARD_START |
14 | #define MOP500_AB8500_IRQ_END (MOP500_AB8500_IRQ_BASE \ | 14 | #define MOP500_AB8500_IRQ_END (MOP500_AB8500_IRQ_BASE \ |
15 | + AB8500_NR_IRQS) | 15 | + AB8500_NR_IRQS) |
16 | #define MOP500_IRQ_END MOP500_AB8500_IRQ_END | 16 | |
17 | #define TC35892_NR_INTERNAL_IRQS 8 | ||
18 | #define TC35892_INT_GPIO(x) (TC35892_NR_INTERNAL_IRQS + (x)) | ||
19 | #define TC35892_NR_GPIOS 24 | ||
20 | #define TC35892_NR_IRQS TC35892_INT_GPIO(TC35892_NR_GPIOS) | ||
21 | |||
22 | #define MOP500_EGPIO_NR_IRQS TC35892_NR_IRQS | ||
23 | |||
24 | #define MOP500_EGPIO_IRQ_BASE MOP500_AB8500_IRQ_END | ||
25 | #define MOP500_EGPIO_IRQ_END (MOP500_EGPIO_IRQ_BASE \ | ||
26 | + MOP500_EGPIO_NR_IRQS) | ||
27 | |||
28 | #define MOP500_IRQ_END MOP500_EGPIO_IRQ_END | ||
17 | 29 | ||
18 | #if MOP500_IRQ_END > IRQ_BOARD_END | 30 | #if MOP500_IRQ_END > IRQ_BOARD_END |
19 | #undef IRQ_BOARD_END | 31 | #undef IRQ_BOARD_END |