blob: e3bbb5506dd1d0e2e007e1af893a634c64f6fa4a [file] [log] [blame]
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +01001/*
2 * Copyright (C) 2008-2009 ST-Ericsson
3 *
4 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
9 *
10 */
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/interrupt.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
Rabin Vincentb8410a12010-08-09 19:18:17 +053016#include <linux/i2c.h>
Rabin Vincentea05a572010-06-03 07:58:42 +010017#include <linux/gpio.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010018#include <linux/amba/bus.h>
19#include <linux/amba/pl022.h>
Linus Walleij5d7b8462010-10-14 13:57:59 +020020#include <linux/amba/serial.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010021#include <linux/spi/spi.h>
Rabin Vincent39ae7022010-07-26 11:12:15 +010022#include <linux/mfd/ab8500.h>
Bengt Jonsson79568b92011-03-11 11:54:46 +010023#include <linux/regulator/ab8500.h>
Sundar Iyer20406eb2010-12-13 09:33:14 +053024#include <linux/mfd/tc3589x.h>
Linus Walleijfe67dfc2011-03-07 11:48:15 +010025#include <linux/mfd/tps6105x.h>
Bibek Basu3ef374a2011-02-15 12:56:16 +053026#include <linux/mfd/ab8500/gpio.h>
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +010027#include <linux/leds-lp5521.h>
Philippe Langlaisa71b8192011-01-14 10:53:59 +010028#include <linux/input.h>
Robert Marklund350abe02011-06-20 15:55:46 +020029#include <linux/smsc911x.h>
Philippe Langlaisa71b8192011-01-14 10:53:59 +010030#include <linux/gpio_keys.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010031
Robert Marklund350abe02011-06-20 15:55:46 +020032#include <linux/leds.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010033#include <asm/mach-types.h>
34#include <asm/mach/arch.h>
35
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +010036#include <plat/i2c.h>
Linus Walleij5d7b8462010-10-14 13:57:59 +020037#include <plat/ste_dma40.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010038
39#include <mach/hardware.h>
40#include <mach/setup.h>
Rabin Vincent9e4e7fe2010-05-03 08:03:52 +010041#include <mach/devices.h>
Linus Walleij29aeb3c2010-09-06 22:15:08 +010042#include <mach/irqs.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010043
Linus Walleij5d7b8462010-10-14 13:57:59 +020044#include "ste-dma40-db8500.h"
Rabin Vincentfbf1ead2010-09-29 19:46:32 +053045#include "devices-db8500.h"
Hanumath Prasad008f8a22010-08-19 12:06:32 +010046#include "board-mop500.h"
Bengt Jonssona1e516e2010-12-10 11:08:48 +010047#include "board-mop500-regulators.h"
Rabin Vincentea05a572010-06-03 07:58:42 +010048
Robert Marklund350abe02011-06-20 15:55:46 +020049static struct gpio_led snowball_led_array[] = {
50 {
51 .name = "user_led",
52 .default_trigger = "none",
53 .gpio = 142,
54 },
55};
56
57static struct gpio_led_platform_data snowball_led_data = {
58 .leds = snowball_led_array,
59 .num_leds = ARRAY_SIZE(snowball_led_array),
60};
61
62static struct platform_device snowball_led_dev = {
63 .name = "leds-gpio",
64 .dev = {
65 .platform_data = &snowball_led_data,
66 },
67};
68
Bibek Basu3ef374a2011-02-15 12:56:16 +053069static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
70 .gpio_base = MOP500_AB8500_GPIO(0),
71 .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
72 /* config_reg is the initial configuration of ab8500 pins.
73 * The pins can be configured as GPIO or alt functions based
74 * on value present in GpioSel1 to GpioSel6 and AlternatFunction
75 * register. This is the array of 7 configuration settings.
76 * One has to compile time decide these settings. Below is the
Lucas De Marchi25985ed2011-03-30 22:57:33 -030077 * explanation of these setting
Bibek Basu3ef374a2011-02-15 12:56:16 +053078 * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
79 * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
80 * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
81 * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO
82 * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO
83 * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO
84 * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured
85 * as GPIO then this register selectes the alternate fucntions
86 */
87 .config_reg = {0x00, 0x1E, 0x80, 0x01,
88 0x7A, 0x00, 0x00},
89};
90
Robert Marklund350abe02011-06-20 15:55:46 +020091static struct gpio_keys_button snowball_key_array[] = {
92 {
93 .gpio = 32,
94 .type = EV_KEY,
95 .code = KEY_1,
96 .desc = "userpb",
97 .active_low = 1,
98 .debounce_interval = 50,
99 .wakeup = 1,
100 },
101 {
102 .gpio = 151,
103 .type = EV_KEY,
104 .code = KEY_2,
105 .desc = "extkb1",
106 .active_low = 1,
107 .debounce_interval = 50,
108 .wakeup = 1,
109 },
110 {
111 .gpio = 152,
112 .type = EV_KEY,
113 .code = KEY_3,
114 .desc = "extkb2",
115 .active_low = 1,
116 .debounce_interval = 50,
117 .wakeup = 1,
118 },
119 {
120 .gpio = 161,
121 .type = EV_KEY,
122 .code = KEY_4,
123 .desc = "extkb3",
124 .active_low = 1,
125 .debounce_interval = 50,
126 .wakeup = 1,
127 },
128 {
129 .gpio = 162,
130 .type = EV_KEY,
131 .code = KEY_5,
132 .desc = "extkb4",
133 .active_low = 1,
134 .debounce_interval = 50,
135 .wakeup = 1,
136 },
137};
138
139static struct gpio_keys_platform_data snowball_key_data = {
140 .buttons = snowball_key_array,
141 .nbuttons = ARRAY_SIZE(snowball_key_array),
142};
143
144static struct platform_device snowball_key_dev = {
145 .name = "gpio-keys",
146 .id = -1,
147 .dev = {
148 .platform_data = &snowball_key_data,
149 }
150};
151
152static struct smsc911x_platform_config snowball_sbnet_cfg = {
153 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
154 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
155 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
156 .shift = 1,
157};
158
159static struct resource sbnet_res[] = {
160 {
161 .name = "smsc911x-memory",
162 .start = (0x5000 << 16),
163 .end = (0x5000 << 16) + 0xffff,
164 .flags = IORESOURCE_MEM,
165 },
166 {
167 .start = NOMADIK_GPIO_TO_IRQ(140),
168 .end = NOMADIK_GPIO_TO_IRQ(140),
169 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
170 },
171};
172
173static struct platform_device snowball_sbnet_dev = {
174 .name = "smsc911x",
175 .num_resources = ARRAY_SIZE(sbnet_res),
176 .resource = sbnet_res,
177 .dev = {
178 .platform_data = &snowball_sbnet_cfg,
179 },
180};
181
Rabin Vincent39ae7022010-07-26 11:12:15 +0100182static struct ab8500_platform_data ab8500_platdata = {
183 .irq_base = MOP500_AB8500_IRQ_BASE,
Bengt Jonssondfa3a822011-03-09 13:34:17 +0100184 .regulator_reg_init = ab8500_regulator_reg_init,
185 .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
Bengt Jonssona1e516e2010-12-10 11:08:48 +0100186 .regulator = ab8500_regulators,
187 .num_regulator = ARRAY_SIZE(ab8500_regulators),
Bibek Basu3ef374a2011-02-15 12:56:16 +0530188 .gpio = &ab8500_gpio_pdata,
Rabin Vincent39ae7022010-07-26 11:12:15 +0100189};
190
Linus Walleij29aeb3c2010-09-06 22:15:08 +0100191static struct resource ab8500_resources[] = {
192 [0] = {
Rabin Vincent22039b72010-12-08 11:07:56 +0530193 .start = IRQ_DB8500_AB8500,
194 .end = IRQ_DB8500_AB8500,
195 .flags = IORESOURCE_IRQ
Linus Walleij29aeb3c2010-09-06 22:15:08 +0100196 }
197};
198
199struct platform_device ab8500_device = {
200 .name = "ab8500-i2c",
201 .id = 0,
202 .dev = {
203 .platform_data = &ab8500_platdata,
204 },
205 .num_resources = 1,
206 .resource = ab8500_resources,
207};
208
Rabin Vincentb8410a12010-08-09 19:18:17 +0530209/*
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100210 * TPS61052
211 */
212
213static struct tps6105x_platform_data mop500_tps61052_data = {
214 .mode = TPS6105X_MODE_VOLTAGE,
215 .regulator_data = &tps61052_regulator,
216};
217
218/*
Rabin Vincentb8410a12010-08-09 19:18:17 +0530219 * TC35892
220 */
221
Sundar Iyer20406eb2010-12-13 09:33:14 +0530222static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
Rabin Vincentb8410a12010-08-09 19:18:17 +0530223{
224 mop500_sdi_tc35892_init();
225}
226
Sundar Iyer20406eb2010-12-13 09:33:14 +0530227static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530228 .gpio_base = MOP500_EGPIO(0),
229 .setup = mop500_tc35892_init,
230};
231
Sundar Iyer20406eb2010-12-13 09:33:14 +0530232static struct tc3589x_platform_data mop500_tc35892_data = {
Sundar Iyer611b7592010-12-13 09:33:15 +0530233 .block = TC3589x_BLOCK_GPIO,
Rabin Vincentb8410a12010-08-09 19:18:17 +0530234 .gpio = &mop500_tc35892_gpio_data,
235 .irq_base = MOP500_EGPIO_IRQ_BASE,
236};
237
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100238static struct lp5521_led_config lp5521_pri_led[] = {
239 [0] = {
240 .chan_nr = 0,
241 .led_current = 0x2f,
242 .max_current = 0x5f,
243 },
244 [1] = {
245 .chan_nr = 1,
246 .led_current = 0x2f,
247 .max_current = 0x5f,
248 },
249 [2] = {
250 .chan_nr = 2,
251 .led_current = 0x2f,
252 .max_current = 0x5f,
253 },
254};
255
256static struct lp5521_platform_data __initdata lp5521_pri_data = {
257 .label = "lp5521_pri",
258 .led_config = &lp5521_pri_led[0],
259 .num_channels = 3,
260 .clock_mode = LP5521_CLOCK_EXT,
261};
262
263static struct lp5521_led_config lp5521_sec_led[] = {
264 [0] = {
265 .chan_nr = 0,
266 .led_current = 0x2f,
267 .max_current = 0x5f,
268 },
269 [1] = {
270 .chan_nr = 1,
271 .led_current = 0x2f,
272 .max_current = 0x5f,
273 },
274 [2] = {
275 .chan_nr = 2,
276 .led_current = 0x2f,
277 .max_current = 0x5f,
278 },
279};
280
281static struct lp5521_platform_data __initdata lp5521_sec_data = {
282 .label = "lp5521_sec",
283 .led_config = &lp5521_sec_led[0],
284 .num_channels = 3,
285 .clock_mode = LP5521_CLOCK_EXT,
286};
287
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100288static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530289 {
Sundar Iyer20406eb2010-12-13 09:33:14 +0530290 I2C_BOARD_INFO("tc3589x", 0x42),
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100291 .irq = NOMADIK_GPIO_TO_IRQ(217),
Rabin Vincentb8410a12010-08-09 19:18:17 +0530292 .platform_data = &mop500_tc35892_data,
293 },
Linus Walleijcf568c52011-03-30 14:31:42 +0200294 /* I2C0 devices only available prior to HREFv60 */
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100295 {
296 I2C_BOARD_INFO("tps61052", 0x33),
297 .platform_data = &mop500_tps61052_data,
298 },
299};
300
Linus Walleijcf568c52011-03-30 14:31:42 +0200301#define NUM_PRE_V60_I2C0_DEVICES 1
302
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100303static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
304 {
305 /* lp5521 LED driver, 1st device */
306 I2C_BOARD_INFO("lp5521", 0x33),
307 .platform_data = &lp5521_pri_data,
308 },
309 {
310 /* lp5521 LED driver, 2st device */
311 I2C_BOARD_INFO("lp5521", 0x34),
312 .platform_data = &lp5521_sec_data,
313 },
Lee Jonesbb3b2182011-01-13 14:41:22 +0000314 {
315 /* Light sensor Rohm BH1780GLI */
316 I2C_BOARD_INFO("bh1780", 0x29),
317 },
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100318};
319
Linus Walleij2b030bd2011-05-13 12:31:13 +0200320#define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, t_out, _sm) \
Rabin Vincentf9faf232010-05-03 08:24:37 +0100321static struct nmk_i2c_controller u8500_i2c##id##_data = { \
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100322 /* \
323 * slave data setup time, which is \
324 * 250 ns,100ns,10ns which is 14,6,2 \
325 * respectively for a 48 Mhz \
326 * i2c clock \
327 */ \
328 .slsu = _slsu, \
329 /* Tx FIFO threshold */ \
330 .tft = _tft, \
331 /* Rx FIFO threshold */ \
332 .rft = _rft, \
333 /* std. mode operation */ \
334 .clk_freq = clk, \
Linus Walleij2b030bd2011-05-13 12:31:13 +0200335 /* Slave response timeout(ms) */\
336 .timeout = t_out, \
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100337 .sm = _sm, \
338}
339
340/*
341 * The board uses 4 i2c controllers, initialize all of
342 * them with slave data setup time of 250 ns,
Linus Walleij2b030bd2011-05-13 12:31:13 +0200343 * Tx & Rx FIFO threshold values as 8 and standard
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100344 * mode of operation
345 */
Linus Walleij2b030bd2011-05-13 12:31:13 +0200346U8500_I2C_CONTROLLER(0, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
347U8500_I2C_CONTROLLER(1, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
348U8500_I2C_CONTROLLER(2, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
349U8500_I2C_CONTROLLER(3, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100350
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530351static void __init mop500_i2c_init(void)
352{
353 db8500_add_i2c0(&u8500_i2c0_data);
354 db8500_add_i2c1(&u8500_i2c1_data);
355 db8500_add_i2c2(&u8500_i2c2_data);
356 db8500_add_i2c3(&u8500_i2c3_data);
357}
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100358
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100359static struct gpio_keys_button mop500_gpio_keys[] = {
360 {
361 .desc = "SFH7741 Proximity Sensor",
362 .type = EV_SW,
363 .code = SW_FRONT_PROXIMITY,
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100364 .active_low = 0,
365 .can_disable = 1,
366 }
367};
368
369static struct regulator *prox_regulator;
370static int mop500_prox_activate(struct device *dev);
371static void mop500_prox_deactivate(struct device *dev);
372
373static struct gpio_keys_platform_data mop500_gpio_keys_data = {
374 .buttons = mop500_gpio_keys,
375 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
376 .enable = mop500_prox_activate,
377 .disable = mop500_prox_deactivate,
378};
379
380static struct platform_device mop500_gpio_keys_device = {
381 .name = "gpio-keys",
382 .id = 0,
383 .dev = {
384 .platform_data = &mop500_gpio_keys_data,
385 },
386};
387
388static int mop500_prox_activate(struct device *dev)
389{
390 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
391 "vcc");
392 if (IS_ERR(prox_regulator)) {
393 dev_err(&mop500_gpio_keys_device.dev,
394 "no regulator\n");
395 return PTR_ERR(prox_regulator);
396 }
397 regulator_enable(prox_regulator);
398 return 0;
399}
400
401static void mop500_prox_deactivate(struct device *dev)
402{
403 regulator_disable(prox_regulator);
404 regulator_put(prox_regulator);
405}
406
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100407/* add any platform devices here - TODO */
Robert Marklund350abe02011-06-20 15:55:46 +0200408static struct platform_device *mop500_platform_devs[] __initdata = {
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100409 &mop500_gpio_keys_device,
Robert Marklund350abe02011-06-20 15:55:46 +0200410 &ab8500_device,
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100411};
412
Linus Walleij5d7b8462010-10-14 13:57:59 +0200413#ifdef CONFIG_STE_DMA40
414static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
415 .mode = STEDMA40_MODE_LOGICAL,
416 .dir = STEDMA40_PERIPH_TO_MEM,
417 .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
418 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
419 .src_info.data_width = STEDMA40_BYTE_WIDTH,
420 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
421};
422
423static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
424 .mode = STEDMA40_MODE_LOGICAL,
425 .dir = STEDMA40_MEM_TO_PERIPH,
426 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
427 .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
428 .src_info.data_width = STEDMA40_BYTE_WIDTH,
429 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
430};
431#endif
432
433static struct pl022_ssp_controller ssp0_platform_data = {
434 .bus_id = 0,
435#ifdef CONFIG_STE_DMA40
436 .enable_dma = 1,
437 .dma_filter = stedma40_filter,
438 .dma_rx_param = &ssp0_dma_cfg_rx,
439 .dma_tx_param = &ssp0_dma_cfg_tx,
440#else
441 .enable_dma = 0,
442#endif
443 /* on this platform, gpio 31,142,144,214 &
444 * 224 are connected as chip selects
445 */
446 .num_chipselect = 5,
447};
448
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530449static void __init mop500_spi_init(void)
450{
451 db8500_add_ssp0(&ssp0_platform_data);
452}
453
Linus Walleij5d7b8462010-10-14 13:57:59 +0200454#ifdef CONFIG_STE_DMA40
455static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
456 .mode = STEDMA40_MODE_LOGICAL,
457 .dir = STEDMA40_PERIPH_TO_MEM,
458 .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
459 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
460 .src_info.data_width = STEDMA40_BYTE_WIDTH,
461 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
462};
463
464static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
465 .mode = STEDMA40_MODE_LOGICAL,
466 .dir = STEDMA40_MEM_TO_PERIPH,
467 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
468 .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
469 .src_info.data_width = STEDMA40_BYTE_WIDTH,
470 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
471};
472
473static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
474 .mode = STEDMA40_MODE_LOGICAL,
475 .dir = STEDMA40_PERIPH_TO_MEM,
476 .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
477 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
478 .src_info.data_width = STEDMA40_BYTE_WIDTH,
479 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
480};
481
482static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
483 .mode = STEDMA40_MODE_LOGICAL,
484 .dir = STEDMA40_MEM_TO_PERIPH,
485 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
486 .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
487 .src_info.data_width = STEDMA40_BYTE_WIDTH,
488 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
489};
490
491static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
492 .mode = STEDMA40_MODE_LOGICAL,
493 .dir = STEDMA40_PERIPH_TO_MEM,
494 .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
495 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
496 .src_info.data_width = STEDMA40_BYTE_WIDTH,
497 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
498};
499
500static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
501 .mode = STEDMA40_MODE_LOGICAL,
502 .dir = STEDMA40_MEM_TO_PERIPH,
503 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
504 .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
505 .src_info.data_width = STEDMA40_BYTE_WIDTH,
506 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
507};
508#endif
509
510static struct amba_pl011_data uart0_plat = {
511#ifdef CONFIG_STE_DMA40
512 .dma_filter = stedma40_filter,
513 .dma_rx_param = &uart0_dma_cfg_rx,
514 .dma_tx_param = &uart0_dma_cfg_tx,
515#endif
516};
517
518static struct amba_pl011_data uart1_plat = {
519#ifdef CONFIG_STE_DMA40
520 .dma_filter = stedma40_filter,
521 .dma_rx_param = &uart1_dma_cfg_rx,
522 .dma_tx_param = &uart1_dma_cfg_tx,
523#endif
524};
525
526static struct amba_pl011_data uart2_plat = {
527#ifdef CONFIG_STE_DMA40
528 .dma_filter = stedma40_filter,
529 .dma_rx_param = &uart2_dma_cfg_rx,
530 .dma_tx_param = &uart2_dma_cfg_tx,
531#endif
532};
533
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530534static void __init mop500_uart_init(void)
535{
Linus Walleij5d7b8462010-10-14 13:57:59 +0200536 db8500_add_uart0(&uart0_plat);
537 db8500_add_uart1(&uart1_plat);
538 db8500_add_uart2(&uart2_plat);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530539}
540
Robert Marklund350abe02011-06-20 15:55:46 +0200541static struct platform_device *snowball_platform_devs[] __initdata = {
542 &snowball_led_dev,
543 &snowball_key_dev,
544 &snowball_sbnet_dev,
545 &ab8500_device,
546};
547
Linus Walleij4b4f7572011-02-15 15:01:35 +0100548static void __init mop500_init_machine(void)
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100549{
Linus Walleijcf568c52011-03-30 14:31:42 +0200550 int i2c0_devs;
551
Linus Walleij4b4f7572011-02-15 15:01:35 +0100552 /*
553 * The HREFv60 board removed a GPIO expander and routed
554 * all these GPIO pins to the internal GPIO controller
555 * instead.
556 */
Robert Marklund350abe02011-06-20 15:55:46 +0200557 if (!machine_is_snowball()) {
558 if (machine_is_hrefv60())
559 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
560 else
561 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
562 }
Linus Walleij4b4f7572011-02-15 15:01:35 +0100563
Rabin Vincentea05a572010-06-03 07:58:42 +0100564 u8500_init_devices();
565
Rabin Vincentfe052032011-02-11 17:07:21 -0700566 mop500_pins_init();
Rabin Vincentea05a572010-06-03 07:58:42 +0100567
Robert Marklund350abe02011-06-20 15:55:46 +0200568 if (machine_is_snowball())
569 platform_add_devices(snowball_platform_devs,
570 ARRAY_SIZE(snowball_platform_devs));
571 else
572 platform_add_devices(mop500_platform_devs,
573 ARRAY_SIZE(mop500_platform_devs));
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100574
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530575 mop500_i2c_init();
Robert Marklund350abe02011-06-20 15:55:46 +0200576 if (!machine_is_snowball())
577 mop500_sdi_init();
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530578 mop500_spi_init();
579 mop500_uart_init();
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100580
Linus Walleijcf568c52011-03-30 14:31:42 +0200581 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
582 if (machine_is_hrefv60())
583 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
584
585 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100586 i2c_register_board_info(2, mop500_i2c2_devices,
587 ARRAY_SIZE(mop500_i2c2_devices));
Linus Walleijdb245202011-04-04 10:44:51 +0200588
589 /* This board has full regulator constraints */
590 regulator_has_full_constraints();
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100591}
592
593MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
594 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100595 .boot_params = 0x100,
596 .map_io = u8500_map_io,
Rabin Vincent178980f2010-05-03 07:39:02 +0100597 .init_irq = ux500_init_irq,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100598 /* we re-use nomadik timer here */
Rabin Vincent41ac3292010-05-03 08:28:05 +0100599 .timer = &ux500_timer,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100600 .init_machine = mop500_init_machine,
601MACHINE_END
602
603MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
604 .boot_params = 0x100,
605 .map_io = u8500_map_io,
606 .init_irq = ux500_init_irq,
607 .timer = &ux500_timer,
608 .init_machine = mop500_init_machine,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100609MACHINE_END
Robert Marklund350abe02011-06-20 15:55:46 +0200610
611MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
612 .boot_params = 0x100,
613 .map_io = u8500_map_io,
614 .init_irq = ux500_init_irq,
615 /* we re-use nomadik timer here */
616 .timer = &ux500_timer,
617 .init_machine = mop500_init_machine,
618MACHINE_END