3 * Copyright (C) 2008-2009 ST-Ericsson
5 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2, as
9 * published by the Free Software Foundation.
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/interrupt.h>
15 #include <linux/platform_device.h>
17 #include <linux/i2c.h>
18 #include <linux/platform_data/i2c-nomadik.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/mfd/tc3589x.h>
27 #include <linux/mfd/tps6105x.h>
28 #include <linux/mfd/abx500/ab8500-gpio.h>
29 #include <linux/mfd/abx500/ab8500-codec.h>
30 #include <linux/leds-lp5521.h>
31 #include <linux/input.h>
32 #include <linux/smsc911x.h>
33 #include <linux/gpio_keys.h>
34 #include <linux/delay.h>
36 #include <linux/of_platform.h>
37 #include <linux/leds.h>
38 #include <linux/pinctrl/consumer.h>
40 #include <asm/mach-types.h>
41 #include <asm/mach/arch.h>
42 #include <asm/hardware/gic.h>
44 #include <plat/ste_dma40.h>
45 #include <plat/gpio-nomadik.h>
47 #include <mach/hardware.h>
48 #include <mach/setup.h>
49 #include <mach/devices.h>
50 #include <mach/irqs.h>
51 #include <mach/crypto-ux500.h>
53 #include "ste-dma40-db8500.h"
54 #include "devices-db8500.h"
55 #include "board-mop500.h"
56 #include "board-mop500-regulators.h"
57 #include "board-mop500-msp.h"
59 static struct gpio_led snowball_led_array
[] = {
62 .default_trigger
= "heartbeat",
67 static struct gpio_led_platform_data snowball_led_data
= {
68 .leds
= snowball_led_array
,
69 .num_leds
= ARRAY_SIZE(snowball_led_array
),
72 static struct platform_device snowball_led_dev
= {
75 .platform_data
= &snowball_led_data
,
79 static struct ab8500_gpio_platform_data ab8500_gpio_pdata
= {
80 .gpio_base
= MOP500_AB8500_PIN_GPIO(1),
81 .irq_base
= MOP500_AB8500_VIR_GPIO_IRQ_BASE
,
82 /* config_reg is the initial configuration of ab8500 pins.
83 * The pins can be configured as GPIO or alt functions based
84 * on value present in GpioSel1 to GpioSel6 and AlternatFunction
85 * register. This is the array of 7 configuration settings.
86 * One has to compile time decide these settings. Below is the
87 * explanation of these setting
88 * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
89 * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
90 * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
91 * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO
92 * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO
93 * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO
94 * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured
95 * as GPIO then this register selectes the alternate fucntions
97 .config_reg
= {0x00, 0x1E, 0x80, 0x01,
102 static struct ab8500_codec_platform_data ab8500_codec_pdata
= {
104 .mic1_type
= AMIC_TYPE_DIFFERENTIAL
,
105 .mic2_type
= AMIC_TYPE_DIFFERENTIAL
,
106 .mic1a_micbias
= AMIC_MICBIAS_VAMIC1
,
107 .mic1b_micbias
= AMIC_MICBIAS_VAMIC1
,
108 .mic2_micbias
= AMIC_MICBIAS_VAMIC2
110 .ear_cmv
= EAR_CMV_0_95V
113 static struct gpio_keys_button snowball_key_array
[] = {
120 .debounce_interval
= 50,
129 .debounce_interval
= 50,
138 .debounce_interval
= 50,
147 .debounce_interval
= 50,
156 .debounce_interval
= 50,
161 static struct gpio_keys_platform_data snowball_key_data
= {
162 .buttons
= snowball_key_array
,
163 .nbuttons
= ARRAY_SIZE(snowball_key_array
),
166 static struct platform_device snowball_key_dev
= {
170 .platform_data
= &snowball_key_data
,
174 static struct smsc911x_platform_config snowball_sbnet_cfg
= {
175 .irq_polarity
= SMSC911X_IRQ_POLARITY_ACTIVE_HIGH
,
176 .irq_type
= SMSC911X_IRQ_TYPE_PUSH_PULL
,
177 .flags
= SMSC911X_USE_16BIT
| SMSC911X_FORCE_INTERNAL_PHY
,
181 static struct resource sbnet_res
[] = {
183 .name
= "smsc911x-memory",
184 .start
= (0x5000 << 16),
185 .end
= (0x5000 << 16) + 0xffff,
186 .flags
= IORESOURCE_MEM
,
189 .start
= NOMADIK_GPIO_TO_IRQ(140),
190 .end
= NOMADIK_GPIO_TO_IRQ(140),
191 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
,
195 static struct platform_device snowball_sbnet_dev
= {
197 .num_resources
= ARRAY_SIZE(sbnet_res
),
198 .resource
= sbnet_res
,
200 .platform_data
= &snowball_sbnet_cfg
,
204 static struct ab8500_platform_data ab8500_platdata
= {
205 .irq_base
= MOP500_AB8500_IRQ_BASE
,
206 .regulator_reg_init
= ab8500_regulator_reg_init
,
207 .num_regulator_reg_init
= ARRAY_SIZE(ab8500_regulator_reg_init
),
208 .regulator
= ab8500_regulators
,
209 .num_regulator
= ARRAY_SIZE(ab8500_regulators
),
210 .gpio
= &ab8500_gpio_pdata
,
211 .codec
= &ab8500_codec_pdata
,
218 static struct tps6105x_platform_data mop500_tps61052_data
= {
219 .mode
= TPS6105X_MODE_VOLTAGE
,
220 .regulator_data
= &tps61052_regulator
,
227 static void mop500_tc35892_init(struct tc3589x
*tc3589x
, unsigned int base
)
229 struct device
*parent
= NULL
;
231 /* FIXME: Is the sdi actually part of tc3589x? */
232 parent
= tc3589x
->dev
;
234 mop500_sdi_tc35892_init(parent
);
237 static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data
= {
238 .gpio_base
= MOP500_EGPIO(0),
239 .setup
= mop500_tc35892_init
,
242 static struct tc3589x_platform_data mop500_tc35892_data
= {
243 .block
= TC3589x_BLOCK_GPIO
,
244 .gpio
= &mop500_tc35892_gpio_data
,
245 .irq_base
= MOP500_EGPIO_IRQ_BASE
,
248 static struct lp5521_led_config lp5521_pri_led
[] = {
266 static struct lp5521_platform_data __initdata lp5521_pri_data
= {
267 .label
= "lp5521_pri",
268 .led_config
= &lp5521_pri_led
[0],
270 .clock_mode
= LP5521_CLOCK_EXT
,
273 static struct lp5521_led_config lp5521_sec_led
[] = {
291 static struct lp5521_platform_data __initdata lp5521_sec_data
= {
292 .label
= "lp5521_sec",
293 .led_config
= &lp5521_sec_led
[0],
295 .clock_mode
= LP5521_CLOCK_EXT
,
298 static struct i2c_board_info __initdata mop500_i2c0_devices
[] = {
300 I2C_BOARD_INFO("tc3589x", 0x42),
301 .irq
= NOMADIK_GPIO_TO_IRQ(217),
302 .platform_data
= &mop500_tc35892_data
,
304 /* I2C0 devices only available prior to HREFv60 */
306 I2C_BOARD_INFO("tps61052", 0x33),
307 .platform_data
= &mop500_tps61052_data
,
311 #define NUM_PRE_V60_I2C0_DEVICES 1
313 static struct i2c_board_info __initdata mop500_i2c2_devices
[] = {
315 /* lp5521 LED driver, 1st device */
316 I2C_BOARD_INFO("lp5521", 0x33),
317 .platform_data
= &lp5521_pri_data
,
320 /* lp5521 LED driver, 2st device */
321 I2C_BOARD_INFO("lp5521", 0x34),
322 .platform_data
= &lp5521_sec_data
,
325 /* Light sensor Rohm BH1780GLI */
326 I2C_BOARD_INFO("bh1780", 0x29),
330 static void __init
mop500_i2c_init(struct device
*parent
)
332 db8500_add_i2c0(parent
, NULL
);
333 db8500_add_i2c1(parent
, NULL
);
334 db8500_add_i2c2(parent
, NULL
);
335 db8500_add_i2c3(parent
, NULL
);
338 static struct gpio_keys_button mop500_gpio_keys
[] = {
340 .desc
= "SFH7741 Proximity Sensor",
342 .code
= SW_FRONT_PROXIMITY
,
348 static struct regulator
*prox_regulator
;
349 static int mop500_prox_activate(struct device
*dev
);
350 static void mop500_prox_deactivate(struct device
*dev
);
352 static struct gpio_keys_platform_data mop500_gpio_keys_data
= {
353 .buttons
= mop500_gpio_keys
,
354 .nbuttons
= ARRAY_SIZE(mop500_gpio_keys
),
355 .enable
= mop500_prox_activate
,
356 .disable
= mop500_prox_deactivate
,
359 static struct platform_device mop500_gpio_keys_device
= {
363 .platform_data
= &mop500_gpio_keys_data
,
367 static int mop500_prox_activate(struct device
*dev
)
369 prox_regulator
= regulator_get(&mop500_gpio_keys_device
.dev
,
371 if (IS_ERR(prox_regulator
)) {
372 dev_err(&mop500_gpio_keys_device
.dev
,
374 return PTR_ERR(prox_regulator
);
376 regulator_enable(prox_regulator
);
380 static void mop500_prox_deactivate(struct device
*dev
)
382 regulator_disable(prox_regulator
);
383 regulator_put(prox_regulator
);
386 static struct cryp_platform_data u8500_cryp1_platform_data
= {
388 .dir
= STEDMA40_MEM_TO_PERIPH
,
389 .src_dev_type
= STEDMA40_DEV_SRC_MEMORY
,
390 .dst_dev_type
= DB8500_DMA_DEV48_CAC1_TX
,
391 .src_info
.data_width
= STEDMA40_WORD_WIDTH
,
392 .dst_info
.data_width
= STEDMA40_WORD_WIDTH
,
393 .mode
= STEDMA40_MODE_LOGICAL
,
394 .src_info
.psize
= STEDMA40_PSIZE_LOG_4
,
395 .dst_info
.psize
= STEDMA40_PSIZE_LOG_4
,
398 .dir
= STEDMA40_PERIPH_TO_MEM
,
399 .src_dev_type
= DB8500_DMA_DEV48_CAC1_RX
,
400 .dst_dev_type
= STEDMA40_DEV_DST_MEMORY
,
401 .src_info
.data_width
= STEDMA40_WORD_WIDTH
,
402 .dst_info
.data_width
= STEDMA40_WORD_WIDTH
,
403 .mode
= STEDMA40_MODE_LOGICAL
,
404 .src_info
.psize
= STEDMA40_PSIZE_LOG_4
,
405 .dst_info
.psize
= STEDMA40_PSIZE_LOG_4
,
409 static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx
= {
410 .dir
= STEDMA40_MEM_TO_PERIPH
,
411 .src_dev_type
= STEDMA40_DEV_SRC_MEMORY
,
412 .dst_dev_type
= DB8500_DMA_DEV50_HAC1_TX
,
413 .src_info
.data_width
= STEDMA40_WORD_WIDTH
,
414 .dst_info
.data_width
= STEDMA40_WORD_WIDTH
,
415 .mode
= STEDMA40_MODE_LOGICAL
,
416 .src_info
.psize
= STEDMA40_PSIZE_LOG_16
,
417 .dst_info
.psize
= STEDMA40_PSIZE_LOG_16
,
420 static struct hash_platform_data u8500_hash1_platform_data
= {
421 .mem_to_engine
= &u8500_hash_dma_cfg_tx
,
422 .dma_filter
= stedma40_filter
,
425 /* add any platform devices here - TODO */
426 static struct platform_device
*mop500_platform_devs
[] __initdata
= {
427 &mop500_gpio_keys_device
,
430 #ifdef CONFIG_STE_DMA40
431 static struct stedma40_chan_cfg ssp0_dma_cfg_rx
= {
432 .mode
= STEDMA40_MODE_LOGICAL
,
433 .dir
= STEDMA40_PERIPH_TO_MEM
,
434 .src_dev_type
= DB8500_DMA_DEV8_SSP0_RX
,
435 .dst_dev_type
= STEDMA40_DEV_DST_MEMORY
,
436 .src_info
.data_width
= STEDMA40_BYTE_WIDTH
,
437 .dst_info
.data_width
= STEDMA40_BYTE_WIDTH
,
440 static struct stedma40_chan_cfg ssp0_dma_cfg_tx
= {
441 .mode
= STEDMA40_MODE_LOGICAL
,
442 .dir
= STEDMA40_MEM_TO_PERIPH
,
443 .src_dev_type
= STEDMA40_DEV_SRC_MEMORY
,
444 .dst_dev_type
= DB8500_DMA_DEV8_SSP0_TX
,
445 .src_info
.data_width
= STEDMA40_BYTE_WIDTH
,
446 .dst_info
.data_width
= STEDMA40_BYTE_WIDTH
,
450 static struct pl022_ssp_controller ssp0_plat
= {
452 #ifdef CONFIG_STE_DMA40
454 .dma_filter
= stedma40_filter
,
455 .dma_rx_param
= &ssp0_dma_cfg_rx
,
456 .dma_tx_param
= &ssp0_dma_cfg_tx
,
460 /* on this platform, gpio 31,142,144,214 &
461 * 224 are connected as chip selects
466 static void __init
mop500_spi_init(struct device
*parent
)
468 db8500_add_ssp0(parent
, &ssp0_plat
);
471 #ifdef CONFIG_STE_DMA40
472 static struct stedma40_chan_cfg uart0_dma_cfg_rx
= {
473 .mode
= STEDMA40_MODE_LOGICAL
,
474 .dir
= STEDMA40_PERIPH_TO_MEM
,
475 .src_dev_type
= DB8500_DMA_DEV13_UART0_RX
,
476 .dst_dev_type
= STEDMA40_DEV_DST_MEMORY
,
477 .src_info
.data_width
= STEDMA40_BYTE_WIDTH
,
478 .dst_info
.data_width
= STEDMA40_BYTE_WIDTH
,
481 static struct stedma40_chan_cfg uart0_dma_cfg_tx
= {
482 .mode
= STEDMA40_MODE_LOGICAL
,
483 .dir
= STEDMA40_MEM_TO_PERIPH
,
484 .src_dev_type
= STEDMA40_DEV_SRC_MEMORY
,
485 .dst_dev_type
= DB8500_DMA_DEV13_UART0_TX
,
486 .src_info
.data_width
= STEDMA40_BYTE_WIDTH
,
487 .dst_info
.data_width
= STEDMA40_BYTE_WIDTH
,
490 static struct stedma40_chan_cfg uart1_dma_cfg_rx
= {
491 .mode
= STEDMA40_MODE_LOGICAL
,
492 .dir
= STEDMA40_PERIPH_TO_MEM
,
493 .src_dev_type
= DB8500_DMA_DEV12_UART1_RX
,
494 .dst_dev_type
= STEDMA40_DEV_DST_MEMORY
,
495 .src_info
.data_width
= STEDMA40_BYTE_WIDTH
,
496 .dst_info
.data_width
= STEDMA40_BYTE_WIDTH
,
499 static struct stedma40_chan_cfg uart1_dma_cfg_tx
= {
500 .mode
= STEDMA40_MODE_LOGICAL
,
501 .dir
= STEDMA40_MEM_TO_PERIPH
,
502 .src_dev_type
= STEDMA40_DEV_SRC_MEMORY
,
503 .dst_dev_type
= DB8500_DMA_DEV12_UART1_TX
,
504 .src_info
.data_width
= STEDMA40_BYTE_WIDTH
,
505 .dst_info
.data_width
= STEDMA40_BYTE_WIDTH
,
508 static struct stedma40_chan_cfg uart2_dma_cfg_rx
= {
509 .mode
= STEDMA40_MODE_LOGICAL
,
510 .dir
= STEDMA40_PERIPH_TO_MEM
,
511 .src_dev_type
= DB8500_DMA_DEV11_UART2_RX
,
512 .dst_dev_type
= STEDMA40_DEV_DST_MEMORY
,
513 .src_info
.data_width
= STEDMA40_BYTE_WIDTH
,
514 .dst_info
.data_width
= STEDMA40_BYTE_WIDTH
,
517 static struct stedma40_chan_cfg uart2_dma_cfg_tx
= {
518 .mode
= STEDMA40_MODE_LOGICAL
,
519 .dir
= STEDMA40_MEM_TO_PERIPH
,
520 .src_dev_type
= STEDMA40_DEV_SRC_MEMORY
,
521 .dst_dev_type
= DB8500_DMA_DEV11_UART2_TX
,
522 .src_info
.data_width
= STEDMA40_BYTE_WIDTH
,
523 .dst_info
.data_width
= STEDMA40_BYTE_WIDTH
,
527 #define PRCC_K_SOFTRST_SET 0x18
528 #define PRCC_K_SOFTRST_CLEAR 0x1C
529 static void ux500_uart0_reset(void)
531 void __iomem
*prcc_rst_set
, *prcc_rst_clr
;
533 prcc_rst_set
= (void __iomem
*)IO_ADDRESS(U8500_CLKRST1_BASE
+
535 prcc_rst_clr
= (void __iomem
*)IO_ADDRESS(U8500_CLKRST1_BASE
+
536 PRCC_K_SOFTRST_CLEAR
);
538 /* Activate soft reset PRCC_K_SOFTRST_CLEAR */
539 writel((readl(prcc_rst_clr
) | 0x1), prcc_rst_clr
);
542 /* Release soft reset PRCC_K_SOFTRST_SET */
543 writel((readl(prcc_rst_set
) | 0x1), prcc_rst_set
);
547 static struct amba_pl011_data uart0_plat
= {
548 #ifdef CONFIG_STE_DMA40
549 .dma_filter
= stedma40_filter
,
550 .dma_rx_param
= &uart0_dma_cfg_rx
,
551 .dma_tx_param
= &uart0_dma_cfg_tx
,
553 .reset
= ux500_uart0_reset
,
556 static struct amba_pl011_data uart1_plat
= {
557 #ifdef CONFIG_STE_DMA40
558 .dma_filter
= stedma40_filter
,
559 .dma_rx_param
= &uart1_dma_cfg_rx
,
560 .dma_tx_param
= &uart1_dma_cfg_tx
,
564 static struct amba_pl011_data uart2_plat
= {
565 #ifdef CONFIG_STE_DMA40
566 .dma_filter
= stedma40_filter
,
567 .dma_rx_param
= &uart2_dma_cfg_rx
,
568 .dma_tx_param
= &uart2_dma_cfg_tx
,
572 static void __init
mop500_uart_init(struct device
*parent
)
574 db8500_add_uart0(parent
, &uart0_plat
);
575 db8500_add_uart1(parent
, &uart1_plat
);
576 db8500_add_uart2(parent
, &uart2_plat
);
579 static void __init
u8500_cryp1_hash1_init(struct device
*parent
)
581 db8500_add_cryp1(parent
, &u8500_cryp1_platform_data
);
582 db8500_add_hash1(parent
, &u8500_hash1_platform_data
);
585 static struct platform_device
*snowball_platform_devs
[] __initdata
= {
591 static void __init
mop500_init_machine(void)
593 struct device
*parent
= NULL
;
597 mop500_gpio_keys
[0].gpio
= GPIO_PROX_SENSOR
;
599 mop500_pinmaps_init();
600 parent
= u8500_init_devices(&ab8500_platdata
);
602 for (i
= 0; i
< ARRAY_SIZE(mop500_platform_devs
); i
++)
603 mop500_platform_devs
[i
]->dev
.parent
= parent
;
605 platform_add_devices(mop500_platform_devs
,
606 ARRAY_SIZE(mop500_platform_devs
));
608 mop500_i2c_init(parent
);
609 mop500_sdi_init(parent
);
610 mop500_spi_init(parent
);
611 mop500_msp_init(parent
);
612 mop500_uart_init(parent
);
614 u8500_cryp1_hash1_init(parent
);
616 i2c0_devs
= ARRAY_SIZE(mop500_i2c0_devices
);
618 i2c_register_board_info(0, mop500_i2c0_devices
, i2c0_devs
);
619 i2c_register_board_info(2, mop500_i2c2_devices
,
620 ARRAY_SIZE(mop500_i2c2_devices
));
622 /* This board has full regulator constraints */
623 regulator_has_full_constraints();
628 static void __init
snowball_init_machine(void)
630 struct device
*parent
= NULL
;
633 snowball_pinmaps_init();
634 parent
= u8500_init_devices(&ab8500_platdata
);
636 for (i
= 0; i
< ARRAY_SIZE(snowball_platform_devs
); i
++)
637 snowball_platform_devs
[i
]->dev
.parent
= parent
;
639 platform_add_devices(snowball_platform_devs
,
640 ARRAY_SIZE(snowball_platform_devs
));
642 mop500_i2c_init(parent
);
643 snowball_sdi_init(parent
);
644 mop500_spi_init(parent
);
645 mop500_msp_init(parent
);
646 mop500_uart_init(parent
);
648 /* This board has full regulator constraints */
649 regulator_has_full_constraints();
652 static void __init
hrefv60_init_machine(void)
654 struct device
*parent
= NULL
;
659 * The HREFv60 board removed a GPIO expander and routed
660 * all these GPIO pins to the internal GPIO controller
663 mop500_gpio_keys
[0].gpio
= HREFV60_PROX_SENSE_GPIO
;
665 hrefv60_pinmaps_init();
666 parent
= u8500_init_devices(&ab8500_platdata
);
668 for (i
= 0; i
< ARRAY_SIZE(mop500_platform_devs
); i
++)
669 mop500_platform_devs
[i
]->dev
.parent
= parent
;
671 platform_add_devices(mop500_platform_devs
,
672 ARRAY_SIZE(mop500_platform_devs
));
674 mop500_i2c_init(parent
);
675 hrefv60_sdi_init(parent
);
676 mop500_spi_init(parent
);
677 mop500_msp_init(parent
);
678 mop500_uart_init(parent
);
680 i2c0_devs
= ARRAY_SIZE(mop500_i2c0_devices
);
682 i2c0_devs
-= NUM_PRE_V60_I2C0_DEVICES
;
684 i2c_register_board_info(0, mop500_i2c0_devices
, i2c0_devs
);
685 i2c_register_board_info(2, mop500_i2c2_devices
,
686 ARRAY_SIZE(mop500_i2c2_devices
));
688 /* This board has full regulator constraints */
689 regulator_has_full_constraints();
694 MACHINE_START(U8500
, "ST-Ericsson MOP500 platform")
695 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
696 .atag_offset
= 0x100,
697 .map_io
= u8500_map_io
,
698 .init_irq
= ux500_init_irq
,
699 /* we re-use nomadik timer here */
700 .timer
= &ux500_timer
,
701 .handle_irq
= gic_handle_irq
,
702 .init_machine
= mop500_init_machine
,
703 .init_late
= ux500_init_late
,
706 MACHINE_START(HREFV60
, "ST-Ericsson U8500 Platform HREFv60+")
707 .atag_offset
= 0x100,
708 .map_io
= u8500_map_io
,
709 .init_irq
= ux500_init_irq
,
710 .timer
= &ux500_timer
,
711 .handle_irq
= gic_handle_irq
,
712 .init_machine
= hrefv60_init_machine
,
713 .init_late
= ux500_init_late
,
716 MACHINE_START(SNOWBALL
, "Calao Systems Snowball platform")
717 .atag_offset
= 0x100,
718 .map_io
= u8500_map_io
,
719 .init_irq
= ux500_init_irq
,
720 /* we re-use nomadik timer here */
721 .timer
= &ux500_timer
,
722 .handle_irq
= gic_handle_irq
,
723 .init_machine
= snowball_init_machine
,
724 .init_late
= ux500_init_late
,
727 #ifdef CONFIG_MACH_UX500_DT
729 static struct platform_device
*snowball_of_platform_devs
[] __initdata
= {
734 struct of_dev_auxdata u8500_auxdata_lookup
[] __initdata
= {
735 /* Requires DMA and call-back bindings. */
736 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat
),
737 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat
),
738 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat
),
739 /* Requires DMA bindings. */
740 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat
),
741 OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data
),
742 OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data
),
743 /* Requires clock name bindings. */
744 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL
),
745 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL
),
746 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL
),
747 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL
),
748 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL
),
749 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL
),
750 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL
),
751 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL
),
752 OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL
),
753 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80004000, "nmk-i2c.0", NULL
),
754 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80122000, "nmk-i2c.1", NULL
),
755 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL
),
756 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL
),
757 OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL
),
758 /* Requires device name bindings. */
759 OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL
),
763 static const struct of_device_id u8500_local_bus_nodes
[] = {
764 /* only create devices below soc node */
765 { .compatible
= "stericsson,db8500", },
766 { .compatible
= "stericsson,db8500-prcmu", },
767 { .compatible
= "simple-bus"},
771 static void __init
u8500_init_machine(void)
773 struct device
*parent
= NULL
;
777 /* Pinmaps must be in place before devices register */
778 if (of_machine_is_compatible("st-ericsson,mop500"))
779 mop500_pinmaps_init();
780 else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
781 snowball_pinmaps_init();
782 else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
783 hrefv60_pinmaps_init();
785 parent
= u8500_of_init_devices();
787 for (i
= 0; i
< ARRAY_SIZE(mop500_platform_devs
); i
++)
788 mop500_platform_devs
[i
]->dev
.parent
= parent
;
790 /* automatically probe child nodes of db8500 device */
791 of_platform_populate(NULL
, u8500_local_bus_nodes
, u8500_auxdata_lookup
, parent
);
793 if (of_machine_is_compatible("st-ericsson,mop500")) {
794 mop500_gpio_keys
[0].gpio
= GPIO_PROX_SENSOR
;
796 platform_add_devices(mop500_platform_devs
,
797 ARRAY_SIZE(mop500_platform_devs
));
799 mop500_sdi_init(parent
);
800 mop500_msp_init(parent
);
801 i2c0_devs
= ARRAY_SIZE(mop500_i2c0_devices
);
802 i2c_register_board_info(0, mop500_i2c0_devices
, i2c0_devs
);
803 i2c_register_board_info(2, mop500_i2c2_devices
,
804 ARRAY_SIZE(mop500_i2c2_devices
));
808 } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
809 mop500_msp_init(parent
);
810 } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
812 * The HREFv60 board removed a GPIO expander and routed
813 * all these GPIO pins to the internal GPIO controller
816 mop500_gpio_keys
[0].gpio
= HREFV60_PROX_SENSE_GPIO
;
817 platform_add_devices(mop500_platform_devs
,
818 ARRAY_SIZE(mop500_platform_devs
));
820 hrefv60_sdi_init(parent
);
821 mop500_msp_init(parent
);
823 i2c0_devs
= ARRAY_SIZE(mop500_i2c0_devices
);
824 i2c0_devs
-= NUM_PRE_V60_I2C0_DEVICES
;
826 i2c_register_board_info(0, mop500_i2c0_devices
, i2c0_devs
);
827 i2c_register_board_info(2, mop500_i2c2_devices
,
828 ARRAY_SIZE(mop500_i2c2_devices
));
833 /* This board has full regulator constraints */
834 regulator_has_full_constraints();
837 static const char * u8500_dt_board_compat
[] = {
838 "calaosystems,snowball-a9500",
839 "st-ericsson,hrefv60+",
841 "st-ericsson,mop500",
846 DT_MACHINE_START(U8500_DT
, "ST-Ericsson U8500 platform (Device Tree Support)")
847 .map_io
= u8500_map_io
,
848 .init_irq
= ux500_init_irq
,
849 /* we re-use nomadik timer here */
850 .timer
= &ux500_timer
,
851 .handle_irq
= gic_handle_irq
,
852 .init_machine
= u8500_init_machine
,
853 .init_late
= ux500_init_late
,
854 .dt_compat
= u8500_dt_board_compat
,