Merge tag 'fixes-nc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
[~shefty/rdma-dev.git] / arch / arm / mach-ux500 / board-mop500.c
1 /*
2  * Copyright (C) 2008-2012 ST-Ericsson
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>
15 #include <linux/clk.h>
16 #include <linux/io.h>
17 #include <linux/i2c.h>
18 #include <linux/platform_data/i2c-nomadik.h>
19 #include <linux/platform_data/db8500_thermal.h>
20 #include <linux/gpio.h>
21 #include <linux/amba/bus.h>
22 #include <linux/amba/pl022.h>
23 #include <linux/amba/serial.h>
24 #include <linux/spi/spi.h>
25 #include <linux/mfd/abx500/ab8500.h>
26 #include <linux/regulator/ab8500.h>
27 #include <linux/regulator/fixed.h>
28 #include <linux/regulator/driver.h>
29 #include <linux/regulator/gpio-regulator.h>
30 #include <linux/mfd/tc3589x.h>
31 #include <linux/mfd/tps6105x.h>
32 #include <linux/mfd/abx500/ab8500-gpio.h>
33 #include <linux/mfd/abx500/ab8500-codec.h>
34 #include <linux/platform_data/leds-lp55xx.h>
35 #include <linux/input.h>
36 #include <linux/smsc911x.h>
37 #include <linux/gpio_keys.h>
38 #include <linux/delay.h>
39 #include <linux/leds.h>
40 #include <linux/pinctrl/consumer.h>
41 #include <linux/platform_data/pinctrl-nomadik.h>
42 #include <linux/platform_data/dma-ste-dma40.h>
43
44 #include <asm/mach-types.h>
45 #include <asm/mach/arch.h>
46
47 #include <mach/hardware.h>
48 #include <mach/setup.h>
49 #include <mach/devices.h>
50 #include <mach/irqs.h>
51 #include <linux/platform_data/crypto-ux500.h>
52
53 #include "ste-dma40-db8500.h"
54 #include "devices-db8500.h"
55 #include "board-mop500.h"
56 #include "board-mop500-regulators.h"
57
58 static struct gpio_led snowball_led_array[] = {
59         {
60                 .name = "user_led",
61                 .default_trigger = "heartbeat",
62                 .gpio = 142,
63         },
64 };
65
66 static struct gpio_led_platform_data snowball_led_data = {
67         .leds = snowball_led_array,
68         .num_leds = ARRAY_SIZE(snowball_led_array),
69 };
70
71 static struct platform_device snowball_led_dev = {
72         .name = "leds-gpio",
73         .dev = {
74                 .platform_data = &snowball_led_data,
75         },
76 };
77
78 static 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
87 static 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
95 /* Dynamically populated. */
96 static struct gpio sdi0_reg_gpios[] = {
97         { 0, GPIOF_OUT_INIT_LOW, "mmci_vsel" },
98 };
99
100 static struct gpio_regulator_state sdi0_reg_states[] = {
101         { .value = 2900000, .gpios = (0 << 0) },
102         { .value = 1800000, .gpios = (1 << 0) },
103 };
104
105 static 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
118 static struct platform_device sdi0_regulator = {
119         .name = "gpio-regulator",
120         .id   = -1,
121         .dev  = {
122                 .platform_data = &sdi0_reg_info,
123         },
124 };
125
126 static struct abx500_gpio_platform_data ab8500_gpio_pdata = {
127         .gpio_base              = MOP500_AB8500_PIN_GPIO(1),
128 };
129
130 /* ab8500-codec */
131 static 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
142 static 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
190 static struct gpio_keys_platform_data snowball_key_data = {
191         .buttons        = snowball_key_array,
192         .nbuttons       = ARRAY_SIZE(snowball_key_array),
193 };
194
195 static struct platform_device snowball_key_dev = {
196         .name           = "gpio-keys",
197         .id             = -1,
198         .dev            = {
199                 .platform_data  = &snowball_key_data,
200         }
201 };
202
203 static 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
210 static 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
224 static 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
233 struct ab8500_platform_data ab8500_platdata = {
234         .irq_base       = MOP500_AB8500_IRQ_BASE,
235         .regulator      = &ab8500_regulator_plat_data,
236         .gpio           = &ab8500_gpio_pdata,
237         .codec          = &ab8500_codec_pdata,
238 };
239
240 /*
241  * Thermal Sensor
242  */
243
244 static struct resource db8500_thsens_resources[] = {
245         {
246                 .name = "IRQ_HOTMON_LOW",
247                 .start  = IRQ_PRCMU_HOTMON_LOW,
248                 .end    = IRQ_PRCMU_HOTMON_LOW,
249                 .flags  = IORESOURCE_IRQ,
250         },
251         {
252                 .name = "IRQ_HOTMON_HIGH",
253                 .start  = IRQ_PRCMU_HOTMON_HIGH,
254                 .end    = IRQ_PRCMU_HOTMON_HIGH,
255                 .flags  = IORESOURCE_IRQ,
256         },
257 };
258
259 static struct db8500_thsens_platform_data db8500_thsens_data = {
260         .trip_points[0] = {
261                 .temp = 70000,
262                 .type = THERMAL_TRIP_ACTIVE,
263                 .cdev_name = {
264                         [0] = "thermal-cpufreq-0",
265                 },
266         },
267         .trip_points[1] = {
268                 .temp = 75000,
269                 .type = THERMAL_TRIP_ACTIVE,
270                 .cdev_name = {
271                         [0] = "thermal-cpufreq-0",
272                 },
273         },
274         .trip_points[2] = {
275                 .temp = 80000,
276                 .type = THERMAL_TRIP_ACTIVE,
277                 .cdev_name = {
278                         [0] = "thermal-cpufreq-0",
279                 },
280         },
281         .trip_points[3] = {
282                 .temp = 85000,
283                 .type = THERMAL_TRIP_CRITICAL,
284         },
285         .num_trips = 4,
286 };
287
288 static struct platform_device u8500_thsens_device = {
289         .name           = "db8500-thermal",
290         .resource       = db8500_thsens_resources,
291         .num_resources  = ARRAY_SIZE(db8500_thsens_resources),
292         .dev    = {
293                 .platform_data  = &db8500_thsens_data,
294         },
295 };
296
297 static struct platform_device u8500_cpufreq_cooling_device = {
298         .name           = "db8500-cpufreq-cooling",
299 };
300
301 /*
302  * TPS61052
303  */
304
305 static struct tps6105x_platform_data mop500_tps61052_data = {
306         .mode = TPS6105X_MODE_VOLTAGE,
307         .regulator_data = &tps61052_regulator,
308 };
309
310 /*
311  * TC35892
312  */
313
314 static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
315 {
316         struct device *parent = NULL;
317 #if 0
318         /* FIXME: Is the sdi actually part of tc3589x? */
319         parent = tc3589x->dev;
320 #endif
321         mop500_sdi_tc35892_init(parent);
322 }
323
324 static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
325         .gpio_base      = MOP500_EGPIO(0),
326         .setup          = mop500_tc35892_init,
327 };
328
329 static struct tc3589x_platform_data mop500_tc35892_data = {
330         .block          = TC3589x_BLOCK_GPIO,
331         .gpio           = &mop500_tc35892_gpio_data,
332         .irq_base       = MOP500_EGPIO_IRQ_BASE,
333 };
334
335 static struct lp55xx_led_config lp5521_pri_led[] = {
336        [0] = {
337                .chan_nr = 0,
338                .led_current = 0x2f,
339                .max_current = 0x5f,
340        },
341        [1] = {
342                .chan_nr = 1,
343                .led_current = 0x2f,
344                .max_current = 0x5f,
345        },
346        [2] = {
347                .chan_nr = 2,
348                .led_current = 0x2f,
349                .max_current = 0x5f,
350        },
351 };
352
353 static struct lp55xx_platform_data __initdata lp5521_pri_data = {
354        .label = "lp5521_pri",
355        .led_config     = &lp5521_pri_led[0],
356        .num_channels   = 3,
357        .clock_mode     = LP55XX_CLOCK_EXT,
358 };
359
360 static struct lp55xx_led_config lp5521_sec_led[] = {
361        [0] = {
362                .chan_nr = 0,
363                .led_current = 0x2f,
364                .max_current = 0x5f,
365        },
366        [1] = {
367                .chan_nr = 1,
368                .led_current = 0x2f,
369                .max_current = 0x5f,
370        },
371        [2] = {
372                .chan_nr = 2,
373                .led_current = 0x2f,
374                .max_current = 0x5f,
375        },
376 };
377
378 static struct lp55xx_platform_data __initdata lp5521_sec_data = {
379        .label = "lp5521_sec",
380        .led_config     = &lp5521_sec_led[0],
381        .num_channels   = 3,
382        .clock_mode     = LP55XX_CLOCK_EXT,
383 };
384
385 static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
386         {
387                 I2C_BOARD_INFO("tc3589x", 0x42),
388                 .irq            = NOMADIK_GPIO_TO_IRQ(217),
389                 .platform_data  = &mop500_tc35892_data,
390         },
391         /* I2C0 devices only available prior to HREFv60 */
392         {
393                 I2C_BOARD_INFO("tps61052", 0x33),
394                 .platform_data  = &mop500_tps61052_data,
395         },
396 };
397
398 #define NUM_PRE_V60_I2C0_DEVICES 1
399
400 static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
401         {
402                 /* lp5521 LED driver, 1st device */
403                 I2C_BOARD_INFO("lp5521", 0x33),
404                 .platform_data = &lp5521_pri_data,
405         },
406         {
407                 /* lp5521 LED driver, 2st device */
408                 I2C_BOARD_INFO("lp5521", 0x34),
409                 .platform_data = &lp5521_sec_data,
410         },
411         {
412                 /* Light sensor Rohm BH1780GLI */
413                 I2C_BOARD_INFO("bh1780", 0x29),
414         },
415 };
416
417 static void __init mop500_i2c_init(struct device *parent)
418 {
419         db8500_add_i2c0(parent, NULL);
420         db8500_add_i2c1(parent, NULL);
421         db8500_add_i2c2(parent, NULL);
422         db8500_add_i2c3(parent, NULL);
423 }
424
425 static struct gpio_keys_button mop500_gpio_keys[] = {
426         {
427                 .desc                   = "SFH7741 Proximity Sensor",
428                 .type                   = EV_SW,
429                 .code                   = SW_FRONT_PROXIMITY,
430                 .active_low             = 0,
431                 .can_disable            = 1,
432         }
433 };
434
435 static struct regulator *prox_regulator;
436 static int mop500_prox_activate(struct device *dev);
437 static void mop500_prox_deactivate(struct device *dev);
438
439 static struct gpio_keys_platform_data mop500_gpio_keys_data = {
440         .buttons        = mop500_gpio_keys,
441         .nbuttons       = ARRAY_SIZE(mop500_gpio_keys),
442         .enable         = mop500_prox_activate,
443         .disable        = mop500_prox_deactivate,
444 };
445
446 static struct platform_device mop500_gpio_keys_device = {
447         .name   = "gpio-keys",
448         .id     = 0,
449         .dev    = {
450                 .platform_data  = &mop500_gpio_keys_data,
451         },
452 };
453
454 static int mop500_prox_activate(struct device *dev)
455 {
456         prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
457                                                 "vcc");
458         if (IS_ERR(prox_regulator)) {
459                 dev_err(&mop500_gpio_keys_device.dev,
460                         "no regulator\n");
461                 return PTR_ERR(prox_regulator);
462         }
463         regulator_enable(prox_regulator);
464         return 0;
465 }
466
467 static void mop500_prox_deactivate(struct device *dev)
468 {
469         regulator_disable(prox_regulator);
470         regulator_put(prox_regulator);
471 }
472
473 void mop500_snowball_ethernet_clock_enable(void)
474 {
475         struct clk *clk;
476
477         clk = clk_get_sys("fsmc", NULL);
478         if (!IS_ERR(clk))
479                 clk_prepare_enable(clk);
480 }
481
482 static struct cryp_platform_data u8500_cryp1_platform_data = {
483                 .mem_to_engine = {
484                                 .dir = STEDMA40_MEM_TO_PERIPH,
485                                 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
486                                 .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
487                                 .src_info.data_width = STEDMA40_WORD_WIDTH,
488                                 .dst_info.data_width = STEDMA40_WORD_WIDTH,
489                                 .mode = STEDMA40_MODE_LOGICAL,
490                                 .src_info.psize = STEDMA40_PSIZE_LOG_4,
491                                 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
492                 },
493                 .engine_to_mem = {
494                                 .dir = STEDMA40_PERIPH_TO_MEM,
495                                 .src_dev_type = DB8500_DMA_DEV48_CAC1_RX,
496                                 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
497                                 .src_info.data_width = STEDMA40_WORD_WIDTH,
498                                 .dst_info.data_width = STEDMA40_WORD_WIDTH,
499                                 .mode = STEDMA40_MODE_LOGICAL,
500                                 .src_info.psize = STEDMA40_PSIZE_LOG_4,
501                                 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
502                 }
503 };
504
505 static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
506                 .dir = STEDMA40_MEM_TO_PERIPH,
507                 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
508                 .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
509                 .src_info.data_width = STEDMA40_WORD_WIDTH,
510                 .dst_info.data_width = STEDMA40_WORD_WIDTH,
511                 .mode = STEDMA40_MODE_LOGICAL,
512                 .src_info.psize = STEDMA40_PSIZE_LOG_16,
513                 .dst_info.psize = STEDMA40_PSIZE_LOG_16,
514 };
515
516 static struct hash_platform_data u8500_hash1_platform_data = {
517                 .mem_to_engine = &u8500_hash_dma_cfg_tx,
518                 .dma_filter = stedma40_filter,
519 };
520
521 /* add any platform devices here - TODO */
522 static struct platform_device *mop500_platform_devs[] __initdata = {
523         &mop500_gpio_keys_device,
524         &sdi0_regulator,
525 };
526
527 #ifdef CONFIG_STE_DMA40
528 static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
529         .mode = STEDMA40_MODE_LOGICAL,
530         .dir = STEDMA40_PERIPH_TO_MEM,
531         .src_dev_type =  DB8500_DMA_DEV8_SSP0_RX,
532         .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
533         .src_info.data_width = STEDMA40_BYTE_WIDTH,
534         .dst_info.data_width = STEDMA40_BYTE_WIDTH,
535 };
536
537 static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
538         .mode = STEDMA40_MODE_LOGICAL,
539         .dir = STEDMA40_MEM_TO_PERIPH,
540         .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
541         .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
542         .src_info.data_width = STEDMA40_BYTE_WIDTH,
543         .dst_info.data_width = STEDMA40_BYTE_WIDTH,
544 };
545 #endif
546
547 struct pl022_ssp_controller ssp0_plat = {
548         .bus_id = 0,
549 #ifdef CONFIG_STE_DMA40
550         .enable_dma = 1,
551         .dma_filter = stedma40_filter,
552         .dma_rx_param = &ssp0_dma_cfg_rx,
553         .dma_tx_param = &ssp0_dma_cfg_tx,
554 #else
555         .enable_dma = 0,
556 #endif
557         /* on this platform, gpio 31,142,144,214 &
558          * 224 are connected as chip selects
559          */
560         .num_chipselect = 5,
561 };
562
563 static void __init mop500_spi_init(struct device *parent)
564 {
565         db8500_add_ssp0(parent, &ssp0_plat);
566 }
567
568 #ifdef CONFIG_STE_DMA40
569 static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
570         .mode = STEDMA40_MODE_LOGICAL,
571         .dir = STEDMA40_PERIPH_TO_MEM,
572         .src_dev_type =  DB8500_DMA_DEV13_UART0_RX,
573         .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
574         .src_info.data_width = STEDMA40_BYTE_WIDTH,
575         .dst_info.data_width = STEDMA40_BYTE_WIDTH,
576 };
577
578 static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
579         .mode = STEDMA40_MODE_LOGICAL,
580         .dir = STEDMA40_MEM_TO_PERIPH,
581         .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
582         .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
583         .src_info.data_width = STEDMA40_BYTE_WIDTH,
584         .dst_info.data_width = STEDMA40_BYTE_WIDTH,
585 };
586
587 static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
588         .mode = STEDMA40_MODE_LOGICAL,
589         .dir = STEDMA40_PERIPH_TO_MEM,
590         .src_dev_type =  DB8500_DMA_DEV12_UART1_RX,
591         .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
592         .src_info.data_width = STEDMA40_BYTE_WIDTH,
593         .dst_info.data_width = STEDMA40_BYTE_WIDTH,
594 };
595
596 static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
597         .mode = STEDMA40_MODE_LOGICAL,
598         .dir = STEDMA40_MEM_TO_PERIPH,
599         .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
600         .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
601         .src_info.data_width = STEDMA40_BYTE_WIDTH,
602         .dst_info.data_width = STEDMA40_BYTE_WIDTH,
603 };
604
605 static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
606         .mode = STEDMA40_MODE_LOGICAL,
607         .dir = STEDMA40_PERIPH_TO_MEM,
608         .src_dev_type =  DB8500_DMA_DEV11_UART2_RX,
609         .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
610         .src_info.data_width = STEDMA40_BYTE_WIDTH,
611         .dst_info.data_width = STEDMA40_BYTE_WIDTH,
612 };
613
614 static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
615         .mode = STEDMA40_MODE_LOGICAL,
616         .dir = STEDMA40_MEM_TO_PERIPH,
617         .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
618         .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
619         .src_info.data_width = STEDMA40_BYTE_WIDTH,
620         .dst_info.data_width = STEDMA40_BYTE_WIDTH,
621 };
622 #endif
623
624 struct amba_pl011_data uart0_plat = {
625 #ifdef CONFIG_STE_DMA40
626         .dma_filter = stedma40_filter,
627         .dma_rx_param = &uart0_dma_cfg_rx,
628         .dma_tx_param = &uart0_dma_cfg_tx,
629 #endif
630 };
631
632 struct amba_pl011_data uart1_plat = {
633 #ifdef CONFIG_STE_DMA40
634         .dma_filter = stedma40_filter,
635         .dma_rx_param = &uart1_dma_cfg_rx,
636         .dma_tx_param = &uart1_dma_cfg_tx,
637 #endif
638 };
639
640 struct amba_pl011_data uart2_plat = {
641 #ifdef CONFIG_STE_DMA40
642         .dma_filter = stedma40_filter,
643         .dma_rx_param = &uart2_dma_cfg_rx,
644         .dma_tx_param = &uart2_dma_cfg_tx,
645 #endif
646 };
647
648 static void __init mop500_uart_init(struct device *parent)
649 {
650         db8500_add_uart0(parent, &uart0_plat);
651         db8500_add_uart1(parent, &uart1_plat);
652         db8500_add_uart2(parent, &uart2_plat);
653 }
654
655 static void __init u8500_cryp1_hash1_init(struct device *parent)
656 {
657         db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
658         db8500_add_hash1(parent, &u8500_hash1_platform_data);
659 }
660
661 static struct platform_device *snowball_platform_devs[] __initdata = {
662         &snowball_led_dev,
663         &snowball_key_dev,
664         &snowball_sbnet_dev,
665         &snowball_gpio_en_3v3_regulator_dev,
666         &u8500_thsens_device,
667         &u8500_cpufreq_cooling_device,
668         &sdi0_regulator,
669 };
670
671 static void __init mop500_init_machine(void)
672 {
673         struct device *parent = NULL;
674         int i2c0_devs;
675         int i;
676
677         platform_device_register(&db8500_prcmu_device);
678         mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
679
680         sdi0_reg_info.enable_gpio = GPIO_SDMMC_EN;
681         sdi0_reg_info.gpios[0].gpio = GPIO_SDMMC_1V8_3V_SEL;
682
683         mop500_pinmaps_init();
684         parent = u8500_init_devices(&ab8500_platdata);
685
686         for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
687                 mop500_platform_devs[i]->dev.parent = parent;
688
689         platform_add_devices(mop500_platform_devs,
690                         ARRAY_SIZE(mop500_platform_devs));
691
692         mop500_i2c_init(parent);
693         mop500_sdi_init(parent);
694         mop500_spi_init(parent);
695         mop500_audio_init(parent);
696         mop500_uart_init(parent);
697
698         u8500_cryp1_hash1_init(parent);
699
700         i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
701
702         i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
703         i2c_register_board_info(2, mop500_i2c2_devices,
704                                 ARRAY_SIZE(mop500_i2c2_devices));
705
706         /* This board has full regulator constraints */
707         regulator_has_full_constraints();
708 }
709
710 static void __init snowball_init_machine(void)
711 {
712         struct device *parent = NULL;
713         int i;
714
715         platform_device_register(&db8500_prcmu_device);
716
717         sdi0_reg_info.enable_gpio = SNOWBALL_SDMMC_EN_GPIO;
718         sdi0_reg_info.gpios[0].gpio = SNOWBALL_SDMMC_1V8_3V_GPIO;
719
720         snowball_pinmaps_init();
721         parent = u8500_init_devices(&ab8500_platdata);
722
723         for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
724                 snowball_platform_devs[i]->dev.parent = parent;
725
726         platform_add_devices(snowball_platform_devs,
727                         ARRAY_SIZE(snowball_platform_devs));
728
729         mop500_i2c_init(parent);
730         snowball_sdi_init(parent);
731         mop500_spi_init(parent);
732         mop500_audio_init(parent);
733         mop500_uart_init(parent);
734
735         mop500_snowball_ethernet_clock_enable();
736
737         /* This board has full regulator constraints */
738         regulator_has_full_constraints();
739 }
740
741 static void __init hrefv60_init_machine(void)
742 {
743         struct device *parent = NULL;
744         int i2c0_devs;
745         int i;
746
747         platform_device_register(&db8500_prcmu_device);
748         /*
749          * The HREFv60 board removed a GPIO expander and routed
750          * all these GPIO pins to the internal GPIO controller
751          * instead.
752          */
753         mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
754
755         sdi0_reg_info.enable_gpio = HREFV60_SDMMC_EN_GPIO;
756         sdi0_reg_info.gpios[0].gpio = HREFV60_SDMMC_1V8_3V_GPIO;
757
758         hrefv60_pinmaps_init();
759         parent = u8500_init_devices(&ab8500_platdata);
760
761         for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
762                 mop500_platform_devs[i]->dev.parent = parent;
763
764         platform_add_devices(mop500_platform_devs,
765                         ARRAY_SIZE(mop500_platform_devs));
766
767         mop500_i2c_init(parent);
768         hrefv60_sdi_init(parent);
769         mop500_spi_init(parent);
770         mop500_audio_init(parent);
771         mop500_uart_init(parent);
772
773         i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
774
775         i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
776
777         i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
778         i2c_register_board_info(2, mop500_i2c2_devices,
779                                 ARRAY_SIZE(mop500_i2c2_devices));
780
781         /* This board has full regulator constraints */
782         regulator_has_full_constraints();
783 }
784
785 MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
786         /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
787         .atag_offset    = 0x100,
788         .smp            = smp_ops(ux500_smp_ops),
789         .map_io         = u8500_map_io,
790         .init_irq       = ux500_init_irq,
791         /* we re-use nomadik timer here */
792         .init_time      = ux500_timer_init,
793         .init_machine   = mop500_init_machine,
794         .init_late      = ux500_init_late,
795 MACHINE_END
796
797 MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520")
798         .atag_offset    = 0x100,
799         .map_io         = u8500_map_io,
800         .init_irq       = ux500_init_irq,
801         .init_time      = ux500_timer_init,
802         .init_machine   = mop500_init_machine,
803         .init_late      = ux500_init_late,
804 MACHINE_END
805
806 MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
807         .atag_offset    = 0x100,
808         .smp            = smp_ops(ux500_smp_ops),
809         .map_io         = u8500_map_io,
810         .init_irq       = ux500_init_irq,
811         .init_time      = ux500_timer_init,
812         .init_machine   = hrefv60_init_machine,
813         .init_late      = ux500_init_late,
814 MACHINE_END
815
816 MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
817         .atag_offset    = 0x100,
818         .smp            = smp_ops(ux500_smp_ops),
819         .map_io         = u8500_map_io,
820         .init_irq       = ux500_init_irq,
821         /* we re-use nomadik timer here */
822         .init_time      = ux500_timer_init,
823         .init_machine   = snowball_init_machine,
824         .init_late      = NULL,
825 MACHINE_END