blob: c8a8fde777bbf7a961205a5b1c3a09748fe3d374 [file] [log] [blame]
Linus Walleijed781d392012-05-03 00:44:52 +02001
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +01002/*
3 * Copyright (C) 2008-2009 ST-Ericsson
4 *
5 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2, as
9 * published by the Free Software Foundation.
10 *
11 */
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/interrupt.h>
15#include <linux/platform_device.h>
16#include <linux/io.h>
Rabin Vincentb8410a12010-08-09 19:18:17 +053017#include <linux/i2c.h>
Rabin Vincentea05a572010-06-03 07:58:42 +010018#include <linux/gpio.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010019#include <linux/amba/bus.h>
20#include <linux/amba/pl022.h>
Linus Walleij5d7b8462010-10-14 13:57:59 +020021#include <linux/amba/serial.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010022#include <linux/spi/spi.h>
Linus Walleijee66e652011-12-02 14:16:33 +010023#include <linux/mfd/abx500/ab8500.h>
Bengt Jonsson79568b942011-03-11 11:54:46 +010024#include <linux/regulator/ab8500.h>
Sundar Iyer20406eb2010-12-13 09:33:14 +053025#include <linux/mfd/tc3589x.h>
Linus Walleijfe67dfc2011-03-07 11:48:15 +010026#include <linux/mfd/tps6105x.h>
Linus Walleijee66e652011-12-02 14:16:33 +010027#include <linux/mfd/abx500/ab8500-gpio.h>
Ola Liljaf242e502012-06-07 14:00:46 +020028#include <linux/mfd/abx500/ab8500-codec.h>
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +010029#include <linux/leds-lp5521.h>
Philippe Langlaisa71b8192011-01-14 10:53:59 +010030#include <linux/input.h>
Robert Marklund350abe02011-06-20 15:55:46 +020031#include <linux/smsc911x.h>
Philippe Langlaisa71b8192011-01-14 10:53:59 +010032#include <linux/gpio_keys.h>
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +020033#include <linux/delay.h>
Arnd Bergmann2d334292012-03-07 15:04:07 +000034#include <linux/of.h>
35#include <linux/of_platform.h>
Robert Marklund350abe02011-06-20 15:55:46 +020036#include <linux/leds.h>
Linus Walleija0980662012-05-07 01:33:24 +020037#include <linux/pinctrl/consumer.h>
38
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010039#include <asm/mach-types.h>
40#include <asm/mach/arch.h>
Marc Zyngierbbf5f382011-09-06 10:23:45 +010041#include <asm/hardware/gic.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010042
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +010043#include <plat/i2c.h>
Linus Walleij5d7b8462010-10-14 13:57:59 +020044#include <plat/ste_dma40.h>
Linus Walleij0f332862011-08-22 08:33:30 +010045#include <plat/gpio-nomadik.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010046
47#include <mach/hardware.h>
48#include <mach/setup.h>
Rabin Vincent9e4e7fe2010-05-03 08:03:52 +010049#include <mach/devices.h>
Linus Walleij29aeb3c2010-09-06 22:15:08 +010050#include <mach/irqs.h>
Andreas Westin585d1882012-05-10 10:14:06 +020051#include <mach/crypto-ux500.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010052
Linus Walleij5d7b8462010-10-14 13:57:59 +020053#include "ste-dma40-db8500.h"
Rabin Vincentfbf1ead2010-09-29 19:46:32 +053054#include "devices-db8500.h"
Hanumath Prasad008f8a22010-08-19 12:06:32 +010055#include "board-mop500.h"
Bengt Jonssona1e516e2010-12-10 11:08:48 +010056#include "board-mop500-regulators.h"
Ola Liljac0af14d2012-04-20 11:32:59 +020057#include "board-mop500-msp.h"
Rabin Vincentea05a572010-06-03 07:58:42 +010058
Robert Marklund350abe02011-06-20 15:55:46 +020059static struct gpio_led snowball_led_array[] = {
60 {
61 .name = "user_led",
62 .default_trigger = "none",
63 .gpio = 142,
64 },
65};
66
67static struct gpio_led_platform_data snowball_led_data = {
68 .leds = snowball_led_array,
69 .num_leds = ARRAY_SIZE(snowball_led_array),
70};
71
72static struct platform_device snowball_led_dev = {
73 .name = "leds-gpio",
74 .dev = {
75 .platform_data = &snowball_led_data,
76 },
77};
78
Bibek Basu3ef374a2011-02-15 12:56:16 +053079static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
Philippe Langlaisa1524ee2012-02-13 10:52:25 +010080 .gpio_base = MOP500_AB8500_PIN_GPIO(1),
Bibek Basu3ef374a2011-02-15 12:56:16 +053081 .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
82 /* config_reg is the initial configuration of ab8500 pins.
83 * The pins can be configured as GPIO or alt functions based
84 * on value present in GpioSel1 to GpioSel6 and AlternatFunction
85 * register. This is the array of 7 configuration settings.
86 * One has to compile time decide these settings. Below is the
Lucas De Marchi25985ed2011-03-30 22:57:33 -030087 * explanation of these setting
Bibek Basu3ef374a2011-02-15 12:56:16 +053088 * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
89 * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
90 * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
91 * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO
92 * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO
93 * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO
94 * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured
95 * as GPIO then this register selectes the alternate fucntions
96 */
97 .config_reg = {0x00, 0x1E, 0x80, 0x01,
98 0x7A, 0x00, 0x00},
99};
100
Ola Liljaf242e502012-06-07 14:00:46 +0200101/* ab8500-codec */
102static struct ab8500_codec_platform_data ab8500_codec_pdata = {
103 .amics = {
104 .mic1_type = AMIC_TYPE_DIFFERENTIAL,
105 .mic2_type = AMIC_TYPE_DIFFERENTIAL,
106 .mic1a_micbias = AMIC_MICBIAS_VAMIC1,
107 .mic1b_micbias = AMIC_MICBIAS_VAMIC1,
108 .mic2_micbias = AMIC_MICBIAS_VAMIC2
109 },
110 .ear_cmv = EAR_CMV_0_95V
111};
112
Robert Marklund350abe02011-06-20 15:55:46 +0200113static struct gpio_keys_button snowball_key_array[] = {
114 {
115 .gpio = 32,
116 .type = EV_KEY,
117 .code = KEY_1,
118 .desc = "userpb",
119 .active_low = 1,
120 .debounce_interval = 50,
121 .wakeup = 1,
122 },
123 {
124 .gpio = 151,
125 .type = EV_KEY,
126 .code = KEY_2,
127 .desc = "extkb1",
128 .active_low = 1,
129 .debounce_interval = 50,
130 .wakeup = 1,
131 },
132 {
133 .gpio = 152,
134 .type = EV_KEY,
135 .code = KEY_3,
136 .desc = "extkb2",
137 .active_low = 1,
138 .debounce_interval = 50,
139 .wakeup = 1,
140 },
141 {
142 .gpio = 161,
143 .type = EV_KEY,
144 .code = KEY_4,
145 .desc = "extkb3",
146 .active_low = 1,
147 .debounce_interval = 50,
148 .wakeup = 1,
149 },
150 {
151 .gpio = 162,
152 .type = EV_KEY,
153 .code = KEY_5,
154 .desc = "extkb4",
155 .active_low = 1,
156 .debounce_interval = 50,
157 .wakeup = 1,
158 },
159};
160
161static struct gpio_keys_platform_data snowball_key_data = {
162 .buttons = snowball_key_array,
163 .nbuttons = ARRAY_SIZE(snowball_key_array),
164};
165
166static struct platform_device snowball_key_dev = {
167 .name = "gpio-keys",
168 .id = -1,
169 .dev = {
170 .platform_data = &snowball_key_data,
171 }
172};
173
174static struct smsc911x_platform_config snowball_sbnet_cfg = {
175 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
176 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
177 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
178 .shift = 1,
179};
180
181static struct resource sbnet_res[] = {
182 {
183 .name = "smsc911x-memory",
184 .start = (0x5000 << 16),
185 .end = (0x5000 << 16) + 0xffff,
186 .flags = IORESOURCE_MEM,
187 },
188 {
189 .start = NOMADIK_GPIO_TO_IRQ(140),
190 .end = NOMADIK_GPIO_TO_IRQ(140),
191 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
192 },
193};
194
195static struct platform_device snowball_sbnet_dev = {
196 .name = "smsc911x",
197 .num_resources = ARRAY_SIZE(sbnet_res),
198 .resource = sbnet_res,
199 .dev = {
200 .platform_data = &snowball_sbnet_cfg,
201 },
202};
203
Rabin Vincent39ae7022010-07-26 11:12:15 +0100204static struct ab8500_platform_data ab8500_platdata = {
205 .irq_base = MOP500_AB8500_IRQ_BASE,
Bengt Jonssondfa3a822011-03-09 13:34:17 +0100206 .regulator_reg_init = ab8500_regulator_reg_init,
207 .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
Bengt Jonssona1e516e2010-12-10 11:08:48 +0100208 .regulator = ab8500_regulators,
209 .num_regulator = ARRAY_SIZE(ab8500_regulators),
Bibek Basu3ef374a2011-02-15 12:56:16 +0530210 .gpio = &ab8500_gpio_pdata,
Ola Liljaf242e502012-06-07 14:00:46 +0200211 .codec = &ab8500_codec_pdata,
Rabin Vincent39ae7022010-07-26 11:12:15 +0100212};
213
Linus Walleij29aeb3c2010-09-06 22:15:08 +0100214static struct resource ab8500_resources[] = {
215 [0] = {
Rabin Vincent22039b72010-12-08 11:07:56 +0530216 .start = IRQ_DB8500_AB8500,
217 .end = IRQ_DB8500_AB8500,
218 .flags = IORESOURCE_IRQ
Linus Walleij29aeb3c2010-09-06 22:15:08 +0100219 }
220};
221
222struct platform_device ab8500_device = {
Lee Jonesd28f1db2012-05-19 17:21:37 +0200223 .name = "ab8500-core",
Linus Walleij29aeb3c2010-09-06 22:15:08 +0100224 .id = 0,
225 .dev = {
226 .platform_data = &ab8500_platdata,
227 },
228 .num_resources = 1,
229 .resource = ab8500_resources,
230};
231
Rabin Vincentb8410a12010-08-09 19:18:17 +0530232/*
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100233 * TPS61052
234 */
235
236static struct tps6105x_platform_data mop500_tps61052_data = {
237 .mode = TPS6105X_MODE_VOLTAGE,
238 .regulator_data = &tps61052_regulator,
239};
240
241/*
Rabin Vincentb8410a12010-08-09 19:18:17 +0530242 * TC35892
243 */
244
Sundar Iyer20406eb2010-12-13 09:33:14 +0530245static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
Rabin Vincentb8410a12010-08-09 19:18:17 +0530246{
Lee Jones18403422012-02-06 11:22:21 -0800247 struct device *parent = NULL;
248#if 0
249 /* FIXME: Is the sdi actually part of tc3589x? */
250 parent = tc3589x->dev;
251#endif
252 mop500_sdi_tc35892_init(parent);
Rabin Vincentb8410a12010-08-09 19:18:17 +0530253}
254
Sundar Iyer20406eb2010-12-13 09:33:14 +0530255static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530256 .gpio_base = MOP500_EGPIO(0),
257 .setup = mop500_tc35892_init,
258};
259
Sundar Iyer20406eb2010-12-13 09:33:14 +0530260static struct tc3589x_platform_data mop500_tc35892_data = {
Sundar Iyer611b7592010-12-13 09:33:15 +0530261 .block = TC3589x_BLOCK_GPIO,
Rabin Vincentb8410a12010-08-09 19:18:17 +0530262 .gpio = &mop500_tc35892_gpio_data,
263 .irq_base = MOP500_EGPIO_IRQ_BASE,
264};
265
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100266static struct lp5521_led_config lp5521_pri_led[] = {
267 [0] = {
268 .chan_nr = 0,
269 .led_current = 0x2f,
270 .max_current = 0x5f,
271 },
272 [1] = {
273 .chan_nr = 1,
274 .led_current = 0x2f,
275 .max_current = 0x5f,
276 },
277 [2] = {
278 .chan_nr = 2,
279 .led_current = 0x2f,
280 .max_current = 0x5f,
281 },
282};
283
284static struct lp5521_platform_data __initdata lp5521_pri_data = {
285 .label = "lp5521_pri",
286 .led_config = &lp5521_pri_led[0],
287 .num_channels = 3,
288 .clock_mode = LP5521_CLOCK_EXT,
289};
290
291static struct lp5521_led_config lp5521_sec_led[] = {
292 [0] = {
293 .chan_nr = 0,
294 .led_current = 0x2f,
295 .max_current = 0x5f,
296 },
297 [1] = {
298 .chan_nr = 1,
299 .led_current = 0x2f,
300 .max_current = 0x5f,
301 },
302 [2] = {
303 .chan_nr = 2,
304 .led_current = 0x2f,
305 .max_current = 0x5f,
306 },
307};
308
309static struct lp5521_platform_data __initdata lp5521_sec_data = {
310 .label = "lp5521_sec",
311 .led_config = &lp5521_sec_led[0],
312 .num_channels = 3,
313 .clock_mode = LP5521_CLOCK_EXT,
314};
315
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100316static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530317 {
Sundar Iyer20406eb2010-12-13 09:33:14 +0530318 I2C_BOARD_INFO("tc3589x", 0x42),
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100319 .irq = NOMADIK_GPIO_TO_IRQ(217),
Rabin Vincentb8410a12010-08-09 19:18:17 +0530320 .platform_data = &mop500_tc35892_data,
321 },
Linus Walleijcf568c52011-03-30 14:31:42 +0200322 /* I2C0 devices only available prior to HREFv60 */
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100323 {
324 I2C_BOARD_INFO("tps61052", 0x33),
325 .platform_data = &mop500_tps61052_data,
326 },
327};
328
Linus Walleijcf568c52011-03-30 14:31:42 +0200329#define NUM_PRE_V60_I2C0_DEVICES 1
330
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100331static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
332 {
333 /* lp5521 LED driver, 1st device */
334 I2C_BOARD_INFO("lp5521", 0x33),
335 .platform_data = &lp5521_pri_data,
336 },
337 {
338 /* lp5521 LED driver, 2st device */
339 I2C_BOARD_INFO("lp5521", 0x34),
340 .platform_data = &lp5521_sec_data,
341 },
Lee Jonesbb3b2182011-01-13 14:41:22 +0000342 {
343 /* Light sensor Rohm BH1780GLI */
344 I2C_BOARD_INFO("bh1780", 0x29),
345 },
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100346};
347
Linus Walleij2b030bd2011-05-13 12:31:13 +0200348#define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, t_out, _sm) \
Rabin Vincentf9faf232010-05-03 08:24:37 +0100349static struct nmk_i2c_controller u8500_i2c##id##_data = { \
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100350 /* \
351 * slave data setup time, which is \
352 * 250 ns,100ns,10ns which is 14,6,2 \
353 * respectively for a 48 Mhz \
354 * i2c clock \
355 */ \
356 .slsu = _slsu, \
357 /* Tx FIFO threshold */ \
358 .tft = _tft, \
359 /* Rx FIFO threshold */ \
360 .rft = _rft, \
361 /* std. mode operation */ \
362 .clk_freq = clk, \
Linus Walleij2b030bd2011-05-13 12:31:13 +0200363 /* Slave response timeout(ms) */\
364 .timeout = t_out, \
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100365 .sm = _sm, \
366}
367
368/*
369 * The board uses 4 i2c controllers, initialize all of
370 * them with slave data setup time of 250 ns,
Linus Walleij2b030bd2011-05-13 12:31:13 +0200371 * Tx & Rx FIFO threshold values as 8 and standard
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100372 * mode of operation
373 */
Linus Walleij2b030bd2011-05-13 12:31:13 +0200374U8500_I2C_CONTROLLER(0, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
375U8500_I2C_CONTROLLER(1, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
376U8500_I2C_CONTROLLER(2, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
377U8500_I2C_CONTROLLER(3, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100378
Lee Jones18403422012-02-06 11:22:21 -0800379static void __init mop500_i2c_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530380{
Lee Jones18403422012-02-06 11:22:21 -0800381 db8500_add_i2c0(parent, &u8500_i2c0_data);
382 db8500_add_i2c1(parent, &u8500_i2c1_data);
383 db8500_add_i2c2(parent, &u8500_i2c2_data);
384 db8500_add_i2c3(parent, &u8500_i2c3_data);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530385}
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100386
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100387static struct gpio_keys_button mop500_gpio_keys[] = {
388 {
389 .desc = "SFH7741 Proximity Sensor",
390 .type = EV_SW,
391 .code = SW_FRONT_PROXIMITY,
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100392 .active_low = 0,
393 .can_disable = 1,
394 }
395};
396
397static struct regulator *prox_regulator;
398static int mop500_prox_activate(struct device *dev);
399static void mop500_prox_deactivate(struct device *dev);
400
401static struct gpio_keys_platform_data mop500_gpio_keys_data = {
402 .buttons = mop500_gpio_keys,
403 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
404 .enable = mop500_prox_activate,
405 .disable = mop500_prox_deactivate,
406};
407
408static struct platform_device mop500_gpio_keys_device = {
409 .name = "gpio-keys",
410 .id = 0,
411 .dev = {
412 .platform_data = &mop500_gpio_keys_data,
413 },
414};
415
416static int mop500_prox_activate(struct device *dev)
417{
418 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
419 "vcc");
420 if (IS_ERR(prox_regulator)) {
421 dev_err(&mop500_gpio_keys_device.dev,
422 "no regulator\n");
423 return PTR_ERR(prox_regulator);
424 }
425 regulator_enable(prox_regulator);
426 return 0;
427}
428
429static void mop500_prox_deactivate(struct device *dev)
430{
431 regulator_disable(prox_regulator);
432 regulator_put(prox_regulator);
433}
434
Andreas Westin585d1882012-05-10 10:14:06 +0200435static struct cryp_platform_data u8500_cryp1_platform_data = {
436 .mem_to_engine = {
437 .dir = STEDMA40_MEM_TO_PERIPH,
438 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
439 .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
440 .src_info.data_width = STEDMA40_WORD_WIDTH,
441 .dst_info.data_width = STEDMA40_WORD_WIDTH,
442 .mode = STEDMA40_MODE_LOGICAL,
443 .src_info.psize = STEDMA40_PSIZE_LOG_4,
444 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
445 },
446 .engine_to_mem = {
447 .dir = STEDMA40_PERIPH_TO_MEM,
448 .src_dev_type = DB8500_DMA_DEV48_CAC1_RX,
449 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
450 .src_info.data_width = STEDMA40_WORD_WIDTH,
451 .dst_info.data_width = STEDMA40_WORD_WIDTH,
452 .mode = STEDMA40_MODE_LOGICAL,
453 .src_info.psize = STEDMA40_PSIZE_LOG_4,
454 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
455 }
456};
457
458static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
459 .dir = STEDMA40_MEM_TO_PERIPH,
460 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
461 .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
462 .src_info.data_width = STEDMA40_WORD_WIDTH,
463 .dst_info.data_width = STEDMA40_WORD_WIDTH,
464 .mode = STEDMA40_MODE_LOGICAL,
465 .src_info.psize = STEDMA40_PSIZE_LOG_16,
466 .dst_info.psize = STEDMA40_PSIZE_LOG_16,
467};
468
469static struct hash_platform_data u8500_hash1_platform_data = {
470 .mem_to_engine = &u8500_hash_dma_cfg_tx,
471 .dma_filter = stedma40_filter,
472};
473
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100474/* add any platform devices here - TODO */
Robert Marklund350abe02011-06-20 15:55:46 +0200475static struct platform_device *mop500_platform_devs[] __initdata = {
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100476 &mop500_gpio_keys_device,
Robert Marklund350abe02011-06-20 15:55:46 +0200477 &ab8500_device,
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100478};
479
Linus Walleij5d7b8462010-10-14 13:57:59 +0200480#ifdef CONFIG_STE_DMA40
481static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
482 .mode = STEDMA40_MODE_LOGICAL,
483 .dir = STEDMA40_PERIPH_TO_MEM,
484 .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
485 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
486 .src_info.data_width = STEDMA40_BYTE_WIDTH,
487 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
488};
489
490static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
491 .mode = STEDMA40_MODE_LOGICAL,
492 .dir = STEDMA40_MEM_TO_PERIPH,
493 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
494 .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
495 .src_info.data_width = STEDMA40_BYTE_WIDTH,
496 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
497};
498#endif
499
Lee Jones15daf692012-03-15 16:47:11 +0000500static struct pl022_ssp_controller ssp0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200501 .bus_id = 0,
502#ifdef CONFIG_STE_DMA40
503 .enable_dma = 1,
504 .dma_filter = stedma40_filter,
505 .dma_rx_param = &ssp0_dma_cfg_rx,
506 .dma_tx_param = &ssp0_dma_cfg_tx,
507#else
508 .enable_dma = 0,
509#endif
510 /* on this platform, gpio 31,142,144,214 &
511 * 224 are connected as chip selects
512 */
513 .num_chipselect = 5,
514};
515
Lee Jones18403422012-02-06 11:22:21 -0800516static void __init mop500_spi_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530517{
Lee Jones15daf692012-03-15 16:47:11 +0000518 db8500_add_ssp0(parent, &ssp0_plat);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530519}
520
Linus Walleij5d7b8462010-10-14 13:57:59 +0200521#ifdef CONFIG_STE_DMA40
522static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
523 .mode = STEDMA40_MODE_LOGICAL,
524 .dir = STEDMA40_PERIPH_TO_MEM,
525 .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
526 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
527 .src_info.data_width = STEDMA40_BYTE_WIDTH,
528 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
529};
530
531static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
532 .mode = STEDMA40_MODE_LOGICAL,
533 .dir = STEDMA40_MEM_TO_PERIPH,
534 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
535 .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
536 .src_info.data_width = STEDMA40_BYTE_WIDTH,
537 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
538};
539
540static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
541 .mode = STEDMA40_MODE_LOGICAL,
542 .dir = STEDMA40_PERIPH_TO_MEM,
543 .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
544 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
545 .src_info.data_width = STEDMA40_BYTE_WIDTH,
546 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
547};
548
549static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
550 .mode = STEDMA40_MODE_LOGICAL,
551 .dir = STEDMA40_MEM_TO_PERIPH,
552 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
553 .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
554 .src_info.data_width = STEDMA40_BYTE_WIDTH,
555 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
556};
557
558static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
559 .mode = STEDMA40_MODE_LOGICAL,
560 .dir = STEDMA40_PERIPH_TO_MEM,
561 .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
562 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
563 .src_info.data_width = STEDMA40_BYTE_WIDTH,
564 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
565};
566
567static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
568 .mode = STEDMA40_MODE_LOGICAL,
569 .dir = STEDMA40_MEM_TO_PERIPH,
570 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
571 .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
572 .src_info.data_width = STEDMA40_BYTE_WIDTH,
573 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
574};
575#endif
576
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +0200577#define PRCC_K_SOFTRST_SET 0x18
578#define PRCC_K_SOFTRST_CLEAR 0x1C
579static void ux500_uart0_reset(void)
580{
581 void __iomem *prcc_rst_set, *prcc_rst_clr;
582
583 prcc_rst_set = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
584 PRCC_K_SOFTRST_SET);
585 prcc_rst_clr = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
586 PRCC_K_SOFTRST_CLEAR);
587
588 /* Activate soft reset PRCC_K_SOFTRST_CLEAR */
589 writel((readl(prcc_rst_clr) | 0x1), prcc_rst_clr);
590 udelay(1);
591
592 /* Release soft reset PRCC_K_SOFTRST_SET */
593 writel((readl(prcc_rst_set) | 0x1), prcc_rst_set);
594 udelay(1);
595}
596
Linus Walleija0980662012-05-07 01:33:24 +0200597/* This needs to be referenced by callbacks */
598struct pinctrl *u0_p;
599struct pinctrl_state *u0_def;
600struct pinctrl_state *u0_sleep;
601
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +0200602static void ux500_uart0_init(void)
603{
604 int ret;
605
Linus Walleija0980662012-05-07 01:33:24 +0200606 if (IS_ERR(u0_p) || IS_ERR(u0_def))
607 return;
608
609 ret = pinctrl_select_state(u0_p, u0_def);
610 if (ret)
611 pr_err("could not set UART0 defstate\n");
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +0200612}
613
614static void ux500_uart0_exit(void)
615{
616 int ret;
617
Linus Walleija0980662012-05-07 01:33:24 +0200618 if (IS_ERR(u0_p) || IS_ERR(u0_sleep))
619 return;
620
621 ret = pinctrl_select_state(u0_p, u0_sleep);
622 if (ret)
623 pr_err("could not set UART0 idlestate\n");
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +0200624}
625
Linus Walleij5d7b8462010-10-14 13:57:59 +0200626static struct amba_pl011_data uart0_plat = {
627#ifdef CONFIG_STE_DMA40
628 .dma_filter = stedma40_filter,
629 .dma_rx_param = &uart0_dma_cfg_rx,
630 .dma_tx_param = &uart0_dma_cfg_tx,
631#endif
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +0200632 .init = ux500_uart0_init,
633 .exit = ux500_uart0_exit,
634 .reset = ux500_uart0_reset,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200635};
636
637static struct amba_pl011_data uart1_plat = {
638#ifdef CONFIG_STE_DMA40
639 .dma_filter = stedma40_filter,
640 .dma_rx_param = &uart1_dma_cfg_rx,
641 .dma_tx_param = &uart1_dma_cfg_tx,
642#endif
643};
644
645static struct amba_pl011_data uart2_plat = {
646#ifdef CONFIG_STE_DMA40
647 .dma_filter = stedma40_filter,
648 .dma_rx_param = &uart2_dma_cfg_rx,
649 .dma_tx_param = &uart2_dma_cfg_tx,
650#endif
651};
652
Lee Jones18403422012-02-06 11:22:21 -0800653static void __init mop500_uart_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530654{
Linus Walleija0980662012-05-07 01:33:24 +0200655 struct amba_device *uart0_device;
656
657 uart0_device = db8500_add_uart0(parent, &uart0_plat);
658 if (uart0_device) {
659 u0_p = pinctrl_get(&uart0_device->dev);
660 if (IS_ERR(u0_p))
661 dev_err(&uart0_device->dev,
662 "could not get UART0 pinctrl\n");
663 else {
664 u0_def = pinctrl_lookup_state(u0_p,
665 PINCTRL_STATE_DEFAULT);
666 if (IS_ERR(u0_def)) {
667 dev_err(&uart0_device->dev,
668 "could not get UART0 defstate\n");
669 }
670 u0_sleep = pinctrl_lookup_state(u0_p,
671 PINCTRL_STATE_SLEEP);
672 if (IS_ERR(u0_sleep))
673 dev_err(&uart0_device->dev,
674 "could not get UART0 idlestate\n");
675 }
676 }
Lee Jones18403422012-02-06 11:22:21 -0800677 db8500_add_uart1(parent, &uart1_plat);
678 db8500_add_uart2(parent, &uart2_plat);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530679}
680
Andreas Westin585d1882012-05-10 10:14:06 +0200681static void __init u8500_cryp1_hash1_init(struct device *parent)
682{
683 db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
684 db8500_add_hash1(parent, &u8500_hash1_platform_data);
685}
686
Robert Marklund350abe02011-06-20 15:55:46 +0200687static struct platform_device *snowball_platform_devs[] __initdata = {
688 &snowball_led_dev,
689 &snowball_key_dev,
Lee Jonese6fada52012-05-17 13:18:36 +0100690 &snowball_sbnet_dev,
Robert Marklund350abe02011-06-20 15:55:46 +0200691 &ab8500_device,
692};
693
Lee Jones11a0b5f02012-05-30 09:55:38 +0800694static struct platform_device *snowball_of_platform_devs[] __initdata = {
695 &snowball_led_dev,
696 &snowball_key_dev,
Lee Jones11a0b5f02012-05-30 09:55:38 +0800697};
698
Linus Walleij4b4f7572011-02-15 15:01:35 +0100699static void __init mop500_init_machine(void)
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100700{
Lee Jones18403422012-02-06 11:22:21 -0800701 struct device *parent = NULL;
Linus Walleijcf568c52011-03-30 14:31:42 +0200702 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800703 int i;
Linus Walleijcf568c52011-03-30 14:31:42 +0200704
Lee Jones110c2c22011-08-26 16:54:07 +0100705 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
Linus Walleij4b4f7572011-02-15 15:01:35 +0100706
Linus Walleijed781d392012-05-03 00:44:52 +0200707 mop500_pinmaps_init();
Lee Jones18403422012-02-06 11:22:21 -0800708 parent = u8500_init_devices();
Rabin Vincentea05a572010-06-03 07:58:42 +0100709
Lee Jones7e0ce272012-03-15 16:46:17 +0000710 /* FIXME: parent of ab8500 should be prcmu */
Lee Jonesb024a0c2012-02-06 11:22:25 -0800711 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
712 mop500_platform_devs[i]->dev.parent = parent;
713
Lee Jones110c2c22011-08-26 16:54:07 +0100714 platform_add_devices(mop500_platform_devs,
715 ARRAY_SIZE(mop500_platform_devs));
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100716
Lee Jones18403422012-02-06 11:22:21 -0800717 mop500_i2c_init(parent);
718 mop500_sdi_init(parent);
719 mop500_spi_init(parent);
Ola Liljac0af14d2012-04-20 11:32:59 +0200720 mop500_msp_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800721 mop500_uart_init(parent);
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100722
Andreas Westin585d1882012-05-10 10:14:06 +0200723 u8500_cryp1_hash1_init(parent);
724
Linus Walleijcf568c52011-03-30 14:31:42 +0200725 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
Lee Jones110c2c22011-08-26 16:54:07 +0100726
727 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
728 i2c_register_board_info(2, mop500_i2c2_devices,
729 ARRAY_SIZE(mop500_i2c2_devices));
730
731 /* This board has full regulator constraints */
732 regulator_has_full_constraints();
Lee Jonesfd6948b2012-05-02 09:53:48 +0100733
734 mop500_uib_init();
Lee Jones110c2c22011-08-26 16:54:07 +0100735}
736
737static void __init snowball_init_machine(void)
738{
Lee Jones18403422012-02-06 11:22:21 -0800739 struct device *parent = NULL;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800740 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100741
Linus Walleijed781d392012-05-03 00:44:52 +0200742 snowball_pinmaps_init();
Lee Jones18403422012-02-06 11:22:21 -0800743 parent = u8500_init_devices();
Lee Jones110c2c22011-08-26 16:54:07 +0100744
Lee Jonesb024a0c2012-02-06 11:22:25 -0800745 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
746 snowball_platform_devs[i]->dev.parent = parent;
747
Lee Jones110c2c22011-08-26 16:54:07 +0100748 platform_add_devices(snowball_platform_devs,
749 ARRAY_SIZE(snowball_platform_devs));
750
Lee Jones18403422012-02-06 11:22:21 -0800751 mop500_i2c_init(parent);
752 snowball_sdi_init(parent);
753 mop500_spi_init(parent);
Ola Liljac0af14d2012-04-20 11:32:59 +0200754 mop500_msp_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800755 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100756
Lee Jones110c2c22011-08-26 16:54:07 +0100757 /* This board has full regulator constraints */
758 regulator_has_full_constraints();
759}
760
761static void __init hrefv60_init_machine(void)
762{
Lee Jones18403422012-02-06 11:22:21 -0800763 struct device *parent = NULL;
Lee Jones110c2c22011-08-26 16:54:07 +0100764 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800765 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100766
767 /*
768 * The HREFv60 board removed a GPIO expander and routed
769 * all these GPIO pins to the internal GPIO controller
770 * instead.
771 */
772 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
773
Linus Walleijed781d392012-05-03 00:44:52 +0200774 hrefv60_pinmaps_init();
Lee Jones18403422012-02-06 11:22:21 -0800775 parent = u8500_init_devices();
Lee Jones110c2c22011-08-26 16:54:07 +0100776
Lee Jonesb024a0c2012-02-06 11:22:25 -0800777 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
778 mop500_platform_devs[i]->dev.parent = parent;
779
Lee Jones110c2c22011-08-26 16:54:07 +0100780 platform_add_devices(mop500_platform_devs,
781 ARRAY_SIZE(mop500_platform_devs));
782
Lee Jones18403422012-02-06 11:22:21 -0800783 mop500_i2c_init(parent);
784 hrefv60_sdi_init(parent);
785 mop500_spi_init(parent);
Ola Liljac0af14d2012-04-20 11:32:59 +0200786 mop500_msp_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800787 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100788
789 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
790
791 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
Linus Walleijcf568c52011-03-30 14:31:42 +0200792
793 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100794 i2c_register_board_info(2, mop500_i2c2_devices,
795 ARRAY_SIZE(mop500_i2c2_devices));
Linus Walleijdb245202011-04-04 10:44:51 +0200796
797 /* This board has full regulator constraints */
798 regulator_has_full_constraints();
Lee Jonesfd6948b2012-05-02 09:53:48 +0100799
800 mop500_uib_init();
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100801}
802
803MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
804 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400805 .atag_offset = 0x100,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100806 .map_io = u8500_map_io,
Rabin Vincent178980f2010-05-03 07:39:02 +0100807 .init_irq = ux500_init_irq,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100808 /* we re-use nomadik timer here */
Rabin Vincent41ac3292010-05-03 08:28:05 +0100809 .timer = &ux500_timer,
Marc Zyngierbbf5f382011-09-06 10:23:45 +0100810 .handle_irq = gic_handle_irq,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100811 .init_machine = mop500_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800812 .init_late = ux500_init_late,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100813MACHINE_END
814
815MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400816 .atag_offset = 0x100,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100817 .map_io = u8500_map_io,
818 .init_irq = ux500_init_irq,
819 .timer = &ux500_timer,
Marc Zyngierbbf5f382011-09-06 10:23:45 +0100820 .handle_irq = gic_handle_irq,
Lee Jones110c2c22011-08-26 16:54:07 +0100821 .init_machine = hrefv60_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800822 .init_late = ux500_init_late,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100823MACHINE_END
Robert Marklund350abe02011-06-20 15:55:46 +0200824
825MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400826 .atag_offset = 0x100,
Robert Marklund350abe02011-06-20 15:55:46 +0200827 .map_io = u8500_map_io,
828 .init_irq = ux500_init_irq,
829 /* we re-use nomadik timer here */
830 .timer = &ux500_timer,
Marc Zyngierbbf5f382011-09-06 10:23:45 +0100831 .handle_irq = gic_handle_irq,
Lee Jones110c2c22011-08-26 16:54:07 +0100832 .init_machine = snowball_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800833 .init_late = ux500_init_late,
Robert Marklund350abe02011-06-20 15:55:46 +0200834MACHINE_END
Arnd Bergmann2d334292012-03-07 15:04:07 +0000835
836#ifdef CONFIG_MACH_UX500_DT
Lee Jones7e0ce272012-03-15 16:46:17 +0000837
838struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
Lee Jones513c27f2012-04-13 15:05:05 +0100839 /* Requires DMA and call-back bindings. */
Lee Jones4905af02012-03-07 17:35:04 +0000840 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
841 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
842 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
Lee Jones513c27f2012-04-13 15:05:05 +0100843 /* Requires DMA bindings. */
Lee Jones15daf692012-03-15 16:47:11 +0000844 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
Lee Jones513c27f2012-04-13 15:05:05 +0100845 /* Requires clock name bindings. */
846 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
847 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
848 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL),
849 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL),
850 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL),
851 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL),
852 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
853 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
854 OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
Lee Jones7e0ce272012-03-15 16:46:17 +0000855 {},
856};
857
Lee Jones2cfaa622012-04-19 21:36:30 +0100858static const struct of_device_id u8500_local_bus_nodes[] = {
Lee Jones7e0ce272012-03-15 16:46:17 +0000859 /* only create devices below soc node */
860 { .compatible = "stericsson,db8500", },
Lee Jones48a4ea62012-05-29 15:06:55 +0800861 { .compatible = "stericsson,db8500-prcmu", },
Lee Jones890d84f2012-05-04 14:01:00 +0100862 { .compatible = "stericsson,db8500-prcmu-regulator", },
Lee Jones48a4ea62012-05-29 15:06:55 +0800863 { .compatible = "stericsson,ab8500", },
864 { .compatible = "stericsson,ab8500-regulator", },
Lee Jones2cfaa622012-04-19 21:36:30 +0100865 { .compatible = "simple-bus"},
Lee Jones7e0ce272012-03-15 16:46:17 +0000866 { },
867};
868
Arnd Bergmann2d334292012-03-07 15:04:07 +0000869static void __init u8500_init_machine(void)
870{
Arnd Bergmann7734fed2012-03-02 22:25:02 +0000871 struct device *parent = NULL;
872 int i2c0_devs;
873 int i;
874
Linus Walleijed781d392012-05-03 00:44:52 +0200875 /* Pinmaps must be in place before devices register */
876 if (of_machine_is_compatible("st-ericsson,mop500"))
877 mop500_pinmaps_init();
878 else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
879 snowball_pinmaps_init();
880 else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
881 hrefv60_pinmaps_init();
882
Lee Jonesf65c1982012-05-29 10:03:09 +0800883 parent = u8500_of_init_devices();
Arnd Bergmann7734fed2012-03-02 22:25:02 +0000884
885 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
886 mop500_platform_devs[i]->dev.parent = parent;
887 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
888 snowball_platform_devs[i]->dev.parent = parent;
889
Lee Jones7e0ce272012-03-15 16:46:17 +0000890 /* automatically probe child nodes of db8500 device */
Lee Jones2cfaa622012-04-19 21:36:30 +0100891 of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent);
Arnd Bergmann7734fed2012-03-02 22:25:02 +0000892
893 if (of_machine_is_compatible("st-ericsson,mop500")) {
894 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
Arnd Bergmann7734fed2012-03-02 22:25:02 +0000895
896 platform_add_devices(mop500_platform_devs,
897 ARRAY_SIZE(mop500_platform_devs));
898
899 mop500_sdi_init(parent);
Lee Jones4809f902012-04-19 21:36:40 +0100900 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
901 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
902 i2c_register_board_info(2, mop500_i2c2_devices,
903 ARRAY_SIZE(mop500_i2c2_devices));
904
Lee Jonesfd6948b2012-05-02 09:53:48 +0100905 mop500_uib_init();
906
Arnd Bergmann7734fed2012-03-02 22:25:02 +0000907 } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
Lee Jones11a0b5f02012-05-30 09:55:38 +0800908 /*
909 * Devices to be DT:ed:
910 * snowball_led_dev = todo
911 * snowball_key_dev = todo
Lee Jonesada46cd2012-05-29 10:28:34 +0800912 * snowball_sbnet_dev = done
Lee Jones48a4ea62012-05-29 15:06:55 +0800913 * ab8500_device = done
Lee Jones11a0b5f02012-05-30 09:55:38 +0800914 */
915 platform_add_devices(snowball_of_platform_devs,
916 ARRAY_SIZE(snowball_of_platform_devs));
Arnd Bergmann7734fed2012-03-02 22:25:02 +0000917
918 snowball_sdi_init(parent);
919 } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
920 /*
921 * The HREFv60 board removed a GPIO expander and routed
922 * all these GPIO pins to the internal GPIO controller
923 * instead.
924 */
925 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
Arnd Bergmann7734fed2012-03-02 22:25:02 +0000926 platform_add_devices(mop500_platform_devs,
927 ARRAY_SIZE(mop500_platform_devs));
928
929 hrefv60_sdi_init(parent);
Lee Jones4809f902012-04-19 21:36:40 +0100930
931 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
932 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
933
934 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
935 i2c_register_board_info(2, mop500_i2c2_devices,
936 ARRAY_SIZE(mop500_i2c2_devices));
Lee Jonesfd6948b2012-05-02 09:53:48 +0100937
938 mop500_uib_init();
Arnd Bergmann7734fed2012-03-02 22:25:02 +0000939 }
940 mop500_i2c_init(parent);
Arnd Bergmann7734fed2012-03-02 22:25:02 +0000941
Arnd Bergmann7734fed2012-03-02 22:25:02 +0000942 /* This board has full regulator constraints */
943 regulator_has_full_constraints();
Arnd Bergmann2d334292012-03-07 15:04:07 +0000944}
945
946static const char * u8500_dt_board_compat[] = {
947 "calaosystems,snowball-a9500",
948 "st-ericsson,hrefv60+",
949 "st-ericsson,u8500",
950 "st-ericsson,mop500",
951 NULL,
952};
953
954
955DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)")
956 .map_io = u8500_map_io,
957 .init_irq = ux500_init_irq,
958 /* we re-use nomadik timer here */
959 .timer = &ux500_timer,
960 .handle_irq = gic_handle_irq,
961 .init_machine = u8500_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800962 .init_late = ux500_init_late,
Arnd Bergmann2d334292012-03-07 15:04:07 +0000963 .dt_compat = u8500_dt_board_compat,
964MACHINE_END
965#endif