Commit | Line | Data |
---|---|---|
aa44ef4d | 1 | /* |
a3a6c6a3 | 2 | * Copyright (C) 2008-2012 ST-Ericsson |
aa44ef4d SK |
3 | * |
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> | |
265c3c0a | 15 | #include <linux/clk.h> |
aa44ef4d | 16 | #include <linux/io.h> |
b8410a15 | 17 | #include <linux/i2c.h> |
af97bace | 18 | #include <linux/platform_data/i2c-nomadik.h> |
dc1956b5 | 19 | #include <linux/platform_data/db8500_thermal.h> |
ea05a57f | 20 | #include <linux/gpio.h> |
aa44ef4d SK |
21 | #include <linux/amba/bus.h> |
22 | #include <linux/amba/pl022.h> | |
5d7b8467 | 23 | #include <linux/amba/serial.h> |
aa44ef4d | 24 | #include <linux/spi/spi.h> |
ee66e653 | 25 | #include <linux/mfd/abx500/ab8500.h> |
79568b94 | 26 | #include <linux/regulator/ab8500.h> |
0b5ea1e2 | 27 | #include <linux/regulator/fixed.h> |
20406ebf | 28 | #include <linux/mfd/tc3589x.h> |
fe67dfc8 | 29 | #include <linux/mfd/tps6105x.h> |
ee66e653 | 30 | #include <linux/mfd/abx500/ab8500-gpio.h> |
f242e50e | 31 | #include <linux/mfd/abx500/ab8500-codec.h> |
df4094d2 | 32 | #include <linux/platform_data/leds-lp55xx.h> |
a71b819b | 33 | #include <linux/input.h> |
350abe03 | 34 | #include <linux/smsc911x.h> |
a71b819b | 35 | #include <linux/gpio_keys.h> |
1a7d4369 | 36 | #include <linux/delay.h> |
350abe03 | 37 | #include <linux/leds.h> |
a0980660 | 38 | #include <linux/pinctrl/consumer.h> |
bb16bd9b | 39 | #include <linux/platform_data/pinctrl-nomadik.h> |
865fab60 | 40 | #include <linux/platform_data/dma-ste-dma40.h> |
a0980660 | 41 | |
aa44ef4d SK |
42 | #include <asm/mach-types.h> |
43 | #include <asm/mach/arch.h> | |
44 | ||
aa44ef4d SK |
45 | #include <mach/hardware.h> |
46 | #include <mach/setup.h> | |
9e4e7fe1 | 47 | #include <mach/devices.h> |
29aeb3cf | 48 | #include <mach/irqs.h> |
db298da2 | 49 | #include <linux/platform_data/crypto-ux500.h> |
aa44ef4d | 50 | |
5d7b8467 | 51 | #include "ste-dma40-db8500.h" |
fbf1eadf | 52 | #include "devices-db8500.h" |
008f8a2f | 53 | #include "board-mop500.h" |
a1e516e3 | 54 | #include "board-mop500-regulators.h" |
ea05a57f | 55 | |
350abe03 RM |
56 | static struct gpio_led snowball_led_array[] = { |
57 | { | |
58 | .name = "user_led", | |
c525f071 | 59 | .default_trigger = "heartbeat", |
350abe03 RM |
60 | .gpio = 142, |
61 | }, | |
62 | }; | |
63 | ||
64 | static struct gpio_led_platform_data snowball_led_data = { | |
65 | .leds = snowball_led_array, | |
66 | .num_leds = ARRAY_SIZE(snowball_led_array), | |
67 | }; | |
68 | ||
69 | static struct platform_device snowball_led_dev = { | |
70 | .name = "leds-gpio", | |
71 | .dev = { | |
72 | .platform_data = &snowball_led_data, | |
73 | }, | |
74 | }; | |
75 | ||
0b5ea1e2 LJ |
76 | static 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 | ||
85 | static 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 | ||
0493e649 | 93 | static struct abx500_gpio_platform_data ab8500_gpio_pdata = { |
a1524eeb | 94 | .gpio_base = MOP500_AB8500_PIN_GPIO(1), |
3ef374a2 BB |
95 | }; |
96 | ||
f242e50e OL |
97 | /* ab8500-codec */ |
98 | static struct ab8500_codec_platform_data ab8500_codec_pdata = { | |
99 | .amics = { | |
100 | .mic1_type = AMIC_TYPE_DIFFERENTIAL, | |
101 | .mic2_type = AMIC_TYPE_DIFFERENTIAL, | |
102 | .mic1a_micbias = AMIC_MICBIAS_VAMIC1, | |
103 | .mic1b_micbias = AMIC_MICBIAS_VAMIC1, | |
104 | .mic2_micbias = AMIC_MICBIAS_VAMIC2 | |
105 | }, | |
106 | .ear_cmv = EAR_CMV_0_95V | |
107 | }; | |
108 | ||
350abe03 RM |
109 | static struct gpio_keys_button snowball_key_array[] = { |
110 | { | |
111 | .gpio = 32, | |
112 | .type = EV_KEY, | |
113 | .code = KEY_1, | |
114 | .desc = "userpb", | |
115 | .active_low = 1, | |
116 | .debounce_interval = 50, | |
117 | .wakeup = 1, | |
118 | }, | |
119 | { | |
120 | .gpio = 151, | |
121 | .type = EV_KEY, | |
122 | .code = KEY_2, | |
123 | .desc = "extkb1", | |
124 | .active_low = 1, | |
125 | .debounce_interval = 50, | |
126 | .wakeup = 1, | |
127 | }, | |
128 | { | |
129 | .gpio = 152, | |
130 | .type = EV_KEY, | |
131 | .code = KEY_3, | |
132 | .desc = "extkb2", | |
133 | .active_low = 1, | |
134 | .debounce_interval = 50, | |
135 | .wakeup = 1, | |
136 | }, | |
137 | { | |
138 | .gpio = 161, | |
139 | .type = EV_KEY, | |
140 | .code = KEY_4, | |
141 | .desc = "extkb3", | |
142 | .active_low = 1, | |
143 | .debounce_interval = 50, | |
144 | .wakeup = 1, | |
145 | }, | |
146 | { | |
147 | .gpio = 162, | |
148 | .type = EV_KEY, | |
149 | .code = KEY_5, | |
150 | .desc = "extkb4", | |
151 | .active_low = 1, | |
152 | .debounce_interval = 50, | |
153 | .wakeup = 1, | |
154 | }, | |
155 | }; | |
156 | ||
157 | static struct gpio_keys_platform_data snowball_key_data = { | |
158 | .buttons = snowball_key_array, | |
159 | .nbuttons = ARRAY_SIZE(snowball_key_array), | |
160 | }; | |
161 | ||
162 | static struct platform_device snowball_key_dev = { | |
163 | .name = "gpio-keys", | |
164 | .id = -1, | |
165 | .dev = { | |
166 | .platform_data = &snowball_key_data, | |
167 | } | |
168 | }; | |
169 | ||
170 | static struct smsc911x_platform_config snowball_sbnet_cfg = { | |
171 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH, | |
172 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, | |
173 | .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY, | |
174 | .shift = 1, | |
175 | }; | |
176 | ||
177 | static struct resource sbnet_res[] = { | |
178 | { | |
179 | .name = "smsc911x-memory", | |
180 | .start = (0x5000 << 16), | |
181 | .end = (0x5000 << 16) + 0xffff, | |
182 | .flags = IORESOURCE_MEM, | |
183 | }, | |
184 | { | |
185 | .start = NOMADIK_GPIO_TO_IRQ(140), | |
186 | .end = NOMADIK_GPIO_TO_IRQ(140), | |
187 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | |
188 | }, | |
189 | }; | |
190 | ||
191 | static struct platform_device snowball_sbnet_dev = { | |
192 | .name = "smsc911x", | |
193 | .num_resources = ARRAY_SIZE(sbnet_res), | |
194 | .resource = sbnet_res, | |
195 | .dev = { | |
196 | .platform_data = &snowball_sbnet_cfg, | |
197 | }, | |
198 | }; | |
199 | ||
05ec260e | 200 | struct ab8500_platform_data ab8500_platdata = { |
39ae702c | 201 | .irq_base = MOP500_AB8500_IRQ_BASE, |
dfa3a824 BJ |
202 | .regulator_reg_init = ab8500_regulator_reg_init, |
203 | .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init), | |
a1e516e3 BJ |
204 | .regulator = ab8500_regulators, |
205 | .num_regulator = ARRAY_SIZE(ab8500_regulators), | |
3ef374a2 | 206 | .gpio = &ab8500_gpio_pdata, |
f242e50e | 207 | .codec = &ab8500_codec_pdata, |
39ae702c RV |
208 | }; |
209 | ||
dc1956b5 | 210 | /* |
211 | * Thermal Sensor | |
212 | */ | |
213 | ||
214 | static struct resource db8500_thsens_resources[] = { | |
215 | { | |
216 | .name = "IRQ_HOTMON_LOW", | |
217 | .start = IRQ_PRCMU_HOTMON_LOW, | |
218 | .end = IRQ_PRCMU_HOTMON_LOW, | |
219 | .flags = IORESOURCE_IRQ, | |
220 | }, | |
221 | { | |
222 | .name = "IRQ_HOTMON_HIGH", | |
223 | .start = IRQ_PRCMU_HOTMON_HIGH, | |
224 | .end = IRQ_PRCMU_HOTMON_HIGH, | |
225 | .flags = IORESOURCE_IRQ, | |
226 | }, | |
227 | }; | |
228 | ||
229 | static struct db8500_thsens_platform_data db8500_thsens_data = { | |
230 | .trip_points[0] = { | |
231 | .temp = 70000, | |
232 | .type = THERMAL_TRIP_ACTIVE, | |
233 | .cdev_name = { | |
234 | [0] = "thermal-cpufreq-0", | |
235 | }, | |
236 | }, | |
237 | .trip_points[1] = { | |
238 | .temp = 75000, | |
239 | .type = THERMAL_TRIP_ACTIVE, | |
240 | .cdev_name = { | |
241 | [0] = "thermal-cpufreq-0", | |
242 | }, | |
243 | }, | |
244 | .trip_points[2] = { | |
245 | .temp = 80000, | |
246 | .type = THERMAL_TRIP_ACTIVE, | |
247 | .cdev_name = { | |
248 | [0] = "thermal-cpufreq-0", | |
249 | }, | |
250 | }, | |
251 | .trip_points[3] = { | |
252 | .temp = 85000, | |
253 | .type = THERMAL_TRIP_CRITICAL, | |
254 | }, | |
255 | .num_trips = 4, | |
256 | }; | |
257 | ||
258 | static struct platform_device u8500_thsens_device = { | |
259 | .name = "db8500-thermal", | |
260 | .resource = db8500_thsens_resources, | |
261 | .num_resources = ARRAY_SIZE(db8500_thsens_resources), | |
262 | .dev = { | |
263 | .platform_data = &db8500_thsens_data, | |
264 | }, | |
265 | }; | |
266 | ||
267 | static struct platform_device u8500_cpufreq_cooling_device = { | |
268 | .name = "db8500-cpufreq-cooling", | |
269 | }; | |
270 | ||
fe67dfc8 LW |
271 | /* |
272 | * TPS61052 | |
273 | */ | |
274 | ||
275 | static struct tps6105x_platform_data mop500_tps61052_data = { | |
276 | .mode = TPS6105X_MODE_VOLTAGE, | |
277 | .regulator_data = &tps61052_regulator, | |
278 | }; | |
279 | ||
b8410a15 RV |
280 | /* |
281 | * TC35892 | |
282 | */ | |
283 | ||
20406ebf | 284 | static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base) |
b8410a15 | 285 | { |
18403424 LJ |
286 | struct device *parent = NULL; |
287 | #if 0 | |
288 | /* FIXME: Is the sdi actually part of tc3589x? */ | |
289 | parent = tc3589x->dev; | |
290 | #endif | |
291 | mop500_sdi_tc35892_init(parent); | |
b8410a15 RV |
292 | } |
293 | ||
20406ebf | 294 | static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = { |
b8410a15 RV |
295 | .gpio_base = MOP500_EGPIO(0), |
296 | .setup = mop500_tc35892_init, | |
297 | }; | |
298 | ||
20406ebf | 299 | static struct tc3589x_platform_data mop500_tc35892_data = { |
611b7590 | 300 | .block = TC3589x_BLOCK_GPIO, |
b8410a15 RV |
301 | .gpio = &mop500_tc35892_gpio_data, |
302 | .irq_base = MOP500_EGPIO_IRQ_BASE, | |
303 | }; | |
304 | ||
df4094d2 | 305 | static struct lp55xx_led_config lp5521_pri_led[] = { |
dd7b2a05 PL |
306 | [0] = { |
307 | .chan_nr = 0, | |
308 | .led_current = 0x2f, | |
309 | .max_current = 0x5f, | |
310 | }, | |
311 | [1] = { | |
312 | .chan_nr = 1, | |
313 | .led_current = 0x2f, | |
314 | .max_current = 0x5f, | |
315 | }, | |
316 | [2] = { | |
317 | .chan_nr = 2, | |
318 | .led_current = 0x2f, | |
319 | .max_current = 0x5f, | |
320 | }, | |
321 | }; | |
322 | ||
df4094d2 | 323 | static struct lp55xx_platform_data __initdata lp5521_pri_data = { |
dd7b2a05 PL |
324 | .label = "lp5521_pri", |
325 | .led_config = &lp5521_pri_led[0], | |
326 | .num_channels = 3, | |
df4094d2 | 327 | .clock_mode = LP55XX_CLOCK_EXT, |
dd7b2a05 PL |
328 | }; |
329 | ||
df4094d2 | 330 | static struct lp55xx_led_config lp5521_sec_led[] = { |
dd7b2a05 PL |
331 | [0] = { |
332 | .chan_nr = 0, | |
333 | .led_current = 0x2f, | |
334 | .max_current = 0x5f, | |
335 | }, | |
336 | [1] = { | |
337 | .chan_nr = 1, | |
338 | .led_current = 0x2f, | |
339 | .max_current = 0x5f, | |
340 | }, | |
341 | [2] = { | |
342 | .chan_nr = 2, | |
343 | .led_current = 0x2f, | |
344 | .max_current = 0x5f, | |
345 | }, | |
346 | }; | |
347 | ||
df4094d2 | 348 | static struct lp55xx_platform_data __initdata lp5521_sec_data = { |
dd7b2a05 PL |
349 | .label = "lp5521_sec", |
350 | .led_config = &lp5521_sec_led[0], | |
351 | .num_channels = 3, | |
df4094d2 | 352 | .clock_mode = LP55XX_CLOCK_EXT, |
dd7b2a05 PL |
353 | }; |
354 | ||
fe67dfc8 | 355 | static struct i2c_board_info __initdata mop500_i2c0_devices[] = { |
b8410a15 | 356 | { |
20406ebf | 357 | I2C_BOARD_INFO("tc3589x", 0x42), |
dd7b2a05 | 358 | .irq = NOMADIK_GPIO_TO_IRQ(217), |
b8410a15 RV |
359 | .platform_data = &mop500_tc35892_data, |
360 | }, | |
cf568c58 | 361 | /* I2C0 devices only available prior to HREFv60 */ |
fe67dfc8 LW |
362 | { |
363 | I2C_BOARD_INFO("tps61052", 0x33), | |
364 | .platform_data = &mop500_tps61052_data, | |
365 | }, | |
366 | }; | |
367 | ||
cf568c58 LW |
368 | #define NUM_PRE_V60_I2C0_DEVICES 1 |
369 | ||
dd7b2a05 PL |
370 | static struct i2c_board_info __initdata mop500_i2c2_devices[] = { |
371 | { | |
372 | /* lp5521 LED driver, 1st device */ | |
373 | I2C_BOARD_INFO("lp5521", 0x33), | |
374 | .platform_data = &lp5521_pri_data, | |
375 | }, | |
376 | { | |
377 | /* lp5521 LED driver, 2st device */ | |
378 | I2C_BOARD_INFO("lp5521", 0x34), | |
379 | .platform_data = &lp5521_sec_data, | |
380 | }, | |
bb3b2187 LJ |
381 | { |
382 | /* Light sensor Rohm BH1780GLI */ | |
383 | I2C_BOARD_INFO("bh1780", 0x29), | |
384 | }, | |
dd7b2a05 PL |
385 | }; |
386 | ||
18403424 | 387 | static void __init mop500_i2c_init(struct device *parent) |
fbf1eadf | 388 | { |
98582d95 LJ |
389 | db8500_add_i2c0(parent, NULL); |
390 | db8500_add_i2c1(parent, NULL); | |
391 | db8500_add_i2c2(parent, NULL); | |
392 | db8500_add_i2c3(parent, NULL); | |
fbf1eadf | 393 | } |
aa44ef4d | 394 | |
a71b819b PL |
395 | static struct gpio_keys_button mop500_gpio_keys[] = { |
396 | { | |
397 | .desc = "SFH7741 Proximity Sensor", | |
398 | .type = EV_SW, | |
399 | .code = SW_FRONT_PROXIMITY, | |
a71b819b PL |
400 | .active_low = 0, |
401 | .can_disable = 1, | |
402 | } | |
403 | }; | |
404 | ||
405 | static struct regulator *prox_regulator; | |
406 | static int mop500_prox_activate(struct device *dev); | |
407 | static void mop500_prox_deactivate(struct device *dev); | |
408 | ||
409 | static struct gpio_keys_platform_data mop500_gpio_keys_data = { | |
410 | .buttons = mop500_gpio_keys, | |
411 | .nbuttons = ARRAY_SIZE(mop500_gpio_keys), | |
412 | .enable = mop500_prox_activate, | |
413 | .disable = mop500_prox_deactivate, | |
414 | }; | |
415 | ||
416 | static struct platform_device mop500_gpio_keys_device = { | |
417 | .name = "gpio-keys", | |
418 | .id = 0, | |
419 | .dev = { | |
420 | .platform_data = &mop500_gpio_keys_data, | |
421 | }, | |
422 | }; | |
423 | ||
424 | static int mop500_prox_activate(struct device *dev) | |
425 | { | |
426 | prox_regulator = regulator_get(&mop500_gpio_keys_device.dev, | |
427 | "vcc"); | |
428 | if (IS_ERR(prox_regulator)) { | |
429 | dev_err(&mop500_gpio_keys_device.dev, | |
430 | "no regulator\n"); | |
431 | return PTR_ERR(prox_regulator); | |
432 | } | |
433 | regulator_enable(prox_regulator); | |
434 | return 0; | |
435 | } | |
436 | ||
437 | static void mop500_prox_deactivate(struct device *dev) | |
438 | { | |
439 | regulator_disable(prox_regulator); | |
440 | regulator_put(prox_regulator); | |
441 | } | |
442 | ||
265c3c0a LJ |
443 | void mop500_snowball_ethernet_clock_enable(void) |
444 | { | |
445 | struct clk *clk; | |
446 | ||
447 | clk = clk_get_sys("fsmc", NULL); | |
448 | if (!IS_ERR(clk)) | |
449 | clk_prepare_enable(clk); | |
450 | } | |
451 | ||
585d188f AW |
452 | static struct cryp_platform_data u8500_cryp1_platform_data = { |
453 | .mem_to_engine = { | |
454 | .dir = STEDMA40_MEM_TO_PERIPH, | |
455 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, | |
456 | .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX, | |
457 | .src_info.data_width = STEDMA40_WORD_WIDTH, | |
458 | .dst_info.data_width = STEDMA40_WORD_WIDTH, | |
459 | .mode = STEDMA40_MODE_LOGICAL, | |
460 | .src_info.psize = STEDMA40_PSIZE_LOG_4, | |
461 | .dst_info.psize = STEDMA40_PSIZE_LOG_4, | |
462 | }, | |
463 | .engine_to_mem = { | |
464 | .dir = STEDMA40_PERIPH_TO_MEM, | |
465 | .src_dev_type = DB8500_DMA_DEV48_CAC1_RX, | |
466 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, | |
467 | .src_info.data_width = STEDMA40_WORD_WIDTH, | |
468 | .dst_info.data_width = STEDMA40_WORD_WIDTH, | |
469 | .mode = STEDMA40_MODE_LOGICAL, | |
470 | .src_info.psize = STEDMA40_PSIZE_LOG_4, | |
471 | .dst_info.psize = STEDMA40_PSIZE_LOG_4, | |
472 | } | |
473 | }; | |
474 | ||
475 | static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = { | |
476 | .dir = STEDMA40_MEM_TO_PERIPH, | |
477 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, | |
478 | .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX, | |
479 | .src_info.data_width = STEDMA40_WORD_WIDTH, | |
480 | .dst_info.data_width = STEDMA40_WORD_WIDTH, | |
481 | .mode = STEDMA40_MODE_LOGICAL, | |
482 | .src_info.psize = STEDMA40_PSIZE_LOG_16, | |
483 | .dst_info.psize = STEDMA40_PSIZE_LOG_16, | |
484 | }; | |
485 | ||
486 | static struct hash_platform_data u8500_hash1_platform_data = { | |
487 | .mem_to_engine = &u8500_hash_dma_cfg_tx, | |
488 | .dma_filter = stedma40_filter, | |
489 | }; | |
490 | ||
d48a41c1 | 491 | /* add any platform devices here - TODO */ |
350abe03 | 492 | static struct platform_device *mop500_platform_devs[] __initdata = { |
a71b819b | 493 | &mop500_gpio_keys_device, |
d48a41c1 SK |
494 | }; |
495 | ||
5d7b8467 LW |
496 | #ifdef CONFIG_STE_DMA40 |
497 | static struct stedma40_chan_cfg ssp0_dma_cfg_rx = { | |
498 | .mode = STEDMA40_MODE_LOGICAL, | |
499 | .dir = STEDMA40_PERIPH_TO_MEM, | |
500 | .src_dev_type = DB8500_DMA_DEV8_SSP0_RX, | |
501 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, | |
502 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
503 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
504 | }; | |
505 | ||
506 | static struct stedma40_chan_cfg ssp0_dma_cfg_tx = { | |
507 | .mode = STEDMA40_MODE_LOGICAL, | |
508 | .dir = STEDMA40_MEM_TO_PERIPH, | |
509 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, | |
510 | .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX, | |
511 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
512 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
513 | }; | |
514 | #endif | |
515 | ||
fa86a764 | 516 | struct pl022_ssp_controller ssp0_plat = { |
5d7b8467 LW |
517 | .bus_id = 0, |
518 | #ifdef CONFIG_STE_DMA40 | |
519 | .enable_dma = 1, | |
520 | .dma_filter = stedma40_filter, | |
521 | .dma_rx_param = &ssp0_dma_cfg_rx, | |
522 | .dma_tx_param = &ssp0_dma_cfg_tx, | |
523 | #else | |
524 | .enable_dma = 0, | |
525 | #endif | |
526 | /* on this platform, gpio 31,142,144,214 & | |
527 | * 224 are connected as chip selects | |
528 | */ | |
529 | .num_chipselect = 5, | |
530 | }; | |
531 | ||
18403424 | 532 | static void __init mop500_spi_init(struct device *parent) |
aa44ef4d | 533 | { |
15daf691 | 534 | db8500_add_ssp0(parent, &ssp0_plat); |
fbf1eadf | 535 | } |
aa44ef4d | 536 | |
5d7b8467 LW |
537 | #ifdef CONFIG_STE_DMA40 |
538 | static struct stedma40_chan_cfg uart0_dma_cfg_rx = { | |
539 | .mode = STEDMA40_MODE_LOGICAL, | |
540 | .dir = STEDMA40_PERIPH_TO_MEM, | |
541 | .src_dev_type = DB8500_DMA_DEV13_UART0_RX, | |
542 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, | |
543 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
544 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
545 | }; | |
546 | ||
547 | static struct stedma40_chan_cfg uart0_dma_cfg_tx = { | |
548 | .mode = STEDMA40_MODE_LOGICAL, | |
549 | .dir = STEDMA40_MEM_TO_PERIPH, | |
550 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, | |
551 | .dst_dev_type = DB8500_DMA_DEV13_UART0_TX, | |
552 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
553 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
554 | }; | |
555 | ||
556 | static struct stedma40_chan_cfg uart1_dma_cfg_rx = { | |
557 | .mode = STEDMA40_MODE_LOGICAL, | |
558 | .dir = STEDMA40_PERIPH_TO_MEM, | |
559 | .src_dev_type = DB8500_DMA_DEV12_UART1_RX, | |
560 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, | |
561 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
562 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
563 | }; | |
564 | ||
565 | static struct stedma40_chan_cfg uart1_dma_cfg_tx = { | |
566 | .mode = STEDMA40_MODE_LOGICAL, | |
567 | .dir = STEDMA40_MEM_TO_PERIPH, | |
568 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, | |
569 | .dst_dev_type = DB8500_DMA_DEV12_UART1_TX, | |
570 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
571 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
572 | }; | |
573 | ||
574 | static struct stedma40_chan_cfg uart2_dma_cfg_rx = { | |
575 | .mode = STEDMA40_MODE_LOGICAL, | |
576 | .dir = STEDMA40_PERIPH_TO_MEM, | |
577 | .src_dev_type = DB8500_DMA_DEV11_UART2_RX, | |
578 | .dst_dev_type = STEDMA40_DEV_DST_MEMORY, | |
579 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
580 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
581 | }; | |
582 | ||
583 | static struct stedma40_chan_cfg uart2_dma_cfg_tx = { | |
584 | .mode = STEDMA40_MODE_LOGICAL, | |
585 | .dir = STEDMA40_MEM_TO_PERIPH, | |
586 | .src_dev_type = STEDMA40_DEV_SRC_MEMORY, | |
587 | .dst_dev_type = DB8500_DMA_DEV11_UART2_TX, | |
588 | .src_info.data_width = STEDMA40_BYTE_WIDTH, | |
589 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, | |
590 | }; | |
591 | #endif | |
592 | ||
fa86a764 | 593 | struct amba_pl011_data uart0_plat = { |
5d7b8467 LW |
594 | #ifdef CONFIG_STE_DMA40 |
595 | .dma_filter = stedma40_filter, | |
596 | .dma_rx_param = &uart0_dma_cfg_rx, | |
597 | .dma_tx_param = &uart0_dma_cfg_tx, | |
598 | #endif | |
599 | }; | |
600 | ||
fa86a764 | 601 | struct amba_pl011_data uart1_plat = { |
5d7b8467 LW |
602 | #ifdef CONFIG_STE_DMA40 |
603 | .dma_filter = stedma40_filter, | |
604 | .dma_rx_param = &uart1_dma_cfg_rx, | |
605 | .dma_tx_param = &uart1_dma_cfg_tx, | |
606 | #endif | |
607 | }; | |
608 | ||
fa86a764 | 609 | struct amba_pl011_data uart2_plat = { |
5d7b8467 LW |
610 | #ifdef CONFIG_STE_DMA40 |
611 | .dma_filter = stedma40_filter, | |
612 | .dma_rx_param = &uart2_dma_cfg_rx, | |
613 | .dma_tx_param = &uart2_dma_cfg_tx, | |
614 | #endif | |
615 | }; | |
616 | ||
18403424 | 617 | static void __init mop500_uart_init(struct device *parent) |
fbf1eadf | 618 | { |
78d80c5a | 619 | db8500_add_uart0(parent, &uart0_plat); |
18403424 LJ |
620 | db8500_add_uart1(parent, &uart1_plat); |
621 | db8500_add_uart2(parent, &uart2_plat); | |
fbf1eadf RV |
622 | } |
623 | ||
585d188f AW |
624 | static void __init u8500_cryp1_hash1_init(struct device *parent) |
625 | { | |
626 | db8500_add_cryp1(parent, &u8500_cryp1_platform_data); | |
627 | db8500_add_hash1(parent, &u8500_hash1_platform_data); | |
628 | } | |
629 | ||
350abe03 RM |
630 | static struct platform_device *snowball_platform_devs[] __initdata = { |
631 | &snowball_led_dev, | |
632 | &snowball_key_dev, | |
e6fada59 | 633 | &snowball_sbnet_dev, |
0b5ea1e2 | 634 | &snowball_gpio_en_3v3_regulator_dev, |
dc1956b5 | 635 | &u8500_thsens_device, |
636 | &u8500_cpufreq_cooling_device, | |
350abe03 RM |
637 | }; |
638 | ||
4b4f757c | 639 | static void __init mop500_init_machine(void) |
fbf1eadf | 640 | { |
18403424 | 641 | struct device *parent = NULL; |
cf568c58 | 642 | int i2c0_devs; |
b024a0c8 | 643 | int i; |
cf568c58 | 644 | |
05ec260e | 645 | platform_device_register(&db8500_prcmu_device); |
110c2c2f LJ |
646 | mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; |
647 | ||
ed781d39 | 648 | mop500_pinmaps_init(); |
3a8e39c9 | 649 | parent = u8500_init_devices(&ab8500_platdata); |
110c2c2f | 650 | |
b024a0c8 LJ |
651 | for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) |
652 | mop500_platform_devs[i]->dev.parent = parent; | |
653 | ||
110c2c2f LJ |
654 | platform_add_devices(mop500_platform_devs, |
655 | ARRAY_SIZE(mop500_platform_devs)); | |
656 | ||
18403424 LJ |
657 | mop500_i2c_init(parent); |
658 | mop500_sdi_init(parent); | |
659 | mop500_spi_init(parent); | |
39b740bf | 660 | mop500_audio_init(parent); |
18403424 | 661 | mop500_uart_init(parent); |
110c2c2f | 662 | |
585d188f AW |
663 | u8500_cryp1_hash1_init(parent); |
664 | ||
110c2c2f LJ |
665 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
666 | ||
667 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); | |
668 | i2c_register_board_info(2, mop500_i2c2_devices, | |
669 | ARRAY_SIZE(mop500_i2c2_devices)); | |
670 | ||
671 | /* This board has full regulator constraints */ | |
672 | regulator_has_full_constraints(); | |
673 | } | |
674 | ||
675 | static void __init snowball_init_machine(void) | |
676 | { | |
18403424 | 677 | struct device *parent = NULL; |
b024a0c8 | 678 | int i; |
110c2c2f | 679 | |
05ec260e | 680 | platform_device_register(&db8500_prcmu_device); |
ed781d39 | 681 | snowball_pinmaps_init(); |
3a8e39c9 | 682 | parent = u8500_init_devices(&ab8500_platdata); |
110c2c2f | 683 | |
b024a0c8 LJ |
684 | for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++) |
685 | snowball_platform_devs[i]->dev.parent = parent; | |
686 | ||
110c2c2f LJ |
687 | platform_add_devices(snowball_platform_devs, |
688 | ARRAY_SIZE(snowball_platform_devs)); | |
689 | ||
18403424 LJ |
690 | mop500_i2c_init(parent); |
691 | snowball_sdi_init(parent); | |
692 | mop500_spi_init(parent); | |
39b740bf | 693 | mop500_audio_init(parent); |
18403424 | 694 | mop500_uart_init(parent); |
110c2c2f | 695 | |
265c3c0a LJ |
696 | mop500_snowball_ethernet_clock_enable(); |
697 | ||
110c2c2f LJ |
698 | /* This board has full regulator constraints */ |
699 | regulator_has_full_constraints(); | |
700 | } | |
701 | ||
702 | static void __init hrefv60_init_machine(void) | |
703 | { | |
18403424 | 704 | struct device *parent = NULL; |
110c2c2f | 705 | int i2c0_devs; |
b024a0c8 | 706 | int i; |
110c2c2f | 707 | |
05ec260e | 708 | platform_device_register(&db8500_prcmu_device); |
4b4f757c LW |
709 | /* |
710 | * The HREFv60 board removed a GPIO expander and routed | |
711 | * all these GPIO pins to the internal GPIO controller | |
712 | * instead. | |
713 | */ | |
110c2c2f | 714 | mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; |
4b4f757c | 715 | |
ed781d39 | 716 | hrefv60_pinmaps_init(); |
3a8e39c9 | 717 | parent = u8500_init_devices(&ab8500_platdata); |
ea05a57f | 718 | |
b024a0c8 LJ |
719 | for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) |
720 | mop500_platform_devs[i]->dev.parent = parent; | |
721 | ||
110c2c2f LJ |
722 | platform_add_devices(mop500_platform_devs, |
723 | ARRAY_SIZE(mop500_platform_devs)); | |
d48a41c1 | 724 | |
18403424 LJ |
725 | mop500_i2c_init(parent); |
726 | hrefv60_sdi_init(parent); | |
727 | mop500_spi_init(parent); | |
39b740bf | 728 | mop500_audio_init(parent); |
18403424 | 729 | mop500_uart_init(parent); |
008f8a2f | 730 | |
cf568c58 | 731 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
110c2c2f LJ |
732 | |
733 | i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES; | |
cf568c58 LW |
734 | |
735 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); | |
dd7b2a05 PL |
736 | i2c_register_board_info(2, mop500_i2c2_devices, |
737 | ARRAY_SIZE(mop500_i2c2_devices)); | |
db24520f LW |
738 | |
739 | /* This board has full regulator constraints */ | |
740 | regulator_has_full_constraints(); | |
aa44ef4d SK |
741 | } |
742 | ||
743 | MACHINE_START(U8500, "ST-Ericsson MOP500 platform") | |
744 | /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */ | |
bc77b1aa | 745 | .atag_offset = 0x100, |
5ac21a94 | 746 | .smp = smp_ops(ux500_smp_ops), |
aa44ef4d | 747 | .map_io = u8500_map_io, |
178980f9 | 748 | .init_irq = ux500_init_irq, |
aa44ef4d | 749 | /* we re-use nomadik timer here */ |
6bb27d73 | 750 | .init_time = ux500_timer_init, |
4b4f757c | 751 | .init_machine = mop500_init_machine, |
a010bc2b | 752 | .init_late = ux500_init_late, |
4b4f757c LW |
753 | MACHINE_END |
754 | ||
a3a6c6a3 LW |
755 | MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520") |
756 | .atag_offset = 0x100, | |
757 | .map_io = u8500_map_io, | |
758 | .init_irq = ux500_init_irq, | |
6bb27d73 | 759 | .init_time = ux500_timer_init, |
a3a6c6a3 LW |
760 | .init_machine = mop500_init_machine, |
761 | .init_late = ux500_init_late, | |
762 | MACHINE_END | |
763 | ||
4b4f757c | 764 | MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+") |
bc77b1aa | 765 | .atag_offset = 0x100, |
5ac21a94 | 766 | .smp = smp_ops(ux500_smp_ops), |
4b4f757c LW |
767 | .map_io = u8500_map_io, |
768 | .init_irq = ux500_init_irq, | |
6bb27d73 | 769 | .init_time = ux500_timer_init, |
110c2c2f | 770 | .init_machine = hrefv60_init_machine, |
a010bc2b | 771 | .init_late = ux500_init_late, |
aa44ef4d | 772 | MACHINE_END |
350abe03 RM |
773 | |
774 | MACHINE_START(SNOWBALL, "Calao Systems Snowball platform") | |
bc77b1aa | 775 | .atag_offset = 0x100, |
5ac21a94 | 776 | .smp = smp_ops(ux500_smp_ops), |
350abe03 RM |
777 | .map_io = u8500_map_io, |
778 | .init_irq = ux500_init_irq, | |
779 | /* we re-use nomadik timer here */ | |
6bb27d73 | 780 | .init_time = ux500_timer_init, |
110c2c2f | 781 | .init_machine = snowball_init_machine, |
0ddf855a | 782 | .init_late = NULL, |
2d334297 | 783 | MACHINE_END |