blob: b6f14ee507cacbb0b00a8dccd3b74bbe21de3bf7 [file] [log] [blame]
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +01001/*
Linus Walleija3a6c6a2012-10-01 09:37:39 +02002 * Copyright (C) 2008-2012 ST-Ericsson
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +01003 *
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>
Alessandro Rubiniaf97bac2012-06-11 22:56:26 +020017#include <linux/platform_data/i2c-nomadik.h>
hongbo.zhangdc1956b2012-11-15 18:56:43 +080018#include <linux/platform_data/db8500_thermal.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 Jonsson79568b942011-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>
Linus Walleijbb16bd92012-10-10 14:27:58 +020038#include <linux/platform_data/pinctrl-nomadik.h>
Linus Walleij865fab62012-10-18 14:20:16 +020039#include <linux/platform_data/dma-ste-dma40.h>
Linus Walleija0980662012-05-07 01:33:24 +020040
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010041#include <asm/mach-types.h>
42#include <asm/mach/arch.h>
Marc Zyngierbbf5f382011-09-06 10:23:45 +010043#include <asm/hardware/gic.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010044
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010045#include <mach/hardware.h>
46#include <mach/setup.h>
Rabin Vincent9e4e7fe2010-05-03 08:03:52 +010047#include <mach/devices.h>
Linus Walleij29aeb3c2010-09-06 22:15:08 +010048#include <mach/irqs.h>
Arnd Bergmanndb298da2012-08-24 15:19:33 +020049#include <linux/platform_data/crypto-ux500.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010050
Linus Walleij5d7b8462010-10-14 13:57:59 +020051#include "ste-dma40-db8500.h"
Rabin Vincentfbf1ead2010-09-29 19:46:32 +053052#include "devices-db8500.h"
Hanumath Prasad008f8a22010-08-19 12:06:32 +010053#include "board-mop500.h"
Bengt Jonssona1e516e2010-12-10 11:08:48 +010054#include "board-mop500-regulators.h"
Rabin Vincentea05a572010-06-03 07:58:42 +010055
Robert Marklund350abe02011-06-20 15:55:46 +020056static struct gpio_led snowball_led_array[] = {
57 {
58 .name = "user_led",
Lee Jonesc525f072012-05-02 09:20:37 +010059 .default_trigger = "heartbeat",
Robert Marklund350abe02011-06-20 15:55:46 +020060 .gpio = 142,
61 },
62};
63
64static struct gpio_led_platform_data snowball_led_data = {
65 .leds = snowball_led_array,
66 .num_leds = ARRAY_SIZE(snowball_led_array),
67};
68
69static struct platform_device snowball_led_dev = {
70 .name = "leds-gpio",
71 .dev = {
72 .platform_data = &snowball_led_data,
73 },
74};
75
Lee Jones0b5ea1e2012-09-03 14:33:39 +010076static struct fixed_voltage_config snowball_gpio_en_3v3_data = {
77 .supply_name = "EN-3V3",
78 .gpio = SNOWBALL_EN_3V3_ETH_GPIO,
79 .microvolts = 3300000,
80 .enable_high = 1,
81 .init_data = &gpio_en_3v3_regulator,
82 .startup_delay = 5000, /* 1200us */
83};
84
85static struct platform_device snowball_gpio_en_3v3_regulator_dev = {
86 .name = "reg-fixed-voltage",
87 .id = 1,
88 .dev = {
89 .platform_data = &snowball_gpio_en_3v3_data,
90 },
91};
92
Patrice Chotard0493e642013-01-08 10:41:02 +010093static struct abx500_gpio_platform_data ab8500_gpio_pdata = {
Philippe Langlaisa1524ee2012-02-13 10:52:25 +010094 .gpio_base = MOP500_AB8500_PIN_GPIO(1),
Bibek Basu3ef374a2011-02-15 12:56:16 +053095 .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
Bibek Basu3ef374a2011-02-15 12:56:16 +053096};
97
Ola Liljaf242e502012-06-07 14:00:46 +020098/* ab8500-codec */
99static struct ab8500_codec_platform_data ab8500_codec_pdata = {
100 .amics = {
101 .mic1_type = AMIC_TYPE_DIFFERENTIAL,
102 .mic2_type = AMIC_TYPE_DIFFERENTIAL,
103 .mic1a_micbias = AMIC_MICBIAS_VAMIC1,
104 .mic1b_micbias = AMIC_MICBIAS_VAMIC1,
105 .mic2_micbias = AMIC_MICBIAS_VAMIC2
106 },
107 .ear_cmv = EAR_CMV_0_95V
108};
109
Robert Marklund350abe02011-06-20 15:55:46 +0200110static struct gpio_keys_button snowball_key_array[] = {
111 {
112 .gpio = 32,
113 .type = EV_KEY,
114 .code = KEY_1,
115 .desc = "userpb",
116 .active_low = 1,
117 .debounce_interval = 50,
118 .wakeup = 1,
119 },
120 {
121 .gpio = 151,
122 .type = EV_KEY,
123 .code = KEY_2,
124 .desc = "extkb1",
125 .active_low = 1,
126 .debounce_interval = 50,
127 .wakeup = 1,
128 },
129 {
130 .gpio = 152,
131 .type = EV_KEY,
132 .code = KEY_3,
133 .desc = "extkb2",
134 .active_low = 1,
135 .debounce_interval = 50,
136 .wakeup = 1,
137 },
138 {
139 .gpio = 161,
140 .type = EV_KEY,
141 .code = KEY_4,
142 .desc = "extkb3",
143 .active_low = 1,
144 .debounce_interval = 50,
145 .wakeup = 1,
146 },
147 {
148 .gpio = 162,
149 .type = EV_KEY,
150 .code = KEY_5,
151 .desc = "extkb4",
152 .active_low = 1,
153 .debounce_interval = 50,
154 .wakeup = 1,
155 },
156};
157
158static struct gpio_keys_platform_data snowball_key_data = {
159 .buttons = snowball_key_array,
160 .nbuttons = ARRAY_SIZE(snowball_key_array),
161};
162
163static struct platform_device snowball_key_dev = {
164 .name = "gpio-keys",
165 .id = -1,
166 .dev = {
167 .platform_data = &snowball_key_data,
168 }
169};
170
171static struct smsc911x_platform_config snowball_sbnet_cfg = {
172 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
173 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
174 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
175 .shift = 1,
176};
177
178static struct resource sbnet_res[] = {
179 {
180 .name = "smsc911x-memory",
181 .start = (0x5000 << 16),
182 .end = (0x5000 << 16) + 0xffff,
183 .flags = IORESOURCE_MEM,
184 },
185 {
186 .start = NOMADIK_GPIO_TO_IRQ(140),
187 .end = NOMADIK_GPIO_TO_IRQ(140),
188 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
189 },
190};
191
192static struct platform_device snowball_sbnet_dev = {
193 .name = "smsc911x",
194 .num_resources = ARRAY_SIZE(sbnet_res),
195 .resource = sbnet_res,
196 .dev = {
197 .platform_data = &snowball_sbnet_cfg,
198 },
199};
200
Rabin Vincent39ae7022010-07-26 11:12:15 +0100201static struct ab8500_platform_data ab8500_platdata = {
202 .irq_base = MOP500_AB8500_IRQ_BASE,
Bengt Jonssondfa3a822011-03-09 13:34:17 +0100203 .regulator_reg_init = ab8500_regulator_reg_init,
204 .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
Bengt Jonssona1e516e2010-12-10 11:08:48 +0100205 .regulator = ab8500_regulators,
206 .num_regulator = ARRAY_SIZE(ab8500_regulators),
Bibek Basu3ef374a2011-02-15 12:56:16 +0530207 .gpio = &ab8500_gpio_pdata,
Ola Liljaf242e502012-06-07 14:00:46 +0200208 .codec = &ab8500_codec_pdata,
Rabin Vincent39ae7022010-07-26 11:12:15 +0100209};
210
Rabin Vincentb8410a12010-08-09 19:18:17 +0530211/*
hongbo.zhangdc1956b2012-11-15 18:56:43 +0800212 * Thermal Sensor
213 */
214
215static struct resource db8500_thsens_resources[] = {
216 {
217 .name = "IRQ_HOTMON_LOW",
218 .start = IRQ_PRCMU_HOTMON_LOW,
219 .end = IRQ_PRCMU_HOTMON_LOW,
220 .flags = IORESOURCE_IRQ,
221 },
222 {
223 .name = "IRQ_HOTMON_HIGH",
224 .start = IRQ_PRCMU_HOTMON_HIGH,
225 .end = IRQ_PRCMU_HOTMON_HIGH,
226 .flags = IORESOURCE_IRQ,
227 },
228};
229
230static struct db8500_thsens_platform_data db8500_thsens_data = {
231 .trip_points[0] = {
232 .temp = 70000,
233 .type = THERMAL_TRIP_ACTIVE,
234 .cdev_name = {
235 [0] = "thermal-cpufreq-0",
236 },
237 },
238 .trip_points[1] = {
239 .temp = 75000,
240 .type = THERMAL_TRIP_ACTIVE,
241 .cdev_name = {
242 [0] = "thermal-cpufreq-0",
243 },
244 },
245 .trip_points[2] = {
246 .temp = 80000,
247 .type = THERMAL_TRIP_ACTIVE,
248 .cdev_name = {
249 [0] = "thermal-cpufreq-0",
250 },
251 },
252 .trip_points[3] = {
253 .temp = 85000,
254 .type = THERMAL_TRIP_CRITICAL,
255 },
256 .num_trips = 4,
257};
258
259static struct platform_device u8500_thsens_device = {
260 .name = "db8500-thermal",
261 .resource = db8500_thsens_resources,
262 .num_resources = ARRAY_SIZE(db8500_thsens_resources),
263 .dev = {
264 .platform_data = &db8500_thsens_data,
265 },
266};
267
268static struct platform_device u8500_cpufreq_cooling_device = {
269 .name = "db8500-cpufreq-cooling",
270};
271
272/*
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100273 * TPS61052
274 */
275
276static struct tps6105x_platform_data mop500_tps61052_data = {
277 .mode = TPS6105X_MODE_VOLTAGE,
278 .regulator_data = &tps61052_regulator,
279};
280
281/*
Rabin Vincentb8410a12010-08-09 19:18:17 +0530282 * TC35892
283 */
284
Sundar Iyer20406eb2010-12-13 09:33:14 +0530285static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
Rabin Vincentb8410a12010-08-09 19:18:17 +0530286{
Lee Jones18403422012-02-06 11:22:21 -0800287 struct device *parent = NULL;
288#if 0
289 /* FIXME: Is the sdi actually part of tc3589x? */
290 parent = tc3589x->dev;
291#endif
292 mop500_sdi_tc35892_init(parent);
Rabin Vincentb8410a12010-08-09 19:18:17 +0530293}
294
Sundar Iyer20406eb2010-12-13 09:33:14 +0530295static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530296 .gpio_base = MOP500_EGPIO(0),
297 .setup = mop500_tc35892_init,
298};
299
Sundar Iyer20406eb2010-12-13 09:33:14 +0530300static struct tc3589x_platform_data mop500_tc35892_data = {
Sundar Iyer611b7592010-12-13 09:33:15 +0530301 .block = TC3589x_BLOCK_GPIO,
Rabin Vincentb8410a12010-08-09 19:18:17 +0530302 .gpio = &mop500_tc35892_gpio_data,
303 .irq_base = MOP500_EGPIO_IRQ_BASE,
304};
305
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100306static struct lp5521_led_config lp5521_pri_led[] = {
307 [0] = {
308 .chan_nr = 0,
309 .led_current = 0x2f,
310 .max_current = 0x5f,
311 },
312 [1] = {
313 .chan_nr = 1,
314 .led_current = 0x2f,
315 .max_current = 0x5f,
316 },
317 [2] = {
318 .chan_nr = 2,
319 .led_current = 0x2f,
320 .max_current = 0x5f,
321 },
322};
323
324static struct lp5521_platform_data __initdata lp5521_pri_data = {
325 .label = "lp5521_pri",
326 .led_config = &lp5521_pri_led[0],
327 .num_channels = 3,
328 .clock_mode = LP5521_CLOCK_EXT,
329};
330
331static struct lp5521_led_config lp5521_sec_led[] = {
332 [0] = {
333 .chan_nr = 0,
334 .led_current = 0x2f,
335 .max_current = 0x5f,
336 },
337 [1] = {
338 .chan_nr = 1,
339 .led_current = 0x2f,
340 .max_current = 0x5f,
341 },
342 [2] = {
343 .chan_nr = 2,
344 .led_current = 0x2f,
345 .max_current = 0x5f,
346 },
347};
348
349static struct lp5521_platform_data __initdata lp5521_sec_data = {
350 .label = "lp5521_sec",
351 .led_config = &lp5521_sec_led[0],
352 .num_channels = 3,
353 .clock_mode = LP5521_CLOCK_EXT,
354};
355
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100356static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530357 {
Sundar Iyer20406eb2010-12-13 09:33:14 +0530358 I2C_BOARD_INFO("tc3589x", 0x42),
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100359 .irq = NOMADIK_GPIO_TO_IRQ(217),
Rabin Vincentb8410a12010-08-09 19:18:17 +0530360 .platform_data = &mop500_tc35892_data,
361 },
Linus Walleijcf568c52011-03-30 14:31:42 +0200362 /* I2C0 devices only available prior to HREFv60 */
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100363 {
364 I2C_BOARD_INFO("tps61052", 0x33),
365 .platform_data = &mop500_tps61052_data,
366 },
367};
368
Linus Walleijcf568c52011-03-30 14:31:42 +0200369#define NUM_PRE_V60_I2C0_DEVICES 1
370
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100371static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
372 {
373 /* lp5521 LED driver, 1st device */
374 I2C_BOARD_INFO("lp5521", 0x33),
375 .platform_data = &lp5521_pri_data,
376 },
377 {
378 /* lp5521 LED driver, 2st device */
379 I2C_BOARD_INFO("lp5521", 0x34),
380 .platform_data = &lp5521_sec_data,
381 },
Lee Jonesbb3b2182011-01-13 14:41:22 +0000382 {
383 /* Light sensor Rohm BH1780GLI */
384 I2C_BOARD_INFO("bh1780", 0x29),
385 },
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100386};
387
Lee Jones18403422012-02-06 11:22:21 -0800388static void __init mop500_i2c_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530389{
Lee Jones98582d92012-04-17 15:52:26 +0100390 db8500_add_i2c0(parent, NULL);
391 db8500_add_i2c1(parent, NULL);
392 db8500_add_i2c2(parent, NULL);
393 db8500_add_i2c3(parent, NULL);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530394}
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100395
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100396static struct gpio_keys_button mop500_gpio_keys[] = {
397 {
398 .desc = "SFH7741 Proximity Sensor",
399 .type = EV_SW,
400 .code = SW_FRONT_PROXIMITY,
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100401 .active_low = 0,
402 .can_disable = 1,
403 }
404};
405
406static struct regulator *prox_regulator;
407static int mop500_prox_activate(struct device *dev);
408static void mop500_prox_deactivate(struct device *dev);
409
410static struct gpio_keys_platform_data mop500_gpio_keys_data = {
411 .buttons = mop500_gpio_keys,
412 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
413 .enable = mop500_prox_activate,
414 .disable = mop500_prox_deactivate,
415};
416
417static struct platform_device mop500_gpio_keys_device = {
418 .name = "gpio-keys",
419 .id = 0,
420 .dev = {
421 .platform_data = &mop500_gpio_keys_data,
422 },
423};
424
425static int mop500_prox_activate(struct device *dev)
426{
427 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
428 "vcc");
429 if (IS_ERR(prox_regulator)) {
430 dev_err(&mop500_gpio_keys_device.dev,
431 "no regulator\n");
432 return PTR_ERR(prox_regulator);
433 }
434 regulator_enable(prox_regulator);
435 return 0;
436}
437
438static void mop500_prox_deactivate(struct device *dev)
439{
440 regulator_disable(prox_regulator);
441 regulator_put(prox_regulator);
442}
443
Andreas Westin585d1882012-05-10 10:14:06 +0200444static struct cryp_platform_data u8500_cryp1_platform_data = {
445 .mem_to_engine = {
446 .dir = STEDMA40_MEM_TO_PERIPH,
447 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
448 .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
449 .src_info.data_width = STEDMA40_WORD_WIDTH,
450 .dst_info.data_width = STEDMA40_WORD_WIDTH,
451 .mode = STEDMA40_MODE_LOGICAL,
452 .src_info.psize = STEDMA40_PSIZE_LOG_4,
453 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
454 },
455 .engine_to_mem = {
456 .dir = STEDMA40_PERIPH_TO_MEM,
457 .src_dev_type = DB8500_DMA_DEV48_CAC1_RX,
458 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
459 .src_info.data_width = STEDMA40_WORD_WIDTH,
460 .dst_info.data_width = STEDMA40_WORD_WIDTH,
461 .mode = STEDMA40_MODE_LOGICAL,
462 .src_info.psize = STEDMA40_PSIZE_LOG_4,
463 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
464 }
465};
466
467static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
468 .dir = STEDMA40_MEM_TO_PERIPH,
469 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
470 .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
471 .src_info.data_width = STEDMA40_WORD_WIDTH,
472 .dst_info.data_width = STEDMA40_WORD_WIDTH,
473 .mode = STEDMA40_MODE_LOGICAL,
474 .src_info.psize = STEDMA40_PSIZE_LOG_16,
475 .dst_info.psize = STEDMA40_PSIZE_LOG_16,
476};
477
478static struct hash_platform_data u8500_hash1_platform_data = {
479 .mem_to_engine = &u8500_hash_dma_cfg_tx,
480 .dma_filter = stedma40_filter,
481};
482
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100483/* add any platform devices here - TODO */
Robert Marklund350abe02011-06-20 15:55:46 +0200484static struct platform_device *mop500_platform_devs[] __initdata = {
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100485 &mop500_gpio_keys_device,
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100486};
487
Linus Walleij5d7b8462010-10-14 13:57:59 +0200488#ifdef CONFIG_STE_DMA40
489static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
490 .mode = STEDMA40_MODE_LOGICAL,
491 .dir = STEDMA40_PERIPH_TO_MEM,
492 .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
493 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
494 .src_info.data_width = STEDMA40_BYTE_WIDTH,
495 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
496};
497
498static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
499 .mode = STEDMA40_MODE_LOGICAL,
500 .dir = STEDMA40_MEM_TO_PERIPH,
501 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
502 .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
503 .src_info.data_width = STEDMA40_BYTE_WIDTH,
504 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
505};
506#endif
507
Lee Jonesfa86a762012-09-27 10:17:36 +0100508struct pl022_ssp_controller ssp0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200509 .bus_id = 0,
510#ifdef CONFIG_STE_DMA40
511 .enable_dma = 1,
512 .dma_filter = stedma40_filter,
513 .dma_rx_param = &ssp0_dma_cfg_rx,
514 .dma_tx_param = &ssp0_dma_cfg_tx,
515#else
516 .enable_dma = 0,
517#endif
518 /* on this platform, gpio 31,142,144,214 &
519 * 224 are connected as chip selects
520 */
521 .num_chipselect = 5,
522};
523
Lee Jones18403422012-02-06 11:22:21 -0800524static void __init mop500_spi_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530525{
Lee Jones15daf692012-03-15 16:47:11 +0000526 db8500_add_ssp0(parent, &ssp0_plat);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530527}
528
Linus Walleij5d7b8462010-10-14 13:57:59 +0200529#ifdef CONFIG_STE_DMA40
530static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
531 .mode = STEDMA40_MODE_LOGICAL,
532 .dir = STEDMA40_PERIPH_TO_MEM,
533 .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
534 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
535 .src_info.data_width = STEDMA40_BYTE_WIDTH,
536 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
537};
538
539static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
540 .mode = STEDMA40_MODE_LOGICAL,
541 .dir = STEDMA40_MEM_TO_PERIPH,
542 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
543 .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
544 .src_info.data_width = STEDMA40_BYTE_WIDTH,
545 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
546};
547
548static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
549 .mode = STEDMA40_MODE_LOGICAL,
550 .dir = STEDMA40_PERIPH_TO_MEM,
551 .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
552 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
553 .src_info.data_width = STEDMA40_BYTE_WIDTH,
554 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
555};
556
557static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
558 .mode = STEDMA40_MODE_LOGICAL,
559 .dir = STEDMA40_MEM_TO_PERIPH,
560 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
561 .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
562 .src_info.data_width = STEDMA40_BYTE_WIDTH,
563 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
564};
565
566static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
567 .mode = STEDMA40_MODE_LOGICAL,
568 .dir = STEDMA40_PERIPH_TO_MEM,
569 .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
570 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
571 .src_info.data_width = STEDMA40_BYTE_WIDTH,
572 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
573};
574
575static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
576 .mode = STEDMA40_MODE_LOGICAL,
577 .dir = STEDMA40_MEM_TO_PERIPH,
578 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
579 .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
580 .src_info.data_width = STEDMA40_BYTE_WIDTH,
581 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
582};
583#endif
584
Lee Jonesfa86a762012-09-27 10:17:36 +0100585struct amba_pl011_data uart0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200586#ifdef CONFIG_STE_DMA40
587 .dma_filter = stedma40_filter,
588 .dma_rx_param = &uart0_dma_cfg_rx,
589 .dma_tx_param = &uart0_dma_cfg_tx,
590#endif
591};
592
Lee Jonesfa86a762012-09-27 10:17:36 +0100593struct amba_pl011_data uart1_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200594#ifdef CONFIG_STE_DMA40
595 .dma_filter = stedma40_filter,
596 .dma_rx_param = &uart1_dma_cfg_rx,
597 .dma_tx_param = &uart1_dma_cfg_tx,
598#endif
599};
600
Lee Jonesfa86a762012-09-27 10:17:36 +0100601struct amba_pl011_data uart2_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200602#ifdef CONFIG_STE_DMA40
603 .dma_filter = stedma40_filter,
604 .dma_rx_param = &uart2_dma_cfg_rx,
605 .dma_tx_param = &uart2_dma_cfg_tx,
606#endif
607};
608
Lee Jones18403422012-02-06 11:22:21 -0800609static void __init mop500_uart_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530610{
Linus Walleij78d80c52012-05-23 21:18:46 +0200611 db8500_add_uart0(parent, &uart0_plat);
Lee Jones18403422012-02-06 11:22:21 -0800612 db8500_add_uart1(parent, &uart1_plat);
613 db8500_add_uart2(parent, &uart2_plat);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530614}
615
Andreas Westin585d1882012-05-10 10:14:06 +0200616static void __init u8500_cryp1_hash1_init(struct device *parent)
617{
618 db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
619 db8500_add_hash1(parent, &u8500_hash1_platform_data);
620}
621
Robert Marklund350abe02011-06-20 15:55:46 +0200622static struct platform_device *snowball_platform_devs[] __initdata = {
623 &snowball_led_dev,
624 &snowball_key_dev,
Lee Jonese6fada52012-05-17 13:18:36 +0100625 &snowball_sbnet_dev,
Lee Jones0b5ea1e2012-09-03 14:33:39 +0100626 &snowball_gpio_en_3v3_regulator_dev,
hongbo.zhangdc1956b2012-11-15 18:56:43 +0800627 &u8500_thsens_device,
628 &u8500_cpufreq_cooling_device,
Robert Marklund350abe02011-06-20 15:55:46 +0200629};
630
Linus Walleij4b4f7572011-02-15 15:01:35 +0100631static void __init mop500_init_machine(void)
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100632{
Lee Jones18403422012-02-06 11:22:21 -0800633 struct device *parent = NULL;
Linus Walleijcf568c52011-03-30 14:31:42 +0200634 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800635 int i;
Linus Walleijcf568c52011-03-30 14:31:42 +0200636
Lee Jones110c2c22011-08-26 16:54:07 +0100637 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
Linus Walleij4b4f7572011-02-15 15:01:35 +0100638
Linus Walleijed781d392012-05-03 00:44:52 +0200639 mop500_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200640 parent = u8500_init_devices(&ab8500_platdata);
Rabin Vincentea05a572010-06-03 07:58:42 +0100641
Lee Jonesb024a0c2012-02-06 11:22:25 -0800642 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
643 mop500_platform_devs[i]->dev.parent = parent;
644
Lee Jones110c2c22011-08-26 16:54:07 +0100645 platform_add_devices(mop500_platform_devs,
646 ARRAY_SIZE(mop500_platform_devs));
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100647
Lee Jones18403422012-02-06 11:22:21 -0800648 mop500_i2c_init(parent);
649 mop500_sdi_init(parent);
650 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100651 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800652 mop500_uart_init(parent);
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100653
Andreas Westin585d1882012-05-10 10:14:06 +0200654 u8500_cryp1_hash1_init(parent);
655
Linus Walleijcf568c52011-03-30 14:31:42 +0200656 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
Lee Jones110c2c22011-08-26 16:54:07 +0100657
658 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
659 i2c_register_board_info(2, mop500_i2c2_devices,
660 ARRAY_SIZE(mop500_i2c2_devices));
661
662 /* This board has full regulator constraints */
663 regulator_has_full_constraints();
664}
665
666static void __init snowball_init_machine(void)
667{
Lee Jones18403422012-02-06 11:22:21 -0800668 struct device *parent = NULL;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800669 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100670
Linus Walleijed781d392012-05-03 00:44:52 +0200671 snowball_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200672 parent = u8500_init_devices(&ab8500_platdata);
Lee Jones110c2c22011-08-26 16:54:07 +0100673
Lee Jonesb024a0c2012-02-06 11:22:25 -0800674 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
675 snowball_platform_devs[i]->dev.parent = parent;
676
Lee Jones110c2c22011-08-26 16:54:07 +0100677 platform_add_devices(snowball_platform_devs,
678 ARRAY_SIZE(snowball_platform_devs));
679
Lee Jones18403422012-02-06 11:22:21 -0800680 mop500_i2c_init(parent);
681 snowball_sdi_init(parent);
682 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100683 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800684 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100685
Lee Jones110c2c22011-08-26 16:54:07 +0100686 /* This board has full regulator constraints */
687 regulator_has_full_constraints();
688}
689
690static void __init hrefv60_init_machine(void)
691{
Lee Jones18403422012-02-06 11:22:21 -0800692 struct device *parent = NULL;
Lee Jones110c2c22011-08-26 16:54:07 +0100693 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800694 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100695
696 /*
697 * The HREFv60 board removed a GPIO expander and routed
698 * all these GPIO pins to the internal GPIO controller
699 * instead.
700 */
701 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
702
Linus Walleijed781d392012-05-03 00:44:52 +0200703 hrefv60_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200704 parent = u8500_init_devices(&ab8500_platdata);
Lee Jones110c2c22011-08-26 16:54:07 +0100705
Lee Jonesb024a0c2012-02-06 11:22:25 -0800706 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
707 mop500_platform_devs[i]->dev.parent = parent;
708
Lee Jones110c2c22011-08-26 16:54:07 +0100709 platform_add_devices(mop500_platform_devs,
710 ARRAY_SIZE(mop500_platform_devs));
711
Lee Jones18403422012-02-06 11:22:21 -0800712 mop500_i2c_init(parent);
713 hrefv60_sdi_init(parent);
714 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100715 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800716 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100717
718 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
719
720 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
Linus Walleijcf568c52011-03-30 14:31:42 +0200721
722 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100723 i2c_register_board_info(2, mop500_i2c2_devices,
724 ARRAY_SIZE(mop500_i2c2_devices));
Linus Walleijdb245202011-04-04 10:44:51 +0200725
726 /* This board has full regulator constraints */
727 regulator_has_full_constraints();
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100728}
729
730MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
731 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400732 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100733 .smp = smp_ops(ux500_smp_ops),
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100734 .map_io = u8500_map_io,
Rabin Vincent178980f2010-05-03 07:39:02 +0100735 .init_irq = ux500_init_irq,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100736 /* we re-use nomadik timer here */
Rabin Vincent41ac3292010-05-03 08:28:05 +0100737 .timer = &ux500_timer,
Marc Zyngierbbf5f382011-09-06 10:23:45 +0100738 .handle_irq = gic_handle_irq,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100739 .init_machine = mop500_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800740 .init_late = ux500_init_late,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100741MACHINE_END
742
Linus Walleija3a6c6a2012-10-01 09:37:39 +0200743MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520")
744 .atag_offset = 0x100,
745 .map_io = u8500_map_io,
746 .init_irq = ux500_init_irq,
747 .timer = &ux500_timer,
748 .handle_irq = gic_handle_irq,
749 .init_machine = mop500_init_machine,
750 .init_late = ux500_init_late,
751MACHINE_END
752
Linus Walleij4b4f7572011-02-15 15:01:35 +0100753MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400754 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100755 .smp = smp_ops(ux500_smp_ops),
Linus Walleij4b4f7572011-02-15 15:01:35 +0100756 .map_io = u8500_map_io,
757 .init_irq = ux500_init_irq,
758 .timer = &ux500_timer,
Marc Zyngierbbf5f382011-09-06 10:23:45 +0100759 .handle_irq = gic_handle_irq,
Lee Jones110c2c22011-08-26 16:54:07 +0100760 .init_machine = hrefv60_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800761 .init_late = ux500_init_late,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100762MACHINE_END
Robert Marklund350abe02011-06-20 15:55:46 +0200763
764MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400765 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100766 .smp = smp_ops(ux500_smp_ops),
Robert Marklund350abe02011-06-20 15:55:46 +0200767 .map_io = u8500_map_io,
768 .init_irq = ux500_init_irq,
769 /* we re-use nomadik timer here */
770 .timer = &ux500_timer,
Marc Zyngierbbf5f382011-09-06 10:23:45 +0100771 .handle_irq = gic_handle_irq,
Lee Jones110c2c22011-08-26 16:54:07 +0100772 .init_machine = snowball_init_machine,
Lee Jones0ddf8552012-09-25 16:03:45 +0100773 .init_late = NULL,
Robert Marklund350abe02011-06-20 15:55:46 +0200774MACHINE_END