Merge branch 'drm-next-3.10' of git://people.freedesktop.org/~agd5f/linux into drm...
[firefly-linux-kernel-4.4.55.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/mfd/tc3589x.h>
29 #include <linux/mfd/tps6105x.h>
30 #include <linux/mfd/abx500/ab8500-gpio.h>
31 #include <linux/mfd/abx500/ab8500-codec.h>
32 #include <linux/platform_data/leds-lp55xx.h>
33 #include <linux/input.h>
34 #include <linux/smsc911x.h>
35 #include <linux/gpio_keys.h>
36 #include <linux/delay.h>
37 #include <linux/leds.h>
38 #include <linux/pinctrl/consumer.h>
39 #include <linux/platform_data/pinctrl-nomadik.h>
40 #include <linux/platform_data/dma-ste-dma40.h>
41
42 #include <asm/mach-types.h>
43 #include <asm/mach/arch.h>
44
45 #include <mach/hardware.h>
46 #include <mach/setup.h>
47 #include <mach/devices.h>
48 #include <mach/irqs.h>
49 #include <linux/platform_data/crypto-ux500.h>
50
51 #include "ste-dma40-db8500.h"
52 #include "devices-db8500.h"
53 #include "board-mop500.h"
54 #include "board-mop500-regulators.h"
55
56 static struct gpio_led snowball_led_array[] = {
57         {
58                 .name = "user_led",
59                 .default_trigger = "heartbeat",
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
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
93 static struct abx500_gpio_platform_data ab8500_gpio_pdata = {
94         .gpio_base              = MOP500_AB8500_PIN_GPIO(1),
95 };
96
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
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
200 struct ab8500_platform_data ab8500_platdata = {
201         .irq_base       = MOP500_AB8500_IRQ_BASE,
202         .regulator_reg_init = ab8500_regulator_reg_init,
203         .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
204         .regulator      = ab8500_regulators,
205         .num_regulator  = ARRAY_SIZE(ab8500_regulators),
206         .gpio           = &ab8500_gpio_pdata,
207         .codec          = &ab8500_codec_pdata,
208 };
209
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
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
280 /*
281  * TC35892
282  */
283
284 static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
285 {
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);
292 }
293
294 static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
295         .gpio_base      = MOP500_EGPIO(0),
296         .setup          = mop500_tc35892_init,
297 };
298
299 static struct tc3589x_platform_data mop500_tc35892_data = {
300         .block          = TC3589x_BLOCK_GPIO,
301         .gpio           = &mop500_tc35892_gpio_data,
302         .irq_base       = MOP500_EGPIO_IRQ_BASE,
303 };
304
305 static struct lp55xx_led_config lp5521_pri_led[] = {
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
323 static struct lp55xx_platform_data __initdata lp5521_pri_data = {
324        .label = "lp5521_pri",
325        .led_config     = &lp5521_pri_led[0],
326        .num_channels   = 3,
327        .clock_mode     = LP55XX_CLOCK_EXT,
328 };
329
330 static struct lp55xx_led_config lp5521_sec_led[] = {
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
348 static struct lp55xx_platform_data __initdata lp5521_sec_data = {
349        .label = "lp5521_sec",
350        .led_config     = &lp5521_sec_led[0],
351        .num_channels   = 3,
352        .clock_mode     = LP55XX_CLOCK_EXT,
353 };
354
355 static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
356         {
357                 I2C_BOARD_INFO("tc3589x", 0x42),
358                 .irq            = NOMADIK_GPIO_TO_IRQ(217),
359                 .platform_data  = &mop500_tc35892_data,
360         },
361         /* I2C0 devices only available prior to HREFv60 */
362         {
363                 I2C_BOARD_INFO("tps61052", 0x33),
364                 .platform_data  = &mop500_tps61052_data,
365         },
366 };
367
368 #define NUM_PRE_V60_I2C0_DEVICES 1
369
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         },
381         {
382                 /* Light sensor Rohm BH1780GLI */
383                 I2C_BOARD_INFO("bh1780", 0x29),
384         },
385 };
386
387 static void __init mop500_i2c_init(struct device *parent)
388 {
389         db8500_add_i2c0(parent, NULL);
390         db8500_add_i2c1(parent, NULL);
391         db8500_add_i2c2(parent, NULL);
392         db8500_add_i2c3(parent, NULL);
393 }
394
395 static struct gpio_keys_button mop500_gpio_keys[] = {
396         {
397                 .desc                   = "SFH7741 Proximity Sensor",
398                 .type                   = EV_SW,
399                 .code                   = SW_FRONT_PROXIMITY,
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
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
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
491 /* add any platform devices here - TODO */
492 static struct platform_device *mop500_platform_devs[] __initdata = {
493         &mop500_gpio_keys_device,
494 };
495
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
516 struct pl022_ssp_controller ssp0_plat = {
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
532 static void __init mop500_spi_init(struct device *parent)
533 {
534         db8500_add_ssp0(parent, &ssp0_plat);
535 }
536
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
593 struct amba_pl011_data uart0_plat = {
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
601 struct amba_pl011_data uart1_plat = {
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
609 struct amba_pl011_data uart2_plat = {
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
617 static void __init mop500_uart_init(struct device *parent)
618 {
619         db8500_add_uart0(parent, &uart0_plat);
620         db8500_add_uart1(parent, &uart1_plat);
621         db8500_add_uart2(parent, &uart2_plat);
622 }
623
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
630 static struct platform_device *snowball_platform_devs[] __initdata = {
631         &snowball_led_dev,
632         &snowball_key_dev,
633         &snowball_sbnet_dev,
634         &snowball_gpio_en_3v3_regulator_dev,
635         &u8500_thsens_device,
636         &u8500_cpufreq_cooling_device,
637 };
638
639 static void __init mop500_init_machine(void)
640 {
641         struct device *parent = NULL;
642         int i2c0_devs;
643         int i;
644
645         platform_device_register(&db8500_prcmu_device);
646         mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
647
648         mop500_pinmaps_init();
649         parent = u8500_init_devices(&ab8500_platdata);
650
651         for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
652                 mop500_platform_devs[i]->dev.parent = parent;
653
654         platform_add_devices(mop500_platform_devs,
655                         ARRAY_SIZE(mop500_platform_devs));
656
657         mop500_i2c_init(parent);
658         mop500_sdi_init(parent);
659         mop500_spi_init(parent);
660         mop500_audio_init(parent);
661         mop500_uart_init(parent);
662
663         u8500_cryp1_hash1_init(parent);
664
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 {
677         struct device *parent = NULL;
678         int i;
679
680         platform_device_register(&db8500_prcmu_device);
681         snowball_pinmaps_init();
682         parent = u8500_init_devices(&ab8500_platdata);
683
684         for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
685                 snowball_platform_devs[i]->dev.parent = parent;
686
687         platform_add_devices(snowball_platform_devs,
688                         ARRAY_SIZE(snowball_platform_devs));
689
690         mop500_i2c_init(parent);
691         snowball_sdi_init(parent);
692         mop500_spi_init(parent);
693         mop500_audio_init(parent);
694         mop500_uart_init(parent);
695
696         mop500_snowball_ethernet_clock_enable();
697
698         /* This board has full regulator constraints */
699         regulator_has_full_constraints();
700 }
701
702 static void __init hrefv60_init_machine(void)
703 {
704         struct device *parent = NULL;
705         int i2c0_devs;
706         int i;
707
708         platform_device_register(&db8500_prcmu_device);
709         /*
710          * The HREFv60 board removed a GPIO expander and routed
711          * all these GPIO pins to the internal GPIO controller
712          * instead.
713          */
714         mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
715
716         hrefv60_pinmaps_init();
717         parent = u8500_init_devices(&ab8500_platdata);
718
719         for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
720                 mop500_platform_devs[i]->dev.parent = parent;
721
722         platform_add_devices(mop500_platform_devs,
723                         ARRAY_SIZE(mop500_platform_devs));
724
725         mop500_i2c_init(parent);
726         hrefv60_sdi_init(parent);
727         mop500_spi_init(parent);
728         mop500_audio_init(parent);
729         mop500_uart_init(parent);
730
731         i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
732
733         i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
734
735         i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
736         i2c_register_board_info(2, mop500_i2c2_devices,
737                                 ARRAY_SIZE(mop500_i2c2_devices));
738
739         /* This board has full regulator constraints */
740         regulator_has_full_constraints();
741 }
742
743 MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
744         /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
745         .atag_offset    = 0x100,
746         .smp            = smp_ops(ux500_smp_ops),
747         .map_io         = u8500_map_io,
748         .init_irq       = ux500_init_irq,
749         /* we re-use nomadik timer here */
750         .init_time      = ux500_timer_init,
751         .init_machine   = mop500_init_machine,
752         .init_late      = ux500_init_late,
753 MACHINE_END
754
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,
759         .init_time      = ux500_timer_init,
760         .init_machine   = mop500_init_machine,
761         .init_late      = ux500_init_late,
762 MACHINE_END
763
764 MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
765         .atag_offset    = 0x100,
766         .smp            = smp_ops(ux500_smp_ops),
767         .map_io         = u8500_map_io,
768         .init_irq       = ux500_init_irq,
769         .init_time      = ux500_timer_init,
770         .init_machine   = hrefv60_init_machine,
771         .init_late      = ux500_init_late,
772 MACHINE_END
773
774 MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
775         .atag_offset    = 0x100,
776         .smp            = smp_ops(ux500_smp_ops),
777         .map_io         = u8500_map_io,
778         .init_irq       = ux500_init_irq,
779         /* we re-use nomadik timer here */
780         .init_time      = ux500_timer_init,
781         .init_machine   = snowball_init_machine,
782         .init_late      = NULL,
783 MACHINE_END