blob: bdd7b80dd7adf1ee14688110badff51f1e544225 [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>
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +020031#include <linux/delay.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010032
Robert Marklund350abe02011-06-20 15:55:46 +020033#include <linux/leds.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010034#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +010037#include <plat/i2c.h>
Linus Walleij5d7b8462010-10-14 13:57:59 +020038#include <plat/ste_dma40.h>
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +020039#include <plat/pincfg.h>
Linus Walleij0f332862011-08-22 08:33:30 +010040#include <plat/gpio-nomadik.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010041
42#include <mach/hardware.h>
43#include <mach/setup.h>
Rabin Vincent9e4e7fe2010-05-03 08:03:52 +010044#include <mach/devices.h>
Linus Walleij29aeb3c2010-09-06 22:15:08 +010045#include <mach/irqs.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010046
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +020047#include "pins-db8500.h"
Linus Walleij5d7b8462010-10-14 13:57:59 +020048#include "ste-dma40-db8500.h"
Rabin Vincentfbf1ead2010-09-29 19:46:32 +053049#include "devices-db8500.h"
Hanumath Prasad008f8a22010-08-19 12:06:32 +010050#include "board-mop500.h"
Bengt Jonssona1e516e2010-12-10 11:08:48 +010051#include "board-mop500-regulators.h"
Rabin Vincentea05a572010-06-03 07:58:42 +010052
Robert Marklund350abe02011-06-20 15:55:46 +020053static struct gpio_led snowball_led_array[] = {
54 {
55 .name = "user_led",
56 .default_trigger = "none",
57 .gpio = 142,
58 },
59};
60
61static struct gpio_led_platform_data snowball_led_data = {
62 .leds = snowball_led_array,
63 .num_leds = ARRAY_SIZE(snowball_led_array),
64};
65
66static struct platform_device snowball_led_dev = {
67 .name = "leds-gpio",
68 .dev = {
69 .platform_data = &snowball_led_data,
70 },
71};
72
Bibek Basu3ef374a2011-02-15 12:56:16 +053073static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
74 .gpio_base = MOP500_AB8500_GPIO(0),
75 .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
76 /* config_reg is the initial configuration of ab8500 pins.
77 * The pins can be configured as GPIO or alt functions based
78 * on value present in GpioSel1 to GpioSel6 and AlternatFunction
79 * register. This is the array of 7 configuration settings.
80 * One has to compile time decide these settings. Below is the
Lucas De Marchi25985ed2011-03-30 22:57:33 -030081 * explanation of these setting
Bibek Basu3ef374a2011-02-15 12:56:16 +053082 * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
83 * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
84 * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
85 * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO
86 * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO
87 * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO
88 * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured
89 * as GPIO then this register selectes the alternate fucntions
90 */
91 .config_reg = {0x00, 0x1E, 0x80, 0x01,
92 0x7A, 0x00, 0x00},
93};
94
Robert Marklund350abe02011-06-20 15:55:46 +020095static struct gpio_keys_button snowball_key_array[] = {
96 {
97 .gpio = 32,
98 .type = EV_KEY,
99 .code = KEY_1,
100 .desc = "userpb",
101 .active_low = 1,
102 .debounce_interval = 50,
103 .wakeup = 1,
104 },
105 {
106 .gpio = 151,
107 .type = EV_KEY,
108 .code = KEY_2,
109 .desc = "extkb1",
110 .active_low = 1,
111 .debounce_interval = 50,
112 .wakeup = 1,
113 },
114 {
115 .gpio = 152,
116 .type = EV_KEY,
117 .code = KEY_3,
118 .desc = "extkb2",
119 .active_low = 1,
120 .debounce_interval = 50,
121 .wakeup = 1,
122 },
123 {
124 .gpio = 161,
125 .type = EV_KEY,
126 .code = KEY_4,
127 .desc = "extkb3",
128 .active_low = 1,
129 .debounce_interval = 50,
130 .wakeup = 1,
131 },
132 {
133 .gpio = 162,
134 .type = EV_KEY,
135 .code = KEY_5,
136 .desc = "extkb4",
137 .active_low = 1,
138 .debounce_interval = 50,
139 .wakeup = 1,
140 },
141};
142
143static struct gpio_keys_platform_data snowball_key_data = {
144 .buttons = snowball_key_array,
145 .nbuttons = ARRAY_SIZE(snowball_key_array),
146};
147
148static struct platform_device snowball_key_dev = {
149 .name = "gpio-keys",
150 .id = -1,
151 .dev = {
152 .platform_data = &snowball_key_data,
153 }
154};
155
156static struct smsc911x_platform_config snowball_sbnet_cfg = {
157 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
158 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
159 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
160 .shift = 1,
161};
162
163static struct resource sbnet_res[] = {
164 {
165 .name = "smsc911x-memory",
166 .start = (0x5000 << 16),
167 .end = (0x5000 << 16) + 0xffff,
168 .flags = IORESOURCE_MEM,
169 },
170 {
171 .start = NOMADIK_GPIO_TO_IRQ(140),
172 .end = NOMADIK_GPIO_TO_IRQ(140),
173 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
174 },
175};
176
177static struct platform_device snowball_sbnet_dev = {
178 .name = "smsc911x",
179 .num_resources = ARRAY_SIZE(sbnet_res),
180 .resource = sbnet_res,
181 .dev = {
182 .platform_data = &snowball_sbnet_cfg,
183 },
184};
185
Rabin Vincent39ae7022010-07-26 11:12:15 +0100186static struct ab8500_platform_data ab8500_platdata = {
187 .irq_base = MOP500_AB8500_IRQ_BASE,
Bengt Jonssondfa3a822011-03-09 13:34:17 +0100188 .regulator_reg_init = ab8500_regulator_reg_init,
189 .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
Bengt Jonssona1e516e2010-12-10 11:08:48 +0100190 .regulator = ab8500_regulators,
191 .num_regulator = ARRAY_SIZE(ab8500_regulators),
Bibek Basu3ef374a2011-02-15 12:56:16 +0530192 .gpio = &ab8500_gpio_pdata,
Rabin Vincent39ae7022010-07-26 11:12:15 +0100193};
194
Linus Walleij29aeb3c2010-09-06 22:15:08 +0100195static struct resource ab8500_resources[] = {
196 [0] = {
Rabin Vincent22039b72010-12-08 11:07:56 +0530197 .start = IRQ_DB8500_AB8500,
198 .end = IRQ_DB8500_AB8500,
199 .flags = IORESOURCE_IRQ
Linus Walleij29aeb3c2010-09-06 22:15:08 +0100200 }
201};
202
203struct platform_device ab8500_device = {
204 .name = "ab8500-i2c",
205 .id = 0,
206 .dev = {
207 .platform_data = &ab8500_platdata,
208 },
209 .num_resources = 1,
210 .resource = ab8500_resources,
211};
212
Rabin Vincentb8410a12010-08-09 19:18:17 +0530213/*
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100214 * TPS61052
215 */
216
217static struct tps6105x_platform_data mop500_tps61052_data = {
218 .mode = TPS6105X_MODE_VOLTAGE,
219 .regulator_data = &tps61052_regulator,
220};
221
222/*
Rabin Vincentb8410a12010-08-09 19:18:17 +0530223 * TC35892
224 */
225
Sundar Iyer20406eb2010-12-13 09:33:14 +0530226static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
Rabin Vincentb8410a12010-08-09 19:18:17 +0530227{
228 mop500_sdi_tc35892_init();
229}
230
Sundar Iyer20406eb2010-12-13 09:33:14 +0530231static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530232 .gpio_base = MOP500_EGPIO(0),
233 .setup = mop500_tc35892_init,
234};
235
Sundar Iyer20406eb2010-12-13 09:33:14 +0530236static struct tc3589x_platform_data mop500_tc35892_data = {
Sundar Iyer611b7592010-12-13 09:33:15 +0530237 .block = TC3589x_BLOCK_GPIO,
Rabin Vincentb8410a12010-08-09 19:18:17 +0530238 .gpio = &mop500_tc35892_gpio_data,
239 .irq_base = MOP500_EGPIO_IRQ_BASE,
240};
241
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100242static struct lp5521_led_config lp5521_pri_led[] = {
243 [0] = {
244 .chan_nr = 0,
245 .led_current = 0x2f,
246 .max_current = 0x5f,
247 },
248 [1] = {
249 .chan_nr = 1,
250 .led_current = 0x2f,
251 .max_current = 0x5f,
252 },
253 [2] = {
254 .chan_nr = 2,
255 .led_current = 0x2f,
256 .max_current = 0x5f,
257 },
258};
259
260static struct lp5521_platform_data __initdata lp5521_pri_data = {
261 .label = "lp5521_pri",
262 .led_config = &lp5521_pri_led[0],
263 .num_channels = 3,
264 .clock_mode = LP5521_CLOCK_EXT,
265};
266
267static struct lp5521_led_config lp5521_sec_led[] = {
268 [0] = {
269 .chan_nr = 0,
270 .led_current = 0x2f,
271 .max_current = 0x5f,
272 },
273 [1] = {
274 .chan_nr = 1,
275 .led_current = 0x2f,
276 .max_current = 0x5f,
277 },
278 [2] = {
279 .chan_nr = 2,
280 .led_current = 0x2f,
281 .max_current = 0x5f,
282 },
283};
284
285static struct lp5521_platform_data __initdata lp5521_sec_data = {
286 .label = "lp5521_sec",
287 .led_config = &lp5521_sec_led[0],
288 .num_channels = 3,
289 .clock_mode = LP5521_CLOCK_EXT,
290};
291
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100292static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530293 {
Sundar Iyer20406eb2010-12-13 09:33:14 +0530294 I2C_BOARD_INFO("tc3589x", 0x42),
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100295 .irq = NOMADIK_GPIO_TO_IRQ(217),
Rabin Vincentb8410a12010-08-09 19:18:17 +0530296 .platform_data = &mop500_tc35892_data,
297 },
Linus Walleijcf568c52011-03-30 14:31:42 +0200298 /* I2C0 devices only available prior to HREFv60 */
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100299 {
300 I2C_BOARD_INFO("tps61052", 0x33),
301 .platform_data = &mop500_tps61052_data,
302 },
303};
304
Linus Walleijcf568c52011-03-30 14:31:42 +0200305#define NUM_PRE_V60_I2C0_DEVICES 1
306
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100307static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
308 {
309 /* lp5521 LED driver, 1st device */
310 I2C_BOARD_INFO("lp5521", 0x33),
311 .platform_data = &lp5521_pri_data,
312 },
313 {
314 /* lp5521 LED driver, 2st device */
315 I2C_BOARD_INFO("lp5521", 0x34),
316 .platform_data = &lp5521_sec_data,
317 },
Lee Jonesbb3b2182011-01-13 14:41:22 +0000318 {
319 /* Light sensor Rohm BH1780GLI */
320 I2C_BOARD_INFO("bh1780", 0x29),
321 },
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100322};
323
Linus Walleij2b030bd2011-05-13 12:31:13 +0200324#define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, t_out, _sm) \
Rabin Vincentf9faf232010-05-03 08:24:37 +0100325static struct nmk_i2c_controller u8500_i2c##id##_data = { \
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100326 /* \
327 * slave data setup time, which is \
328 * 250 ns,100ns,10ns which is 14,6,2 \
329 * respectively for a 48 Mhz \
330 * i2c clock \
331 */ \
332 .slsu = _slsu, \
333 /* Tx FIFO threshold */ \
334 .tft = _tft, \
335 /* Rx FIFO threshold */ \
336 .rft = _rft, \
337 /* std. mode operation */ \
338 .clk_freq = clk, \
Linus Walleij2b030bd2011-05-13 12:31:13 +0200339 /* Slave response timeout(ms) */\
340 .timeout = t_out, \
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100341 .sm = _sm, \
342}
343
344/*
345 * The board uses 4 i2c controllers, initialize all of
346 * them with slave data setup time of 250 ns,
Linus Walleij2b030bd2011-05-13 12:31:13 +0200347 * Tx & Rx FIFO threshold values as 8 and standard
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100348 * mode of operation
349 */
Linus Walleij2b030bd2011-05-13 12:31:13 +0200350U8500_I2C_CONTROLLER(0, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
351U8500_I2C_CONTROLLER(1, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
352U8500_I2C_CONTROLLER(2, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
353U8500_I2C_CONTROLLER(3, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100354
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530355static void __init mop500_i2c_init(void)
356{
357 db8500_add_i2c0(&u8500_i2c0_data);
358 db8500_add_i2c1(&u8500_i2c1_data);
359 db8500_add_i2c2(&u8500_i2c2_data);
360 db8500_add_i2c3(&u8500_i2c3_data);
361}
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100362
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100363static struct gpio_keys_button mop500_gpio_keys[] = {
364 {
365 .desc = "SFH7741 Proximity Sensor",
366 .type = EV_SW,
367 .code = SW_FRONT_PROXIMITY,
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100368 .active_low = 0,
369 .can_disable = 1,
370 }
371};
372
373static struct regulator *prox_regulator;
374static int mop500_prox_activate(struct device *dev);
375static void mop500_prox_deactivate(struct device *dev);
376
377static struct gpio_keys_platform_data mop500_gpio_keys_data = {
378 .buttons = mop500_gpio_keys,
379 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
380 .enable = mop500_prox_activate,
381 .disable = mop500_prox_deactivate,
382};
383
384static struct platform_device mop500_gpio_keys_device = {
385 .name = "gpio-keys",
386 .id = 0,
387 .dev = {
388 .platform_data = &mop500_gpio_keys_data,
389 },
390};
391
392static int mop500_prox_activate(struct device *dev)
393{
394 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
395 "vcc");
396 if (IS_ERR(prox_regulator)) {
397 dev_err(&mop500_gpio_keys_device.dev,
398 "no regulator\n");
399 return PTR_ERR(prox_regulator);
400 }
401 regulator_enable(prox_regulator);
402 return 0;
403}
404
405static void mop500_prox_deactivate(struct device *dev)
406{
407 regulator_disable(prox_regulator);
408 regulator_put(prox_regulator);
409}
410
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100411/* add any platform devices here - TODO */
Robert Marklund350abe02011-06-20 15:55:46 +0200412static struct platform_device *mop500_platform_devs[] __initdata = {
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100413 &mop500_gpio_keys_device,
Robert Marklund350abe02011-06-20 15:55:46 +0200414 &ab8500_device,
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100415};
416
Linus Walleij5d7b8462010-10-14 13:57:59 +0200417#ifdef CONFIG_STE_DMA40
418static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
419 .mode = STEDMA40_MODE_LOGICAL,
420 .dir = STEDMA40_PERIPH_TO_MEM,
421 .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
422 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
423 .src_info.data_width = STEDMA40_BYTE_WIDTH,
424 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
425};
426
427static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
428 .mode = STEDMA40_MODE_LOGICAL,
429 .dir = STEDMA40_MEM_TO_PERIPH,
430 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
431 .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
432 .src_info.data_width = STEDMA40_BYTE_WIDTH,
433 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
434};
435#endif
436
437static struct pl022_ssp_controller ssp0_platform_data = {
438 .bus_id = 0,
439#ifdef CONFIG_STE_DMA40
440 .enable_dma = 1,
441 .dma_filter = stedma40_filter,
442 .dma_rx_param = &ssp0_dma_cfg_rx,
443 .dma_tx_param = &ssp0_dma_cfg_tx,
444#else
445 .enable_dma = 0,
446#endif
447 /* on this platform, gpio 31,142,144,214 &
448 * 224 are connected as chip selects
449 */
450 .num_chipselect = 5,
451};
452
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530453static void __init mop500_spi_init(void)
454{
455 db8500_add_ssp0(&ssp0_platform_data);
456}
457
Linus Walleij5d7b8462010-10-14 13:57:59 +0200458#ifdef CONFIG_STE_DMA40
459static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
460 .mode = STEDMA40_MODE_LOGICAL,
461 .dir = STEDMA40_PERIPH_TO_MEM,
462 .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
463 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
464 .src_info.data_width = STEDMA40_BYTE_WIDTH,
465 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
466};
467
468static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
469 .mode = STEDMA40_MODE_LOGICAL,
470 .dir = STEDMA40_MEM_TO_PERIPH,
471 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
472 .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
473 .src_info.data_width = STEDMA40_BYTE_WIDTH,
474 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
475};
476
477static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
478 .mode = STEDMA40_MODE_LOGICAL,
479 .dir = STEDMA40_PERIPH_TO_MEM,
480 .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
481 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
482 .src_info.data_width = STEDMA40_BYTE_WIDTH,
483 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
484};
485
486static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
487 .mode = STEDMA40_MODE_LOGICAL,
488 .dir = STEDMA40_MEM_TO_PERIPH,
489 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
490 .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
491 .src_info.data_width = STEDMA40_BYTE_WIDTH,
492 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
493};
494
495static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
496 .mode = STEDMA40_MODE_LOGICAL,
497 .dir = STEDMA40_PERIPH_TO_MEM,
498 .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
499 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
500 .src_info.data_width = STEDMA40_BYTE_WIDTH,
501 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
502};
503
504static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
505 .mode = STEDMA40_MODE_LOGICAL,
506 .dir = STEDMA40_MEM_TO_PERIPH,
507 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
508 .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
509 .src_info.data_width = STEDMA40_BYTE_WIDTH,
510 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
511};
512#endif
513
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +0200514
515static pin_cfg_t mop500_pins_uart0[] = {
516 GPIO0_U0_CTSn | PIN_INPUT_PULLUP,
517 GPIO1_U0_RTSn | PIN_OUTPUT_HIGH,
518 GPIO2_U0_RXD | PIN_INPUT_PULLUP,
519 GPIO3_U0_TXD | PIN_OUTPUT_HIGH,
520};
521
522#define PRCC_K_SOFTRST_SET 0x18
523#define PRCC_K_SOFTRST_CLEAR 0x1C
524static void ux500_uart0_reset(void)
525{
526 void __iomem *prcc_rst_set, *prcc_rst_clr;
527
528 prcc_rst_set = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
529 PRCC_K_SOFTRST_SET);
530 prcc_rst_clr = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
531 PRCC_K_SOFTRST_CLEAR);
532
533 /* Activate soft reset PRCC_K_SOFTRST_CLEAR */
534 writel((readl(prcc_rst_clr) | 0x1), prcc_rst_clr);
535 udelay(1);
536
537 /* Release soft reset PRCC_K_SOFTRST_SET */
538 writel((readl(prcc_rst_set) | 0x1), prcc_rst_set);
539 udelay(1);
540}
541
542static void ux500_uart0_init(void)
543{
544 int ret;
545
546 ret = nmk_config_pins(mop500_pins_uart0,
547 ARRAY_SIZE(mop500_pins_uart0));
548 if (ret < 0)
549 pr_err("pl011: uart pins_enable failed\n");
550}
551
552static void ux500_uart0_exit(void)
553{
554 int ret;
555
556 ret = nmk_config_pins_sleep(mop500_pins_uart0,
557 ARRAY_SIZE(mop500_pins_uart0));
558 if (ret < 0)
559 pr_err("pl011: uart pins_disable failed\n");
560}
561
Linus Walleij5d7b8462010-10-14 13:57:59 +0200562static struct amba_pl011_data uart0_plat = {
563#ifdef CONFIG_STE_DMA40
564 .dma_filter = stedma40_filter,
565 .dma_rx_param = &uart0_dma_cfg_rx,
566 .dma_tx_param = &uart0_dma_cfg_tx,
567#endif
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +0200568 .init = ux500_uart0_init,
569 .exit = ux500_uart0_exit,
570 .reset = ux500_uart0_reset,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200571};
572
573static struct amba_pl011_data uart1_plat = {
574#ifdef CONFIG_STE_DMA40
575 .dma_filter = stedma40_filter,
576 .dma_rx_param = &uart1_dma_cfg_rx,
577 .dma_tx_param = &uart1_dma_cfg_tx,
578#endif
579};
580
581static struct amba_pl011_data uart2_plat = {
582#ifdef CONFIG_STE_DMA40
583 .dma_filter = stedma40_filter,
584 .dma_rx_param = &uart2_dma_cfg_rx,
585 .dma_tx_param = &uart2_dma_cfg_tx,
586#endif
587};
588
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530589static void __init mop500_uart_init(void)
590{
Linus Walleij5d7b8462010-10-14 13:57:59 +0200591 db8500_add_uart0(&uart0_plat);
592 db8500_add_uart1(&uart1_plat);
593 db8500_add_uart2(&uart2_plat);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530594}
595
Robert Marklund350abe02011-06-20 15:55:46 +0200596static struct platform_device *snowball_platform_devs[] __initdata = {
597 &snowball_led_dev,
598 &snowball_key_dev,
599 &snowball_sbnet_dev,
600 &ab8500_device,
601};
602
Linus Walleij4b4f7572011-02-15 15:01:35 +0100603static void __init mop500_init_machine(void)
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100604{
Linus Walleijcf568c52011-03-30 14:31:42 +0200605 int i2c0_devs;
606
Lee Jones110c2c22011-08-26 16:54:07 +0100607 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
Linus Walleij4b4f7572011-02-15 15:01:35 +0100608
Rabin Vincentea05a572010-06-03 07:58:42 +0100609 u8500_init_devices();
610
Rabin Vincentfe052032011-02-11 17:07:21 -0700611 mop500_pins_init();
Rabin Vincentea05a572010-06-03 07:58:42 +0100612
Lee Jones110c2c22011-08-26 16:54:07 +0100613 platform_add_devices(mop500_platform_devs,
614 ARRAY_SIZE(mop500_platform_devs));
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100615
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530616 mop500_i2c_init();
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100617 mop500_sdi_init();
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530618 mop500_spi_init();
619 mop500_uart_init();
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100620
Linus Walleijcf568c52011-03-30 14:31:42 +0200621 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
Lee Jones110c2c22011-08-26 16:54:07 +0100622
623 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
624 i2c_register_board_info(2, mop500_i2c2_devices,
625 ARRAY_SIZE(mop500_i2c2_devices));
626
627 /* This board has full regulator constraints */
628 regulator_has_full_constraints();
629}
630
631static void __init snowball_init_machine(void)
632{
633 int i2c0_devs;
634
635 u8500_init_devices();
636
637 snowball_pins_init();
638
639 platform_add_devices(snowball_platform_devs,
640 ARRAY_SIZE(snowball_platform_devs));
641
642 mop500_i2c_init();
643 snowball_sdi_init();
644 mop500_spi_init();
645 mop500_uart_init();
646
647 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
648 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
649 i2c_register_board_info(2, mop500_i2c2_devices,
650 ARRAY_SIZE(mop500_i2c2_devices));
651
652 /* This board has full regulator constraints */
653 regulator_has_full_constraints();
654}
655
656static void __init hrefv60_init_machine(void)
657{
658 int i2c0_devs;
659
660 /*
661 * The HREFv60 board removed a GPIO expander and routed
662 * all these GPIO pins to the internal GPIO controller
663 * instead.
664 */
665 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
666
667 u8500_init_devices();
668
669 hrefv60_pins_init();
670
671 platform_add_devices(mop500_platform_devs,
672 ARRAY_SIZE(mop500_platform_devs));
673
674 mop500_i2c_init();
675 mop500_sdi_init();
676 mop500_spi_init();
677 mop500_uart_init();
678
679 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
680
681 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
Linus Walleijcf568c52011-03-30 14:31:42 +0200682
683 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100684 i2c_register_board_info(2, mop500_i2c2_devices,
685 ARRAY_SIZE(mop500_i2c2_devices));
Linus Walleijdb245202011-04-04 10:44:51 +0200686
687 /* This board has full regulator constraints */
688 regulator_has_full_constraints();
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100689}
690
691MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
692 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400693 .atag_offset = 0x100,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100694 .map_io = u8500_map_io,
Rabin Vincent178980f2010-05-03 07:39:02 +0100695 .init_irq = ux500_init_irq,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100696 /* we re-use nomadik timer here */
Rabin Vincent41ac3292010-05-03 08:28:05 +0100697 .timer = &ux500_timer,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100698 .init_machine = mop500_init_machine,
699MACHINE_END
700
701MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400702 .atag_offset = 0x100,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100703 .map_io = u8500_map_io,
704 .init_irq = ux500_init_irq,
705 .timer = &ux500_timer,
Lee Jones110c2c22011-08-26 16:54:07 +0100706 .init_machine = hrefv60_init_machine,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100707MACHINE_END
Robert Marklund350abe02011-06-20 15:55:46 +0200708
709MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400710 .atag_offset = 0x100,
Robert Marklund350abe02011-06-20 15:55:46 +0200711 .map_io = u8500_map_io,
712 .init_irq = ux500_init_irq,
713 /* we re-use nomadik timer here */
714 .timer = &ux500_timer,
Lee Jones110c2c22011-08-26 16:54:07 +0100715 .init_machine = snowball_init_machine,
Robert Marklund350abe02011-06-20 15:55:46 +0200716MACHINE_END