blob: d453522edb0d66b0488e46247fa4446876e69f6f [file] [log] [blame]
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +01001/*
Linus Walleija3a6c6a2012-10-01 09:37:39 +02002 * Copyright (C) 2008-2012 ST-Ericsson
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +01003 *
4 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
9 *
10 */
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/interrupt.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
Rabin Vincentb8410a12010-08-09 19:18:17 +053016#include <linux/i2c.h>
Alessandro Rubiniaf97bac2012-06-11 22:56:26 +020017#include <linux/platform_data/i2c-nomadik.h>
hongbo.zhangdc1956b2012-11-15 18:56:43 +080018#include <linux/platform_data/db8500_thermal.h>
Rabin Vincentea05a572010-06-03 07:58:42 +010019#include <linux/gpio.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010020#include <linux/amba/bus.h>
21#include <linux/amba/pl022.h>
Linus Walleij5d7b8462010-10-14 13:57:59 +020022#include <linux/amba/serial.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010023#include <linux/spi/spi.h>
Linus Walleijee66e652011-12-02 14:16:33 +010024#include <linux/mfd/abx500/ab8500.h>
Bengt Jonsson79568b942011-03-11 11:54:46 +010025#include <linux/regulator/ab8500.h>
Lee Jones0b5ea1e2012-09-03 14:33:39 +010026#include <linux/regulator/fixed.h>
Sundar Iyer20406eb2010-12-13 09:33:14 +053027#include <linux/mfd/tc3589x.h>
Linus Walleijfe67dfc2011-03-07 11:48:15 +010028#include <linux/mfd/tps6105x.h>
Linus Walleijee66e652011-12-02 14:16:33 +010029#include <linux/mfd/abx500/ab8500-gpio.h>
Ola Liljaf242e502012-06-07 14:00:46 +020030#include <linux/mfd/abx500/ab8500-codec.h>
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +010031#include <linux/leds-lp5521.h>
Philippe Langlaisa71b8192011-01-14 10:53:59 +010032#include <linux/input.h>
Robert Marklund350abe02011-06-20 15:55:46 +020033#include <linux/smsc911x.h>
Philippe Langlaisa71b8192011-01-14 10:53:59 +010034#include <linux/gpio_keys.h>
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +020035#include <linux/delay.h>
Robert Marklund350abe02011-06-20 15:55:46 +020036#include <linux/leds.h>
Linus Walleija0980662012-05-07 01:33:24 +020037#include <linux/pinctrl/consumer.h>
Linus Walleijbb16bd92012-10-10 14:27:58 +020038#include <linux/platform_data/pinctrl-nomadik.h>
Linus Walleij865fab62012-10-18 14:20:16 +020039#include <linux/platform_data/dma-ste-dma40.h>
Linus Walleija0980662012-05-07 01:33:24 +020040
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010041#include <asm/mach-types.h>
42#include <asm/mach/arch.h>
Marc Zyngierbbf5f382011-09-06 10:23:45 +010043#include <asm/hardware/gic.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010044
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010045#include <mach/hardware.h>
46#include <mach/setup.h>
Rabin Vincent9e4e7fe2010-05-03 08:03:52 +010047#include <mach/devices.h>
Linus Walleij29aeb3c2010-09-06 22:15:08 +010048#include <mach/irqs.h>
Arnd Bergmanndb298da2012-08-24 15:19:33 +020049#include <linux/platform_data/crypto-ux500.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010050
Linus Walleij5d7b8462010-10-14 13:57:59 +020051#include "ste-dma40-db8500.h"
Rabin Vincentfbf1ead2010-09-29 19:46:32 +053052#include "devices-db8500.h"
Hanumath Prasad008f8a22010-08-19 12:06:32 +010053#include "board-mop500.h"
Bengt Jonssona1e516e2010-12-10 11:08:48 +010054#include "board-mop500-regulators.h"
Rabin Vincentea05a572010-06-03 07:58:42 +010055
Robert Marklund350abe02011-06-20 15:55:46 +020056static struct gpio_led snowball_led_array[] = {
57 {
58 .name = "user_led",
Lee Jonesc525f072012-05-02 09:20:37 +010059 .default_trigger = "heartbeat",
Robert Marklund350abe02011-06-20 15:55:46 +020060 .gpio = 142,
61 },
62};
63
64static struct gpio_led_platform_data snowball_led_data = {
65 .leds = snowball_led_array,
66 .num_leds = ARRAY_SIZE(snowball_led_array),
67};
68
69static struct platform_device snowball_led_dev = {
70 .name = "leds-gpio",
71 .dev = {
72 .platform_data = &snowball_led_data,
73 },
74};
75
Lee Jones0b5ea1e2012-09-03 14:33:39 +010076static struct fixed_voltage_config snowball_gpio_en_3v3_data = {
77 .supply_name = "EN-3V3",
78 .gpio = SNOWBALL_EN_3V3_ETH_GPIO,
79 .microvolts = 3300000,
80 .enable_high = 1,
81 .init_data = &gpio_en_3v3_regulator,
82 .startup_delay = 5000, /* 1200us */
83};
84
85static struct platform_device snowball_gpio_en_3v3_regulator_dev = {
86 .name = "reg-fixed-voltage",
87 .id = 1,
88 .dev = {
89 .platform_data = &snowball_gpio_en_3v3_data,
90 },
91};
92
Bibek Basu3ef374a2011-02-15 12:56:16 +053093static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
Philippe Langlaisa1524ee2012-02-13 10:52:25 +010094 .gpio_base = MOP500_AB8500_PIN_GPIO(1),
Bibek Basu3ef374a2011-02-15 12:56:16 +053095 .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
96 /* config_reg is the initial configuration of ab8500 pins.
97 * The pins can be configured as GPIO or alt functions based
98 * on value present in GpioSel1 to GpioSel6 and AlternatFunction
99 * register. This is the array of 7 configuration settings.
100 * One has to compile time decide these settings. Below is the
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300101 * explanation of these setting
Bibek Basu3ef374a2011-02-15 12:56:16 +0530102 * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
103 * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
104 * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
105 * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO
106 * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO
107 * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO
108 * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured
109 * as GPIO then this register selectes the alternate fucntions
110 */
111 .config_reg = {0x00, 0x1E, 0x80, 0x01,
112 0x7A, 0x00, 0x00},
113};
114
Ola Liljaf242e502012-06-07 14:00:46 +0200115/* ab8500-codec */
116static struct ab8500_codec_platform_data ab8500_codec_pdata = {
117 .amics = {
118 .mic1_type = AMIC_TYPE_DIFFERENTIAL,
119 .mic2_type = AMIC_TYPE_DIFFERENTIAL,
120 .mic1a_micbias = AMIC_MICBIAS_VAMIC1,
121 .mic1b_micbias = AMIC_MICBIAS_VAMIC1,
122 .mic2_micbias = AMIC_MICBIAS_VAMIC2
123 },
124 .ear_cmv = EAR_CMV_0_95V
125};
126
Robert Marklund350abe02011-06-20 15:55:46 +0200127static struct gpio_keys_button snowball_key_array[] = {
128 {
129 .gpio = 32,
130 .type = EV_KEY,
131 .code = KEY_1,
132 .desc = "userpb",
133 .active_low = 1,
134 .debounce_interval = 50,
135 .wakeup = 1,
136 },
137 {
138 .gpio = 151,
139 .type = EV_KEY,
140 .code = KEY_2,
141 .desc = "extkb1",
142 .active_low = 1,
143 .debounce_interval = 50,
144 .wakeup = 1,
145 },
146 {
147 .gpio = 152,
148 .type = EV_KEY,
149 .code = KEY_3,
150 .desc = "extkb2",
151 .active_low = 1,
152 .debounce_interval = 50,
153 .wakeup = 1,
154 },
155 {
156 .gpio = 161,
157 .type = EV_KEY,
158 .code = KEY_4,
159 .desc = "extkb3",
160 .active_low = 1,
161 .debounce_interval = 50,
162 .wakeup = 1,
163 },
164 {
165 .gpio = 162,
166 .type = EV_KEY,
167 .code = KEY_5,
168 .desc = "extkb4",
169 .active_low = 1,
170 .debounce_interval = 50,
171 .wakeup = 1,
172 },
173};
174
175static struct gpio_keys_platform_data snowball_key_data = {
176 .buttons = snowball_key_array,
177 .nbuttons = ARRAY_SIZE(snowball_key_array),
178};
179
180static struct platform_device snowball_key_dev = {
181 .name = "gpio-keys",
182 .id = -1,
183 .dev = {
184 .platform_data = &snowball_key_data,
185 }
186};
187
188static struct smsc911x_platform_config snowball_sbnet_cfg = {
189 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
190 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
191 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
192 .shift = 1,
193};
194
195static struct resource sbnet_res[] = {
196 {
197 .name = "smsc911x-memory",
198 .start = (0x5000 << 16),
199 .end = (0x5000 << 16) + 0xffff,
200 .flags = IORESOURCE_MEM,
201 },
202 {
203 .start = NOMADIK_GPIO_TO_IRQ(140),
204 .end = NOMADIK_GPIO_TO_IRQ(140),
205 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
206 },
207};
208
209static struct platform_device snowball_sbnet_dev = {
210 .name = "smsc911x",
211 .num_resources = ARRAY_SIZE(sbnet_res),
212 .resource = sbnet_res,
213 .dev = {
214 .platform_data = &snowball_sbnet_cfg,
215 },
216};
217
Rabin Vincent39ae7022010-07-26 11:12:15 +0100218static struct ab8500_platform_data ab8500_platdata = {
219 .irq_base = MOP500_AB8500_IRQ_BASE,
Bengt Jonssondfa3a822011-03-09 13:34:17 +0100220 .regulator_reg_init = ab8500_regulator_reg_init,
221 .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
Bengt Jonssona1e516e2010-12-10 11:08:48 +0100222 .regulator = ab8500_regulators,
223 .num_regulator = ARRAY_SIZE(ab8500_regulators),
Bibek Basu3ef374a2011-02-15 12:56:16 +0530224 .gpio = &ab8500_gpio_pdata,
Ola Liljaf242e502012-06-07 14:00:46 +0200225 .codec = &ab8500_codec_pdata,
Rabin Vincent39ae7022010-07-26 11:12:15 +0100226};
227
Rabin Vincentb8410a12010-08-09 19:18:17 +0530228/*
hongbo.zhangdc1956b2012-11-15 18:56:43 +0800229 * Thermal Sensor
230 */
231
232static struct resource db8500_thsens_resources[] = {
233 {
234 .name = "IRQ_HOTMON_LOW",
235 .start = IRQ_PRCMU_HOTMON_LOW,
236 .end = IRQ_PRCMU_HOTMON_LOW,
237 .flags = IORESOURCE_IRQ,
238 },
239 {
240 .name = "IRQ_HOTMON_HIGH",
241 .start = IRQ_PRCMU_HOTMON_HIGH,
242 .end = IRQ_PRCMU_HOTMON_HIGH,
243 .flags = IORESOURCE_IRQ,
244 },
245};
246
247static struct db8500_thsens_platform_data db8500_thsens_data = {
248 .trip_points[0] = {
249 .temp = 70000,
250 .type = THERMAL_TRIP_ACTIVE,
251 .cdev_name = {
252 [0] = "thermal-cpufreq-0",
253 },
254 },
255 .trip_points[1] = {
256 .temp = 75000,
257 .type = THERMAL_TRIP_ACTIVE,
258 .cdev_name = {
259 [0] = "thermal-cpufreq-0",
260 },
261 },
262 .trip_points[2] = {
263 .temp = 80000,
264 .type = THERMAL_TRIP_ACTIVE,
265 .cdev_name = {
266 [0] = "thermal-cpufreq-0",
267 },
268 },
269 .trip_points[3] = {
270 .temp = 85000,
271 .type = THERMAL_TRIP_CRITICAL,
272 },
273 .num_trips = 4,
274};
275
276static struct platform_device u8500_thsens_device = {
277 .name = "db8500-thermal",
278 .resource = db8500_thsens_resources,
279 .num_resources = ARRAY_SIZE(db8500_thsens_resources),
280 .dev = {
281 .platform_data = &db8500_thsens_data,
282 },
283};
284
285static struct platform_device u8500_cpufreq_cooling_device = {
286 .name = "db8500-cpufreq-cooling",
287};
288
289/*
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100290 * TPS61052
291 */
292
293static struct tps6105x_platform_data mop500_tps61052_data = {
294 .mode = TPS6105X_MODE_VOLTAGE,
295 .regulator_data = &tps61052_regulator,
296};
297
298/*
Rabin Vincentb8410a12010-08-09 19:18:17 +0530299 * TC35892
300 */
301
Sundar Iyer20406eb2010-12-13 09:33:14 +0530302static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
Rabin Vincentb8410a12010-08-09 19:18:17 +0530303{
Lee Jones18403422012-02-06 11:22:21 -0800304 struct device *parent = NULL;
305#if 0
306 /* FIXME: Is the sdi actually part of tc3589x? */
307 parent = tc3589x->dev;
308#endif
309 mop500_sdi_tc35892_init(parent);
Rabin Vincentb8410a12010-08-09 19:18:17 +0530310}
311
Sundar Iyer20406eb2010-12-13 09:33:14 +0530312static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530313 .gpio_base = MOP500_EGPIO(0),
314 .setup = mop500_tc35892_init,
315};
316
Sundar Iyer20406eb2010-12-13 09:33:14 +0530317static struct tc3589x_platform_data mop500_tc35892_data = {
Sundar Iyer611b7592010-12-13 09:33:15 +0530318 .block = TC3589x_BLOCK_GPIO,
Rabin Vincentb8410a12010-08-09 19:18:17 +0530319 .gpio = &mop500_tc35892_gpio_data,
320 .irq_base = MOP500_EGPIO_IRQ_BASE,
321};
322
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100323static struct lp5521_led_config lp5521_pri_led[] = {
324 [0] = {
325 .chan_nr = 0,
326 .led_current = 0x2f,
327 .max_current = 0x5f,
328 },
329 [1] = {
330 .chan_nr = 1,
331 .led_current = 0x2f,
332 .max_current = 0x5f,
333 },
334 [2] = {
335 .chan_nr = 2,
336 .led_current = 0x2f,
337 .max_current = 0x5f,
338 },
339};
340
341static struct lp5521_platform_data __initdata lp5521_pri_data = {
342 .label = "lp5521_pri",
343 .led_config = &lp5521_pri_led[0],
344 .num_channels = 3,
345 .clock_mode = LP5521_CLOCK_EXT,
346};
347
348static struct lp5521_led_config lp5521_sec_led[] = {
349 [0] = {
350 .chan_nr = 0,
351 .led_current = 0x2f,
352 .max_current = 0x5f,
353 },
354 [1] = {
355 .chan_nr = 1,
356 .led_current = 0x2f,
357 .max_current = 0x5f,
358 },
359 [2] = {
360 .chan_nr = 2,
361 .led_current = 0x2f,
362 .max_current = 0x5f,
363 },
364};
365
366static struct lp5521_platform_data __initdata lp5521_sec_data = {
367 .label = "lp5521_sec",
368 .led_config = &lp5521_sec_led[0],
369 .num_channels = 3,
370 .clock_mode = LP5521_CLOCK_EXT,
371};
372
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100373static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530374 {
Sundar Iyer20406eb2010-12-13 09:33:14 +0530375 I2C_BOARD_INFO("tc3589x", 0x42),
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100376 .irq = NOMADIK_GPIO_TO_IRQ(217),
Rabin Vincentb8410a12010-08-09 19:18:17 +0530377 .platform_data = &mop500_tc35892_data,
378 },
Linus Walleijcf568c52011-03-30 14:31:42 +0200379 /* I2C0 devices only available prior to HREFv60 */
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100380 {
381 I2C_BOARD_INFO("tps61052", 0x33),
382 .platform_data = &mop500_tps61052_data,
383 },
384};
385
Linus Walleijcf568c52011-03-30 14:31:42 +0200386#define NUM_PRE_V60_I2C0_DEVICES 1
387
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100388static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
389 {
390 /* lp5521 LED driver, 1st device */
391 I2C_BOARD_INFO("lp5521", 0x33),
392 .platform_data = &lp5521_pri_data,
393 },
394 {
395 /* lp5521 LED driver, 2st device */
396 I2C_BOARD_INFO("lp5521", 0x34),
397 .platform_data = &lp5521_sec_data,
398 },
Lee Jonesbb3b2182011-01-13 14:41:22 +0000399 {
400 /* Light sensor Rohm BH1780GLI */
401 I2C_BOARD_INFO("bh1780", 0x29),
402 },
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100403};
404
Lee Jones18403422012-02-06 11:22:21 -0800405static void __init mop500_i2c_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530406{
Lee Jones98582d92012-04-17 15:52:26 +0100407 db8500_add_i2c0(parent, NULL);
408 db8500_add_i2c1(parent, NULL);
409 db8500_add_i2c2(parent, NULL);
410 db8500_add_i2c3(parent, NULL);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530411}
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100412
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100413static struct gpio_keys_button mop500_gpio_keys[] = {
414 {
415 .desc = "SFH7741 Proximity Sensor",
416 .type = EV_SW,
417 .code = SW_FRONT_PROXIMITY,
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100418 .active_low = 0,
419 .can_disable = 1,
420 }
421};
422
423static struct regulator *prox_regulator;
424static int mop500_prox_activate(struct device *dev);
425static void mop500_prox_deactivate(struct device *dev);
426
427static struct gpio_keys_platform_data mop500_gpio_keys_data = {
428 .buttons = mop500_gpio_keys,
429 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
430 .enable = mop500_prox_activate,
431 .disable = mop500_prox_deactivate,
432};
433
434static struct platform_device mop500_gpio_keys_device = {
435 .name = "gpio-keys",
436 .id = 0,
437 .dev = {
438 .platform_data = &mop500_gpio_keys_data,
439 },
440};
441
442static int mop500_prox_activate(struct device *dev)
443{
444 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
445 "vcc");
446 if (IS_ERR(prox_regulator)) {
447 dev_err(&mop500_gpio_keys_device.dev,
448 "no regulator\n");
449 return PTR_ERR(prox_regulator);
450 }
451 regulator_enable(prox_regulator);
452 return 0;
453}
454
455static void mop500_prox_deactivate(struct device *dev)
456{
457 regulator_disable(prox_regulator);
458 regulator_put(prox_regulator);
459}
460
Andreas Westin585d1882012-05-10 10:14:06 +0200461static struct cryp_platform_data u8500_cryp1_platform_data = {
462 .mem_to_engine = {
463 .dir = STEDMA40_MEM_TO_PERIPH,
464 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
465 .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
466 .src_info.data_width = STEDMA40_WORD_WIDTH,
467 .dst_info.data_width = STEDMA40_WORD_WIDTH,
468 .mode = STEDMA40_MODE_LOGICAL,
469 .src_info.psize = STEDMA40_PSIZE_LOG_4,
470 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
471 },
472 .engine_to_mem = {
473 .dir = STEDMA40_PERIPH_TO_MEM,
474 .src_dev_type = DB8500_DMA_DEV48_CAC1_RX,
475 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
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_4,
480 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
481 }
482};
483
484static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
485 .dir = STEDMA40_MEM_TO_PERIPH,
486 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
487 .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
488 .src_info.data_width = STEDMA40_WORD_WIDTH,
489 .dst_info.data_width = STEDMA40_WORD_WIDTH,
490 .mode = STEDMA40_MODE_LOGICAL,
491 .src_info.psize = STEDMA40_PSIZE_LOG_16,
492 .dst_info.psize = STEDMA40_PSIZE_LOG_16,
493};
494
495static struct hash_platform_data u8500_hash1_platform_data = {
496 .mem_to_engine = &u8500_hash_dma_cfg_tx,
497 .dma_filter = stedma40_filter,
498};
499
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100500/* add any platform devices here - TODO */
Robert Marklund350abe02011-06-20 15:55:46 +0200501static struct platform_device *mop500_platform_devs[] __initdata = {
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100502 &mop500_gpio_keys_device,
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100503};
504
Linus Walleij5d7b8462010-10-14 13:57:59 +0200505#ifdef CONFIG_STE_DMA40
506static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
507 .mode = STEDMA40_MODE_LOGICAL,
508 .dir = STEDMA40_PERIPH_TO_MEM,
509 .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
510 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
511 .src_info.data_width = STEDMA40_BYTE_WIDTH,
512 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
513};
514
515static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
516 .mode = STEDMA40_MODE_LOGICAL,
517 .dir = STEDMA40_MEM_TO_PERIPH,
518 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
519 .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
520 .src_info.data_width = STEDMA40_BYTE_WIDTH,
521 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
522};
523#endif
524
Lee Jonesfa86a762012-09-27 10:17:36 +0100525struct pl022_ssp_controller ssp0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200526 .bus_id = 0,
527#ifdef CONFIG_STE_DMA40
528 .enable_dma = 1,
529 .dma_filter = stedma40_filter,
530 .dma_rx_param = &ssp0_dma_cfg_rx,
531 .dma_tx_param = &ssp0_dma_cfg_tx,
532#else
533 .enable_dma = 0,
534#endif
535 /* on this platform, gpio 31,142,144,214 &
536 * 224 are connected as chip selects
537 */
538 .num_chipselect = 5,
539};
540
Lee Jones18403422012-02-06 11:22:21 -0800541static void __init mop500_spi_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530542{
Lee Jones15daf692012-03-15 16:47:11 +0000543 db8500_add_ssp0(parent, &ssp0_plat);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530544}
545
Linus Walleij5d7b8462010-10-14 13:57:59 +0200546#ifdef CONFIG_STE_DMA40
547static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
548 .mode = STEDMA40_MODE_LOGICAL,
549 .dir = STEDMA40_PERIPH_TO_MEM,
550 .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
551 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
552 .src_info.data_width = STEDMA40_BYTE_WIDTH,
553 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
554};
555
556static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
557 .mode = STEDMA40_MODE_LOGICAL,
558 .dir = STEDMA40_MEM_TO_PERIPH,
559 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
560 .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
561 .src_info.data_width = STEDMA40_BYTE_WIDTH,
562 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
563};
564
565static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
566 .mode = STEDMA40_MODE_LOGICAL,
567 .dir = STEDMA40_PERIPH_TO_MEM,
568 .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
569 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
570 .src_info.data_width = STEDMA40_BYTE_WIDTH,
571 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
572};
573
574static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
575 .mode = STEDMA40_MODE_LOGICAL,
576 .dir = STEDMA40_MEM_TO_PERIPH,
577 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
578 .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
579 .src_info.data_width = STEDMA40_BYTE_WIDTH,
580 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
581};
582
583static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
584 .mode = STEDMA40_MODE_LOGICAL,
585 .dir = STEDMA40_PERIPH_TO_MEM,
586 .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
587 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
588 .src_info.data_width = STEDMA40_BYTE_WIDTH,
589 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
590};
591
592static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
593 .mode = STEDMA40_MODE_LOGICAL,
594 .dir = STEDMA40_MEM_TO_PERIPH,
595 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
596 .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
597 .src_info.data_width = STEDMA40_BYTE_WIDTH,
598 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
599};
600#endif
601
Lee Jonesfa86a762012-09-27 10:17:36 +0100602struct amba_pl011_data uart0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200603#ifdef CONFIG_STE_DMA40
604 .dma_filter = stedma40_filter,
605 .dma_rx_param = &uart0_dma_cfg_rx,
606 .dma_tx_param = &uart0_dma_cfg_tx,
607#endif
608};
609
Lee Jonesfa86a762012-09-27 10:17:36 +0100610struct amba_pl011_data uart1_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200611#ifdef CONFIG_STE_DMA40
612 .dma_filter = stedma40_filter,
613 .dma_rx_param = &uart1_dma_cfg_rx,
614 .dma_tx_param = &uart1_dma_cfg_tx,
615#endif
616};
617
Lee Jonesfa86a762012-09-27 10:17:36 +0100618struct amba_pl011_data uart2_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200619#ifdef CONFIG_STE_DMA40
620 .dma_filter = stedma40_filter,
621 .dma_rx_param = &uart2_dma_cfg_rx,
622 .dma_tx_param = &uart2_dma_cfg_tx,
623#endif
624};
625
Lee Jones18403422012-02-06 11:22:21 -0800626static void __init mop500_uart_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530627{
Linus Walleij78d80c52012-05-23 21:18:46 +0200628 db8500_add_uart0(parent, &uart0_plat);
Lee Jones18403422012-02-06 11:22:21 -0800629 db8500_add_uart1(parent, &uart1_plat);
630 db8500_add_uart2(parent, &uart2_plat);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530631}
632
Andreas Westin585d1882012-05-10 10:14:06 +0200633static void __init u8500_cryp1_hash1_init(struct device *parent)
634{
635 db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
636 db8500_add_hash1(parent, &u8500_hash1_platform_data);
637}
638
Robert Marklund350abe02011-06-20 15:55:46 +0200639static struct platform_device *snowball_platform_devs[] __initdata = {
640 &snowball_led_dev,
641 &snowball_key_dev,
Lee Jonese6fada52012-05-17 13:18:36 +0100642 &snowball_sbnet_dev,
Lee Jones0b5ea1e2012-09-03 14:33:39 +0100643 &snowball_gpio_en_3v3_regulator_dev,
hongbo.zhangdc1956b2012-11-15 18:56:43 +0800644 &u8500_thsens_device,
645 &u8500_cpufreq_cooling_device,
Robert Marklund350abe02011-06-20 15:55:46 +0200646};
647
Linus Walleij4b4f7572011-02-15 15:01:35 +0100648static void __init mop500_init_machine(void)
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100649{
Lee Jones18403422012-02-06 11:22:21 -0800650 struct device *parent = NULL;
Linus Walleijcf568c52011-03-30 14:31:42 +0200651 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800652 int i;
Linus Walleijcf568c52011-03-30 14:31:42 +0200653
Lee Jones110c2c22011-08-26 16:54:07 +0100654 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
Linus Walleij4b4f7572011-02-15 15:01:35 +0100655
Linus Walleijed781d392012-05-03 00:44:52 +0200656 mop500_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200657 parent = u8500_init_devices(&ab8500_platdata);
Rabin Vincentea05a572010-06-03 07:58:42 +0100658
Lee Jonesb024a0c2012-02-06 11:22:25 -0800659 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
660 mop500_platform_devs[i]->dev.parent = parent;
661
Lee Jones110c2c22011-08-26 16:54:07 +0100662 platform_add_devices(mop500_platform_devs,
663 ARRAY_SIZE(mop500_platform_devs));
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100664
Lee Jones18403422012-02-06 11:22:21 -0800665 mop500_i2c_init(parent);
666 mop500_sdi_init(parent);
667 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100668 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800669 mop500_uart_init(parent);
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100670
Andreas Westin585d1882012-05-10 10:14:06 +0200671 u8500_cryp1_hash1_init(parent);
672
Linus Walleijcf568c52011-03-30 14:31:42 +0200673 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
Lee Jones110c2c22011-08-26 16:54:07 +0100674
675 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
676 i2c_register_board_info(2, mop500_i2c2_devices,
677 ARRAY_SIZE(mop500_i2c2_devices));
678
679 /* This board has full regulator constraints */
680 regulator_has_full_constraints();
681}
682
683static void __init snowball_init_machine(void)
684{
Lee Jones18403422012-02-06 11:22:21 -0800685 struct device *parent = NULL;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800686 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100687
Linus Walleijed781d392012-05-03 00:44:52 +0200688 snowball_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200689 parent = u8500_init_devices(&ab8500_platdata);
Lee Jones110c2c22011-08-26 16:54:07 +0100690
Lee Jonesb024a0c2012-02-06 11:22:25 -0800691 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
692 snowball_platform_devs[i]->dev.parent = parent;
693
Lee Jones110c2c22011-08-26 16:54:07 +0100694 platform_add_devices(snowball_platform_devs,
695 ARRAY_SIZE(snowball_platform_devs));
696
Lee Jones18403422012-02-06 11:22:21 -0800697 mop500_i2c_init(parent);
698 snowball_sdi_init(parent);
699 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100700 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800701 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100702
Lee Jones110c2c22011-08-26 16:54:07 +0100703 /* This board has full regulator constraints */
704 regulator_has_full_constraints();
705}
706
707static void __init hrefv60_init_machine(void)
708{
Lee Jones18403422012-02-06 11:22:21 -0800709 struct device *parent = NULL;
Lee Jones110c2c22011-08-26 16:54:07 +0100710 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800711 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100712
713 /*
714 * The HREFv60 board removed a GPIO expander and routed
715 * all these GPIO pins to the internal GPIO controller
716 * instead.
717 */
718 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
719
Linus Walleijed781d392012-05-03 00:44:52 +0200720 hrefv60_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200721 parent = u8500_init_devices(&ab8500_platdata);
Lee Jones110c2c22011-08-26 16:54:07 +0100722
Lee Jonesb024a0c2012-02-06 11:22:25 -0800723 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
724 mop500_platform_devs[i]->dev.parent = parent;
725
Lee Jones110c2c22011-08-26 16:54:07 +0100726 platform_add_devices(mop500_platform_devs,
727 ARRAY_SIZE(mop500_platform_devs));
728
Lee Jones18403422012-02-06 11:22:21 -0800729 mop500_i2c_init(parent);
730 hrefv60_sdi_init(parent);
731 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100732 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800733 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100734
735 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
736
737 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
Linus Walleijcf568c52011-03-30 14:31:42 +0200738
739 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100740 i2c_register_board_info(2, mop500_i2c2_devices,
741 ARRAY_SIZE(mop500_i2c2_devices));
Linus Walleijdb245202011-04-04 10:44:51 +0200742
743 /* This board has full regulator constraints */
744 regulator_has_full_constraints();
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100745}
746
747MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
748 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400749 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100750 .smp = smp_ops(ux500_smp_ops),
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100751 .map_io = u8500_map_io,
Rabin Vincent178980f2010-05-03 07:39:02 +0100752 .init_irq = ux500_init_irq,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100753 /* we re-use nomadik timer here */
Rabin Vincent41ac3292010-05-03 08:28:05 +0100754 .timer = &ux500_timer,
Marc Zyngierbbf5f382011-09-06 10:23:45 +0100755 .handle_irq = gic_handle_irq,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100756 .init_machine = mop500_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800757 .init_late = ux500_init_late,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100758MACHINE_END
759
Linus Walleija3a6c6a2012-10-01 09:37:39 +0200760MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520")
761 .atag_offset = 0x100,
762 .map_io = u8500_map_io,
763 .init_irq = ux500_init_irq,
764 .timer = &ux500_timer,
765 .handle_irq = gic_handle_irq,
766 .init_machine = mop500_init_machine,
767 .init_late = ux500_init_late,
768MACHINE_END
769
Linus Walleij4b4f7572011-02-15 15:01:35 +0100770MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400771 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100772 .smp = smp_ops(ux500_smp_ops),
Linus Walleij4b4f7572011-02-15 15:01:35 +0100773 .map_io = u8500_map_io,
774 .init_irq = ux500_init_irq,
775 .timer = &ux500_timer,
Marc Zyngierbbf5f382011-09-06 10:23:45 +0100776 .handle_irq = gic_handle_irq,
Lee Jones110c2c22011-08-26 16:54:07 +0100777 .init_machine = hrefv60_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800778 .init_late = ux500_init_late,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100779MACHINE_END
Robert Marklund350abe02011-06-20 15:55:46 +0200780
781MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400782 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100783 .smp = smp_ops(ux500_smp_ops),
Robert Marklund350abe02011-06-20 15:55:46 +0200784 .map_io = u8500_map_io,
785 .init_irq = ux500_init_irq,
786 /* we re-use nomadik timer here */
787 .timer = &ux500_timer,
Marc Zyngierbbf5f382011-09-06 10:23:45 +0100788 .handle_irq = gic_handle_irq,
Lee Jones110c2c22011-08-26 16:54:07 +0100789 .init_machine = snowball_init_machine,
Lee Jones0ddf8552012-09-25 16:03:45 +0100790 .init_late = NULL,
Robert Marklund350abe02011-06-20 15:55:46 +0200791MACHINE_END