blob: 87d2d7b38ce90742a0a1b9d3ccda2e0271c1f5fb [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>
Lee Jones265c3c02013-03-27 14:13:53 +000015#include <linux/clk.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010016#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>
hongbo.zhangdc1956b2012-11-15 18:56:43 +080019#include <linux/platform_data/db8500_thermal.h>
Rabin Vincentea05a572010-06-03 07:58:42 +010020#include <linux/gpio.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010021#include <linux/amba/bus.h>
22#include <linux/amba/pl022.h>
Linus Walleij5d7b8462010-10-14 13:57:59 +020023#include <linux/amba/serial.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010024#include <linux/spi/spi.h>
Linus Walleijee66e652011-12-02 14:16:33 +010025#include <linux/mfd/abx500/ab8500.h>
Bengt Jonsson79568b942011-03-11 11:54:46 +010026#include <linux/regulator/ab8500.h>
Lee Jones0b5ea1e2012-09-03 14:33:39 +010027#include <linux/regulator/fixed.h>
Sundar Iyer20406eb2010-12-13 09:33:14 +053028#include <linux/mfd/tc3589x.h>
Linus Walleijfe67dfc2011-03-07 11:48:15 +010029#include <linux/mfd/tps6105x.h>
Linus Walleijee66e652011-12-02 14:16:33 +010030#include <linux/mfd/abx500/ab8500-gpio.h>
Ola Liljaf242e502012-06-07 14:00:46 +020031#include <linux/mfd/abx500/ab8500-codec.h>
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +090032#include <linux/platform_data/leds-lp55xx.h>
Philippe Langlaisa71b8192011-01-14 10:53:59 +010033#include <linux/input.h>
Robert Marklund350abe02011-06-20 15:55:46 +020034#include <linux/smsc911x.h>
Philippe Langlaisa71b8192011-01-14 10:53:59 +010035#include <linux/gpio_keys.h>
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +020036#include <linux/delay.h>
Robert Marklund350abe02011-06-20 15:55:46 +020037#include <linux/leds.h>
Linus Walleija0980662012-05-07 01:33:24 +020038#include <linux/pinctrl/consumer.h>
Linus Walleijbb16bd92012-10-10 14:27:58 +020039#include <linux/platform_data/pinctrl-nomadik.h>
Linus Walleij865fab62012-10-18 14:20:16 +020040#include <linux/platform_data/dma-ste-dma40.h>
Linus Walleija0980662012-05-07 01:33:24 +020041
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010042#include <asm/mach-types.h>
43#include <asm/mach/arch.h>
44
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 Vincentfbf1eadf2010-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};
96
Ola Liljaf242e502012-06-07 14:00:46 +020097/* ab8500-codec */
98static struct ab8500_codec_platform_data ab8500_codec_pdata = {
99 .amics = {
100 .mic1_type = AMIC_TYPE_DIFFERENTIAL,
101 .mic2_type = AMIC_TYPE_DIFFERENTIAL,
102 .mic1a_micbias = AMIC_MICBIAS_VAMIC1,
103 .mic1b_micbias = AMIC_MICBIAS_VAMIC1,
104 .mic2_micbias = AMIC_MICBIAS_VAMIC2
105 },
106 .ear_cmv = EAR_CMV_0_95V
107};
108
Robert Marklund350abe02011-06-20 15:55:46 +0200109static struct gpio_keys_button snowball_key_array[] = {
110 {
111 .gpio = 32,
112 .type = EV_KEY,
113 .code = KEY_1,
114 .desc = "userpb",
115 .active_low = 1,
116 .debounce_interval = 50,
117 .wakeup = 1,
118 },
119 {
120 .gpio = 151,
121 .type = EV_KEY,
122 .code = KEY_2,
123 .desc = "extkb1",
124 .active_low = 1,
125 .debounce_interval = 50,
126 .wakeup = 1,
127 },
128 {
129 .gpio = 152,
130 .type = EV_KEY,
131 .code = KEY_3,
132 .desc = "extkb2",
133 .active_low = 1,
134 .debounce_interval = 50,
135 .wakeup = 1,
136 },
137 {
138 .gpio = 161,
139 .type = EV_KEY,
140 .code = KEY_4,
141 .desc = "extkb3",
142 .active_low = 1,
143 .debounce_interval = 50,
144 .wakeup = 1,
145 },
146 {
147 .gpio = 162,
148 .type = EV_KEY,
149 .code = KEY_5,
150 .desc = "extkb4",
151 .active_low = 1,
152 .debounce_interval = 50,
153 .wakeup = 1,
154 },
155};
156
157static struct gpio_keys_platform_data snowball_key_data = {
158 .buttons = snowball_key_array,
159 .nbuttons = ARRAY_SIZE(snowball_key_array),
160};
161
162static struct platform_device snowball_key_dev = {
163 .name = "gpio-keys",
164 .id = -1,
165 .dev = {
166 .platform_data = &snowball_key_data,
167 }
168};
169
170static struct smsc911x_platform_config snowball_sbnet_cfg = {
171 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
172 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
173 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
174 .shift = 1,
175};
176
177static struct resource sbnet_res[] = {
178 {
179 .name = "smsc911x-memory",
180 .start = (0x5000 << 16),
181 .end = (0x5000 << 16) + 0xffff,
182 .flags = IORESOURCE_MEM,
183 },
184 {
185 .start = NOMADIK_GPIO_TO_IRQ(140),
186 .end = NOMADIK_GPIO_TO_IRQ(140),
187 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
188 },
189};
190
191static struct platform_device snowball_sbnet_dev = {
192 .name = "smsc911x",
193 .num_resources = ARRAY_SIZE(sbnet_res),
194 .resource = sbnet_res,
195 .dev = {
196 .platform_data = &snowball_sbnet_cfg,
197 },
198};
199
Linus Walleij05ec2602013-02-07 10:17:31 +0100200struct ab8500_platform_data ab8500_platdata = {
Rabin Vincent39ae7022010-07-26 11:12:15 +0100201 .irq_base = MOP500_AB8500_IRQ_BASE,
Bengt Jonssondfa3a822011-03-09 13:34:17 +0100202 .regulator_reg_init = ab8500_regulator_reg_init,
203 .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
Bengt Jonssona1e516e2010-12-10 11:08:48 +0100204 .regulator = ab8500_regulators,
205 .num_regulator = ARRAY_SIZE(ab8500_regulators),
Bibek Basu3ef374a2011-02-15 12:56:16 +0530206 .gpio = &ab8500_gpio_pdata,
Ola Liljaf242e502012-06-07 14:00:46 +0200207 .codec = &ab8500_codec_pdata,
Rabin Vincent39ae7022010-07-26 11:12:15 +0100208};
209
Rabin Vincentb8410a12010-08-09 19:18:17 +0530210/*
hongbo.zhangdc1956b2012-11-15 18:56:43 +0800211 * Thermal Sensor
212 */
213
214static struct resource db8500_thsens_resources[] = {
215 {
216 .name = "IRQ_HOTMON_LOW",
217 .start = IRQ_PRCMU_HOTMON_LOW,
218 .end = IRQ_PRCMU_HOTMON_LOW,
219 .flags = IORESOURCE_IRQ,
220 },
221 {
222 .name = "IRQ_HOTMON_HIGH",
223 .start = IRQ_PRCMU_HOTMON_HIGH,
224 .end = IRQ_PRCMU_HOTMON_HIGH,
225 .flags = IORESOURCE_IRQ,
226 },
227};
228
229static struct db8500_thsens_platform_data db8500_thsens_data = {
230 .trip_points[0] = {
231 .temp = 70000,
232 .type = THERMAL_TRIP_ACTIVE,
233 .cdev_name = {
234 [0] = "thermal-cpufreq-0",
235 },
236 },
237 .trip_points[1] = {
238 .temp = 75000,
239 .type = THERMAL_TRIP_ACTIVE,
240 .cdev_name = {
241 [0] = "thermal-cpufreq-0",
242 },
243 },
244 .trip_points[2] = {
245 .temp = 80000,
246 .type = THERMAL_TRIP_ACTIVE,
247 .cdev_name = {
248 [0] = "thermal-cpufreq-0",
249 },
250 },
251 .trip_points[3] = {
252 .temp = 85000,
253 .type = THERMAL_TRIP_CRITICAL,
254 },
255 .num_trips = 4,
256};
257
258static struct platform_device u8500_thsens_device = {
259 .name = "db8500-thermal",
260 .resource = db8500_thsens_resources,
261 .num_resources = ARRAY_SIZE(db8500_thsens_resources),
262 .dev = {
263 .platform_data = &db8500_thsens_data,
264 },
265};
266
267static struct platform_device u8500_cpufreq_cooling_device = {
268 .name = "db8500-cpufreq-cooling",
269};
270
271/*
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100272 * TPS61052
273 */
274
275static struct tps6105x_platform_data mop500_tps61052_data = {
276 .mode = TPS6105X_MODE_VOLTAGE,
277 .regulator_data = &tps61052_regulator,
278};
279
280/*
Rabin Vincentb8410a12010-08-09 19:18:17 +0530281 * TC35892
282 */
283
Sundar Iyer20406eb2010-12-13 09:33:14 +0530284static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
Rabin Vincentb8410a12010-08-09 19:18:17 +0530285{
Lee Jones18403422012-02-06 11:22:21 -0800286 struct device *parent = NULL;
287#if 0
288 /* FIXME: Is the sdi actually part of tc3589x? */
289 parent = tc3589x->dev;
290#endif
291 mop500_sdi_tc35892_init(parent);
Rabin Vincentb8410a12010-08-09 19:18:17 +0530292}
293
Sundar Iyer20406eb2010-12-13 09:33:14 +0530294static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530295 .gpio_base = MOP500_EGPIO(0),
296 .setup = mop500_tc35892_init,
297};
298
Sundar Iyer20406eb2010-12-13 09:33:14 +0530299static struct tc3589x_platform_data mop500_tc35892_data = {
Sundar Iyer611b7592010-12-13 09:33:15 +0530300 .block = TC3589x_BLOCK_GPIO,
Rabin Vincentb8410a12010-08-09 19:18:17 +0530301 .gpio = &mop500_tc35892_gpio_data,
302 .irq_base = MOP500_EGPIO_IRQ_BASE,
303};
304
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900305static struct lp55xx_led_config lp5521_pri_led[] = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100306 [0] = {
307 .chan_nr = 0,
308 .led_current = 0x2f,
309 .max_current = 0x5f,
310 },
311 [1] = {
312 .chan_nr = 1,
313 .led_current = 0x2f,
314 .max_current = 0x5f,
315 },
316 [2] = {
317 .chan_nr = 2,
318 .led_current = 0x2f,
319 .max_current = 0x5f,
320 },
321};
322
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900323static struct lp55xx_platform_data __initdata lp5521_pri_data = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100324 .label = "lp5521_pri",
325 .led_config = &lp5521_pri_led[0],
326 .num_channels = 3,
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900327 .clock_mode = LP55XX_CLOCK_EXT,
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100328};
329
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900330static struct lp55xx_led_config lp5521_sec_led[] = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100331 [0] = {
332 .chan_nr = 0,
333 .led_current = 0x2f,
334 .max_current = 0x5f,
335 },
336 [1] = {
337 .chan_nr = 1,
338 .led_current = 0x2f,
339 .max_current = 0x5f,
340 },
341 [2] = {
342 .chan_nr = 2,
343 .led_current = 0x2f,
344 .max_current = 0x5f,
345 },
346};
347
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900348static struct lp55xx_platform_data __initdata lp5521_sec_data = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100349 .label = "lp5521_sec",
350 .led_config = &lp5521_sec_led[0],
351 .num_channels = 3,
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900352 .clock_mode = LP55XX_CLOCK_EXT,
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100353};
354
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100355static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530356 {
Sundar Iyer20406eb2010-12-13 09:33:14 +0530357 I2C_BOARD_INFO("tc3589x", 0x42),
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100358 .irq = NOMADIK_GPIO_TO_IRQ(217),
Rabin Vincentb8410a12010-08-09 19:18:17 +0530359 .platform_data = &mop500_tc35892_data,
360 },
Linus Walleijcf568c52011-03-30 14:31:42 +0200361 /* I2C0 devices only available prior to HREFv60 */
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100362 {
363 I2C_BOARD_INFO("tps61052", 0x33),
364 .platform_data = &mop500_tps61052_data,
365 },
366};
367
Linus Walleijcf568c52011-03-30 14:31:42 +0200368#define NUM_PRE_V60_I2C0_DEVICES 1
369
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100370static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
371 {
372 /* lp5521 LED driver, 1st device */
373 I2C_BOARD_INFO("lp5521", 0x33),
374 .platform_data = &lp5521_pri_data,
375 },
376 {
377 /* lp5521 LED driver, 2st device */
378 I2C_BOARD_INFO("lp5521", 0x34),
379 .platform_data = &lp5521_sec_data,
380 },
Lee Jonesbb3b2182011-01-13 14:41:22 +0000381 {
382 /* Light sensor Rohm BH1780GLI */
383 I2C_BOARD_INFO("bh1780", 0x29),
384 },
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100385};
386
Lee Jones18403422012-02-06 11:22:21 -0800387static void __init mop500_i2c_init(struct device *parent)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530388{
Lee Jones98582d92012-04-17 15:52:26 +0100389 db8500_add_i2c0(parent, NULL);
390 db8500_add_i2c1(parent, NULL);
391 db8500_add_i2c2(parent, NULL);
392 db8500_add_i2c3(parent, NULL);
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530393}
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100394
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100395static struct gpio_keys_button mop500_gpio_keys[] = {
396 {
397 .desc = "SFH7741 Proximity Sensor",
398 .type = EV_SW,
399 .code = SW_FRONT_PROXIMITY,
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100400 .active_low = 0,
401 .can_disable = 1,
402 }
403};
404
405static struct regulator *prox_regulator;
406static int mop500_prox_activate(struct device *dev);
407static void mop500_prox_deactivate(struct device *dev);
408
409static struct gpio_keys_platform_data mop500_gpio_keys_data = {
410 .buttons = mop500_gpio_keys,
411 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
412 .enable = mop500_prox_activate,
413 .disable = mop500_prox_deactivate,
414};
415
416static struct platform_device mop500_gpio_keys_device = {
417 .name = "gpio-keys",
418 .id = 0,
419 .dev = {
420 .platform_data = &mop500_gpio_keys_data,
421 },
422};
423
424static int mop500_prox_activate(struct device *dev)
425{
426 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
427 "vcc");
428 if (IS_ERR(prox_regulator)) {
429 dev_err(&mop500_gpio_keys_device.dev,
430 "no regulator\n");
431 return PTR_ERR(prox_regulator);
432 }
433 regulator_enable(prox_regulator);
434 return 0;
435}
436
437static void mop500_prox_deactivate(struct device *dev)
438{
439 regulator_disable(prox_regulator);
440 regulator_put(prox_regulator);
441}
442
Lee Jones265c3c02013-03-27 14:13:53 +0000443void mop500_snowball_ethernet_clock_enable(void)
444{
445 struct clk *clk;
446
447 clk = clk_get_sys("fsmc", NULL);
448 if (!IS_ERR(clk))
449 clk_prepare_enable(clk);
450}
451
Andreas Westin585d1882012-05-10 10:14:06 +0200452static struct cryp_platform_data u8500_cryp1_platform_data = {
453 .mem_to_engine = {
454 .dir = STEDMA40_MEM_TO_PERIPH,
455 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
456 .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
457 .src_info.data_width = STEDMA40_WORD_WIDTH,
458 .dst_info.data_width = STEDMA40_WORD_WIDTH,
459 .mode = STEDMA40_MODE_LOGICAL,
460 .src_info.psize = STEDMA40_PSIZE_LOG_4,
461 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
462 },
463 .engine_to_mem = {
464 .dir = STEDMA40_PERIPH_TO_MEM,
465 .src_dev_type = DB8500_DMA_DEV48_CAC1_RX,
466 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
467 .src_info.data_width = STEDMA40_WORD_WIDTH,
468 .dst_info.data_width = STEDMA40_WORD_WIDTH,
469 .mode = STEDMA40_MODE_LOGICAL,
470 .src_info.psize = STEDMA40_PSIZE_LOG_4,
471 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
472 }
473};
474
475static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
476 .dir = STEDMA40_MEM_TO_PERIPH,
477 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
478 .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
479 .src_info.data_width = STEDMA40_WORD_WIDTH,
480 .dst_info.data_width = STEDMA40_WORD_WIDTH,
481 .mode = STEDMA40_MODE_LOGICAL,
482 .src_info.psize = STEDMA40_PSIZE_LOG_16,
483 .dst_info.psize = STEDMA40_PSIZE_LOG_16,
484};
485
486static struct hash_platform_data u8500_hash1_platform_data = {
487 .mem_to_engine = &u8500_hash_dma_cfg_tx,
488 .dma_filter = stedma40_filter,
489};
490
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100491/* add any platform devices here - TODO */
Robert Marklund350abe02011-06-20 15:55:46 +0200492static struct platform_device *mop500_platform_devs[] __initdata = {
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100493 &mop500_gpio_keys_device,
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100494};
495
Linus Walleij5d7b8462010-10-14 13:57:59 +0200496#ifdef CONFIG_STE_DMA40
497static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
498 .mode = STEDMA40_MODE_LOGICAL,
499 .dir = STEDMA40_PERIPH_TO_MEM,
500 .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
501 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
502 .src_info.data_width = STEDMA40_BYTE_WIDTH,
503 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
504};
505
506static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
507 .mode = STEDMA40_MODE_LOGICAL,
508 .dir = STEDMA40_MEM_TO_PERIPH,
509 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
510 .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
511 .src_info.data_width = STEDMA40_BYTE_WIDTH,
512 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
513};
514#endif
515
Lee Jonesfa86a762012-09-27 10:17:36 +0100516struct pl022_ssp_controller ssp0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200517 .bus_id = 0,
518#ifdef CONFIG_STE_DMA40
519 .enable_dma = 1,
520 .dma_filter = stedma40_filter,
521 .dma_rx_param = &ssp0_dma_cfg_rx,
522 .dma_tx_param = &ssp0_dma_cfg_tx,
523#else
524 .enable_dma = 0,
525#endif
526 /* on this platform, gpio 31,142,144,214 &
527 * 224 are connected as chip selects
528 */
529 .num_chipselect = 5,
530};
531
Lee Jones18403422012-02-06 11:22:21 -0800532static void __init mop500_spi_init(struct device *parent)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530533{
Lee Jones15daf692012-03-15 16:47:11 +0000534 db8500_add_ssp0(parent, &ssp0_plat);
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530535}
536
Linus Walleij5d7b8462010-10-14 13:57:59 +0200537#ifdef CONFIG_STE_DMA40
538static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
539 .mode = STEDMA40_MODE_LOGICAL,
540 .dir = STEDMA40_PERIPH_TO_MEM,
541 .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
542 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
543 .src_info.data_width = STEDMA40_BYTE_WIDTH,
544 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
545};
546
547static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
548 .mode = STEDMA40_MODE_LOGICAL,
549 .dir = STEDMA40_MEM_TO_PERIPH,
550 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
551 .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
552 .src_info.data_width = STEDMA40_BYTE_WIDTH,
553 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
554};
555
556static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
557 .mode = STEDMA40_MODE_LOGICAL,
558 .dir = STEDMA40_PERIPH_TO_MEM,
559 .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
560 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
561 .src_info.data_width = STEDMA40_BYTE_WIDTH,
562 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
563};
564
565static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
566 .mode = STEDMA40_MODE_LOGICAL,
567 .dir = STEDMA40_MEM_TO_PERIPH,
568 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
569 .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
570 .src_info.data_width = STEDMA40_BYTE_WIDTH,
571 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
572};
573
574static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
575 .mode = STEDMA40_MODE_LOGICAL,
576 .dir = STEDMA40_PERIPH_TO_MEM,
577 .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
578 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
579 .src_info.data_width = STEDMA40_BYTE_WIDTH,
580 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
581};
582
583static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
584 .mode = STEDMA40_MODE_LOGICAL,
585 .dir = STEDMA40_MEM_TO_PERIPH,
586 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
587 .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
588 .src_info.data_width = STEDMA40_BYTE_WIDTH,
589 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
590};
591#endif
592
Lee Jonesfa86a762012-09-27 10:17:36 +0100593struct amba_pl011_data uart0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200594#ifdef CONFIG_STE_DMA40
595 .dma_filter = stedma40_filter,
596 .dma_rx_param = &uart0_dma_cfg_rx,
597 .dma_tx_param = &uart0_dma_cfg_tx,
598#endif
599};
600
Lee Jonesfa86a762012-09-27 10:17:36 +0100601struct amba_pl011_data uart1_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200602#ifdef CONFIG_STE_DMA40
603 .dma_filter = stedma40_filter,
604 .dma_rx_param = &uart1_dma_cfg_rx,
605 .dma_tx_param = &uart1_dma_cfg_tx,
606#endif
607};
608
Lee Jonesfa86a762012-09-27 10:17:36 +0100609struct amba_pl011_data uart2_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200610#ifdef CONFIG_STE_DMA40
611 .dma_filter = stedma40_filter,
612 .dma_rx_param = &uart2_dma_cfg_rx,
613 .dma_tx_param = &uart2_dma_cfg_tx,
614#endif
615};
616
Lee Jones18403422012-02-06 11:22:21 -0800617static void __init mop500_uart_init(struct device *parent)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530618{
Linus Walleij78d80c52012-05-23 21:18:46 +0200619 db8500_add_uart0(parent, &uart0_plat);
Lee Jones18403422012-02-06 11:22:21 -0800620 db8500_add_uart1(parent, &uart1_plat);
621 db8500_add_uart2(parent, &uart2_plat);
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530622}
623
Andreas Westin585d1882012-05-10 10:14:06 +0200624static void __init u8500_cryp1_hash1_init(struct device *parent)
625{
626 db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
627 db8500_add_hash1(parent, &u8500_hash1_platform_data);
628}
629
Robert Marklund350abe02011-06-20 15:55:46 +0200630static struct platform_device *snowball_platform_devs[] __initdata = {
631 &snowball_led_dev,
632 &snowball_key_dev,
Lee Jonese6fada52012-05-17 13:18:36 +0100633 &snowball_sbnet_dev,
Lee Jones0b5ea1e2012-09-03 14:33:39 +0100634 &snowball_gpio_en_3v3_regulator_dev,
hongbo.zhangdc1956b2012-11-15 18:56:43 +0800635 &u8500_thsens_device,
636 &u8500_cpufreq_cooling_device,
Robert Marklund350abe02011-06-20 15:55:46 +0200637};
638
Linus Walleij4b4f7572011-02-15 15:01:35 +0100639static void __init mop500_init_machine(void)
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100640{
Lee Jones18403422012-02-06 11:22:21 -0800641 struct device *parent = NULL;
Linus Walleijcf568c52011-03-30 14:31:42 +0200642 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800643 int i;
Linus Walleijcf568c52011-03-30 14:31:42 +0200644
Linus Walleij05ec2602013-02-07 10:17:31 +0100645 platform_device_register(&db8500_prcmu_device);
Lee Jones110c2c22011-08-26 16:54:07 +0100646 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
Linus Walleij4b4f7572011-02-15 15:01:35 +0100647
Linus Walleijed781d392012-05-03 00:44:52 +0200648 mop500_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200649 parent = u8500_init_devices(&ab8500_platdata);
Rabin Vincentea05a572010-06-03 07:58:42 +0100650
Lee Jonesb024a0c2012-02-06 11:22:25 -0800651 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
652 mop500_platform_devs[i]->dev.parent = parent;
653
Lee Jones110c2c22011-08-26 16:54:07 +0100654 platform_add_devices(mop500_platform_devs,
655 ARRAY_SIZE(mop500_platform_devs));
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100656
Lee Jones18403422012-02-06 11:22:21 -0800657 mop500_i2c_init(parent);
658 mop500_sdi_init(parent);
659 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100660 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800661 mop500_uart_init(parent);
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100662
Andreas Westin585d1882012-05-10 10:14:06 +0200663 u8500_cryp1_hash1_init(parent);
664
Linus Walleijcf568c52011-03-30 14:31:42 +0200665 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
Lee Jones110c2c22011-08-26 16:54:07 +0100666
667 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
668 i2c_register_board_info(2, mop500_i2c2_devices,
669 ARRAY_SIZE(mop500_i2c2_devices));
670
671 /* This board has full regulator constraints */
672 regulator_has_full_constraints();
673}
674
675static void __init snowball_init_machine(void)
676{
Lee Jones18403422012-02-06 11:22:21 -0800677 struct device *parent = NULL;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800678 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100679
Linus Walleij05ec2602013-02-07 10:17:31 +0100680 platform_device_register(&db8500_prcmu_device);
Linus Walleijed781d392012-05-03 00:44:52 +0200681 snowball_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200682 parent = u8500_init_devices(&ab8500_platdata);
Lee Jones110c2c22011-08-26 16:54:07 +0100683
Lee Jonesb024a0c2012-02-06 11:22:25 -0800684 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
685 snowball_platform_devs[i]->dev.parent = parent;
686
Lee Jones110c2c22011-08-26 16:54:07 +0100687 platform_add_devices(snowball_platform_devs,
688 ARRAY_SIZE(snowball_platform_devs));
689
Lee Jones18403422012-02-06 11:22:21 -0800690 mop500_i2c_init(parent);
691 snowball_sdi_init(parent);
692 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100693 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800694 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100695
Lee Jones265c3c02013-03-27 14:13:53 +0000696 mop500_snowball_ethernet_clock_enable();
697
Lee Jones110c2c22011-08-26 16:54:07 +0100698 /* This board has full regulator constraints */
699 regulator_has_full_constraints();
700}
701
702static void __init hrefv60_init_machine(void)
703{
Lee Jones18403422012-02-06 11:22:21 -0800704 struct device *parent = NULL;
Lee Jones110c2c22011-08-26 16:54:07 +0100705 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800706 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100707
Linus Walleij05ec2602013-02-07 10:17:31 +0100708 platform_device_register(&db8500_prcmu_device);
Lee Jones110c2c22011-08-26 16:54:07 +0100709 /*
710 * The HREFv60 board removed a GPIO expander and routed
711 * all these GPIO pins to the internal GPIO controller
712 * instead.
713 */
714 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
715
Linus Walleijed781d392012-05-03 00:44:52 +0200716 hrefv60_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200717 parent = u8500_init_devices(&ab8500_platdata);
Lee Jones110c2c22011-08-26 16:54:07 +0100718
Lee Jonesb024a0c2012-02-06 11:22:25 -0800719 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
720 mop500_platform_devs[i]->dev.parent = parent;
721
Lee Jones110c2c22011-08-26 16:54:07 +0100722 platform_add_devices(mop500_platform_devs,
723 ARRAY_SIZE(mop500_platform_devs));
724
Lee Jones18403422012-02-06 11:22:21 -0800725 mop500_i2c_init(parent);
726 hrefv60_sdi_init(parent);
727 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100728 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800729 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100730
731 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
732
733 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
Linus Walleijcf568c52011-03-30 14:31:42 +0200734
735 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100736 i2c_register_board_info(2, mop500_i2c2_devices,
737 ARRAY_SIZE(mop500_i2c2_devices));
Linus Walleijdb245202011-04-04 10:44:51 +0200738
739 /* This board has full regulator constraints */
740 regulator_has_full_constraints();
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100741}
742
743MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
744 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400745 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100746 .smp = smp_ops(ux500_smp_ops),
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100747 .map_io = u8500_map_io,
Rabin Vincent178980f2010-05-03 07:39:02 +0100748 .init_irq = ux500_init_irq,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100749 /* we re-use nomadik timer here */
Stephen Warren6bb27d72012-11-08 12:40:59 -0700750 .init_time = ux500_timer_init,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100751 .init_machine = mop500_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800752 .init_late = ux500_init_late,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100753MACHINE_END
754
Linus Walleija3a6c6a2012-10-01 09:37:39 +0200755MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520")
756 .atag_offset = 0x100,
757 .map_io = u8500_map_io,
758 .init_irq = ux500_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700759 .init_time = ux500_timer_init,
Linus Walleija3a6c6a2012-10-01 09:37:39 +0200760 .init_machine = mop500_init_machine,
761 .init_late = ux500_init_late,
762MACHINE_END
763
Linus Walleij4b4f7572011-02-15 15:01:35 +0100764MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
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),
Linus Walleij4b4f7572011-02-15 15:01:35 +0100767 .map_io = u8500_map_io,
768 .init_irq = ux500_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700769 .init_time = ux500_timer_init,
Lee Jones110c2c22011-08-26 16:54:07 +0100770 .init_machine = hrefv60_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800771 .init_late = ux500_init_late,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100772MACHINE_END
Robert Marklund350abe02011-06-20 15:55:46 +0200773
774MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400775 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100776 .smp = smp_ops(ux500_smp_ops),
Robert Marklund350abe02011-06-20 15:55:46 +0200777 .map_io = u8500_map_io,
778 .init_irq = ux500_init_irq,
779 /* we re-use nomadik timer here */
Stephen Warren6bb27d72012-11-08 12:40:59 -0700780 .init_time = ux500_timer_init,
Lee Jones110c2c22011-08-26 16:54:07 +0100781 .init_machine = snowball_init_machine,
Lee Jones0ddf8552012-09-25 16:03:45 +0100782 .init_late = NULL,
Robert Marklund350abe02011-06-20 15:55:46 +0200783MACHINE_END