diff options
Diffstat (limited to 'arch/arm/mach-ux500/board-mop500.c')
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.c | 328 |
1 files changed, 265 insertions, 63 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index a393f57ed2a8..8790d984cac8 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c | |||
@@ -17,68 +17,30 @@ | |||
17 | #include <linux/gpio.h> | 17 | #include <linux/gpio.h> |
18 | #include <linux/amba/bus.h> | 18 | #include <linux/amba/bus.h> |
19 | #include <linux/amba/pl022.h> | 19 | #include <linux/amba/pl022.h> |
20 | #include <linux/amba/serial.h> | ||
20 | #include <linux/spi/spi.h> | 21 | #include <linux/spi/spi.h> |
21 | #include <linux/mfd/ab8500.h> | 22 | #include <linux/mfd/ab8500.h> |
22 | #include <linux/mfd/tc3589x.h> | 23 | #include <linux/mfd/tc3589x.h> |
24 | #include <linux/leds-lp5521.h> | ||
25 | #include <linux/input.h> | ||
26 | #include <linux/gpio_keys.h> | ||
23 | 27 | ||
24 | #include <asm/mach-types.h> | 28 | #include <asm/mach-types.h> |
25 | #include <asm/mach/arch.h> | 29 | #include <asm/mach/arch.h> |
26 | 30 | ||
27 | #include <plat/pincfg.h> | ||
28 | #include <plat/i2c.h> | 31 | #include <plat/i2c.h> |
32 | #include <plat/ste_dma40.h> | ||
29 | 33 | ||
30 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
31 | #include <mach/setup.h> | 35 | #include <mach/setup.h> |
32 | #include <mach/devices.h> | 36 | #include <mach/devices.h> |
33 | #include <mach/irqs.h> | 37 | #include <mach/irqs.h> |
34 | 38 | ||
39 | #include "ste-dma40-db8500.h" | ||
35 | #include "devices-db8500.h" | 40 | #include "devices-db8500.h" |
36 | #include "pins-db8500.h" | ||
37 | #include "board-mop500.h" | 41 | #include "board-mop500.h" |
38 | #include "board-mop500-regulators.h" | 42 | #include "board-mop500-regulators.h" |
39 | 43 | ||
40 | static pin_cfg_t mop500_pins[] = { | ||
41 | /* SSP0 */ | ||
42 | GPIO143_SSP0_CLK, | ||
43 | GPIO144_SSP0_FRM, | ||
44 | GPIO145_SSP0_RXD, | ||
45 | GPIO146_SSP0_TXD, | ||
46 | |||
47 | /* I2C */ | ||
48 | GPIO147_I2C0_SCL, | ||
49 | GPIO148_I2C0_SDA, | ||
50 | GPIO16_I2C1_SCL, | ||
51 | GPIO17_I2C1_SDA, | ||
52 | GPIO10_I2C2_SDA, | ||
53 | GPIO11_I2C2_SCL, | ||
54 | GPIO229_I2C3_SDA, | ||
55 | GPIO230_I2C3_SCL, | ||
56 | |||
57 | /* SKE keypad */ | ||
58 | GPIO153_KP_I7, | ||
59 | GPIO154_KP_I6, | ||
60 | GPIO155_KP_I5, | ||
61 | GPIO156_KP_I4, | ||
62 | GPIO157_KP_O7, | ||
63 | GPIO158_KP_O6, | ||
64 | GPIO159_KP_O5, | ||
65 | GPIO160_KP_O4, | ||
66 | GPIO161_KP_I3, | ||
67 | GPIO162_KP_I2, | ||
68 | GPIO163_KP_I1, | ||
69 | GPIO164_KP_I0, | ||
70 | GPIO165_KP_O3, | ||
71 | GPIO166_KP_O2, | ||
72 | GPIO167_KP_O1, | ||
73 | GPIO168_KP_O0, | ||
74 | |||
75 | /* GPIO_EXP_INT */ | ||
76 | GPIO217_GPIO, | ||
77 | |||
78 | /* STMPE1601 IRQ */ | ||
79 | GPIO218_GPIO | PIN_INPUT_PULLUP, | ||
80 | }; | ||
81 | |||
82 | static struct ab8500_platform_data ab8500_platdata = { | 44 | static struct ab8500_platform_data ab8500_platdata = { |
83 | .irq_base = MOP500_AB8500_IRQ_BASE, | 45 | .irq_base = MOP500_AB8500_IRQ_BASE, |
84 | .regulator = ab8500_regulators, | 46 | .regulator = ab8500_regulators, |
@@ -103,16 +65,6 @@ struct platform_device ab8500_device = { | |||
103 | .resource = ab8500_resources, | 65 | .resource = ab8500_resources, |
104 | }; | 66 | }; |
105 | 67 | ||
106 | static struct pl022_ssp_controller ssp0_platform_data = { | ||
107 | .bus_id = 0, | ||
108 | /* pl022 not yet supports dma */ | ||
109 | .enable_dma = 0, | ||
110 | /* on this platform, gpio 31,142,144,214 & | ||
111 | * 224 are connected as chip selects | ||
112 | */ | ||
113 | .num_chipselect = 5, | ||
114 | }; | ||
115 | |||
116 | /* | 68 | /* |
117 | * TC35892 | 69 | * TC35892 |
118 | */ | 70 | */ |
@@ -133,14 +85,81 @@ static struct tc3589x_platform_data mop500_tc35892_data = { | |||
133 | .irq_base = MOP500_EGPIO_IRQ_BASE, | 85 | .irq_base = MOP500_EGPIO_IRQ_BASE, |
134 | }; | 86 | }; |
135 | 87 | ||
88 | static struct lp5521_led_config lp5521_pri_led[] = { | ||
89 | [0] = { | ||
90 | .chan_nr = 0, | ||
91 | .led_current = 0x2f, | ||
92 | .max_current = 0x5f, | ||
93 | }, | ||
94 | [1] = { | ||
95 | .chan_nr = 1, | ||
96 | .led_current = 0x2f, | ||
97 | .max_current = 0x5f, | ||
98 | }, | ||
99 | [2] = { | ||
100 | .chan_nr = 2, | ||
101 | .led_current = 0x2f, | ||
102 | .max_current = 0x5f, | ||
103 | }, | ||
104 | }; | ||
105 | |||
106 | static struct lp5521_platform_data __initdata lp5521_pri_data = { | ||
107 | .label = "lp5521_pri", | ||
108 | .led_config = &lp5521_pri_led[0], | ||
109 | .num_channels = 3, | ||
110 | .clock_mode = LP5521_CLOCK_EXT, | ||
111 | }; | ||
112 | |||
113 | static struct lp5521_led_config lp5521_sec_led[] = { | ||
114 | [0] = { | ||
115 | .chan_nr = 0, | ||
116 | .led_current = 0x2f, | ||
117 | .max_current = 0x5f, | ||
118 | }, | ||
119 | [1] = { | ||
120 | .chan_nr = 1, | ||
121 | .led_current = 0x2f, | ||
122 | .max_current = 0x5f, | ||
123 | }, | ||
124 | [2] = { | ||
125 | .chan_nr = 2, | ||
126 | .led_current = 0x2f, | ||
127 | .max_current = 0x5f, | ||
128 | }, | ||
129 | }; | ||
130 | |||
131 | static struct lp5521_platform_data __initdata lp5521_sec_data = { | ||
132 | .label = "lp5521_sec", | ||
133 | .led_config = &lp5521_sec_led[0], | ||
134 | .num_channels = 3, | ||
135 | .clock_mode = LP5521_CLOCK_EXT, | ||
136 | }; | ||
137 | |||
136 | static struct i2c_board_info mop500_i2c0_devices[] = { | 138 | static struct i2c_board_info mop500_i2c0_devices[] = { |
137 | { | 139 | { |
138 | I2C_BOARD_INFO("tc3589x", 0x42), | 140 | I2C_BOARD_INFO("tc3589x", 0x42), |
139 | .irq = NOMADIK_GPIO_TO_IRQ(217), | 141 | .irq = NOMADIK_GPIO_TO_IRQ(217), |
140 | .platform_data = &mop500_tc35892_data, | 142 | .platform_data = &mop500_tc35892_data, |
141 | }, | 143 | }, |
142 | }; | 144 | }; |
143 | 145 | ||
146 | static struct i2c_board_info __initdata mop500_i2c2_devices[] = { | ||
147 | { | ||
148 | /* lp5521 LED driver, 1st device */ | ||
149 | I2C_BOARD_INFO("lp5521", 0x33), | ||
150 | .platform_data = &lp5521_pri_data, | ||
151 | }, | ||
152 | { | ||
153 | /* lp5521 LED driver, 2st device */ | ||
154 | I2C_BOARD_INFO("lp5521", 0x34), | ||
155 | .platform_data = &lp5521_sec_data, | ||
156 | }, | ||
157 | { | ||
158 | /* Light sensor Rohm BH1780GLI */ | ||
159 | I2C_BOARD_INFO("bh1780", 0x29), | ||
160 | }, | ||
161 | }; | ||
162 | |||
144 | #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \ | 163 | #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \ |
145 | static struct nmk_i2c_controller u8500_i2c##id##_data = { \ | 164 | static struct nmk_i2c_controller u8500_i2c##id##_data = { \ |
146 | /* \ | 165 | /* \ |
@@ -178,8 +197,93 @@ static void __init mop500_i2c_init(void) | |||
178 | db8500_add_i2c3(&u8500_i2c3_data); | 197 | db8500_add_i2c3(&u8500_i2c3_data); |
179 | } | 198 | } |
180 | 199 | ||
200 | static struct gpio_keys_button mop500_gpio_keys[] = { | ||
201 | { | ||
202 | .desc = "SFH7741 Proximity Sensor", | ||
203 | .type = EV_SW, | ||
204 | .code = SW_FRONT_PROXIMITY, | ||
205 | .active_low = 0, | ||
206 | .can_disable = 1, | ||
207 | } | ||
208 | }; | ||
209 | |||
210 | static struct regulator *prox_regulator; | ||
211 | static int mop500_prox_activate(struct device *dev); | ||
212 | static void mop500_prox_deactivate(struct device *dev); | ||
213 | |||
214 | static struct gpio_keys_platform_data mop500_gpio_keys_data = { | ||
215 | .buttons = mop500_gpio_keys, | ||
216 | .nbuttons = ARRAY_SIZE(mop500_gpio_keys), | ||
217 | .enable = mop500_prox_activate, | ||
218 | .disable = mop500_prox_deactivate, | ||
219 | }; | ||
220 | |||
221 | static struct platform_device mop500_gpio_keys_device = { | ||
222 | .name = "gpio-keys", | ||
223 | .id = 0, | ||
224 | .dev = { | ||
225 | .platform_data = &mop500_gpio_keys_data, | ||
226 | }, | ||
227 | }; | ||
228 | |||
229 | static int mop500_prox_activate(struct device *dev) | ||
230 | { | ||
231 | prox_regulator = regulator_get(&mop500_gpio_keys_device.dev, | ||
232 | "vcc"); | ||
233 | if (IS_ERR(prox_regulator)) { | ||
234 | dev_err(&mop500_gpio_keys_device.dev, | ||
235 | "no regulator\n"); | ||
236 | return PTR_ERR(prox_regulator); | ||
237 | } | ||
238 | regulator_enable(prox_regulator); | ||
239 | return 0; | ||
240 | } | ||
241 | |||
242 | static void mop500_prox_deactivate(struct device *dev) | ||
243 | { | ||
244 | regulator_disable(prox_regulator); | ||
245 | regulator_put(prox_regulator); | ||
246 | } | ||
247 | |||
181 | /* add any platform devices here - TODO */ | 248 | /* add any platform devices here - TODO */ |
182 | static struct platform_device *platform_devs[] __initdata = { | 249 | static struct platform_device *platform_devs[] __initdata = { |
250 | &mop500_gpio_keys_device, | ||
251 | }; | ||
252 | |||
253 | #ifdef CONFIG_STE_DMA40 | ||
254 | static struct stedma40_chan_cfg ssp0_dma_cfg_rx = { | ||
255 | .mode = STEDMA40_MODE_LOGICAL, | ||
256 | .dir = STEDMA40_PERIPH_TO_MEM, | ||
257 | .src_dev_type = DB8500_DMA_DEV8_SSP0_RX, | ||
258 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, | ||
259 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | ||
260 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | ||
261 | }; | ||
262 | |||
263 | static struct stedma40_chan_cfg ssp0_dma_cfg_tx = { | ||
264 | .mode = STEDMA40_MODE_LOGICAL, | ||
265 | .dir = STEDMA40_MEM_TO_PERIPH, | ||
266 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, | ||
267 | .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX, | ||
268 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | ||
269 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | ||
270 | }; | ||
271 | #endif | ||
272 | |||
273 | static struct pl022_ssp_controller ssp0_platform_data = { | ||
274 | .bus_id = 0, | ||
275 | #ifdef CONFIG_STE_DMA40 | ||
276 | .enable_dma = 1, | ||
277 | .dma_filter = stedma40_filter, | ||
278 | .dma_rx_param = &ssp0_dma_cfg_rx, | ||
279 | .dma_tx_param = &ssp0_dma_cfg_tx, | ||
280 | #else | ||
281 | .enable_dma = 0, | ||
282 | #endif | ||
283 | /* on this platform, gpio 31,142,144,214 & | ||
284 | * 224 are connected as chip selects | ||
285 | */ | ||
286 | .num_chipselect = 5, | ||
183 | }; | 287 | }; |
184 | 288 | ||
185 | static void __init mop500_spi_init(void) | 289 | static void __init mop500_spi_init(void) |
@@ -187,18 +291,108 @@ static void __init mop500_spi_init(void) | |||
187 | db8500_add_ssp0(&ssp0_platform_data); | 291 | db8500_add_ssp0(&ssp0_platform_data); |
188 | } | 292 | } |
189 | 293 | ||
294 | #ifdef CONFIG_STE_DMA40 | ||
295 | static struct stedma40_chan_cfg uart0_dma_cfg_rx = { | ||
296 | .mode = STEDMA40_MODE_LOGICAL, | ||
297 | .dir = STEDMA40_PERIPH_TO_MEM, | ||
298 | .src_dev_type = DB8500_DMA_DEV13_UART0_RX, | ||
299 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, | ||
300 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | ||
301 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | ||
302 | }; | ||
303 | |||
304 | static struct stedma40_chan_cfg uart0_dma_cfg_tx = { | ||
305 | .mode = STEDMA40_MODE_LOGICAL, | ||
306 | .dir = STEDMA40_MEM_TO_PERIPH, | ||
307 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, | ||
308 | .dst_dev_type = DB8500_DMA_DEV13_UART0_TX, | ||
309 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | ||
310 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | ||
311 | }; | ||
312 | |||
313 | static struct stedma40_chan_cfg uart1_dma_cfg_rx = { | ||
314 | .mode = STEDMA40_MODE_LOGICAL, | ||
315 | .dir = STEDMA40_PERIPH_TO_MEM, | ||
316 | .src_dev_type = DB8500_DMA_DEV12_UART1_RX, | ||
317 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, | ||
318 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | ||
319 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | ||
320 | }; | ||
321 | |||
322 | static struct stedma40_chan_cfg uart1_dma_cfg_tx = { | ||
323 | .mode = STEDMA40_MODE_LOGICAL, | ||
324 | .dir = STEDMA40_MEM_TO_PERIPH, | ||
325 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, | ||
326 | .dst_dev_type = DB8500_DMA_DEV12_UART1_TX, | ||
327 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | ||
328 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | ||
329 | }; | ||
330 | |||
331 | static struct stedma40_chan_cfg uart2_dma_cfg_rx = { | ||
332 | .mode = STEDMA40_MODE_LOGICAL, | ||
333 | .dir = STEDMA40_PERIPH_TO_MEM, | ||
334 | .src_dev_type = DB8500_DMA_DEV11_UART2_RX, | ||
335 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, | ||
336 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | ||
337 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | ||
338 | }; | ||
339 | |||
340 | static struct stedma40_chan_cfg uart2_dma_cfg_tx = { | ||
341 | .mode = STEDMA40_MODE_LOGICAL, | ||
342 | .dir = STEDMA40_MEM_TO_PERIPH, | ||
343 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, | ||
344 | .dst_dev_type = DB8500_DMA_DEV11_UART2_TX, | ||
345 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | ||
346 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | ||
347 | }; | ||
348 | #endif | ||
349 | |||
350 | static struct amba_pl011_data uart0_plat = { | ||
351 | #ifdef CONFIG_STE_DMA40 | ||
352 | .dma_filter = stedma40_filter, | ||
353 | .dma_rx_param = &uart0_dma_cfg_rx, | ||
354 | .dma_tx_param = &uart0_dma_cfg_tx, | ||
355 | #endif | ||
356 | }; | ||
357 | |||
358 | static struct amba_pl011_data uart1_plat = { | ||
359 | #ifdef CONFIG_STE_DMA40 | ||
360 | .dma_filter = stedma40_filter, | ||
361 | .dma_rx_param = &uart1_dma_cfg_rx, | ||
362 | .dma_tx_param = &uart1_dma_cfg_tx, | ||
363 | #endif | ||
364 | }; | ||
365 | |||
366 | static struct amba_pl011_data uart2_plat = { | ||
367 | #ifdef CONFIG_STE_DMA40 | ||
368 | .dma_filter = stedma40_filter, | ||
369 | .dma_rx_param = &uart2_dma_cfg_rx, | ||
370 | .dma_tx_param = &uart2_dma_cfg_tx, | ||
371 | #endif | ||
372 | }; | ||
373 | |||
190 | static void __init mop500_uart_init(void) | 374 | static void __init mop500_uart_init(void) |
191 | { | 375 | { |
192 | db8500_add_uart0(); | 376 | db8500_add_uart0(&uart0_plat); |
193 | db8500_add_uart1(); | 377 | db8500_add_uart1(&uart1_plat); |
194 | db8500_add_uart2(); | 378 | db8500_add_uart2(&uart2_plat); |
195 | } | 379 | } |
196 | 380 | ||
197 | static void __init u8500_init_machine(void) | 381 | static void __init mop500_init_machine(void) |
198 | { | 382 | { |
383 | /* | ||
384 | * The HREFv60 board removed a GPIO expander and routed | ||
385 | * all these GPIO pins to the internal GPIO controller | ||
386 | * instead. | ||
387 | */ | ||
388 | if (machine_is_hrefv60()) | ||
389 | mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; | ||
390 | else | ||
391 | mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; | ||
392 | |||
199 | u8500_init_devices(); | 393 | u8500_init_devices(); |
200 | 394 | ||
201 | nmk_config_pins(mop500_pins, ARRAY_SIZE(mop500_pins)); | 395 | mop500_pins_init(); |
202 | 396 | ||
203 | platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); | 397 | platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); |
204 | 398 | ||
@@ -207,12 +401,12 @@ static void __init u8500_init_machine(void) | |||
207 | mop500_spi_init(); | 401 | mop500_spi_init(); |
208 | mop500_uart_init(); | 402 | mop500_uart_init(); |
209 | 403 | ||
210 | mop500_keypad_init(); | ||
211 | |||
212 | platform_device_register(&ab8500_device); | 404 | platform_device_register(&ab8500_device); |
213 | 405 | ||
214 | i2c_register_board_info(0, mop500_i2c0_devices, | 406 | i2c_register_board_info(0, mop500_i2c0_devices, |
215 | ARRAY_SIZE(mop500_i2c0_devices)); | 407 | ARRAY_SIZE(mop500_i2c0_devices)); |
408 | i2c_register_board_info(2, mop500_i2c2_devices, | ||
409 | ARRAY_SIZE(mop500_i2c2_devices)); | ||
216 | } | 410 | } |
217 | 411 | ||
218 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") | 412 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") |
@@ -222,5 +416,13 @@ MACHINE_START(U8500, "ST-Ericsson MOP500 platform") | |||
222 | .init_irq = ux500_init_irq, | 416 | .init_irq = ux500_init_irq, |
223 | /* we re-use nomadik timer here */ | 417 | /* we re-use nomadik timer here */ |
224 | .timer = &ux500_timer, | 418 | .timer = &ux500_timer, |
225 | .init_machine = u8500_init_machine, | 419 | .init_machine = mop500_init_machine, |
420 | MACHINE_END | ||
421 | |||
422 | MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+") | ||
423 | .boot_params = 0x100, | ||
424 | .map_io = u8500_map_io, | ||
425 | .init_irq = ux500_init_irq, | ||
426 | .timer = &ux500_timer, | ||
427 | .init_machine = mop500_init_machine, | ||
226 | MACHINE_END | 428 | MACHINE_END |