blob: e1b38ef24e00480613fbb4725209266271994ac4 [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>
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +090031#include <linux/platform_data/leds-lp55xx.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>
43
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010044#include <mach/setup.h>
Rabin Vincent9e4e7fe2010-05-03 08:03:52 +010045#include <mach/devices.h>
Linus Walleij29aeb3c2010-09-06 22:15:08 +010046#include <mach/irqs.h>
Arnd Bergmanndb298da2012-08-24 15:19:33 +020047#include <linux/platform_data/crypto-ux500.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010048
Linus Walleij5d7b8462010-10-14 13:57:59 +020049#include "ste-dma40-db8500.h"
Linus Walleij174e7792013-03-19 15:41:55 +010050#include "db8500-regs.h"
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +053051#include "devices-db8500.h"
Hanumath Prasad008f8a22010-08-19 12:06:32 +010052#include "board-mop500.h"
Bengt Jonssona1e516e2010-12-10 11:08:48 +010053#include "board-mop500-regulators.h"
Rabin Vincentea05a572010-06-03 07:58:42 +010054
Robert Marklund350abe02011-06-20 15:55:46 +020055static struct gpio_led snowball_led_array[] = {
56 {
57 .name = "user_led",
Lee Jonesc525f072012-05-02 09:20:37 +010058 .default_trigger = "heartbeat",
Robert Marklund350abe02011-06-20 15:55:46 +020059 .gpio = 142,
60 },
61};
62
63static struct gpio_led_platform_data snowball_led_data = {
64 .leds = snowball_led_array,
65 .num_leds = ARRAY_SIZE(snowball_led_array),
66};
67
68static struct platform_device snowball_led_dev = {
69 .name = "leds-gpio",
70 .dev = {
71 .platform_data = &snowball_led_data,
72 },
73};
74
Lee Jones0b5ea1e2012-09-03 14:33:39 +010075static struct fixed_voltage_config snowball_gpio_en_3v3_data = {
76 .supply_name = "EN-3V3",
77 .gpio = SNOWBALL_EN_3V3_ETH_GPIO,
78 .microvolts = 3300000,
79 .enable_high = 1,
80 .init_data = &gpio_en_3v3_regulator,
81 .startup_delay = 5000, /* 1200us */
82};
83
84static struct platform_device snowball_gpio_en_3v3_regulator_dev = {
85 .name = "reg-fixed-voltage",
86 .id = 1,
87 .dev = {
88 .platform_data = &snowball_gpio_en_3v3_data,
89 },
90};
91
Patrice Chotard0493e642013-01-08 10:41:02 +010092static struct abx500_gpio_platform_data ab8500_gpio_pdata = {
Philippe Langlaisa1524ee2012-02-13 10:52:25 +010093 .gpio_base = MOP500_AB8500_PIN_GPIO(1),
Bibek Basu3ef374a2011-02-15 12:56:16 +053094};
95
Ola Liljaf242e502012-06-07 14:00:46 +020096/* ab8500-codec */
97static struct ab8500_codec_platform_data ab8500_codec_pdata = {
98 .amics = {
99 .mic1_type = AMIC_TYPE_DIFFERENTIAL,
100 .mic2_type = AMIC_TYPE_DIFFERENTIAL,
101 .mic1a_micbias = AMIC_MICBIAS_VAMIC1,
102 .mic1b_micbias = AMIC_MICBIAS_VAMIC1,
103 .mic2_micbias = AMIC_MICBIAS_VAMIC2
104 },
105 .ear_cmv = EAR_CMV_0_95V
106};
107
Robert Marklund350abe02011-06-20 15:55:46 +0200108static struct gpio_keys_button snowball_key_array[] = {
109 {
110 .gpio = 32,
111 .type = EV_KEY,
112 .code = KEY_1,
113 .desc = "userpb",
114 .active_low = 1,
115 .debounce_interval = 50,
116 .wakeup = 1,
117 },
118 {
119 .gpio = 151,
120 .type = EV_KEY,
121 .code = KEY_2,
122 .desc = "extkb1",
123 .active_low = 1,
124 .debounce_interval = 50,
125 .wakeup = 1,
126 },
127 {
128 .gpio = 152,
129 .type = EV_KEY,
130 .code = KEY_3,
131 .desc = "extkb2",
132 .active_low = 1,
133 .debounce_interval = 50,
134 .wakeup = 1,
135 },
136 {
137 .gpio = 161,
138 .type = EV_KEY,
139 .code = KEY_4,
140 .desc = "extkb3",
141 .active_low = 1,
142 .debounce_interval = 50,
143 .wakeup = 1,
144 },
145 {
146 .gpio = 162,
147 .type = EV_KEY,
148 .code = KEY_5,
149 .desc = "extkb4",
150 .active_low = 1,
151 .debounce_interval = 50,
152 .wakeup = 1,
153 },
154};
155
156static struct gpio_keys_platform_data snowball_key_data = {
157 .buttons = snowball_key_array,
158 .nbuttons = ARRAY_SIZE(snowball_key_array),
159};
160
161static struct platform_device snowball_key_dev = {
162 .name = "gpio-keys",
163 .id = -1,
164 .dev = {
165 .platform_data = &snowball_key_data,
166 }
167};
168
169static struct smsc911x_platform_config snowball_sbnet_cfg = {
170 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
171 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
172 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
173 .shift = 1,
174};
175
176static struct resource sbnet_res[] = {
177 {
178 .name = "smsc911x-memory",
179 .start = (0x5000 << 16),
180 .end = (0x5000 << 16) + 0xffff,
181 .flags = IORESOURCE_MEM,
182 },
183 {
184 .start = NOMADIK_GPIO_TO_IRQ(140),
185 .end = NOMADIK_GPIO_TO_IRQ(140),
186 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
187 },
188};
189
190static struct platform_device snowball_sbnet_dev = {
191 .name = "smsc911x",
192 .num_resources = ARRAY_SIZE(sbnet_res),
193 .resource = sbnet_res,
194 .dev = {
195 .platform_data = &snowball_sbnet_cfg,
196 },
197};
198
Linus Walleij05ec2602013-02-07 10:17:31 +0100199struct ab8500_platform_data ab8500_platdata = {
Rabin Vincent39ae7022010-07-26 11:12:15 +0100200 .irq_base = MOP500_AB8500_IRQ_BASE,
Bengt Jonssondfa3a822011-03-09 13:34:17 +0100201 .regulator_reg_init = ab8500_regulator_reg_init,
202 .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
Bengt Jonssona1e516e2010-12-10 11:08:48 +0100203 .regulator = ab8500_regulators,
204 .num_regulator = ARRAY_SIZE(ab8500_regulators),
Bibek Basu3ef374a2011-02-15 12:56:16 +0530205 .gpio = &ab8500_gpio_pdata,
Ola Liljaf242e502012-06-07 14:00:46 +0200206 .codec = &ab8500_codec_pdata,
Rabin Vincent39ae7022010-07-26 11:12:15 +0100207};
208
hongbo.zhangdc1956b2012-11-15 18:56:43 +0800209static struct platform_device u8500_cpufreq_cooling_device = {
210 .name = "db8500-cpufreq-cooling",
211};
212
213/*
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100214 * TPS61052
215 */
216
217static struct tps6105x_platform_data mop500_tps61052_data = {
218 .mode = TPS6105X_MODE_VOLTAGE,
219 .regulator_data = &tps61052_regulator,
220};
221
222/*
Rabin Vincentb8410a12010-08-09 19:18:17 +0530223 * TC35892
224 */
225
Sundar Iyer20406eb2010-12-13 09:33:14 +0530226static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
Rabin Vincentb8410a12010-08-09 19:18:17 +0530227{
Lee Jones18403422012-02-06 11:22:21 -0800228 struct device *parent = NULL;
229#if 0
230 /* FIXME: Is the sdi actually part of tc3589x? */
231 parent = tc3589x->dev;
232#endif
233 mop500_sdi_tc35892_init(parent);
Rabin Vincentb8410a12010-08-09 19:18:17 +0530234}
235
Sundar Iyer20406eb2010-12-13 09:33:14 +0530236static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530237 .gpio_base = MOP500_EGPIO(0),
238 .setup = mop500_tc35892_init,
239};
240
Sundar Iyer20406eb2010-12-13 09:33:14 +0530241static struct tc3589x_platform_data mop500_tc35892_data = {
Sundar Iyer611b7592010-12-13 09:33:15 +0530242 .block = TC3589x_BLOCK_GPIO,
Rabin Vincentb8410a12010-08-09 19:18:17 +0530243 .gpio = &mop500_tc35892_gpio_data,
244 .irq_base = MOP500_EGPIO_IRQ_BASE,
245};
246
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900247static struct lp55xx_led_config lp5521_pri_led[] = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100248 [0] = {
249 .chan_nr = 0,
250 .led_current = 0x2f,
251 .max_current = 0x5f,
252 },
253 [1] = {
254 .chan_nr = 1,
255 .led_current = 0x2f,
256 .max_current = 0x5f,
257 },
258 [2] = {
259 .chan_nr = 2,
260 .led_current = 0x2f,
261 .max_current = 0x5f,
262 },
263};
264
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900265static struct lp55xx_platform_data __initdata lp5521_pri_data = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100266 .label = "lp5521_pri",
267 .led_config = &lp5521_pri_led[0],
268 .num_channels = 3,
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900269 .clock_mode = LP55XX_CLOCK_EXT,
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100270};
271
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900272static struct lp55xx_led_config lp5521_sec_led[] = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100273 [0] = {
274 .chan_nr = 0,
275 .led_current = 0x2f,
276 .max_current = 0x5f,
277 },
278 [1] = {
279 .chan_nr = 1,
280 .led_current = 0x2f,
281 .max_current = 0x5f,
282 },
283 [2] = {
284 .chan_nr = 2,
285 .led_current = 0x2f,
286 .max_current = 0x5f,
287 },
288};
289
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900290static struct lp55xx_platform_data __initdata lp5521_sec_data = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100291 .label = "lp5521_sec",
292 .led_config = &lp5521_sec_led[0],
293 .num_channels = 3,
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900294 .clock_mode = LP55XX_CLOCK_EXT,
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100295};
296
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100297static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530298 {
Sundar Iyer20406eb2010-12-13 09:33:14 +0530299 I2C_BOARD_INFO("tc3589x", 0x42),
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100300 .irq = NOMADIK_GPIO_TO_IRQ(217),
Rabin Vincentb8410a12010-08-09 19:18:17 +0530301 .platform_data = &mop500_tc35892_data,
302 },
Linus Walleijcf568c52011-03-30 14:31:42 +0200303 /* I2C0 devices only available prior to HREFv60 */
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100304 {
305 I2C_BOARD_INFO("tps61052", 0x33),
306 .platform_data = &mop500_tps61052_data,
307 },
308};
309
Linus Walleijcf568c52011-03-30 14:31:42 +0200310#define NUM_PRE_V60_I2C0_DEVICES 1
311
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100312static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
313 {
314 /* lp5521 LED driver, 1st device */
315 I2C_BOARD_INFO("lp5521", 0x33),
316 .platform_data = &lp5521_pri_data,
317 },
318 {
319 /* lp5521 LED driver, 2st device */
320 I2C_BOARD_INFO("lp5521", 0x34),
321 .platform_data = &lp5521_sec_data,
322 },
Lee Jonesbb3b2182011-01-13 14:41:22 +0000323 {
324 /* Light sensor Rohm BH1780GLI */
325 I2C_BOARD_INFO("bh1780", 0x29),
326 },
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100327};
328
Lee Jones18403422012-02-06 11:22:21 -0800329static void __init mop500_i2c_init(struct device *parent)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530330{
Lee Jones98582d92012-04-17 15:52:26 +0100331 db8500_add_i2c0(parent, NULL);
332 db8500_add_i2c1(parent, NULL);
333 db8500_add_i2c2(parent, NULL);
334 db8500_add_i2c3(parent, NULL);
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530335}
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100336
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100337static struct gpio_keys_button mop500_gpio_keys[] = {
338 {
339 .desc = "SFH7741 Proximity Sensor",
340 .type = EV_SW,
341 .code = SW_FRONT_PROXIMITY,
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100342 .active_low = 0,
343 .can_disable = 1,
344 }
345};
346
347static struct regulator *prox_regulator;
348static int mop500_prox_activate(struct device *dev);
349static void mop500_prox_deactivate(struct device *dev);
350
351static struct gpio_keys_platform_data mop500_gpio_keys_data = {
352 .buttons = mop500_gpio_keys,
353 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
354 .enable = mop500_prox_activate,
355 .disable = mop500_prox_deactivate,
356};
357
358static struct platform_device mop500_gpio_keys_device = {
359 .name = "gpio-keys",
360 .id = 0,
361 .dev = {
362 .platform_data = &mop500_gpio_keys_data,
363 },
364};
365
366static int mop500_prox_activate(struct device *dev)
367{
368 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
369 "vcc");
370 if (IS_ERR(prox_regulator)) {
371 dev_err(&mop500_gpio_keys_device.dev,
372 "no regulator\n");
373 return PTR_ERR(prox_regulator);
374 }
375 regulator_enable(prox_regulator);
376 return 0;
377}
378
379static void mop500_prox_deactivate(struct device *dev)
380{
381 regulator_disable(prox_regulator);
382 regulator_put(prox_regulator);
383}
384
Andreas Westin585d1882012-05-10 10:14:06 +0200385static struct cryp_platform_data u8500_cryp1_platform_data = {
386 .mem_to_engine = {
387 .dir = STEDMA40_MEM_TO_PERIPH,
388 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
389 .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
390 .src_info.data_width = STEDMA40_WORD_WIDTH,
391 .dst_info.data_width = STEDMA40_WORD_WIDTH,
392 .mode = STEDMA40_MODE_LOGICAL,
393 .src_info.psize = STEDMA40_PSIZE_LOG_4,
394 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
395 },
396 .engine_to_mem = {
397 .dir = STEDMA40_PERIPH_TO_MEM,
398 .src_dev_type = DB8500_DMA_DEV48_CAC1_RX,
399 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
400 .src_info.data_width = STEDMA40_WORD_WIDTH,
401 .dst_info.data_width = STEDMA40_WORD_WIDTH,
402 .mode = STEDMA40_MODE_LOGICAL,
403 .src_info.psize = STEDMA40_PSIZE_LOG_4,
404 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
405 }
406};
407
408static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
409 .dir = STEDMA40_MEM_TO_PERIPH,
410 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
411 .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
412 .src_info.data_width = STEDMA40_WORD_WIDTH,
413 .dst_info.data_width = STEDMA40_WORD_WIDTH,
414 .mode = STEDMA40_MODE_LOGICAL,
415 .src_info.psize = STEDMA40_PSIZE_LOG_16,
416 .dst_info.psize = STEDMA40_PSIZE_LOG_16,
417};
418
419static struct hash_platform_data u8500_hash1_platform_data = {
420 .mem_to_engine = &u8500_hash_dma_cfg_tx,
421 .dma_filter = stedma40_filter,
422};
423
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100424/* add any platform devices here - TODO */
Robert Marklund350abe02011-06-20 15:55:46 +0200425static struct platform_device *mop500_platform_devs[] __initdata = {
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100426 &mop500_gpio_keys_device,
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100427};
428
Linus Walleij5d7b8462010-10-14 13:57:59 +0200429#ifdef CONFIG_STE_DMA40
430static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
431 .mode = STEDMA40_MODE_LOGICAL,
432 .dir = STEDMA40_PERIPH_TO_MEM,
433 .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
434 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
435 .src_info.data_width = STEDMA40_BYTE_WIDTH,
436 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
437};
438
439static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
440 .mode = STEDMA40_MODE_LOGICAL,
441 .dir = STEDMA40_MEM_TO_PERIPH,
442 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
443 .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
444 .src_info.data_width = STEDMA40_BYTE_WIDTH,
445 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
446};
447#endif
448
Lee Jonesfa86a762012-09-27 10:17:36 +0100449struct pl022_ssp_controller ssp0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200450 .bus_id = 0,
451#ifdef CONFIG_STE_DMA40
452 .enable_dma = 1,
453 .dma_filter = stedma40_filter,
454 .dma_rx_param = &ssp0_dma_cfg_rx,
455 .dma_tx_param = &ssp0_dma_cfg_tx,
456#else
457 .enable_dma = 0,
458#endif
459 /* on this platform, gpio 31,142,144,214 &
460 * 224 are connected as chip selects
461 */
462 .num_chipselect = 5,
463};
464
Lee Jones18403422012-02-06 11:22:21 -0800465static void __init mop500_spi_init(struct device *parent)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530466{
Lee Jones15daf692012-03-15 16:47:11 +0000467 db8500_add_ssp0(parent, &ssp0_plat);
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530468}
469
Linus Walleij5d7b8462010-10-14 13:57:59 +0200470#ifdef CONFIG_STE_DMA40
471static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
472 .mode = STEDMA40_MODE_LOGICAL,
473 .dir = STEDMA40_PERIPH_TO_MEM,
474 .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
475 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
476 .src_info.data_width = STEDMA40_BYTE_WIDTH,
477 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
478};
479
480static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
481 .mode = STEDMA40_MODE_LOGICAL,
482 .dir = STEDMA40_MEM_TO_PERIPH,
483 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
484 .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
485 .src_info.data_width = STEDMA40_BYTE_WIDTH,
486 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
487};
488
489static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
490 .mode = STEDMA40_MODE_LOGICAL,
491 .dir = STEDMA40_PERIPH_TO_MEM,
492 .src_dev_type = DB8500_DMA_DEV12_UART1_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 uart1_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_DEV12_UART1_TX,
503 .src_info.data_width = STEDMA40_BYTE_WIDTH,
504 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
505};
506
507static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
508 .mode = STEDMA40_MODE_LOGICAL,
509 .dir = STEDMA40_PERIPH_TO_MEM,
510 .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
511 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
512 .src_info.data_width = STEDMA40_BYTE_WIDTH,
513 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
514};
515
516static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
517 .mode = STEDMA40_MODE_LOGICAL,
518 .dir = STEDMA40_MEM_TO_PERIPH,
519 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
520 .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
521 .src_info.data_width = STEDMA40_BYTE_WIDTH,
522 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
523};
524#endif
525
Lee Jonesfa86a762012-09-27 10:17:36 +0100526struct amba_pl011_data uart0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200527#ifdef CONFIG_STE_DMA40
528 .dma_filter = stedma40_filter,
529 .dma_rx_param = &uart0_dma_cfg_rx,
530 .dma_tx_param = &uart0_dma_cfg_tx,
531#endif
532};
533
Lee Jonesfa86a762012-09-27 10:17:36 +0100534struct amba_pl011_data uart1_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200535#ifdef CONFIG_STE_DMA40
536 .dma_filter = stedma40_filter,
537 .dma_rx_param = &uart1_dma_cfg_rx,
538 .dma_tx_param = &uart1_dma_cfg_tx,
539#endif
540};
541
Lee Jonesfa86a762012-09-27 10:17:36 +0100542struct amba_pl011_data uart2_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200543#ifdef CONFIG_STE_DMA40
544 .dma_filter = stedma40_filter,
545 .dma_rx_param = &uart2_dma_cfg_rx,
546 .dma_tx_param = &uart2_dma_cfg_tx,
547#endif
548};
549
Lee Jones18403422012-02-06 11:22:21 -0800550static void __init mop500_uart_init(struct device *parent)
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530551{
Linus Walleij78d80c52012-05-23 21:18:46 +0200552 db8500_add_uart0(parent, &uart0_plat);
Lee Jones18403422012-02-06 11:22:21 -0800553 db8500_add_uart1(parent, &uart1_plat);
554 db8500_add_uart2(parent, &uart2_plat);
Rabin Vincentfbf1eadf2010-09-29 19:46:32 +0530555}
556
Andreas Westin585d1882012-05-10 10:14:06 +0200557static void __init u8500_cryp1_hash1_init(struct device *parent)
558{
559 db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
560 db8500_add_hash1(parent, &u8500_hash1_platform_data);
561}
562
Robert Marklund350abe02011-06-20 15:55:46 +0200563static struct platform_device *snowball_platform_devs[] __initdata = {
564 &snowball_led_dev,
565 &snowball_key_dev,
Lee Jonese6fada52012-05-17 13:18:36 +0100566 &snowball_sbnet_dev,
Lee Jones0b5ea1e2012-09-03 14:33:39 +0100567 &snowball_gpio_en_3v3_regulator_dev,
hongbo.zhangdc1956b2012-11-15 18:56:43 +0800568 &u8500_cpufreq_cooling_device,
Robert Marklund350abe02011-06-20 15:55:46 +0200569};
570
Linus Walleij4b4f7572011-02-15 15:01:35 +0100571static void __init mop500_init_machine(void)
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100572{
Lee Jones18403422012-02-06 11:22:21 -0800573 struct device *parent = NULL;
Linus Walleijcf568c52011-03-30 14:31:42 +0200574 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800575 int i;
Linus Walleijcf568c52011-03-30 14:31:42 +0200576
Linus Walleij05ec2602013-02-07 10:17:31 +0100577 platform_device_register(&db8500_prcmu_device);
Lee Jones110c2c22011-08-26 16:54:07 +0100578 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
Linus Walleij4b4f7572011-02-15 15:01:35 +0100579
Linus Walleijed781d392012-05-03 00:44:52 +0200580 mop500_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200581 parent = u8500_init_devices(&ab8500_platdata);
Rabin Vincentea05a572010-06-03 07:58:42 +0100582
Lee Jonesb024a0c2012-02-06 11:22:25 -0800583 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
584 mop500_platform_devs[i]->dev.parent = parent;
585
Lee Jones110c2c22011-08-26 16:54:07 +0100586 platform_add_devices(mop500_platform_devs,
587 ARRAY_SIZE(mop500_platform_devs));
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100588
Lee Jones18403422012-02-06 11:22:21 -0800589 mop500_i2c_init(parent);
590 mop500_sdi_init(parent);
591 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100592 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800593 mop500_uart_init(parent);
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100594
Andreas Westin585d1882012-05-10 10:14:06 +0200595 u8500_cryp1_hash1_init(parent);
596
Linus Walleijcf568c52011-03-30 14:31:42 +0200597 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
Lee Jones110c2c22011-08-26 16:54:07 +0100598
599 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
600 i2c_register_board_info(2, mop500_i2c2_devices,
601 ARRAY_SIZE(mop500_i2c2_devices));
602
603 /* This board has full regulator constraints */
604 regulator_has_full_constraints();
605}
606
607static void __init snowball_init_machine(void)
608{
Lee Jones18403422012-02-06 11:22:21 -0800609 struct device *parent = NULL;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800610 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100611
Linus Walleij05ec2602013-02-07 10:17:31 +0100612 platform_device_register(&db8500_prcmu_device);
Linus Walleijed781d392012-05-03 00:44:52 +0200613 snowball_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200614 parent = u8500_init_devices(&ab8500_platdata);
Lee Jones110c2c22011-08-26 16:54:07 +0100615
Lee Jonesb024a0c2012-02-06 11:22:25 -0800616 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
617 snowball_platform_devs[i]->dev.parent = parent;
618
Lee Jones110c2c22011-08-26 16:54:07 +0100619 platform_add_devices(snowball_platform_devs,
620 ARRAY_SIZE(snowball_platform_devs));
621
Lee Jones18403422012-02-06 11:22:21 -0800622 mop500_i2c_init(parent);
623 snowball_sdi_init(parent);
624 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100625 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800626 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100627
Lee Jones110c2c22011-08-26 16:54:07 +0100628 /* This board has full regulator constraints */
629 regulator_has_full_constraints();
630}
631
632static void __init hrefv60_init_machine(void)
633{
Lee Jones18403422012-02-06 11:22:21 -0800634 struct device *parent = NULL;
Lee Jones110c2c22011-08-26 16:54:07 +0100635 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800636 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100637
Linus Walleij05ec2602013-02-07 10:17:31 +0100638 platform_device_register(&db8500_prcmu_device);
Lee Jones110c2c22011-08-26 16:54:07 +0100639 /*
640 * The HREFv60 board removed a GPIO expander and routed
641 * all these GPIO pins to the internal GPIO controller
642 * instead.
643 */
644 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
645
Linus Walleijed781d392012-05-03 00:44:52 +0200646 hrefv60_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200647 parent = u8500_init_devices(&ab8500_platdata);
Lee Jones110c2c22011-08-26 16:54:07 +0100648
Lee Jonesb024a0c2012-02-06 11:22:25 -0800649 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
650 mop500_platform_devs[i]->dev.parent = parent;
651
Lee Jones110c2c22011-08-26 16:54:07 +0100652 platform_add_devices(mop500_platform_devs,
653 ARRAY_SIZE(mop500_platform_devs));
654
Lee Jones18403422012-02-06 11:22:21 -0800655 mop500_i2c_init(parent);
656 hrefv60_sdi_init(parent);
657 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100658 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800659 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100660
661 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
662
663 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
Linus Walleijcf568c52011-03-30 14:31:42 +0200664
665 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100666 i2c_register_board_info(2, mop500_i2c2_devices,
667 ARRAY_SIZE(mop500_i2c2_devices));
Linus Walleijdb245202011-04-04 10:44:51 +0200668
669 /* This board has full regulator constraints */
670 regulator_has_full_constraints();
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100671}
672
673MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
674 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400675 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100676 .smp = smp_ops(ux500_smp_ops),
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100677 .map_io = u8500_map_io,
Rabin Vincent178980f2010-05-03 07:39:02 +0100678 .init_irq = ux500_init_irq,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100679 /* we re-use nomadik timer here */
Stephen Warren6bb27d72012-11-08 12:40:59 -0700680 .init_time = ux500_timer_init,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100681 .init_machine = mop500_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800682 .init_late = ux500_init_late,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100683MACHINE_END
684
Linus Walleija3a6c6a2012-10-01 09:37:39 +0200685MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520")
686 .atag_offset = 0x100,
687 .map_io = u8500_map_io,
688 .init_irq = ux500_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700689 .init_time = ux500_timer_init,
Linus Walleija3a6c6a2012-10-01 09:37:39 +0200690 .init_machine = mop500_init_machine,
691 .init_late = ux500_init_late,
692MACHINE_END
693
Linus Walleij4b4f7572011-02-15 15:01:35 +0100694MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400695 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100696 .smp = smp_ops(ux500_smp_ops),
Linus Walleij4b4f7572011-02-15 15:01:35 +0100697 .map_io = u8500_map_io,
698 .init_irq = ux500_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700699 .init_time = ux500_timer_init,
Lee Jones110c2c22011-08-26 16:54:07 +0100700 .init_machine = hrefv60_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800701 .init_late = ux500_init_late,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100702MACHINE_END
Robert Marklund350abe02011-06-20 15:55:46 +0200703
704MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400705 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100706 .smp = smp_ops(ux500_smp_ops),
Robert Marklund350abe02011-06-20 15:55:46 +0200707 .map_io = u8500_map_io,
708 .init_irq = ux500_init_irq,
709 /* we re-use nomadik timer here */
Stephen Warren6bb27d72012-11-08 12:40:59 -0700710 .init_time = ux500_timer_init,
Lee Jones110c2c22011-08-26 16:54:07 +0100711 .init_machine = snowball_init_machine,
Lee Jones0ddf8552012-09-25 16:03:45 +0100712 .init_late = NULL,
Robert Marklund350abe02011-06-20 15:55:46 +0200713MACHINE_END