blob: daa4237ac0dcfe7be72d403e496cc6724bfb1e24 [file] [log] [blame]
Linus Walleijed781d32012-05-03 00:44:52 +02001
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +01002/*
3 * Copyright (C) 2008-2009 ST-Ericsson
4 *
5 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2, as
9 * published by the Free Software Foundation.
10 *
11 */
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/interrupt.h>
15#include <linux/platform_device.h>
16#include <linux/io.h>
Rabin Vincentb8410a12010-08-09 19:18:17 +053017#include <linux/i2c.h>
Alessandro Rubiniaf97bac2012-06-11 22:56:26 +020018#include <linux/platform_data/i2c-nomadik.h>
Rabin Vincentea05a572010-06-03 07:58:42 +010019#include <linux/gpio.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010020#include <linux/amba/bus.h>
21#include <linux/amba/pl022.h>
Linus Walleij5d7b8462010-10-14 13:57:59 +020022#include <linux/amba/serial.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010023#include <linux/spi/spi.h>
Linus Walleijee66e652011-12-02 14:16:33 +010024#include <linux/mfd/abx500/ab8500.h>
Bengt Jonsson79568b92011-03-11 11:54:46 +010025#include <linux/regulator/ab8500.h>
Lee Jones0b5ea1e2012-09-03 14:33:39 +010026#include <linux/regulator/fixed.h>
Sundar Iyer20406eb2010-12-13 09:33:14 +053027#include <linux/mfd/tc3589x.h>
Linus Walleijfe67dfc2011-03-07 11:48:15 +010028#include <linux/mfd/tps6105x.h>
Linus Walleijee66e652011-12-02 14:16:33 +010029#include <linux/mfd/abx500/ab8500-gpio.h>
Ola Liljaf242e502012-06-07 14:00:46 +020030#include <linux/mfd/abx500/ab8500-codec.h>
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +010031#include <linux/leds-lp5521.h>
Philippe Langlaisa71b8192011-01-14 10:53:59 +010032#include <linux/input.h>
Robert Marklund350abe02011-06-20 15:55:46 +020033#include <linux/smsc911x.h>
Philippe Langlaisa71b8192011-01-14 10:53:59 +010034#include <linux/gpio_keys.h>
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +020035#include <linux/delay.h>
Robert Marklund350abe02011-06-20 15:55:46 +020036#include <linux/leds.h>
Linus Walleija0980662012-05-07 01:33:24 +020037#include <linux/pinctrl/consumer.h>
38
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010039#include <asm/mach-types.h>
40#include <asm/mach/arch.h>
Marc Zyngierbbf5f382011-09-06 10:23:45 +010041#include <asm/hardware/gic.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010042
Linus Walleij5d7b8462010-10-14 13:57:59 +020043#include <plat/ste_dma40.h>
Linus Walleij0f332862011-08-22 08:33:30 +010044#include <plat/gpio-nomadik.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010045
46#include <mach/hardware.h>
47#include <mach/setup.h>
Rabin Vincent9e4e7fe2010-05-03 08:03:52 +010048#include <mach/devices.h>
Linus Walleij29aeb3c2010-09-06 22:15:08 +010049#include <mach/irqs.h>
Arnd Bergmanndb298da2012-08-24 15:19:33 +020050#include <linux/platform_data/crypto-ux500.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010051
Linus Walleij5d7b8462010-10-14 13:57:59 +020052#include "ste-dma40-db8500.h"
Rabin Vincentfbf1ead2010-09-29 19:46:32 +053053#include "devices-db8500.h"
Hanumath Prasad008f8a22010-08-19 12:06:32 +010054#include "board-mop500.h"
Bengt Jonssona1e516e2010-12-10 11:08:48 +010055#include "board-mop500-regulators.h"
Rabin Vincentea05a572010-06-03 07:58:42 +010056
Robert Marklund350abe02011-06-20 15:55:46 +020057static struct gpio_led snowball_led_array[] = {
58 {
59 .name = "user_led",
Lee Jonesc525f072012-05-02 09:20:37 +010060 .default_trigger = "heartbeat",
Robert Marklund350abe02011-06-20 15:55:46 +020061 .gpio = 142,
62 },
63};
64
65static struct gpio_led_platform_data snowball_led_data = {
66 .leds = snowball_led_array,
67 .num_leds = ARRAY_SIZE(snowball_led_array),
68};
69
70static struct platform_device snowball_led_dev = {
71 .name = "leds-gpio",
72 .dev = {
73 .platform_data = &snowball_led_data,
74 },
75};
76
Lee Jones0b5ea1e2012-09-03 14:33:39 +010077static struct fixed_voltage_config snowball_gpio_en_3v3_data = {
78 .supply_name = "EN-3V3",
79 .gpio = SNOWBALL_EN_3V3_ETH_GPIO,
80 .microvolts = 3300000,
81 .enable_high = 1,
82 .init_data = &gpio_en_3v3_regulator,
83 .startup_delay = 5000, /* 1200us */
84};
85
86static struct platform_device snowball_gpio_en_3v3_regulator_dev = {
87 .name = "reg-fixed-voltage",
88 .id = 1,
89 .dev = {
90 .platform_data = &snowball_gpio_en_3v3_data,
91 },
92};
93
Bibek Basu3ef374a2011-02-15 12:56:16 +053094static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
Philippe Langlaisa1524ee2012-02-13 10:52:25 +010095 .gpio_base = MOP500_AB8500_PIN_GPIO(1),
Bibek Basu3ef374a2011-02-15 12:56:16 +053096 .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
97 /* config_reg is the initial configuration of ab8500 pins.
98 * The pins can be configured as GPIO or alt functions based
99 * on value present in GpioSel1 to GpioSel6 and AlternatFunction
100 * register. This is the array of 7 configuration settings.
101 * One has to compile time decide these settings. Below is the
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300102 * explanation of these setting
Bibek Basu3ef374a2011-02-15 12:56:16 +0530103 * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
104 * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
105 * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
106 * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO
107 * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO
108 * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO
109 * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured
110 * as GPIO then this register selectes the alternate fucntions
111 */
112 .config_reg = {0x00, 0x1E, 0x80, 0x01,
113 0x7A, 0x00, 0x00},
114};
115
Ola Liljaf242e502012-06-07 14:00:46 +0200116/* ab8500-codec */
117static struct ab8500_codec_platform_data ab8500_codec_pdata = {
118 .amics = {
119 .mic1_type = AMIC_TYPE_DIFFERENTIAL,
120 .mic2_type = AMIC_TYPE_DIFFERENTIAL,
121 .mic1a_micbias = AMIC_MICBIAS_VAMIC1,
122 .mic1b_micbias = AMIC_MICBIAS_VAMIC1,
123 .mic2_micbias = AMIC_MICBIAS_VAMIC2
124 },
125 .ear_cmv = EAR_CMV_0_95V
126};
127
Robert Marklund350abe02011-06-20 15:55:46 +0200128static struct gpio_keys_button snowball_key_array[] = {
129 {
130 .gpio = 32,
131 .type = EV_KEY,
132 .code = KEY_1,
133 .desc = "userpb",
134 .active_low = 1,
135 .debounce_interval = 50,
136 .wakeup = 1,
137 },
138 {
139 .gpio = 151,
140 .type = EV_KEY,
141 .code = KEY_2,
142 .desc = "extkb1",
143 .active_low = 1,
144 .debounce_interval = 50,
145 .wakeup = 1,
146 },
147 {
148 .gpio = 152,
149 .type = EV_KEY,
150 .code = KEY_3,
151 .desc = "extkb2",
152 .active_low = 1,
153 .debounce_interval = 50,
154 .wakeup = 1,
155 },
156 {
157 .gpio = 161,
158 .type = EV_KEY,
159 .code = KEY_4,
160 .desc = "extkb3",
161 .active_low = 1,
162 .debounce_interval = 50,
163 .wakeup = 1,
164 },
165 {
166 .gpio = 162,
167 .type = EV_KEY,
168 .code = KEY_5,
169 .desc = "extkb4",
170 .active_low = 1,
171 .debounce_interval = 50,
172 .wakeup = 1,
173 },
174};
175
176static struct gpio_keys_platform_data snowball_key_data = {
177 .buttons = snowball_key_array,
178 .nbuttons = ARRAY_SIZE(snowball_key_array),
179};
180
181static struct platform_device snowball_key_dev = {
182 .name = "gpio-keys",
183 .id = -1,
184 .dev = {
185 .platform_data = &snowball_key_data,
186 }
187};
188
189static struct smsc911x_platform_config snowball_sbnet_cfg = {
190 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
191 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
192 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
193 .shift = 1,
194};
195
196static struct resource sbnet_res[] = {
197 {
198 .name = "smsc911x-memory",
199 .start = (0x5000 << 16),
200 .end = (0x5000 << 16) + 0xffff,
201 .flags = IORESOURCE_MEM,
202 },
203 {
204 .start = NOMADIK_GPIO_TO_IRQ(140),
205 .end = NOMADIK_GPIO_TO_IRQ(140),
206 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
207 },
208};
209
210static struct platform_device snowball_sbnet_dev = {
211 .name = "smsc911x",
212 .num_resources = ARRAY_SIZE(sbnet_res),
213 .resource = sbnet_res,
214 .dev = {
215 .platform_data = &snowball_sbnet_cfg,
216 },
217};
218
Rabin Vincent39ae7022010-07-26 11:12:15 +0100219static struct ab8500_platform_data ab8500_platdata = {
220 .irq_base = MOP500_AB8500_IRQ_BASE,
Bengt Jonssondfa3a822011-03-09 13:34:17 +0100221 .regulator_reg_init = ab8500_regulator_reg_init,
222 .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
Bengt Jonssona1e516e2010-12-10 11:08:48 +0100223 .regulator = ab8500_regulators,
224 .num_regulator = ARRAY_SIZE(ab8500_regulators),
Bibek Basu3ef374a2011-02-15 12:56:16 +0530225 .gpio = &ab8500_gpio_pdata,
Ola Liljaf242e502012-06-07 14:00:46 +0200226 .codec = &ab8500_codec_pdata,
Rabin Vincent39ae7022010-07-26 11:12:15 +0100227};
228
Rabin Vincentb8410a12010-08-09 19:18:17 +0530229/*
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100230 * TPS61052
231 */
232
233static struct tps6105x_platform_data mop500_tps61052_data = {
234 .mode = TPS6105X_MODE_VOLTAGE,
235 .regulator_data = &tps61052_regulator,
236};
237
238/*
Rabin Vincentb8410a12010-08-09 19:18:17 +0530239 * TC35892
240 */
241
Sundar Iyer20406eb2010-12-13 09:33:14 +0530242static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
Rabin Vincentb8410a12010-08-09 19:18:17 +0530243{
Lee Jones18403422012-02-06 11:22:21 -0800244 struct device *parent = NULL;
245#if 0
246 /* FIXME: Is the sdi actually part of tc3589x? */
247 parent = tc3589x->dev;
248#endif
249 mop500_sdi_tc35892_init(parent);
Rabin Vincentb8410a12010-08-09 19:18:17 +0530250}
251
Sundar Iyer20406eb2010-12-13 09:33:14 +0530252static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530253 .gpio_base = MOP500_EGPIO(0),
254 .setup = mop500_tc35892_init,
255};
256
Sundar Iyer20406eb2010-12-13 09:33:14 +0530257static struct tc3589x_platform_data mop500_tc35892_data = {
Sundar Iyer611b7592010-12-13 09:33:15 +0530258 .block = TC3589x_BLOCK_GPIO,
Rabin Vincentb8410a12010-08-09 19:18:17 +0530259 .gpio = &mop500_tc35892_gpio_data,
260 .irq_base = MOP500_EGPIO_IRQ_BASE,
261};
262
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100263static struct lp5521_led_config lp5521_pri_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_pri_data = {
282 .label = "lp5521_pri",
283 .led_config = &lp5521_pri_led[0],
284 .num_channels = 3,
285 .clock_mode = LP5521_CLOCK_EXT,
286};
287
288static struct lp5521_led_config lp5521_sec_led[] = {
289 [0] = {
290 .chan_nr = 0,
291 .led_current = 0x2f,
292 .max_current = 0x5f,
293 },
294 [1] = {
295 .chan_nr = 1,
296 .led_current = 0x2f,
297 .max_current = 0x5f,
298 },
299 [2] = {
300 .chan_nr = 2,
301 .led_current = 0x2f,
302 .max_current = 0x5f,
303 },
304};
305
306static struct lp5521_platform_data __initdata lp5521_sec_data = {
307 .label = "lp5521_sec",
308 .led_config = &lp5521_sec_led[0],
309 .num_channels = 3,
310 .clock_mode = LP5521_CLOCK_EXT,
311};
312
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100313static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530314 {
Sundar Iyer20406eb2010-12-13 09:33:14 +0530315 I2C_BOARD_INFO("tc3589x", 0x42),
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100316 .irq = NOMADIK_GPIO_TO_IRQ(217),
Rabin Vincentb8410a12010-08-09 19:18:17 +0530317 .platform_data = &mop500_tc35892_data,
318 },
Linus Walleijcf568c52011-03-30 14:31:42 +0200319 /* I2C0 devices only available prior to HREFv60 */
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100320 {
321 I2C_BOARD_INFO("tps61052", 0x33),
322 .platform_data = &mop500_tps61052_data,
323 },
324};
325
Linus Walleijcf568c52011-03-30 14:31:42 +0200326#define NUM_PRE_V60_I2C0_DEVICES 1
327
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100328static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
329 {
330 /* lp5521 LED driver, 1st device */
331 I2C_BOARD_INFO("lp5521", 0x33),
332 .platform_data = &lp5521_pri_data,
333 },
334 {
335 /* lp5521 LED driver, 2st device */
336 I2C_BOARD_INFO("lp5521", 0x34),
337 .platform_data = &lp5521_sec_data,
338 },
Lee Jonesbb3b2182011-01-13 14:41:22 +0000339 {
340 /* Light sensor Rohm BH1780GLI */
341 I2C_BOARD_INFO("bh1780", 0x29),
342 },
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100343};
344
Lee Jones18403422012-02-06 11:22:21 -0800345static void __init mop500_i2c_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530346{
Lee Jones98582d92012-04-17 15:52:26 +0100347 db8500_add_i2c0(parent, NULL);
348 db8500_add_i2c1(parent, NULL);
349 db8500_add_i2c2(parent, NULL);
350 db8500_add_i2c3(parent, NULL);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530351}
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100352
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100353static struct gpio_keys_button mop500_gpio_keys[] = {
354 {
355 .desc = "SFH7741 Proximity Sensor",
356 .type = EV_SW,
357 .code = SW_FRONT_PROXIMITY,
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100358 .active_low = 0,
359 .can_disable = 1,
360 }
361};
362
363static struct regulator *prox_regulator;
364static int mop500_prox_activate(struct device *dev);
365static void mop500_prox_deactivate(struct device *dev);
366
367static struct gpio_keys_platform_data mop500_gpio_keys_data = {
368 .buttons = mop500_gpio_keys,
369 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
370 .enable = mop500_prox_activate,
371 .disable = mop500_prox_deactivate,
372};
373
374static struct platform_device mop500_gpio_keys_device = {
375 .name = "gpio-keys",
376 .id = 0,
377 .dev = {
378 .platform_data = &mop500_gpio_keys_data,
379 },
380};
381
382static int mop500_prox_activate(struct device *dev)
383{
384 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
385 "vcc");
386 if (IS_ERR(prox_regulator)) {
387 dev_err(&mop500_gpio_keys_device.dev,
388 "no regulator\n");
389 return PTR_ERR(prox_regulator);
390 }
391 regulator_enable(prox_regulator);
392 return 0;
393}
394
395static void mop500_prox_deactivate(struct device *dev)
396{
397 regulator_disable(prox_regulator);
398 regulator_put(prox_regulator);
399}
400
Andreas Westin585d1882012-05-10 10:14:06 +0200401static struct cryp_platform_data u8500_cryp1_platform_data = {
402 .mem_to_engine = {
403 .dir = STEDMA40_MEM_TO_PERIPH,
404 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
405 .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
406 .src_info.data_width = STEDMA40_WORD_WIDTH,
407 .dst_info.data_width = STEDMA40_WORD_WIDTH,
408 .mode = STEDMA40_MODE_LOGICAL,
409 .src_info.psize = STEDMA40_PSIZE_LOG_4,
410 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
411 },
412 .engine_to_mem = {
413 .dir = STEDMA40_PERIPH_TO_MEM,
414 .src_dev_type = DB8500_DMA_DEV48_CAC1_RX,
415 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
416 .src_info.data_width = STEDMA40_WORD_WIDTH,
417 .dst_info.data_width = STEDMA40_WORD_WIDTH,
418 .mode = STEDMA40_MODE_LOGICAL,
419 .src_info.psize = STEDMA40_PSIZE_LOG_4,
420 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
421 }
422};
423
424static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
425 .dir = STEDMA40_MEM_TO_PERIPH,
426 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
427 .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
428 .src_info.data_width = STEDMA40_WORD_WIDTH,
429 .dst_info.data_width = STEDMA40_WORD_WIDTH,
430 .mode = STEDMA40_MODE_LOGICAL,
431 .src_info.psize = STEDMA40_PSIZE_LOG_16,
432 .dst_info.psize = STEDMA40_PSIZE_LOG_16,
433};
434
435static struct hash_platform_data u8500_hash1_platform_data = {
436 .mem_to_engine = &u8500_hash_dma_cfg_tx,
437 .dma_filter = stedma40_filter,
438};
439
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100440/* add any platform devices here - TODO */
Robert Marklund350abe02011-06-20 15:55:46 +0200441static struct platform_device *mop500_platform_devs[] __initdata = {
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100442 &mop500_gpio_keys_device,
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100443};
444
Linus Walleij5d7b8462010-10-14 13:57:59 +0200445#ifdef CONFIG_STE_DMA40
446static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
447 .mode = STEDMA40_MODE_LOGICAL,
448 .dir = STEDMA40_PERIPH_TO_MEM,
449 .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
450 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
451 .src_info.data_width = STEDMA40_BYTE_WIDTH,
452 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
453};
454
455static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
456 .mode = STEDMA40_MODE_LOGICAL,
457 .dir = STEDMA40_MEM_TO_PERIPH,
458 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
459 .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
460 .src_info.data_width = STEDMA40_BYTE_WIDTH,
461 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
462};
463#endif
464
Lee Jonesfa86a762012-09-27 10:17:36 +0100465struct pl022_ssp_controller ssp0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200466 .bus_id = 0,
467#ifdef CONFIG_STE_DMA40
468 .enable_dma = 1,
469 .dma_filter = stedma40_filter,
470 .dma_rx_param = &ssp0_dma_cfg_rx,
471 .dma_tx_param = &ssp0_dma_cfg_tx,
472#else
473 .enable_dma = 0,
474#endif
475 /* on this platform, gpio 31,142,144,214 &
476 * 224 are connected as chip selects
477 */
478 .num_chipselect = 5,
479};
480
Lee Jones18403422012-02-06 11:22:21 -0800481static void __init mop500_spi_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530482{
Lee Jones15daf692012-03-15 16:47:11 +0000483 db8500_add_ssp0(parent, &ssp0_plat);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530484}
485
Linus Walleij5d7b8462010-10-14 13:57:59 +0200486#ifdef CONFIG_STE_DMA40
487static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
488 .mode = STEDMA40_MODE_LOGICAL,
489 .dir = STEDMA40_PERIPH_TO_MEM,
490 .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
491 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
492 .src_info.data_width = STEDMA40_BYTE_WIDTH,
493 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
494};
495
496static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
497 .mode = STEDMA40_MODE_LOGICAL,
498 .dir = STEDMA40_MEM_TO_PERIPH,
499 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
500 .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
501 .src_info.data_width = STEDMA40_BYTE_WIDTH,
502 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
503};
504
505static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
506 .mode = STEDMA40_MODE_LOGICAL,
507 .dir = STEDMA40_PERIPH_TO_MEM,
508 .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
509 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
510 .src_info.data_width = STEDMA40_BYTE_WIDTH,
511 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
512};
513
514static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
515 .mode = STEDMA40_MODE_LOGICAL,
516 .dir = STEDMA40_MEM_TO_PERIPH,
517 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
518 .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
519 .src_info.data_width = STEDMA40_BYTE_WIDTH,
520 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
521};
522
523static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
524 .mode = STEDMA40_MODE_LOGICAL,
525 .dir = STEDMA40_PERIPH_TO_MEM,
526 .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
527 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
528 .src_info.data_width = STEDMA40_BYTE_WIDTH,
529 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
530};
531
532static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
533 .mode = STEDMA40_MODE_LOGICAL,
534 .dir = STEDMA40_MEM_TO_PERIPH,
535 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
536 .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
537 .src_info.data_width = STEDMA40_BYTE_WIDTH,
538 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
539};
540#endif
541
Lee Jonesfa86a762012-09-27 10:17:36 +0100542struct amba_pl011_data uart0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200543#ifdef CONFIG_STE_DMA40
544 .dma_filter = stedma40_filter,
545 .dma_rx_param = &uart0_dma_cfg_rx,
546 .dma_tx_param = &uart0_dma_cfg_tx,
547#endif
548};
549
Lee Jonesfa86a762012-09-27 10:17:36 +0100550struct amba_pl011_data uart1_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200551#ifdef CONFIG_STE_DMA40
552 .dma_filter = stedma40_filter,
553 .dma_rx_param = &uart1_dma_cfg_rx,
554 .dma_tx_param = &uart1_dma_cfg_tx,
555#endif
556};
557
Lee Jonesfa86a762012-09-27 10:17:36 +0100558struct amba_pl011_data uart2_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200559#ifdef CONFIG_STE_DMA40
560 .dma_filter = stedma40_filter,
561 .dma_rx_param = &uart2_dma_cfg_rx,
562 .dma_tx_param = &uart2_dma_cfg_tx,
563#endif
564};
565
Lee Jones18403422012-02-06 11:22:21 -0800566static void __init mop500_uart_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530567{
Linus Walleij78d80c52012-05-23 21:18:46 +0200568 db8500_add_uart0(parent, &uart0_plat);
Lee Jones18403422012-02-06 11:22:21 -0800569 db8500_add_uart1(parent, &uart1_plat);
570 db8500_add_uart2(parent, &uart2_plat);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530571}
572
Andreas Westin585d1882012-05-10 10:14:06 +0200573static void __init u8500_cryp1_hash1_init(struct device *parent)
574{
575 db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
576 db8500_add_hash1(parent, &u8500_hash1_platform_data);
577}
578
Robert Marklund350abe02011-06-20 15:55:46 +0200579static struct platform_device *snowball_platform_devs[] __initdata = {
580 &snowball_led_dev,
581 &snowball_key_dev,
Lee Jonese6fada52012-05-17 13:18:36 +0100582 &snowball_sbnet_dev,
Lee Jones0b5ea1e2012-09-03 14:33:39 +0100583 &snowball_gpio_en_3v3_regulator_dev,
Robert Marklund350abe02011-06-20 15:55:46 +0200584};
585
Linus Walleij4b4f7572011-02-15 15:01:35 +0100586static void __init mop500_init_machine(void)
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100587{
Lee Jones18403422012-02-06 11:22:21 -0800588 struct device *parent = NULL;
Linus Walleijcf568c52011-03-30 14:31:42 +0200589 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800590 int i;
Linus Walleijcf568c52011-03-30 14:31:42 +0200591
Lee Jones110c2c22011-08-26 16:54:07 +0100592 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
Linus Walleij4b4f7572011-02-15 15:01:35 +0100593
Linus Walleijed781d32012-05-03 00:44:52 +0200594 mop500_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200595 parent = u8500_init_devices(&ab8500_platdata);
Rabin Vincentea05a572010-06-03 07:58:42 +0100596
Lee Jonesb024a0c2012-02-06 11:22:25 -0800597 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
598 mop500_platform_devs[i]->dev.parent = parent;
599
Lee Jones110c2c22011-08-26 16:54:07 +0100600 platform_add_devices(mop500_platform_devs,
601 ARRAY_SIZE(mop500_platform_devs));
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100602
Lee Jones18403422012-02-06 11:22:21 -0800603 mop500_i2c_init(parent);
604 mop500_sdi_init(parent);
605 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100606 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800607 mop500_uart_init(parent);
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100608
Andreas Westin585d1882012-05-10 10:14:06 +0200609 u8500_cryp1_hash1_init(parent);
610
Linus Walleijcf568c52011-03-30 14:31:42 +0200611 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
Lee Jones110c2c22011-08-26 16:54:07 +0100612
613 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
614 i2c_register_board_info(2, mop500_i2c2_devices,
615 ARRAY_SIZE(mop500_i2c2_devices));
616
617 /* This board has full regulator constraints */
618 regulator_has_full_constraints();
619}
620
621static void __init snowball_init_machine(void)
622{
Lee Jones18403422012-02-06 11:22:21 -0800623 struct device *parent = NULL;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800624 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100625
Linus Walleijed781d32012-05-03 00:44:52 +0200626 snowball_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200627 parent = u8500_init_devices(&ab8500_platdata);
Lee Jones110c2c22011-08-26 16:54:07 +0100628
Lee Jonesb024a0c2012-02-06 11:22:25 -0800629 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
630 snowball_platform_devs[i]->dev.parent = parent;
631
Lee Jones110c2c22011-08-26 16:54:07 +0100632 platform_add_devices(snowball_platform_devs,
633 ARRAY_SIZE(snowball_platform_devs));
634
Lee Jones18403422012-02-06 11:22:21 -0800635 mop500_i2c_init(parent);
636 snowball_sdi_init(parent);
637 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100638 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800639 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100640
Lee Jones110c2c22011-08-26 16:54:07 +0100641 /* This board has full regulator constraints */
642 regulator_has_full_constraints();
643}
644
645static void __init hrefv60_init_machine(void)
646{
Lee Jones18403422012-02-06 11:22:21 -0800647 struct device *parent = NULL;
Lee Jones110c2c22011-08-26 16:54:07 +0100648 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800649 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100650
651 /*
652 * The HREFv60 board removed a GPIO expander and routed
653 * all these GPIO pins to the internal GPIO controller
654 * instead.
655 */
656 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
657
Linus Walleijed781d32012-05-03 00:44:52 +0200658 hrefv60_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200659 parent = u8500_init_devices(&ab8500_platdata);
Lee Jones110c2c22011-08-26 16:54:07 +0100660
Lee Jonesb024a0c2012-02-06 11:22:25 -0800661 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
662 mop500_platform_devs[i]->dev.parent = parent;
663
Lee Jones110c2c22011-08-26 16:54:07 +0100664 platform_add_devices(mop500_platform_devs,
665 ARRAY_SIZE(mop500_platform_devs));
666
Lee Jones18403422012-02-06 11:22:21 -0800667 mop500_i2c_init(parent);
668 hrefv60_sdi_init(parent);
669 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100670 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800671 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100672
673 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
674
675 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
Linus Walleijcf568c52011-03-30 14:31:42 +0200676
677 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100678 i2c_register_board_info(2, mop500_i2c2_devices,
679 ARRAY_SIZE(mop500_i2c2_devices));
Linus Walleijdb245202011-04-04 10:44:51 +0200680
681 /* This board has full regulator constraints */
682 regulator_has_full_constraints();
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100683}
684
685MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
686 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400687 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100688 .smp = smp_ops(ux500_smp_ops),
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100689 .map_io = u8500_map_io,
Rabin Vincent178980f2010-05-03 07:39:02 +0100690 .init_irq = ux500_init_irq,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100691 /* we re-use nomadik timer here */
Rabin Vincent41ac3292010-05-03 08:28:05 +0100692 .timer = &ux500_timer,
Marc Zyngierbbf5f382011-09-06 10:23:45 +0100693 .handle_irq = gic_handle_irq,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100694 .init_machine = mop500_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800695 .init_late = ux500_init_late,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100696MACHINE_END
697
698MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400699 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100700 .smp = smp_ops(ux500_smp_ops),
Linus Walleij4b4f7572011-02-15 15:01:35 +0100701 .map_io = u8500_map_io,
702 .init_irq = ux500_init_irq,
703 .timer = &ux500_timer,
Marc Zyngierbbf5f382011-09-06 10:23:45 +0100704 .handle_irq = gic_handle_irq,
Lee Jones110c2c22011-08-26 16:54:07 +0100705 .init_machine = hrefv60_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800706 .init_late = ux500_init_late,
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,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100711 .smp = smp_ops(ux500_smp_ops),
Robert Marklund350abe02011-06-20 15:55:46 +0200712 .map_io = u8500_map_io,
713 .init_irq = ux500_init_irq,
714 /* we re-use nomadik timer here */
715 .timer = &ux500_timer,
Marc Zyngierbbf5f382011-09-06 10:23:45 +0100716 .handle_irq = gic_handle_irq,
Lee Jones110c2c22011-08-26 16:54:07 +0100717 .init_machine = snowball_init_machine,
Lee Jones0ddf8552012-09-25 16:03:45 +0100718 .init_late = NULL,
Robert Marklund350abe02011-06-20 15:55:46 +0200719MACHINE_END