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/gpio.h>
19 #include <linux/amba/bus.h>
20 #include <linux/amba/pl022.h>
21 #include <linux/amba/serial.h>
22 #include <linux/spi/spi.h>
23 #include <linux/mfd/abx500/ab8500.h>
24 #include <linux/regulator/ab8500.h>
25 #include <linux/mfd/tc3589x.h>
26 #include <linux/mfd/tps6105x.h>
27 #include <linux/mfd/abx500/ab8500-gpio.h>
28 #include <linux/leds-lp5521.h>
29 #include <linux/input.h>
30 #include <linux/smsc911x.h>
31 #include <linux/gpio_keys.h>
32 #include <linux/delay.h>
34 #include <linux/of_platform.h>
35 #include <linux/leds.h>
36 #include <linux/pinctrl/consumer.h>
38 #include <asm/mach-types.h>
39 #include <asm/mach/arch.h>
40 #include <asm/hardware/gic.h>
43 #include <plat/ste_dma40.h>
44 #include <plat/gpio-nomadik.h>
46 #include <mach/hardware.h>
47 #include <mach/setup.h>
48 #include <mach/devices.h>
49 #include <mach/irqs.h>
51 #include "ste-dma40-db8500.h"
52 #include "devices-db8500.h"
53 #include "board-mop500.h"
54 #include "board-mop500-regulators.h"
55 #include "board-mop500-msp.h"
57 static struct gpio_led snowball_led_array[] = {
60 .default_trigger = "none",
65 static struct gpio_led_platform_data snowball_led_data = {
66 .leds = snowball_led_array,
67 .num_leds = ARRAY_SIZE(snowball_led_array),
70 static struct platform_device snowball_led_dev = {
73 .platform_data = &snowball_led_data,
77 static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
78 .gpio_base = MOP500_AB8500_PIN_GPIO(1),
79 .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
80 /* config_reg is the initial configuration of ab8500 pins.
81 * The pins can be configured as GPIO or alt functions based
82 * on value present in GpioSel1 to GpioSel6 and AlternatFunction
83 * register. This is the array of 7 configuration settings.
84 * One has to compile time decide these settings. Below is the
85 * explanation of these setting
86 * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
87 * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
88 * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
89 * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO
90 * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO
91 * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO
92 * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured
93 * as GPIO then this register selectes the alternate fucntions
95 .config_reg = {0x00, 0x1E, 0x80, 0x01,
99 static struct gpio_keys_button snowball_key_array[] = {
106 .debounce_interval = 50,
115 .debounce_interval = 50,
124 .debounce_interval = 50,
133 .debounce_interval = 50,
142 .debounce_interval = 50,
147 static struct gpio_keys_platform_data snowball_key_data = {
148 .buttons = snowball_key_array,
149 .nbuttons = ARRAY_SIZE(snowball_key_array),
152 static struct platform_device snowball_key_dev = {
156 .platform_data = &snowball_key_data,
160 static struct smsc911x_platform_config snowball_sbnet_cfg = {
161 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
162 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
163 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
167 static struct resource sbnet_res[] = {
169 .name = "smsc911x-memory",
170 .start = (0x5000 << 16),
171 .end = (0x5000 << 16) + 0xffff,
172 .flags = IORESOURCE_MEM,
175 .start = NOMADIK_GPIO_TO_IRQ(140),
176 .end = NOMADIK_GPIO_TO_IRQ(140),
177 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
181 static struct platform_device snowball_sbnet_dev = {
183 .num_resources = ARRAY_SIZE(sbnet_res),
184 .resource = sbnet_res,
186 .platform_data = &snowball_sbnet_cfg,
190 static struct ab8500_platform_data ab8500_platdata = {
191 .irq_base = MOP500_AB8500_IRQ_BASE,
192 .regulator_reg_init = ab8500_regulator_reg_init,
193 .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
194 .regulator = ab8500_regulators,
195 .num_regulator = ARRAY_SIZE(ab8500_regulators),
196 .gpio = &ab8500_gpio_pdata,
199 static struct resource ab8500_resources[] = {
201 .start = IRQ_DB8500_AB8500,
202 .end = IRQ_DB8500_AB8500,
203 .flags = IORESOURCE_IRQ
207 struct platform_device ab8500_device = {
208 .name = "ab8500-i2c",
211 .platform_data = &ab8500_platdata,
214 .resource = ab8500_resources,
221 static struct tps6105x_platform_data mop500_tps61052_data = {
222 .mode = TPS6105X_MODE_VOLTAGE,
223 .regulator_data = &tps61052_regulator,
230 static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
232 struct device *parent = NULL;
234 /* FIXME: Is the sdi actually part of tc3589x? */
235 parent = tc3589x->dev;
237 mop500_sdi_tc35892_init(parent);
240 static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
241 .gpio_base = MOP500_EGPIO(0),
242 .setup = mop500_tc35892_init,
245 static struct tc3589x_platform_data mop500_tc35892_data = {
246 .block = TC3589x_BLOCK_GPIO,
247 .gpio = &mop500_tc35892_gpio_data,
248 .irq_base = MOP500_EGPIO_IRQ_BASE,
251 static struct lp5521_led_config lp5521_pri_led[] = {
269 static struct lp5521_platform_data __initdata lp5521_pri_data = {
270 .label = "lp5521_pri",
271 .led_config = &lp5521_pri_led[0],
273 .clock_mode = LP5521_CLOCK_EXT,
276 static struct lp5521_led_config lp5521_sec_led[] = {
294 static struct lp5521_platform_data __initdata lp5521_sec_data = {
295 .label = "lp5521_sec",
296 .led_config = &lp5521_sec_led[0],
298 .clock_mode = LP5521_CLOCK_EXT,
301 static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
303 I2C_BOARD_INFO("tc3589x", 0x42),
304 .irq = NOMADIK_GPIO_TO_IRQ(217),
305 .platform_data = &mop500_tc35892_data,
307 /* I2C0 devices only available prior to HREFv60 */
309 I2C_BOARD_INFO("tps61052", 0x33),
310 .platform_data = &mop500_tps61052_data,
314 #define NUM_PRE_V60_I2C0_DEVICES 1
316 static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
318 /* lp5521 LED driver, 1st device */
319 I2C_BOARD_INFO("lp5521", 0x33),
320 .platform_data = &lp5521_pri_data,
323 /* lp5521 LED driver, 2st device */
324 I2C_BOARD_INFO("lp5521", 0x34),
325 .platform_data = &lp5521_sec_data,
328 /* Light sensor Rohm BH1780GLI */
329 I2C_BOARD_INFO("bh1780", 0x29),
333 #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, t_out, _sm) \
334 static struct nmk_i2c_controller u8500_i2c##id##_data = { \
336 * slave data setup time, which is \
337 * 250 ns,100ns,10ns which is 14,6,2 \
338 * respectively for a 48 Mhz \
342 /* Tx FIFO threshold */ \
344 /* Rx FIFO threshold */ \
346 /* std. mode operation */ \
348 /* Slave response timeout(ms) */\
354 * The board uses 4 i2c controllers, initialize all of
355 * them with slave data setup time of 250 ns,
356 * Tx & Rx FIFO threshold values as 8 and standard
359 U8500_I2C_CONTROLLER(0, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
360 U8500_I2C_CONTROLLER(1, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
361 U8500_I2C_CONTROLLER(2, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
362 U8500_I2C_CONTROLLER(3, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
364 static void __init mop500_i2c_init(struct device *parent)
366 db8500_add_i2c0(parent, &u8500_i2c0_data);
367 db8500_add_i2c1(parent, &u8500_i2c1_data);
368 db8500_add_i2c2(parent, &u8500_i2c2_data);
369 db8500_add_i2c3(parent, &u8500_i2c3_data);
372 static struct gpio_keys_button mop500_gpio_keys[] = {
374 .desc = "SFH7741 Proximity Sensor",
376 .code = SW_FRONT_PROXIMITY,
382 static struct regulator *prox_regulator;
383 static int mop500_prox_activate(struct device *dev);
384 static void mop500_prox_deactivate(struct device *dev);
386 static struct gpio_keys_platform_data mop500_gpio_keys_data = {
387 .buttons = mop500_gpio_keys,
388 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
389 .enable = mop500_prox_activate,
390 .disable = mop500_prox_deactivate,
393 static struct platform_device mop500_gpio_keys_device = {
397 .platform_data = &mop500_gpio_keys_data,
401 static int mop500_prox_activate(struct device *dev)
403 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
405 if (IS_ERR(prox_regulator)) {
406 dev_err(&mop500_gpio_keys_device.dev,
408 return PTR_ERR(prox_regulator);
410 regulator_enable(prox_regulator);
414 static void mop500_prox_deactivate(struct device *dev)
416 regulator_disable(prox_regulator);
417 regulator_put(prox_regulator);
420 /* add any platform devices here - TODO */
421 static struct platform_device *mop500_platform_devs[] __initdata = {
422 &mop500_gpio_keys_device,
426 #ifdef CONFIG_STE_DMA40
427 static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
428 .mode = STEDMA40_MODE_LOGICAL,
429 .dir = STEDMA40_PERIPH_TO_MEM,
430 .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
431 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
432 .src_info.data_width = STEDMA40_BYTE_WIDTH,
433 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
436 static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
437 .mode = STEDMA40_MODE_LOGICAL,
438 .dir = STEDMA40_MEM_TO_PERIPH,
439 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
440 .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
441 .src_info.data_width = STEDMA40_BYTE_WIDTH,
442 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
446 static struct pl022_ssp_controller ssp0_plat = {
448 #ifdef CONFIG_STE_DMA40
450 .dma_filter = stedma40_filter,
451 .dma_rx_param = &ssp0_dma_cfg_rx,
452 .dma_tx_param = &ssp0_dma_cfg_tx,
456 /* on this platform, gpio 31,142,144,214 &
457 * 224 are connected as chip selects
462 static void __init mop500_spi_init(struct device *parent)
464 db8500_add_ssp0(parent, &ssp0_plat);
467 #ifdef CONFIG_STE_DMA40
468 static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
469 .mode = STEDMA40_MODE_LOGICAL,
470 .dir = STEDMA40_PERIPH_TO_MEM,
471 .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
472 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
473 .src_info.data_width = STEDMA40_BYTE_WIDTH,
474 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
477 static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
478 .mode = STEDMA40_MODE_LOGICAL,
479 .dir = STEDMA40_MEM_TO_PERIPH,
480 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
481 .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
482 .src_info.data_width = STEDMA40_BYTE_WIDTH,
483 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
486 static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
487 .mode = STEDMA40_MODE_LOGICAL,
488 .dir = STEDMA40_PERIPH_TO_MEM,
489 .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
490 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
491 .src_info.data_width = STEDMA40_BYTE_WIDTH,
492 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
495 static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
496 .mode = STEDMA40_MODE_LOGICAL,
497 .dir = STEDMA40_MEM_TO_PERIPH,
498 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
499 .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
500 .src_info.data_width = STEDMA40_BYTE_WIDTH,
501 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
504 static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
505 .mode = STEDMA40_MODE_LOGICAL,
506 .dir = STEDMA40_PERIPH_TO_MEM,
507 .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
508 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
509 .src_info.data_width = STEDMA40_BYTE_WIDTH,
510 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
513 static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
514 .mode = STEDMA40_MODE_LOGICAL,
515 .dir = STEDMA40_MEM_TO_PERIPH,
516 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
517 .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
518 .src_info.data_width = STEDMA40_BYTE_WIDTH,
519 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
523 #define PRCC_K_SOFTRST_SET 0x18
524 #define PRCC_K_SOFTRST_CLEAR 0x1C
525 static void ux500_uart0_reset(void)
527 void __iomem *prcc_rst_set, *prcc_rst_clr;
529 prcc_rst_set = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
531 prcc_rst_clr = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
532 PRCC_K_SOFTRST_CLEAR);
534 /* Activate soft reset PRCC_K_SOFTRST_CLEAR */
535 writel((readl(prcc_rst_clr) | 0x1), prcc_rst_clr);
538 /* Release soft reset PRCC_K_SOFTRST_SET */
539 writel((readl(prcc_rst_set) | 0x1), prcc_rst_set);
543 /* This needs to be referenced by callbacks */
544 struct pinctrl *u0_p;
545 struct pinctrl_state *u0_def;
546 struct pinctrl_state *u0_sleep;
548 static void ux500_uart0_init(void)
552 if (IS_ERR(u0_p) || IS_ERR(u0_def))
555 ret = pinctrl_select_state(u0_p, u0_def);
557 pr_err("could not set UART0 defstate\n");
560 static void ux500_uart0_exit(void)
564 if (IS_ERR(u0_p) || IS_ERR(u0_sleep))
567 ret = pinctrl_select_state(u0_p, u0_sleep);
569 pr_err("could not set UART0 idlestate\n");
572 static struct amba_pl011_data uart0_plat = {
573 #ifdef CONFIG_STE_DMA40
574 .dma_filter = stedma40_filter,
575 .dma_rx_param = &uart0_dma_cfg_rx,
576 .dma_tx_param = &uart0_dma_cfg_tx,
578 .init = ux500_uart0_init,
579 .exit = ux500_uart0_exit,
580 .reset = ux500_uart0_reset,
583 static struct amba_pl011_data uart1_plat = {
584 #ifdef CONFIG_STE_DMA40
585 .dma_filter = stedma40_filter,
586 .dma_rx_param = &uart1_dma_cfg_rx,
587 .dma_tx_param = &uart1_dma_cfg_tx,
591 static struct amba_pl011_data uart2_plat = {
592 #ifdef CONFIG_STE_DMA40
593 .dma_filter = stedma40_filter,
594 .dma_rx_param = &uart2_dma_cfg_rx,
595 .dma_tx_param = &uart2_dma_cfg_tx,
599 static void __init mop500_uart_init(struct device *parent)
601 struct amba_device *uart0_device;
603 uart0_device = db8500_add_uart0(parent, &uart0_plat);
605 u0_p = pinctrl_get(&uart0_device->dev);
607 dev_err(&uart0_device->dev,
608 "could not get UART0 pinctrl\n");
610 u0_def = pinctrl_lookup_state(u0_p,
611 PINCTRL_STATE_DEFAULT);
612 if (IS_ERR(u0_def)) {
613 dev_err(&uart0_device->dev,
614 "could not get UART0 defstate\n");
616 u0_sleep = pinctrl_lookup_state(u0_p,
617 PINCTRL_STATE_SLEEP);
618 if (IS_ERR(u0_sleep))
619 dev_err(&uart0_device->dev,
620 "could not get UART0 idlestate\n");
623 db8500_add_uart1(parent, &uart1_plat);
624 db8500_add_uart2(parent, &uart2_plat);
627 static struct platform_device *snowball_platform_devs[] __initdata = {
633 static void __init mop500_init_machine(void)
635 struct device *parent = NULL;
639 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
641 mop500_pinmaps_init();
642 parent = u8500_init_devices();
644 /* FIXME: parent of ab8500 should be prcmu */
645 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
646 mop500_platform_devs[i]->dev.parent = parent;
648 platform_add_devices(mop500_platform_devs,
649 ARRAY_SIZE(mop500_platform_devs));
651 mop500_i2c_init(parent);
652 mop500_sdi_init(parent);
653 mop500_spi_init(parent);
654 mop500_msp_init(parent);
655 mop500_uart_init(parent);
657 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
659 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
660 i2c_register_board_info(2, mop500_i2c2_devices,
661 ARRAY_SIZE(mop500_i2c2_devices));
663 /* This board has full regulator constraints */
664 regulator_has_full_constraints();
667 static void __init snowball_init_machine(void)
669 struct device *parent = NULL;
672 snowball_pinmaps_init();
673 parent = u8500_init_devices();
675 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
676 snowball_platform_devs[i]->dev.parent = parent;
678 platform_add_devices(snowball_platform_devs,
679 ARRAY_SIZE(snowball_platform_devs));
681 mop500_i2c_init(parent);
682 snowball_sdi_init(parent);
683 mop500_spi_init(parent);
684 mop500_msp_init(parent);
685 mop500_uart_init(parent);
687 /* This board has full regulator constraints */
688 regulator_has_full_constraints();
691 static void __init hrefv60_init_machine(void)
693 struct device *parent = NULL;
698 * The HREFv60 board removed a GPIO expander and routed
699 * all these GPIO pins to the internal GPIO controller
702 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
704 hrefv60_pinmaps_init();
705 parent = u8500_init_devices();
707 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
708 mop500_platform_devs[i]->dev.parent = parent;
710 platform_add_devices(mop500_platform_devs,
711 ARRAY_SIZE(mop500_platform_devs));
713 mop500_i2c_init(parent);
714 hrefv60_sdi_init(parent);
715 mop500_spi_init(parent);
716 mop500_msp_init(parent);
717 mop500_uart_init(parent);
719 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
721 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
723 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
724 i2c_register_board_info(2, mop500_i2c2_devices,
725 ARRAY_SIZE(mop500_i2c2_devices));
727 /* This board has full regulator constraints */
728 regulator_has_full_constraints();
731 MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
732 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
733 .atag_offset = 0x100,
734 .map_io = u8500_map_io,
735 .init_irq = ux500_init_irq,
736 /* we re-use nomadik timer here */
737 .timer = &ux500_timer,
738 .handle_irq = gic_handle_irq,
739 .init_machine = mop500_init_machine,
742 MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
743 .atag_offset = 0x100,
744 .map_io = u8500_map_io,
745 .init_irq = ux500_init_irq,
746 .timer = &ux500_timer,
747 .handle_irq = gic_handle_irq,
748 .init_machine = hrefv60_init_machine,
751 MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
752 .atag_offset = 0x100,
753 .map_io = u8500_map_io,
754 .init_irq = ux500_init_irq,
755 /* we re-use nomadik timer here */
756 .timer = &ux500_timer,
757 .handle_irq = gic_handle_irq,
758 .init_machine = snowball_init_machine,
761 #ifdef CONFIG_MACH_UX500_DT
763 struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
764 /* Requires DMA and call-back bindings. */
765 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
766 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
767 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
768 /* Requires DMA bindings. */
769 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
770 /* Requires clock name bindings. */
771 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
772 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
773 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL),
774 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL),
775 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL),
776 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL),
777 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
778 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
779 OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
783 static const struct of_device_id u8500_local_bus_nodes[] = {
784 /* only create devices below soc node */
785 { .compatible = "stericsson,db8500", },
786 { .compatible = "simple-bus"},
790 static void __init u8500_init_machine(void)
792 struct device *parent = NULL;
796 /* Pinmaps must be in place before devices register */
797 if (of_machine_is_compatible("st-ericsson,mop500"))
798 mop500_pinmaps_init();
799 else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
800 snowball_pinmaps_init();
801 else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
802 hrefv60_pinmaps_init();
804 parent = u8500_init_devices();
806 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
807 mop500_platform_devs[i]->dev.parent = parent;
808 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
809 snowball_platform_devs[i]->dev.parent = parent;
811 /* automatically probe child nodes of db8500 device */
812 of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent);
814 if (of_machine_is_compatible("st-ericsson,mop500")) {
815 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
817 platform_add_devices(mop500_platform_devs,
818 ARRAY_SIZE(mop500_platform_devs));
820 mop500_sdi_init(parent);
822 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
823 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
824 i2c_register_board_info(2, mop500_i2c2_devices,
825 ARRAY_SIZE(mop500_i2c2_devices));
827 } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
828 platform_add_devices(snowball_platform_devs,
829 ARRAY_SIZE(snowball_platform_devs));
831 snowball_sdi_init(parent);
832 } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
834 * The HREFv60 board removed a GPIO expander and routed
835 * all these GPIO pins to the internal GPIO controller
838 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
839 platform_add_devices(mop500_platform_devs,
840 ARRAY_SIZE(mop500_platform_devs));
842 hrefv60_sdi_init(parent);
844 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
845 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
847 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
848 i2c_register_board_info(2, mop500_i2c2_devices,
849 ARRAY_SIZE(mop500_i2c2_devices));
851 mop500_i2c_init(parent);
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 .dt_compat = u8500_dt_board_compat,