blob: 871e61517fb228479df70c4332143dcd6d1ca087 [file] [log] [blame]
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +01001/*
Linus Walleija3a6c6a2012-10-01 09:37:39 +02002 * Copyright (C) 2008-2012 ST-Ericsson
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +01003 *
4 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
9 *
10 */
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/interrupt.h>
14#include <linux/platform_device.h>
Lee Jones265c3c02013-03-27 14:13:53 +000015#include <linux/clk.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010016#include <linux/io.h>
Rabin Vincentb8410a12010-08-09 19:18:17 +053017#include <linux/i2c.h>
Alessandro Rubiniaf97bac2012-06-11 22:56:26 +020018#include <linux/platform_data/i2c-nomadik.h>
hongbo.zhangdc1956b2012-11-15 18:56:43 +080019#include <linux/platform_data/db8500_thermal.h>
Rabin Vincentea05a572010-06-03 07:58:42 +010020#include <linux/gpio.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010021#include <linux/amba/bus.h>
22#include <linux/amba/pl022.h>
Linus Walleij5d7b8462010-10-14 13:57:59 +020023#include <linux/amba/serial.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010024#include <linux/spi/spi.h>
Linus Walleijee66e652011-12-02 14:16:33 +010025#include <linux/mfd/abx500/ab8500.h>
Bengt Jonsson79568b942011-03-11 11:54:46 +010026#include <linux/regulator/ab8500.h>
Lee Jones0b5ea1e2012-09-03 14:33:39 +010027#include <linux/regulator/fixed.h>
Lee Jonescd2fa6d2013-01-31 11:31:16 +000028#include <linux/regulator/driver.h>
29#include <linux/regulator/gpio-regulator.h>
Sundar Iyer20406eb2010-12-13 09:33:14 +053030#include <linux/mfd/tc3589x.h>
Linus Walleijfe67dfc2011-03-07 11:48:15 +010031#include <linux/mfd/tps6105x.h>
Linus Walleijee66e652011-12-02 14:16:33 +010032#include <linux/mfd/abx500/ab8500-gpio.h>
Ola Liljaf242e502012-06-07 14:00:46 +020033#include <linux/mfd/abx500/ab8500-codec.h>
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +090034#include <linux/platform_data/leds-lp55xx.h>
Philippe Langlaisa71b8192011-01-14 10:53:59 +010035#include <linux/input.h>
Robert Marklund350abe02011-06-20 15:55:46 +020036#include <linux/smsc911x.h>
Philippe Langlaisa71b8192011-01-14 10:53:59 +010037#include <linux/gpio_keys.h>
Shreshtha Kumar Sahu1a7d4362011-06-13 10:11:44 +020038#include <linux/delay.h>
Robert Marklund350abe02011-06-20 15:55:46 +020039#include <linux/leds.h>
Linus Walleija0980662012-05-07 01:33:24 +020040#include <linux/pinctrl/consumer.h>
Linus Walleijbb16bd92012-10-10 14:27:58 +020041#include <linux/platform_data/pinctrl-nomadik.h>
Linus Walleij865fab62012-10-18 14:20:16 +020042#include <linux/platform_data/dma-ste-dma40.h>
Linus Walleija0980662012-05-07 01:33:24 +020043
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010044#include <asm/mach-types.h>
45#include <asm/mach/arch.h>
46
Arnd Bergmanne657bcf2013-03-21 22:51:12 +010047#include "setup.h"
48#include "devices.h"
Arnd Bergmanneba52742013-03-21 22:51:08 +010049#include "irqs.h"
Arnd Bergmanndb298da2012-08-24 15:19:33 +020050#include <linux/platform_data/crypto-ux500.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010051
Linus Walleij5d7b8462010-10-14 13:57:59 +020052#include "ste-dma40-db8500.h"
Linus Walleij174e7792013-03-19 15:41:55 +010053#include "db8500-regs.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"
Rabin Vincentea05a572010-06-03 07:58:42 +010057
Robert Marklund350abe02011-06-20 15:55:46 +020058static struct gpio_led snowball_led_array[] = {
59 {
60 .name = "user_led",
Lee Jonesc525f072012-05-02 09:20:37 +010061 .default_trigger = "heartbeat",
Robert Marklund350abe02011-06-20 15:55:46 +020062 .gpio = 142,
63 },
64};
65
66static struct gpio_led_platform_data snowball_led_data = {
67 .leds = snowball_led_array,
68 .num_leds = ARRAY_SIZE(snowball_led_array),
69};
70
71static struct platform_device snowball_led_dev = {
72 .name = "leds-gpio",
73 .dev = {
74 .platform_data = &snowball_led_data,
75 },
76};
77
Lee Jones0b5ea1e2012-09-03 14:33:39 +010078static struct fixed_voltage_config snowball_gpio_en_3v3_data = {
79 .supply_name = "EN-3V3",
80 .gpio = SNOWBALL_EN_3V3_ETH_GPIO,
81 .microvolts = 3300000,
82 .enable_high = 1,
83 .init_data = &gpio_en_3v3_regulator,
84 .startup_delay = 5000, /* 1200us */
85};
86
87static struct platform_device snowball_gpio_en_3v3_regulator_dev = {
88 .name = "reg-fixed-voltage",
89 .id = 1,
90 .dev = {
91 .platform_data = &snowball_gpio_en_3v3_data,
92 },
93};
94
Lee Jonescd2fa6d2013-01-31 11:31:16 +000095/* Dynamically populated. */
96static struct gpio sdi0_reg_gpios[] = {
97 { 0, GPIOF_OUT_INIT_LOW, "mmci_vsel" },
98};
99
100static struct gpio_regulator_state sdi0_reg_states[] = {
101 { .value = 2900000, .gpios = (0 << 0) },
102 { .value = 1800000, .gpios = (1 << 0) },
103};
104
105static struct gpio_regulator_config sdi0_reg_info = {
106 .supply_name = "ext-mmc-level-shifter",
107 .gpios = sdi0_reg_gpios,
108 .nr_gpios = ARRAY_SIZE(sdi0_reg_gpios),
109 .states = sdi0_reg_states,
110 .nr_states = ARRAY_SIZE(sdi0_reg_states),
111 .type = REGULATOR_VOLTAGE,
112 .enable_high = 1,
113 .enabled_at_boot = 0,
114 .init_data = &sdi0_reg_init_data,
115 .startup_delay = 100,
116};
117
118static struct platform_device sdi0_regulator = {
119 .name = "gpio-regulator",
120 .id = -1,
121 .dev = {
122 .platform_data = &sdi0_reg_info,
123 },
124};
125
Patrice Chotard0493e642013-01-08 10:41:02 +0100126static struct abx500_gpio_platform_data ab8500_gpio_pdata = {
Philippe Langlaisa1524ee2012-02-13 10:52:25 +0100127 .gpio_base = MOP500_AB8500_PIN_GPIO(1),
Bibek Basu3ef374a2011-02-15 12:56:16 +0530128};
129
Ola Liljaf242e502012-06-07 14:00:46 +0200130/* ab8500-codec */
131static struct ab8500_codec_platform_data ab8500_codec_pdata = {
132 .amics = {
133 .mic1_type = AMIC_TYPE_DIFFERENTIAL,
134 .mic2_type = AMIC_TYPE_DIFFERENTIAL,
135 .mic1a_micbias = AMIC_MICBIAS_VAMIC1,
136 .mic1b_micbias = AMIC_MICBIAS_VAMIC1,
137 .mic2_micbias = AMIC_MICBIAS_VAMIC2
138 },
139 .ear_cmv = EAR_CMV_0_95V
140};
141
Robert Marklund350abe02011-06-20 15:55:46 +0200142static struct gpio_keys_button snowball_key_array[] = {
143 {
144 .gpio = 32,
145 .type = EV_KEY,
146 .code = KEY_1,
147 .desc = "userpb",
148 .active_low = 1,
149 .debounce_interval = 50,
150 .wakeup = 1,
151 },
152 {
153 .gpio = 151,
154 .type = EV_KEY,
155 .code = KEY_2,
156 .desc = "extkb1",
157 .active_low = 1,
158 .debounce_interval = 50,
159 .wakeup = 1,
160 },
161 {
162 .gpio = 152,
163 .type = EV_KEY,
164 .code = KEY_3,
165 .desc = "extkb2",
166 .active_low = 1,
167 .debounce_interval = 50,
168 .wakeup = 1,
169 },
170 {
171 .gpio = 161,
172 .type = EV_KEY,
173 .code = KEY_4,
174 .desc = "extkb3",
175 .active_low = 1,
176 .debounce_interval = 50,
177 .wakeup = 1,
178 },
179 {
180 .gpio = 162,
181 .type = EV_KEY,
182 .code = KEY_5,
183 .desc = "extkb4",
184 .active_low = 1,
185 .debounce_interval = 50,
186 .wakeup = 1,
187 },
188};
189
190static struct gpio_keys_platform_data snowball_key_data = {
191 .buttons = snowball_key_array,
192 .nbuttons = ARRAY_SIZE(snowball_key_array),
193};
194
195static struct platform_device snowball_key_dev = {
196 .name = "gpio-keys",
197 .id = -1,
198 .dev = {
199 .platform_data = &snowball_key_data,
200 }
201};
202
203static struct smsc911x_platform_config snowball_sbnet_cfg = {
204 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
205 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
206 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
207 .shift = 1,
208};
209
210static struct resource sbnet_res[] = {
211 {
212 .name = "smsc911x-memory",
213 .start = (0x5000 << 16),
214 .end = (0x5000 << 16) + 0xffff,
215 .flags = IORESOURCE_MEM,
216 },
217 {
218 .start = NOMADIK_GPIO_TO_IRQ(140),
219 .end = NOMADIK_GPIO_TO_IRQ(140),
220 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
221 },
222};
223
224static struct platform_device snowball_sbnet_dev = {
225 .name = "smsc911x",
226 .num_resources = ARRAY_SIZE(sbnet_res),
227 .resource = sbnet_res,
228 .dev = {
229 .platform_data = &snowball_sbnet_cfg,
230 },
231};
232
Linus Walleij05ec2602013-02-07 10:17:31 +0100233struct ab8500_platform_data ab8500_platdata = {
Rabin Vincent39ae7022010-07-26 11:12:15 +0100234 .irq_base = MOP500_AB8500_IRQ_BASE,
Lee Jonesc4e67bb2013-04-02 13:24:19 +0100235 .regulator = &ab8500_regulator_plat_data,
Bibek Basu3ef374a2011-02-15 12:56:16 +0530236 .gpio = &ab8500_gpio_pdata,
Ola Liljaf242e502012-06-07 14:00:46 +0200237 .codec = &ab8500_codec_pdata,
Rabin Vincent39ae7022010-07-26 11:12:15 +0100238};
239
hongbo.zhangdc1956b2012-11-15 18:56:43 +0800240static struct platform_device u8500_cpufreq_cooling_device = {
241 .name = "db8500-cpufreq-cooling",
242};
243
244/*
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100245 * TPS61052
246 */
247
248static struct tps6105x_platform_data mop500_tps61052_data = {
249 .mode = TPS6105X_MODE_VOLTAGE,
250 .regulator_data = &tps61052_regulator,
251};
252
253/*
Rabin Vincentb8410a12010-08-09 19:18:17 +0530254 * TC35892
255 */
256
Sundar Iyer20406eb2010-12-13 09:33:14 +0530257static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
Rabin Vincentb8410a12010-08-09 19:18:17 +0530258{
Lee Jones18403422012-02-06 11:22:21 -0800259 struct device *parent = NULL;
260#if 0
261 /* FIXME: Is the sdi actually part of tc3589x? */
262 parent = tc3589x->dev;
263#endif
264 mop500_sdi_tc35892_init(parent);
Rabin Vincentb8410a12010-08-09 19:18:17 +0530265}
266
Sundar Iyer20406eb2010-12-13 09:33:14 +0530267static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530268 .gpio_base = MOP500_EGPIO(0),
269 .setup = mop500_tc35892_init,
270};
271
Sundar Iyer20406eb2010-12-13 09:33:14 +0530272static struct tc3589x_platform_data mop500_tc35892_data = {
Sundar Iyer611b7592010-12-13 09:33:15 +0530273 .block = TC3589x_BLOCK_GPIO,
Rabin Vincentb8410a12010-08-09 19:18:17 +0530274 .gpio = &mop500_tc35892_gpio_data,
275 .irq_base = MOP500_EGPIO_IRQ_BASE,
276};
277
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900278static struct lp55xx_led_config lp5521_pri_led[] = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100279 [0] = {
280 .chan_nr = 0,
281 .led_current = 0x2f,
282 .max_current = 0x5f,
283 },
284 [1] = {
285 .chan_nr = 1,
286 .led_current = 0x2f,
287 .max_current = 0x5f,
288 },
289 [2] = {
290 .chan_nr = 2,
291 .led_current = 0x2f,
292 .max_current = 0x5f,
293 },
294};
295
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900296static struct lp55xx_platform_data __initdata lp5521_pri_data = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100297 .label = "lp5521_pri",
298 .led_config = &lp5521_pri_led[0],
299 .num_channels = 3,
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900300 .clock_mode = LP55XX_CLOCK_EXT,
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100301};
302
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900303static struct lp55xx_led_config lp5521_sec_led[] = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100304 [0] = {
305 .chan_nr = 0,
306 .led_current = 0x2f,
307 .max_current = 0x5f,
308 },
309 [1] = {
310 .chan_nr = 1,
311 .led_current = 0x2f,
312 .max_current = 0x5f,
313 },
314 [2] = {
315 .chan_nr = 2,
316 .led_current = 0x2f,
317 .max_current = 0x5f,
318 },
319};
320
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900321static struct lp55xx_platform_data __initdata lp5521_sec_data = {
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100322 .label = "lp5521_sec",
323 .led_config = &lp5521_sec_led[0],
324 .num_channels = 3,
Milo(Woogyom) Kimdf4094d2013-02-05 19:26:59 +0900325 .clock_mode = LP55XX_CLOCK_EXT,
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100326};
327
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100328static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
Rabin Vincentb8410a12010-08-09 19:18:17 +0530329 {
Sundar Iyer20406eb2010-12-13 09:33:14 +0530330 I2C_BOARD_INFO("tc3589x", 0x42),
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100331 .irq = NOMADIK_GPIO_TO_IRQ(217),
Rabin Vincentb8410a12010-08-09 19:18:17 +0530332 .platform_data = &mop500_tc35892_data,
333 },
Linus Walleijcf568c52011-03-30 14:31:42 +0200334 /* I2C0 devices only available prior to HREFv60 */
Linus Walleijfe67dfc2011-03-07 11:48:15 +0100335 {
336 I2C_BOARD_INFO("tps61052", 0x33),
337 .platform_data = &mop500_tps61052_data,
338 },
339};
340
Linus Walleijcf568c52011-03-30 14:31:42 +0200341#define NUM_PRE_V60_I2C0_DEVICES 1
342
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100343static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
344 {
345 /* lp5521 LED driver, 1st device */
346 I2C_BOARD_INFO("lp5521", 0x33),
347 .platform_data = &lp5521_pri_data,
348 },
349 {
350 /* lp5521 LED driver, 2st device */
351 I2C_BOARD_INFO("lp5521", 0x34),
352 .platform_data = &lp5521_sec_data,
353 },
Lee Jonesbb3b2182011-01-13 14:41:22 +0000354 {
355 /* Light sensor Rohm BH1780GLI */
356 I2C_BOARD_INFO("bh1780", 0x29),
357 },
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100358};
359
Lee Jones18403422012-02-06 11:22:21 -0800360static void __init mop500_i2c_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530361{
Lee Jones98582d92012-04-17 15:52:26 +0100362 db8500_add_i2c0(parent, NULL);
363 db8500_add_i2c1(parent, NULL);
364 db8500_add_i2c2(parent, NULL);
365 db8500_add_i2c3(parent, NULL);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530366}
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100367
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100368static struct gpio_keys_button mop500_gpio_keys[] = {
369 {
370 .desc = "SFH7741 Proximity Sensor",
371 .type = EV_SW,
372 .code = SW_FRONT_PROXIMITY,
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100373 .active_low = 0,
374 .can_disable = 1,
375 }
376};
377
378static struct regulator *prox_regulator;
379static int mop500_prox_activate(struct device *dev);
380static void mop500_prox_deactivate(struct device *dev);
381
382static struct gpio_keys_platform_data mop500_gpio_keys_data = {
383 .buttons = mop500_gpio_keys,
384 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
385 .enable = mop500_prox_activate,
386 .disable = mop500_prox_deactivate,
387};
388
389static struct platform_device mop500_gpio_keys_device = {
390 .name = "gpio-keys",
391 .id = 0,
392 .dev = {
393 .platform_data = &mop500_gpio_keys_data,
394 },
395};
396
397static int mop500_prox_activate(struct device *dev)
398{
399 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
400 "vcc");
401 if (IS_ERR(prox_regulator)) {
402 dev_err(&mop500_gpio_keys_device.dev,
403 "no regulator\n");
404 return PTR_ERR(prox_regulator);
405 }
Lee Jones27d4cdc2013-05-02 16:48:07 +0100406
407 return regulator_enable(prox_regulator);
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100408}
409
410static void mop500_prox_deactivate(struct device *dev)
411{
412 regulator_disable(prox_regulator);
413 regulator_put(prox_regulator);
414}
415
Lee Jones265c3c02013-03-27 14:13:53 +0000416void mop500_snowball_ethernet_clock_enable(void)
417{
418 struct clk *clk;
419
420 clk = clk_get_sys("fsmc", NULL);
421 if (!IS_ERR(clk))
422 clk_prepare_enable(clk);
423}
424
Andreas Westin585d1882012-05-10 10:14:06 +0200425static struct cryp_platform_data u8500_cryp1_platform_data = {
426 .mem_to_engine = {
427 .dir = STEDMA40_MEM_TO_PERIPH,
Lee Jones26955c07d2013-05-03 15:31:56 +0100428 .dev_type = DB8500_DMA_DEV48_CAC1,
Andreas Westin585d1882012-05-10 10:14:06 +0200429 .src_info.data_width = STEDMA40_WORD_WIDTH,
430 .dst_info.data_width = STEDMA40_WORD_WIDTH,
431 .mode = STEDMA40_MODE_LOGICAL,
432 .src_info.psize = STEDMA40_PSIZE_LOG_4,
433 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
434 },
435 .engine_to_mem = {
436 .dir = STEDMA40_PERIPH_TO_MEM,
Lee Jones26955c07d2013-05-03 15:31:56 +0100437 .dev_type = DB8500_DMA_DEV48_CAC1,
Andreas Westin585d1882012-05-10 10:14:06 +0200438 .src_info.data_width = STEDMA40_WORD_WIDTH,
439 .dst_info.data_width = STEDMA40_WORD_WIDTH,
440 .mode = STEDMA40_MODE_LOGICAL,
441 .src_info.psize = STEDMA40_PSIZE_LOG_4,
442 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
443 }
444};
445
446static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
447 .dir = STEDMA40_MEM_TO_PERIPH,
Lee Jones26955c07d2013-05-03 15:31:56 +0100448 .dev_type = DB8500_DMA_DEV50_HAC1_TX,
Andreas Westin585d1882012-05-10 10:14:06 +0200449 .src_info.data_width = STEDMA40_WORD_WIDTH,
450 .dst_info.data_width = STEDMA40_WORD_WIDTH,
451 .mode = STEDMA40_MODE_LOGICAL,
452 .src_info.psize = STEDMA40_PSIZE_LOG_16,
453 .dst_info.psize = STEDMA40_PSIZE_LOG_16,
454};
455
456static struct hash_platform_data u8500_hash1_platform_data = {
457 .mem_to_engine = &u8500_hash_dma_cfg_tx,
458 .dma_filter = stedma40_filter,
459};
460
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100461/* add any platform devices here - TODO */
Robert Marklund350abe02011-06-20 15:55:46 +0200462static struct platform_device *mop500_platform_devs[] __initdata = {
Philippe Langlaisa71b8192011-01-14 10:53:59 +0100463 &mop500_gpio_keys_device,
Lee Jonescd2fa6d2013-01-31 11:31:16 +0000464 &sdi0_regulator,
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100465};
466
Linus Walleij5d7b8462010-10-14 13:57:59 +0200467#ifdef CONFIG_STE_DMA40
468static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
469 .mode = STEDMA40_MODE_LOGICAL,
470 .dir = STEDMA40_PERIPH_TO_MEM,
Lee Jones26955c07d2013-05-03 15:31:56 +0100471 .dev_type = DB8500_DMA_DEV8_SSP0,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200472 .src_info.data_width = STEDMA40_BYTE_WIDTH,
473 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
474};
475
476static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
477 .mode = STEDMA40_MODE_LOGICAL,
478 .dir = STEDMA40_MEM_TO_PERIPH,
Lee Jones26955c07d2013-05-03 15:31:56 +0100479 .dev_type = DB8500_DMA_DEV8_SSP0,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200480 .src_info.data_width = STEDMA40_BYTE_WIDTH,
481 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
482};
483#endif
484
Lee Jonesfa86a762012-09-27 10:17:36 +0100485struct pl022_ssp_controller ssp0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200486 .bus_id = 0,
487#ifdef CONFIG_STE_DMA40
488 .enable_dma = 1,
489 .dma_filter = stedma40_filter,
490 .dma_rx_param = &ssp0_dma_cfg_rx,
491 .dma_tx_param = &ssp0_dma_cfg_tx,
492#else
493 .enable_dma = 0,
494#endif
495 /* on this platform, gpio 31,142,144,214 &
496 * 224 are connected as chip selects
497 */
498 .num_chipselect = 5,
499};
500
Lee Jones18403422012-02-06 11:22:21 -0800501static void __init mop500_spi_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530502{
Lee Jones15daf692012-03-15 16:47:11 +0000503 db8500_add_ssp0(parent, &ssp0_plat);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530504}
505
Linus Walleij5d7b8462010-10-14 13:57:59 +0200506#ifdef CONFIG_STE_DMA40
507static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
508 .mode = STEDMA40_MODE_LOGICAL,
509 .dir = STEDMA40_PERIPH_TO_MEM,
Lee Jones26955c07d2013-05-03 15:31:56 +0100510 .dev_type = DB8500_DMA_DEV13_UART0,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200511 .src_info.data_width = STEDMA40_BYTE_WIDTH,
512 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
513};
514
515static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
516 .mode = STEDMA40_MODE_LOGICAL,
517 .dir = STEDMA40_MEM_TO_PERIPH,
Lee Jones26955c07d2013-05-03 15:31:56 +0100518 .dev_type = DB8500_DMA_DEV13_UART0,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200519 .src_info.data_width = STEDMA40_BYTE_WIDTH,
520 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
521};
522
523static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
524 .mode = STEDMA40_MODE_LOGICAL,
525 .dir = STEDMA40_PERIPH_TO_MEM,
Lee Jones26955c07d2013-05-03 15:31:56 +0100526 .dev_type = DB8500_DMA_DEV12_UART1,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200527 .src_info.data_width = STEDMA40_BYTE_WIDTH,
528 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
529};
530
531static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
532 .mode = STEDMA40_MODE_LOGICAL,
533 .dir = STEDMA40_MEM_TO_PERIPH,
Lee Jones26955c07d2013-05-03 15:31:56 +0100534 .dev_type = DB8500_DMA_DEV12_UART1,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200535 .src_info.data_width = STEDMA40_BYTE_WIDTH,
536 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
537};
538
539static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
540 .mode = STEDMA40_MODE_LOGICAL,
541 .dir = STEDMA40_PERIPH_TO_MEM,
Lee Jones26955c07d2013-05-03 15:31:56 +0100542 .dev_type = DB8500_DMA_DEV11_UART2,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200543 .src_info.data_width = STEDMA40_BYTE_WIDTH,
544 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
545};
546
547static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
548 .mode = STEDMA40_MODE_LOGICAL,
549 .dir = STEDMA40_MEM_TO_PERIPH,
Lee Jones26955c07d2013-05-03 15:31:56 +0100550 .dev_type = DB8500_DMA_DEV11_UART2,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200551 .src_info.data_width = STEDMA40_BYTE_WIDTH,
552 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
553};
554#endif
555
Lee Jonesfa86a762012-09-27 10:17:36 +0100556struct amba_pl011_data uart0_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200557#ifdef CONFIG_STE_DMA40
558 .dma_filter = stedma40_filter,
559 .dma_rx_param = &uart0_dma_cfg_rx,
560 .dma_tx_param = &uart0_dma_cfg_tx,
561#endif
562};
563
Lee Jonesfa86a762012-09-27 10:17:36 +0100564struct amba_pl011_data uart1_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200565#ifdef CONFIG_STE_DMA40
566 .dma_filter = stedma40_filter,
567 .dma_rx_param = &uart1_dma_cfg_rx,
568 .dma_tx_param = &uart1_dma_cfg_tx,
569#endif
570};
571
Lee Jonesfa86a762012-09-27 10:17:36 +0100572struct amba_pl011_data uart2_plat = {
Linus Walleij5d7b8462010-10-14 13:57:59 +0200573#ifdef CONFIG_STE_DMA40
574 .dma_filter = stedma40_filter,
575 .dma_rx_param = &uart2_dma_cfg_rx,
576 .dma_tx_param = &uart2_dma_cfg_tx,
577#endif
578};
579
Lee Jones18403422012-02-06 11:22:21 -0800580static void __init mop500_uart_init(struct device *parent)
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530581{
Linus Walleij78d80c52012-05-23 21:18:46 +0200582 db8500_add_uart0(parent, &uart0_plat);
Lee Jones18403422012-02-06 11:22:21 -0800583 db8500_add_uart1(parent, &uart1_plat);
584 db8500_add_uart2(parent, &uart2_plat);
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530585}
586
Andreas Westin585d1882012-05-10 10:14:06 +0200587static void __init u8500_cryp1_hash1_init(struct device *parent)
588{
589 db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
590 db8500_add_hash1(parent, &u8500_hash1_platform_data);
591}
592
Robert Marklund350abe02011-06-20 15:55:46 +0200593static struct platform_device *snowball_platform_devs[] __initdata = {
594 &snowball_led_dev,
595 &snowball_key_dev,
Lee Jonese6fada52012-05-17 13:18:36 +0100596 &snowball_sbnet_dev,
Lee Jones0b5ea1e2012-09-03 14:33:39 +0100597 &snowball_gpio_en_3v3_regulator_dev,
hongbo.zhangdc1956b2012-11-15 18:56:43 +0800598 &u8500_cpufreq_cooling_device,
Lee Jonescd2fa6d2013-01-31 11:31:16 +0000599 &sdi0_regulator,
Robert Marklund350abe02011-06-20 15:55:46 +0200600};
601
Linus Walleij4b4f7572011-02-15 15:01:35 +0100602static void __init mop500_init_machine(void)
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100603{
Lee Jones18403422012-02-06 11:22:21 -0800604 struct device *parent = NULL;
Linus Walleijcf568c52011-03-30 14:31:42 +0200605 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800606 int i;
Linus Walleijcf568c52011-03-30 14:31:42 +0200607
Linus Walleij05ec2602013-02-07 10:17:31 +0100608 platform_device_register(&db8500_prcmu_device);
Lee Jones110c2c22011-08-26 16:54:07 +0100609 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
Linus Walleij4b4f7572011-02-15 15:01:35 +0100610
Lee Jonescd2fa6d2013-01-31 11:31:16 +0000611 sdi0_reg_info.enable_gpio = GPIO_SDMMC_EN;
612 sdi0_reg_info.gpios[0].gpio = GPIO_SDMMC_1V8_3V_SEL;
613
Linus Walleijed781d392012-05-03 00:44:52 +0200614 mop500_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200615 parent = u8500_init_devices(&ab8500_platdata);
Rabin Vincentea05a572010-06-03 07:58:42 +0100616
Lee Jonesb024a0c2012-02-06 11:22:25 -0800617 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
618 mop500_platform_devs[i]->dev.parent = parent;
619
Lee Jones110c2c22011-08-26 16:54:07 +0100620 platform_add_devices(mop500_platform_devs,
621 ARRAY_SIZE(mop500_platform_devs));
Srinidhi Kasagard48a41c2010-02-03 13:02:48 +0100622
Lee Jones18403422012-02-06 11:22:21 -0800623 mop500_i2c_init(parent);
624 mop500_sdi_init(parent);
625 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100626 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800627 mop500_uart_init(parent);
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100628
Andreas Westin585d1882012-05-10 10:14:06 +0200629 u8500_cryp1_hash1_init(parent);
630
Linus Walleijcf568c52011-03-30 14:31:42 +0200631 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
Lee Jones110c2c22011-08-26 16:54:07 +0100632
633 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
634 i2c_register_board_info(2, mop500_i2c2_devices,
635 ARRAY_SIZE(mop500_i2c2_devices));
636
637 /* This board has full regulator constraints */
638 regulator_has_full_constraints();
639}
640
641static void __init snowball_init_machine(void)
642{
Lee Jones18403422012-02-06 11:22:21 -0800643 struct device *parent = NULL;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800644 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100645
Linus Walleij05ec2602013-02-07 10:17:31 +0100646 platform_device_register(&db8500_prcmu_device);
Lee Jonescd2fa6d2013-01-31 11:31:16 +0000647
648 sdi0_reg_info.enable_gpio = SNOWBALL_SDMMC_EN_GPIO;
649 sdi0_reg_info.gpios[0].gpio = SNOWBALL_SDMMC_1V8_3V_GPIO;
650
Linus Walleijed781d392012-05-03 00:44:52 +0200651 snowball_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200652 parent = u8500_init_devices(&ab8500_platdata);
Lee Jones110c2c22011-08-26 16:54:07 +0100653
Lee Jonesb024a0c2012-02-06 11:22:25 -0800654 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
655 snowball_platform_devs[i]->dev.parent = parent;
656
Lee Jones110c2c22011-08-26 16:54:07 +0100657 platform_add_devices(snowball_platform_devs,
658 ARRAY_SIZE(snowball_platform_devs));
659
Lee Jones18403422012-02-06 11:22:21 -0800660 mop500_i2c_init(parent);
661 snowball_sdi_init(parent);
662 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100663 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800664 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100665
Lee Jones265c3c02013-03-27 14:13:53 +0000666 mop500_snowball_ethernet_clock_enable();
667
Lee Jones110c2c22011-08-26 16:54:07 +0100668 /* This board has full regulator constraints */
669 regulator_has_full_constraints();
670}
671
672static void __init hrefv60_init_machine(void)
673{
Lee Jones18403422012-02-06 11:22:21 -0800674 struct device *parent = NULL;
Lee Jones110c2c22011-08-26 16:54:07 +0100675 int i2c0_devs;
Lee Jonesb024a0c2012-02-06 11:22:25 -0800676 int i;
Lee Jones110c2c22011-08-26 16:54:07 +0100677
Linus Walleij05ec2602013-02-07 10:17:31 +0100678 platform_device_register(&db8500_prcmu_device);
Lee Jones110c2c22011-08-26 16:54:07 +0100679 /*
680 * The HREFv60 board removed a GPIO expander and routed
681 * all these GPIO pins to the internal GPIO controller
682 * instead.
683 */
684 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
685
Lee Jonescd2fa6d2013-01-31 11:31:16 +0000686 sdi0_reg_info.enable_gpio = HREFV60_SDMMC_EN_GPIO;
687 sdi0_reg_info.gpios[0].gpio = HREFV60_SDMMC_1V8_3V_GPIO;
688
Linus Walleijed781d392012-05-03 00:44:52 +0200689 hrefv60_pinmaps_init();
Lee Jones3a8e39c2012-07-06 12:46:23 +0200690 parent = u8500_init_devices(&ab8500_platdata);
Lee Jones110c2c22011-08-26 16:54:07 +0100691
Lee Jonesb024a0c2012-02-06 11:22:25 -0800692 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
693 mop500_platform_devs[i]->dev.parent = parent;
694
Lee Jones110c2c22011-08-26 16:54:07 +0100695 platform_add_devices(mop500_platform_devs,
696 ARRAY_SIZE(mop500_platform_devs));
697
Lee Jones18403422012-02-06 11:22:21 -0800698 mop500_i2c_init(parent);
699 hrefv60_sdi_init(parent);
700 mop500_spi_init(parent);
Lee Jones39b740b2012-09-14 15:46:29 +0100701 mop500_audio_init(parent);
Lee Jones18403422012-02-06 11:22:21 -0800702 mop500_uart_init(parent);
Lee Jones110c2c22011-08-26 16:54:07 +0100703
704 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
705
706 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
Linus Walleijcf568c52011-03-30 14:31:42 +0200707
708 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
Philippe Langlaisdd7b2a02011-01-12 11:26:20 +0100709 i2c_register_board_info(2, mop500_i2c2_devices,
710 ARRAY_SIZE(mop500_i2c2_devices));
Linus Walleijdb245202011-04-04 10:44:51 +0200711
712 /* This board has full regulator constraints */
713 regulator_has_full_constraints();
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100714}
715
716MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
717 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400718 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100719 .smp = smp_ops(ux500_smp_ops),
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100720 .map_io = u8500_map_io,
Rabin Vincent178980f2010-05-03 07:39:02 +0100721 .init_irq = ux500_init_irq,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100722 /* we re-use nomadik timer here */
Stephen Warren6bb27d72012-11-08 12:40:59 -0700723 .init_time = ux500_timer_init,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100724 .init_machine = mop500_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800725 .init_late = ux500_init_late,
Linus Walleij4b4f7572011-02-15 15:01:35 +0100726MACHINE_END
727
Linus Walleija3a6c6a2012-10-01 09:37:39 +0200728MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520")
729 .atag_offset = 0x100,
730 .map_io = u8500_map_io,
731 .init_irq = ux500_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700732 .init_time = ux500_timer_init,
Linus Walleija3a6c6a2012-10-01 09:37:39 +0200733 .init_machine = mop500_init_machine,
734 .init_late = ux500_init_late,
735MACHINE_END
736
Linus Walleij4b4f7572011-02-15 15:01:35 +0100737MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400738 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100739 .smp = smp_ops(ux500_smp_ops),
Linus Walleij4b4f7572011-02-15 15:01:35 +0100740 .map_io = u8500_map_io,
741 .init_irq = ux500_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700742 .init_time = ux500_timer_init,
Lee Jones110c2c22011-08-26 16:54:07 +0100743 .init_machine = hrefv60_init_machine,
Shawn Guoa010bc22012-05-02 17:10:07 +0800744 .init_late = ux500_init_late,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100745MACHINE_END
Robert Marklund350abe02011-06-20 15:55:46 +0200746
747MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
Nicolas Pitrebc77b1a2011-07-05 22:38:18 -0400748 .atag_offset = 0x100,
Marc Zyngier5ac21a92011-09-08 13:15:22 +0100749 .smp = smp_ops(ux500_smp_ops),
Robert Marklund350abe02011-06-20 15:55:46 +0200750 .map_io = u8500_map_io,
751 .init_irq = ux500_init_irq,
752 /* we re-use nomadik timer here */
Stephen Warren6bb27d72012-11-08 12:40:59 -0700753 .init_time = ux500_timer_init,
Lee Jones110c2c22011-08-26 16:54:07 +0100754 .init_machine = snowball_init_machine,
Lee Jones0ddf8552012-09-25 16:03:45 +0100755 .init_late = NULL,
Robert Marklund350abe02011-06-20 15:55:46 +0200756MACHINE_END