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,
214 static struct resource ab8500_resources[] = {
216 .start = IRQ_DB8500_AB8500,
217 .end = IRQ_DB8500_AB8500,
218 .flags = IORESOURCE_IRQ
222 struct platform_device ab8500_device = {
223 .name = "ab8500-core",
226 .platform_data = &ab8500_platdata,
229 .resource = ab8500_resources,
236 static struct tps6105x_platform_data mop500_tps61052_data = {
237 .mode = TPS6105X_MODE_VOLTAGE,
238 .regulator_data = &tps61052_regulator,
245 static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
247 struct device *parent = NULL;
249 /* FIXME: Is the sdi actually part of tc3589x? */
250 parent = tc3589x->dev;
252 mop500_sdi_tc35892_init(parent);
255 static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
256 .gpio_base = MOP500_EGPIO(0),
257 .setup = mop500_tc35892_init,
260 static struct tc3589x_platform_data mop500_tc35892_data = {
261 .block = TC3589x_BLOCK_GPIO,
262 .gpio = &mop500_tc35892_gpio_data,
263 .irq_base = MOP500_EGPIO_IRQ_BASE,
266 static struct lp5521_led_config lp5521_pri_led[] = {
284 static struct lp5521_platform_data __initdata lp5521_pri_data = {
285 .label = "lp5521_pri",
286 .led_config = &lp5521_pri_led[0],
288 .clock_mode = LP5521_CLOCK_EXT,
291 static struct lp5521_led_config lp5521_sec_led[] = {
309 static struct lp5521_platform_data __initdata lp5521_sec_data = {
310 .label = "lp5521_sec",
311 .led_config = &lp5521_sec_led[0],
313 .clock_mode = LP5521_CLOCK_EXT,
316 static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
318 I2C_BOARD_INFO("tc3589x", 0x42),
319 .irq = NOMADIK_GPIO_TO_IRQ(217),
320 .platform_data = &mop500_tc35892_data,
322 /* I2C0 devices only available prior to HREFv60 */
324 I2C_BOARD_INFO("tps61052", 0x33),
325 .platform_data = &mop500_tps61052_data,
329 #define NUM_PRE_V60_I2C0_DEVICES 1
331 static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
333 /* lp5521 LED driver, 1st device */
334 I2C_BOARD_INFO("lp5521", 0x33),
335 .platform_data = &lp5521_pri_data,
338 /* lp5521 LED driver, 2st device */
339 I2C_BOARD_INFO("lp5521", 0x34),
340 .platform_data = &lp5521_sec_data,
343 /* Light sensor Rohm BH1780GLI */
344 I2C_BOARD_INFO("bh1780", 0x29),
348 static void __init mop500_i2c_init(struct device *parent)
350 db8500_add_i2c0(parent, NULL);
351 db8500_add_i2c1(parent, NULL);
352 db8500_add_i2c2(parent, NULL);
353 db8500_add_i2c3(parent, NULL);
356 static struct gpio_keys_button mop500_gpio_keys[] = {
358 .desc = "SFH7741 Proximity Sensor",
360 .code = SW_FRONT_PROXIMITY,
366 static struct regulator *prox_regulator;
367 static int mop500_prox_activate(struct device *dev);
368 static void mop500_prox_deactivate(struct device *dev);
370 static struct gpio_keys_platform_data mop500_gpio_keys_data = {
371 .buttons = mop500_gpio_keys,
372 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
373 .enable = mop500_prox_activate,
374 .disable = mop500_prox_deactivate,
377 static struct platform_device mop500_gpio_keys_device = {
381 .platform_data = &mop500_gpio_keys_data,
385 static int mop500_prox_activate(struct device *dev)
387 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
389 if (IS_ERR(prox_regulator)) {
390 dev_err(&mop500_gpio_keys_device.dev,
392 return PTR_ERR(prox_regulator);
394 regulator_enable(prox_regulator);
398 static void mop500_prox_deactivate(struct device *dev)
400 regulator_disable(prox_regulator);
401 regulator_put(prox_regulator);
404 static struct cryp_platform_data u8500_cryp1_platform_data = {
406 .dir = STEDMA40_MEM_TO_PERIPH,
407 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
408 .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
409 .src_info.data_width = STEDMA40_WORD_WIDTH,
410 .dst_info.data_width = STEDMA40_WORD_WIDTH,
411 .mode = STEDMA40_MODE_LOGICAL,
412 .src_info.psize = STEDMA40_PSIZE_LOG_4,
413 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
416 .dir = STEDMA40_PERIPH_TO_MEM,
417 .src_dev_type = DB8500_DMA_DEV48_CAC1_RX,
418 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
419 .src_info.data_width = STEDMA40_WORD_WIDTH,
420 .dst_info.data_width = STEDMA40_WORD_WIDTH,
421 .mode = STEDMA40_MODE_LOGICAL,
422 .src_info.psize = STEDMA40_PSIZE_LOG_4,
423 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
427 static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
428 .dir = STEDMA40_MEM_TO_PERIPH,
429 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
430 .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
431 .src_info.data_width = STEDMA40_WORD_WIDTH,
432 .dst_info.data_width = STEDMA40_WORD_WIDTH,
433 .mode = STEDMA40_MODE_LOGICAL,
434 .src_info.psize = STEDMA40_PSIZE_LOG_16,
435 .dst_info.psize = STEDMA40_PSIZE_LOG_16,
438 static struct hash_platform_data u8500_hash1_platform_data = {
439 .mem_to_engine = &u8500_hash_dma_cfg_tx,
440 .dma_filter = stedma40_filter,
443 /* add any platform devices here - TODO */
444 static struct platform_device *mop500_platform_devs[] __initdata = {
445 &mop500_gpio_keys_device,
449 #ifdef CONFIG_STE_DMA40
450 static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
451 .mode = STEDMA40_MODE_LOGICAL,
452 .dir = STEDMA40_PERIPH_TO_MEM,
453 .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
454 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
455 .src_info.data_width = STEDMA40_BYTE_WIDTH,
456 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
459 static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
460 .mode = STEDMA40_MODE_LOGICAL,
461 .dir = STEDMA40_MEM_TO_PERIPH,
462 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
463 .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
464 .src_info.data_width = STEDMA40_BYTE_WIDTH,
465 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
469 static struct pl022_ssp_controller ssp0_plat = {
471 #ifdef CONFIG_STE_DMA40
473 .dma_filter = stedma40_filter,
474 .dma_rx_param = &ssp0_dma_cfg_rx,
475 .dma_tx_param = &ssp0_dma_cfg_tx,
479 /* on this platform, gpio 31,142,144,214 &
480 * 224 are connected as chip selects
485 static void __init mop500_spi_init(struct device *parent)
487 db8500_add_ssp0(parent, &ssp0_plat);
490 #ifdef CONFIG_STE_DMA40
491 static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
492 .mode = STEDMA40_MODE_LOGICAL,
493 .dir = STEDMA40_PERIPH_TO_MEM,
494 .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
495 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
496 .src_info.data_width = STEDMA40_BYTE_WIDTH,
497 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
500 static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
501 .mode = STEDMA40_MODE_LOGICAL,
502 .dir = STEDMA40_MEM_TO_PERIPH,
503 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
504 .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
505 .src_info.data_width = STEDMA40_BYTE_WIDTH,
506 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
509 static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
510 .mode = STEDMA40_MODE_LOGICAL,
511 .dir = STEDMA40_PERIPH_TO_MEM,
512 .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
513 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
514 .src_info.data_width = STEDMA40_BYTE_WIDTH,
515 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
518 static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
519 .mode = STEDMA40_MODE_LOGICAL,
520 .dir = STEDMA40_MEM_TO_PERIPH,
521 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
522 .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
523 .src_info.data_width = STEDMA40_BYTE_WIDTH,
524 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
527 static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
528 .mode = STEDMA40_MODE_LOGICAL,
529 .dir = STEDMA40_PERIPH_TO_MEM,
530 .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
531 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
532 .src_info.data_width = STEDMA40_BYTE_WIDTH,
533 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
536 static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
537 .mode = STEDMA40_MODE_LOGICAL,
538 .dir = STEDMA40_MEM_TO_PERIPH,
539 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
540 .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
541 .src_info.data_width = STEDMA40_BYTE_WIDTH,
542 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
546 #define PRCC_K_SOFTRST_SET 0x18
547 #define PRCC_K_SOFTRST_CLEAR 0x1C
548 static void ux500_uart0_reset(void)
550 void __iomem *prcc_rst_set, *prcc_rst_clr;
552 prcc_rst_set = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
554 prcc_rst_clr = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
555 PRCC_K_SOFTRST_CLEAR);
557 /* Activate soft reset PRCC_K_SOFTRST_CLEAR */
558 writel((readl(prcc_rst_clr) | 0x1), prcc_rst_clr);
561 /* Release soft reset PRCC_K_SOFTRST_SET */
562 writel((readl(prcc_rst_set) | 0x1), prcc_rst_set);
566 static struct amba_pl011_data uart0_plat = {
567 #ifdef CONFIG_STE_DMA40
568 .dma_filter = stedma40_filter,
569 .dma_rx_param = &uart0_dma_cfg_rx,
570 .dma_tx_param = &uart0_dma_cfg_tx,
572 .reset = ux500_uart0_reset,
575 static struct amba_pl011_data uart1_plat = {
576 #ifdef CONFIG_STE_DMA40
577 .dma_filter = stedma40_filter,
578 .dma_rx_param = &uart1_dma_cfg_rx,
579 .dma_tx_param = &uart1_dma_cfg_tx,
583 static struct amba_pl011_data uart2_plat = {
584 #ifdef CONFIG_STE_DMA40
585 .dma_filter = stedma40_filter,
586 .dma_rx_param = &uart2_dma_cfg_rx,
587 .dma_tx_param = &uart2_dma_cfg_tx,
591 static void __init mop500_uart_init(struct device *parent)
593 db8500_add_uart0(parent, &uart0_plat);
594 db8500_add_uart1(parent, &uart1_plat);
595 db8500_add_uart2(parent, &uart2_plat);
598 static void __init u8500_cryp1_hash1_init(struct device *parent)
600 db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
601 db8500_add_hash1(parent, &u8500_hash1_platform_data);
604 static struct platform_device *snowball_platform_devs[] __initdata = {
611 static void __init mop500_init_machine(void)
613 struct device *parent = NULL;
617 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
619 mop500_pinmaps_init();
620 parent = u8500_init_devices();
622 /* FIXME: parent of ab8500 should be prcmu */
623 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
624 mop500_platform_devs[i]->dev.parent = parent;
626 platform_add_devices(mop500_platform_devs,
627 ARRAY_SIZE(mop500_platform_devs));
629 mop500_i2c_init(parent);
630 mop500_sdi_init(parent);
631 mop500_spi_init(parent);
632 mop500_msp_init(parent);
633 mop500_uart_init(parent);
635 u8500_cryp1_hash1_init(parent);
637 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
639 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
640 i2c_register_board_info(2, mop500_i2c2_devices,
641 ARRAY_SIZE(mop500_i2c2_devices));
643 /* This board has full regulator constraints */
644 regulator_has_full_constraints();
649 static void __init snowball_init_machine(void)
651 struct device *parent = NULL;
654 snowball_pinmaps_init();
655 parent = u8500_init_devices();
657 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
658 snowball_platform_devs[i]->dev.parent = parent;
660 platform_add_devices(snowball_platform_devs,
661 ARRAY_SIZE(snowball_platform_devs));
663 mop500_i2c_init(parent);
664 snowball_sdi_init(parent);
665 mop500_spi_init(parent);
666 mop500_msp_init(parent);
667 mop500_uart_init(parent);
669 /* This board has full regulator constraints */
670 regulator_has_full_constraints();
673 static void __init hrefv60_init_machine(void)
675 struct device *parent = NULL;
680 * The HREFv60 board removed a GPIO expander and routed
681 * all these GPIO pins to the internal GPIO controller
684 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
686 hrefv60_pinmaps_init();
687 parent = u8500_init_devices();
689 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
690 mop500_platform_devs[i]->dev.parent = parent;
692 platform_add_devices(mop500_platform_devs,
693 ARRAY_SIZE(mop500_platform_devs));
695 mop500_i2c_init(parent);
696 hrefv60_sdi_init(parent);
697 mop500_spi_init(parent);
698 mop500_msp_init(parent);
699 mop500_uart_init(parent);
701 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
703 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
705 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
706 i2c_register_board_info(2, mop500_i2c2_devices,
707 ARRAY_SIZE(mop500_i2c2_devices));
709 /* This board has full regulator constraints */
710 regulator_has_full_constraints();
715 MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
716 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
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 = mop500_init_machine,
724 .init_late = ux500_init_late,
727 MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
728 .atag_offset = 0x100,
729 .map_io = u8500_map_io,
730 .init_irq = ux500_init_irq,
731 .timer = &ux500_timer,
732 .handle_irq = gic_handle_irq,
733 .init_machine = hrefv60_init_machine,
734 .init_late = ux500_init_late,
737 MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
738 .atag_offset = 0x100,
739 .map_io = u8500_map_io,
740 .init_irq = ux500_init_irq,
741 /* we re-use nomadik timer here */
742 .timer = &ux500_timer,
743 .handle_irq = gic_handle_irq,
744 .init_machine = snowball_init_machine,
745 .init_late = ux500_init_late,
748 #ifdef CONFIG_MACH_UX500_DT
750 static struct platform_device *snowball_of_platform_devs[] __initdata = {
755 struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
756 /* Requires DMA and call-back bindings. */
757 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
758 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
759 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
760 /* Requires DMA bindings. */
761 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
762 OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data),
763 OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data),
764 /* Requires clock name bindings. */
765 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
766 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
767 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL),
768 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL),
769 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL),
770 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL),
771 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
772 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
773 OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
774 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80004000, "nmk-i2c.0", NULL),
775 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80122000, "nmk-i2c.1", NULL),
776 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL),
777 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL),
778 OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
779 /* Requires device name bindings. */
780 OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL),
784 static const struct of_device_id u8500_local_bus_nodes[] = {
785 /* only create devices below soc node */
786 { .compatible = "stericsson,db8500", },
787 { .compatible = "stericsson,db8500-prcmu", },
788 { .compatible = "stericsson,db8500-prcmu-regulator", },
789 { .compatible = "stericsson,ab8500", },
790 { .compatible = "stericsson,ab8500-regulator", },
791 { .compatible = "simple-bus"},
795 static void __init u8500_init_machine(void)
797 struct device *parent = NULL;
801 /* Pinmaps must be in place before devices register */
802 if (of_machine_is_compatible("st-ericsson,mop500"))
803 mop500_pinmaps_init();
804 else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
805 snowball_pinmaps_init();
806 else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
807 hrefv60_pinmaps_init();
809 parent = u8500_of_init_devices();
811 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
812 mop500_platform_devs[i]->dev.parent = parent;
814 /* automatically probe child nodes of db8500 device */
815 of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent);
817 if (of_machine_is_compatible("st-ericsson,mop500")) {
818 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
820 platform_add_devices(mop500_platform_devs,
821 ARRAY_SIZE(mop500_platform_devs));
823 mop500_sdi_init(parent);
824 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
825 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
826 i2c_register_board_info(2, mop500_i2c2_devices,
827 ARRAY_SIZE(mop500_i2c2_devices));
831 } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
833 * The HREFv60 board removed a GPIO expander and routed
834 * all these GPIO pins to the internal GPIO controller
837 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
838 platform_add_devices(mop500_platform_devs,
839 ARRAY_SIZE(mop500_platform_devs));
841 hrefv60_sdi_init(parent);
843 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
844 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
846 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
847 i2c_register_board_info(2, mop500_i2c2_devices,
848 ARRAY_SIZE(mop500_i2c2_devices));
853 /* This board has full regulator constraints */
854 regulator_has_full_constraints();
857 static const char * u8500_dt_board_compat[] = {
858 "calaosystems,snowball-a9500",
859 "st-ericsson,hrefv60+",
861 "st-ericsson,mop500",
866 DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)")
867 .map_io = u8500_map_io,
868 .init_irq = ux500_init_irq,
869 /* we re-use nomadik timer here */
870 .timer = &ux500_timer,
871 .handle_irq = gic_handle_irq,
872 .init_machine = u8500_init_machine,
873 .init_late = ux500_init_late,
874 .dt_compat = u8500_dt_board_compat,