blob: ce672378a83058c855a5fa053e413b3be1bb2f52 [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 Jonsson79568b92011-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 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};
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,
Lee Jonesc4e67bb2013-04-02 13:24:19 +0100202 .regulator = &ab8500_regulator_plat_data,
Bibek Basu3ef374a2011-02-15 12:56:16 +0530203 .gpio = &ab8500_gpio_pdata,
Ola Liljaf242e502012-06-07 14:00:46 +0200204 .codec = &ab8500_codec_pdata,
Rabin Vincent39ae7022010-07-26 11:12:15 +0100205};
206
Rabin Vincentb8410a12010-08-09 19:18:17 +0530207/*
hongbo.zhangdc1956b2012-11-15 18:56:43 +0800208 * Thermal Sensor
209 */
210
211static struct resource db8500_thsens_resources[] = {
212 {
213 .name = "IRQ_HOTMON_LOW",
214 .start = IRQ_PRCMU_HOTMON_LOW,
215 .end = IRQ_PRCMU_HOTMON_LOW,
216 .flags = IORESOURCE_IRQ,
217 },
218 {
219 .name = "IRQ_HOTMON_HIGH",
220 .start = IRQ_PRCMU_HOTMON_HIGH,
221 .end = IRQ_PRCMU_HOTMON_HIGH,
222 .flags = IORESOURCE_IRQ,
223 },
224};
225
226static struct db8500_thsens_platform_data db8500_thsens_data = {
227 .trip_points[0] = {
228 .temp = 70000,
229 .type = THERMAL_TRIP_ACTIVE,
230 .cdev_name = {
231 [0] = "thermal-cpufreq-0",
232 },
233 },
234 .trip_points[1] = {
235 .temp = 75000,
236 .type = THERMAL_TRIP_ACTIVE,
237 .cdev_name = {
238 [0] = "thermal-cpufreq-0",
239 },
240 },
241 .trip_points[2] = {
242 .temp = 80000,
243 .type = THERMAL_TRIP_ACTIVE,
244 .cdev_name = {
245 [0] = "thermal-cpufreq-0",
246 },
247 },
248 .trip_points[3] = {
249 .temp = 85000,
250 .type = THERMAL_TRIP_CRITICAL,
251 },
252 .num_trips = 4,
253};
254
255static struct platform_device u8500_thsens_device = {
256 .name = "db8500-thermal",
257 .resource = db8500_thsens_resources,
258 .num_resources = ARRAY_SIZE(db8500_thsens_resources),
259 .dev = {
260 .platform_data = &db8500_thsens_data,
261 },
262};
263
264static struct platform_device u8500_cpufreq_cooling_device = {
265 .name = "db8500-cpufreq-cooling",
266};
267
268/*
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100269 * TPS61052
270 */
271
272static struct tps6105x_platform_data mop500_tps61052_data = {
273 .mode = TPS6105X_MODE_VOLTAGE,
274 .regulator_data = &tps61052_regulator,
275};
276
277/*
Rabin Vincentb8410a12010-08-09 19:18:17 +0530278 * TC35892
279 */
280
Sundar Iyer20406eb2010-12-13 09:33:14 +0530281static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
Rabin Vincentb8410a12010-08-09 19:18:17 +0530282{
Lee Jones18403422012-02-06 11:22:21 -0800283 struct device *parent = NULL;
284#if 0
285 /* FIXME: Is the sdi actually part of tc3589x? */
286 parent = tc3589x->dev;
287#endif
288 mop500_sdi_tc35892_init(parent);
Rabin Vincentb8410a12010-08-09 19:18:17 +0530289}
290
Sundar Iyer20406eb2010-12-13 09:33:14 +0530291static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530292 .gpio_base = MOP500_EGPIO(0),
293 .setup = mop500_tc35892_init,
294};
295
Sundar Iyer20406eb2010-12-13 09:33:14 +0530296static struct tc3589x_platform_data mop500_tc35892_data = {
Sundar Iyer611b7592010-12-13 09:33:15 +0530297 .block = TC3589x_BLOCK_GPIO,
Rabin Vincentb8410a12010-08-09 19:18:17 +0530298 .gpio = &mop500_tc35892_gpio_data,
299 .irq_base = MOP500_EGPIO_IRQ_BASE,
300};
301
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900302static struct lp55xx_led_config lp5521_pri_led[] = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100303 [0] = {
304 .chan_nr = 0,
305 .led_current = 0x2f,
306 .max_current = 0x5f,
307 },
308 [1] = {
309 .chan_nr = 1,
310 .led_current = 0x2f,
311 .max_current = 0x5f,
312 },
313 [2] = {
314 .chan_nr = 2,
315 .led_current = 0x2f,
316 .max_current = 0x5f,
317 },
318};
319
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900320static struct lp55xx_platform_data __initdata lp5521_pri_data = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100321 .label = "lp5521_pri",
322 .led_config = &lp5521_pri_led[0],
323 .num_channels = 3,
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900324 .clock_mode = LP55XX_CLOCK_EXT,
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100325};
326
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900327static struct lp55xx_led_config lp5521_sec_led[] = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100328 [0] = {
329 .chan_nr = 0,
330 .led_current = 0x2f,
331 .max_current = 0x5f,
332 },
333 [1] = {
334 .chan_nr = 1,
335 .led_current = 0x2f,
336 .max_current = 0x5f,
337 },
338 [2] = {
339 .chan_nr = 2,
340 .led_current = 0x2f,
341 .max_current = 0x5f,
342 },
343};
344
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900345static struct lp55xx_platform_data __initdata lp5521_sec_data = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100346 .label = "lp5521_sec",
347 .led_config = &lp5521_sec_led[0],
348 .num_channels = 3,
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900349 .clock_mode = LP55XX_CLOCK_EXT,
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100350};
351
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100352static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530353 {
Sundar Iyer20406eb2010-12-13 09:33:14 +0530354 I2C_BOARD_INFO("tc3589x", 0x42),
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100355 .irq = NOMADIK_GPIO_TO_IRQ(217),
Rabin Vincentb8410a12010-08-09 19:18:17 +0530356 .platform_data = &mop500_tc35892_data,
357 },
Linus Walleijcf568c52011-03-30 14:31:42 +0200358 /* I2C0 devices only available prior to HREFv60 */
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100359 {
360 I2C_BOARD_INFO("tps61052", 0x33),
361 .platform_data = &mop500_tps61052_data,
362 },
363};
364
Linus Walleijcf568c52011-03-30 14:31:42 +0200365#define NUM_PRE_V60_I2C0_DEVICES 1
366
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100367static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
368 {
369 /* lp5521 LED driver, 1st device */
370 I2C_BOARD_INFO("lp5521", 0x33),
371 .platform_data = &lp5521_pri_data,
372 },
373 {
374 /* lp5521 LED driver, 2st device */
375 I2C_BOARD_INFO("lp5521", 0x34),
376 .platform_data = &lp5521_sec_data,
377 },
Lee Jonesbb3b2182011-01-13 14:41:22 +0000378 {
379 /* Light sensor Rohm BH1780GLI */
380 I2C_BOARD_INFO("bh1780", 0x29),
381 },
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100382};
383
Lee Jones18403422012-02-06 11:22:21 -0800384static void __init mop500_i2c_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530385{
Lee Jones98582d92012-04-17 15:52:26 +0100386 db8500_add_i2c0(parent, NULL);
387 db8500_add_i2c1(parent, NULL);
388 db8500_add_i2c2(parent, NULL);
389 db8500_add_i2c3(parent, NULL);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530390}
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100391
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100392static struct gpio_keys_button mop500_gpio_keys[] = {
393 {
394 .desc = "SFH7741 Proximity Sensor",
395 .type = EV_SW,
396 .code = SW_FRONT_PROXIMITY,
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100397 .active_low = 0,
398 .can_disable = 1,
399 }
400};
401
402static struct regulator *prox_regulator;
403static int mop500_prox_activate(struct device *dev);
404static void mop500_prox_deactivate(struct device *dev);
405
406static struct gpio_keys_platform_data mop500_gpio_keys_data = {
407 .buttons = mop500_gpio_keys,
408 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
409 .enable = mop500_prox_activate,
410 .disable = mop500_prox_deactivate,
411};
412
413static struct platform_device mop500_gpio_keys_device = {
414 .name = "gpio-keys",
415 .id = 0,
416 .dev = {
417 .platform_data = &mop500_gpio_keys_data,
418 },
419};
420
421static int mop500_prox_activate(struct device *dev)
422{
423 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
424 "vcc");
425 if (IS_ERR(prox_regulator)) {
426 dev_err(&mop500_gpio_keys_device.dev,
427 "no regulator\n");
428 return PTR_ERR(prox_regulator);
429 }
430 regulator_enable(prox_regulator);
431 return 0;
432}
433
434static void mop500_prox_deactivate(struct device *dev)
435{
436 regulator_disable(prox_regulator);
437 regulator_put(prox_regulator);
438}
439
Lee Jones265c3c02013-03-27 14:13:53 +0000440void mop500_snowball_ethernet_clock_enable(void)
441{
442 struct clk *clk;
443
444 clk = clk_get_sys("fsmc", NULL);
445 if (!IS_ERR(clk))
446 clk_prepare_enable(clk);
447}
448
Andreas Westin585d1882012-05-10 10:14:06 +0200449static struct cryp_platform_data u8500_cryp1_platform_data = {
450 .mem_to_engine = {
451 .dir = STEDMA40_MEM_TO_PERIPH,
452 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
453 .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
454 .src_info.data_width = STEDMA40_WORD_WIDTH,
455 .dst_info.data_width = STEDMA40_WORD_WIDTH,
456 .mode = STEDMA40_MODE_LOGICAL,
457 .src_info.psize = STEDMA40_PSIZE_LOG_4,
458 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
459 },
460 .engine_to_mem = {
461 .dir = STEDMA40_PERIPH_TO_MEM,
462 .src_dev_type = DB8500_DMA_DEV48_CAC1_RX,
463 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
464 .src_info.data_width = STEDMA40_WORD_WIDTH,
465 .dst_info.data_width = STEDMA40_WORD_WIDTH,
466 .mode = STEDMA40_MODE_LOGICAL,
467 .src_info.psize = STEDMA40_PSIZE_LOG_4,
468 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
469 }
470};
471
472static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
473 .dir = STEDMA40_MEM_TO_PERIPH,
474 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
475 .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
476 .src_info.data_width = STEDMA40_WORD_WIDTH,
477 .dst_info.data_width = STEDMA40_WORD_WIDTH,
478 .mode = STEDMA40_MODE_LOGICAL,
479 .src_info.psize = STEDMA40_PSIZE_LOG_16,
480 .dst_info.psize = STEDMA40_PSIZE_LOG_16,
481};
482
483static struct hash_platform_data u8500_hash1_platform_data = {
484 .mem_to_engine = &u8500_hash_dma_cfg_tx,
485 .dma_filter = stedma40_filter,
486};
487
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100488/* add any platform devices here - TODO */
Robert Marklund350abe02011-06-20 15:55:46 +0200489static struct platform_device *mop500_platform_devs[] __initdata = {
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100490 &mop500_gpio_keys_device,
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100491};
492
Linus Walleij5d7b8462010-10-14 13:57:59 +0200493#ifdef CONFIG_STE_DMA40
494static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
495 .mode = STEDMA40_MODE_LOGICAL,
496 .dir = STEDMA40_PERIPH_TO_MEM,
497 .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
498 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
499 .src_info.data_width = STEDMA40_BYTE_WIDTH,
500 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
501};
502
503static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
504 .mode = STEDMA40_MODE_LOGICAL,
505 .dir = STEDMA40_MEM_TO_PERIPH,
506 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
507 .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
508 .src_info.data_width = STEDMA40_BYTE_WIDTH,
509 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
510};
511#endif
512
Lee Jonesfa86a762012-09-27 10:17:36 +0100513struct pl022_ssp_controller ssp0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200514 .bus_id = 0,
515#ifdef CONFIG_STE_DMA40
516 .enable_dma = 1,
517 .dma_filter = stedma40_filter,
518 .dma_rx_param = &ssp0_dma_cfg_rx,
519 .dma_tx_param = &ssp0_dma_cfg_tx,
520#else
521 .enable_dma = 0,
522#endif
523 /* on this platform, gpio 31,142,144,214 &
524 * 224 are connected as chip selects
525 */
526 .num_chipselect = 5,
527};
528
Lee Jones18403422012-02-06 11:22:21 -0800529static void __init mop500_spi_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530530{
Lee Jones15daf692012-03-15 16:47:11 +0000531 db8500_add_ssp0(parent, &ssp0_plat);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530532}
533
Linus Walleij5d7b8462010-10-14 13:57:59 +0200534#ifdef CONFIG_STE_DMA40
535static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
536 .mode = STEDMA40_MODE_LOGICAL,
537 .dir = STEDMA40_PERIPH_TO_MEM,
538 .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
539 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
540 .src_info.data_width = STEDMA40_BYTE_WIDTH,
541 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
542};
543
544static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
545 .mode = STEDMA40_MODE_LOGICAL,
546 .dir = STEDMA40_MEM_TO_PERIPH,
547 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
548 .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
549 .src_info.data_width = STEDMA40_BYTE_WIDTH,
550 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
551};
552
553static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
554 .mode = STEDMA40_MODE_LOGICAL,
555 .dir = STEDMA40_PERIPH_TO_MEM,
556 .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
557 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
558 .src_info.data_width = STEDMA40_BYTE_WIDTH,
559 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
560};
561
562static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
563 .mode = STEDMA40_MODE_LOGICAL,
564 .dir = STEDMA40_MEM_TO_PERIPH,
565 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
566 .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
567 .src_info.data_width = STEDMA40_BYTE_WIDTH,
568 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
569};
570
571static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
572 .mode = STEDMA40_MODE_LOGICAL,
573 .dir = STEDMA40_PERIPH_TO_MEM,
574 .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
575 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
576 .src_info.data_width = STEDMA40_BYTE_WIDTH,
577 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
578};
579
580static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
581 .mode = STEDMA40_MODE_LOGICAL,
582 .dir = STEDMA40_MEM_TO_PERIPH,
583 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
584 .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
585 .src_info.data_width = STEDMA40_BYTE_WIDTH,
586 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
587};
588#endif
589
Lee Jonesfa86a762012-09-27 10:17:36 +0100590struct amba_pl011_data uart0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200591#ifdef CONFIG_STE_DMA40
592 .dma_filter = stedma40_filter,
593 .dma_rx_param = &uart0_dma_cfg_rx,
594 .dma_tx_param = &uart0_dma_cfg_tx,
595#endif
596};
597
Lee Jonesfa86a762012-09-27 10:17:36 +0100598struct amba_pl011_data uart1_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200599#ifdef CONFIG_STE_DMA40
600 .dma_filter = stedma40_filter,
601 .dma_rx_param = &uart1_dma_cfg_rx,
602 .dma_tx_param = &uart1_dma_cfg_tx,
603#endif
604};
605
Lee Jonesfa86a762012-09-27 10:17:36 +0100606struct amba_pl011_data uart2_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200607#ifdef CONFIG_STE_DMA40
608 .dma_filter = stedma40_filter,
609 .dma_rx_param = &uart2_dma_cfg_rx,
610 .dma_tx_param = &uart2_dma_cfg_tx,
611#endif
612};
613
Lee Jones18403422012-02-06 11:22:21 -0800614static void __init mop500_uart_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530615{
Linus Walleij78d80c52012-05-23 21:18:46 +0200616 db8500_add_uart0(parent, &uart0_plat);
Lee Jones18403422012-02-06 11:22:21 -0800617 db8500_add_uart1(parent, &uart1_plat);
618 db8500_add_uart2(parent, &uart2_plat);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530619}
620
Andreas Westin585d1882012-05-10 10:14:06 +0200621static void __init u8500_cryp1_hash1_init(struct device *parent)
622{
623 db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
624 db8500_add_hash1(parent, &u8500_hash1_platform_data);
625}
626
Robert Marklund350abe02011-06-20 15:55:46 +0200627static struct platform_device *snowball_platform_devs[] __initdata = {
628 &snowball_led_dev,
629 &snowball_key_dev,
Lee Jonese6fada52012-05-17 13:18:36 +0100630 &snowball_sbnet_dev,
Lee Jones0b5ea1e2012-09-03 14:33:39 +0100631 &snowball_gpio_en_3v3_regulator_dev,
hongbo.zhangdc1956b2012-11-15 18:56:43 +0800632 &u8500_thsens_device,
633 &u8500_cpufreq_cooling_device,
Robert Marklund350abe02011-06-20 15:55:46 +0200634};
635
Linus Walleij4b4f7572011-02-15 15:01:35 +0100636static void __init mop500_init_machine(void)
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100637{
Lee Jones18403422012-02-06 11:22:21 -0800638 struct device *parent = NULL;
Linus Walleijcf568c52011-03-30 14:31:42 +0200639 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800640 int i;
Linus Walleijcf568c52011-03-30 14:31:42 +0200641
Linus Walleij05ec2602013-02-07 10:17:31 +0100642 platform_device_register(&db8500_prcmu_device);
Lee Jones110c2c22011-08-26 16:54:07 +0100643 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
Linus Walleij4b4f7572011-02-15 15:01:35 +0100644
Linus Walleijed781d32012-05-03 00:44:52 +0200645 mop500_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200646 parent = u8500_init_devices(&ab8500_platdata);
Rabin Vincentea05a572010-06-03 07:58:42 +0100647
Lee Jonesb024a0c2012-02-06 11:22:25 -0800648 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
649 mop500_platform_devs[i]->dev.parent = parent;
650
Lee Jones110c2c22011-08-26 16:54:07 +0100651 platform_add_devices(mop500_platform_devs,
652 ARRAY_SIZE(mop500_platform_devs));
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100653
Lee Jones18403422012-02-06 11:22:21 -0800654 mop500_i2c_init(parent);
655 mop500_sdi_init(parent);
656 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100657 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800658 mop500_uart_init(parent);
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100659
Andreas Westin585d1882012-05-10 10:14:06 +0200660 u8500_cryp1_hash1_init(parent);
661
Linus Walleijcf568c52011-03-30 14:31:42 +0200662 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
Lee Jones110c2c22011-08-26 16:54:07 +0100663
664 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
665 i2c_register_board_info(2, mop500_i2c2_devices,
666 ARRAY_SIZE(mop500_i2c2_devices));
667
668 /* This board has full regulator constraints */
669 regulator_has_full_constraints();
670}
671
672static void __init snowball_init_machine(void)
673{
Lee Jones18403422012-02-06 11:22:21 -0800674 struct device *parent = NULL;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800675 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100676
Linus Walleij05ec2602013-02-07 10:17:31 +0100677 platform_device_register(&db8500_prcmu_device);
Linus Walleijed781d32012-05-03 00:44:52 +0200678 snowball_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200679 parent = u8500_init_devices(&ab8500_platdata);
Lee Jones110c2c22011-08-26 16:54:07 +0100680
Lee Jonesb024a0c2012-02-06 11:22:25 -0800681 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
682 snowball_platform_devs[i]->dev.parent = parent;
683
Lee Jones110c2c22011-08-26 16:54:07 +0100684 platform_add_devices(snowball_platform_devs,
685 ARRAY_SIZE(snowball_platform_devs));
686
Lee Jones18403422012-02-06 11:22:21 -0800687 mop500_i2c_init(parent);
688 snowball_sdi_init(parent);
689 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100690 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800691 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100692
Lee Jones265c3c02013-03-27 14:13:53 +0000693 mop500_snowball_ethernet_clock_enable();
694
Lee Jones110c2c22011-08-26 16:54:07 +0100695 /* This board has full regulator constraints */
696 regulator_has_full_constraints();
697}
698
699static void __init hrefv60_init_machine(void)
700{
Lee Jones18403422012-02-06 11:22:21 -0800701 struct device *parent = NULL;
Lee Jones110c2c22011-08-26 16:54:07 +0100702 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800703 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100704
Linus Walleij05ec2602013-02-07 10:17:31 +0100705 platform_device_register(&db8500_prcmu_device);
Lee Jones110c2c22011-08-26 16:54:07 +0100706 /*
707 * The HREFv60 board removed a GPIO expander and routed
708 * all these GPIO pins to the internal GPIO controller
709 * instead.
710 */
711 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
712
Linus Walleijed781d32012-05-03 00:44:52 +0200713 hrefv60_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200714 parent = u8500_init_devices(&ab8500_platdata);
Lee Jones110c2c22011-08-26 16:54:07 +0100715
Lee Jonesb024a0c2012-02-06 11:22:25 -0800716 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
717 mop500_platform_devs[i]->dev.parent = parent;
718
Lee Jones110c2c22011-08-26 16:54:07 +0100719 platform_add_devices(mop500_platform_devs,
720 ARRAY_SIZE(mop500_platform_devs));
721
Lee Jones18403422012-02-06 11:22:21 -0800722 mop500_i2c_init(parent);
723 hrefv60_sdi_init(parent);
724 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100725 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800726 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100727
728 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
729
730 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
Linus Walleijcf568c52011-03-30 14:31:42 +0200731
732 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100733 i2c_register_board_info(2, mop500_i2c2_devices,
734 ARRAY_SIZE(mop500_i2c2_devices));
Linus Walleijdb245202011-04-04 10:44:51 +0200735
736 /* This board has full regulator constraints */
737 regulator_has_full_constraints();
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100738}
739
740MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
741 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400742 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100743 .smp = smp_ops(ux500_smp_ops),
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100744 .map_io = u8500_map_io,
Rabin Vincent178980f2010-05-03 07:39:02 +0100745 .init_irq = ux500_init_irq,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100746 /* we re-use nomadik timer here */
Stephen Warren6bb27d72012-11-08 12:40:59 -0700747 .init_time = ux500_timer_init,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100748 .init_machine = mop500_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800749 .init_late = ux500_init_late,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100750MACHINE_END
751
Linus Walleija3a6c6a2012-10-01 09:37:39 +0200752MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520")
753 .atag_offset = 0x100,
754 .map_io = u8500_map_io,
755 .init_irq = ux500_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700756 .init_time = ux500_timer_init,
Linus Walleija3a6c6a2012-10-01 09:37:39 +0200757 .init_machine = mop500_init_machine,
758 .init_late = ux500_init_late,
759MACHINE_END
760
Linus Walleij4b4f7572011-02-15 15:01:35 +0100761MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400762 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100763 .smp = smp_ops(ux500_smp_ops),
Linus Walleij4b4f7572011-02-15 15:01:35 +0100764 .map_io = u8500_map_io,
765 .init_irq = ux500_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700766 .init_time = ux500_timer_init,
Lee Jones110c2c22011-08-26 16:54:07 +0100767 .init_machine = hrefv60_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800768 .init_late = ux500_init_late,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100769MACHINE_END
Robert Marklund350abe02011-06-20 15:55:46 +0200770
771MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400772 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100773 .smp = smp_ops(ux500_smp_ops),
Robert Marklund350abe02011-06-20 15:55:46 +0200774 .map_io = u8500_map_io,
775 .init_irq = ux500_init_irq,
776 /* we re-use nomadik timer here */
Stephen Warren6bb27d72012-11-08 12:40:59 -0700777 .init_time = ux500_timer_init,
Lee Jones110c2c22011-08-26 16:54:07 +0100778 .init_machine = snowball_init_machine,
Lee Jones0ddf8552012-09-25 16:03:45 +0100779 .init_late = NULL,
Robert Marklund350abe02011-06-20 15:55:46 +0200780MACHINE_END