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