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"
58 static struct gpio_led snowball_led_array[] = {
61 .default_trigger = "heartbeat",
66 static struct gpio_led_platform_data snowball_led_data = {
67 .leds = snowball_led_array,
68 .num_leds = ARRAY_SIZE(snowball_led_array),
71 static struct platform_device snowball_led_dev = {
74 .platform_data = &snowball_led_data,
78 static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
79 .gpio_base = MOP500_AB8500_PIN_GPIO(1),
80 .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
81 /* config_reg is the initial configuration of ab8500 pins.
82 * The pins can be configured as GPIO or alt functions based
83 * on value present in GpioSel1 to GpioSel6 and AlternatFunction
84 * register. This is the array of 7 configuration settings.
85 * One has to compile time decide these settings. Below is the
86 * explanation of these setting
87 * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
88 * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
89 * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
90 * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO
91 * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO
92 * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO
93 * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured
94 * as GPIO then this register selectes the alternate fucntions
96 .config_reg = {0x00, 0x1E, 0x80, 0x01,
101 static struct ab8500_codec_platform_data ab8500_codec_pdata = {
103 .mic1_type = AMIC_TYPE_DIFFERENTIAL,
104 .mic2_type = AMIC_TYPE_DIFFERENTIAL,
105 .mic1a_micbias = AMIC_MICBIAS_VAMIC1,
106 .mic1b_micbias = AMIC_MICBIAS_VAMIC1,
107 .mic2_micbias = AMIC_MICBIAS_VAMIC2
109 .ear_cmv = EAR_CMV_0_95V
112 static struct gpio_keys_button snowball_key_array[] = {
119 .debounce_interval = 50,
128 .debounce_interval = 50,
137 .debounce_interval = 50,
146 .debounce_interval = 50,
155 .debounce_interval = 50,
160 static struct gpio_keys_platform_data snowball_key_data = {
161 .buttons = snowball_key_array,
162 .nbuttons = ARRAY_SIZE(snowball_key_array),
165 static struct platform_device snowball_key_dev = {
169 .platform_data = &snowball_key_data,
173 static struct smsc911x_platform_config snowball_sbnet_cfg = {
174 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
175 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
176 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
180 static struct resource sbnet_res[] = {
182 .name = "smsc911x-memory",
183 .start = (0x5000 << 16),
184 .end = (0x5000 << 16) + 0xffff,
185 .flags = IORESOURCE_MEM,
188 .start = NOMADIK_GPIO_TO_IRQ(140),
189 .end = NOMADIK_GPIO_TO_IRQ(140),
190 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
194 static struct platform_device snowball_sbnet_dev = {
196 .num_resources = ARRAY_SIZE(sbnet_res),
197 .resource = sbnet_res,
199 .platform_data = &snowball_sbnet_cfg,
203 static struct ab8500_platform_data ab8500_platdata = {
204 .irq_base = MOP500_AB8500_IRQ_BASE,
205 .regulator_reg_init = ab8500_regulator_reg_init,
206 .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
207 .regulator = ab8500_regulators,
208 .num_regulator = ARRAY_SIZE(ab8500_regulators),
209 .gpio = &ab8500_gpio_pdata,
210 .codec = &ab8500_codec_pdata,
217 static struct tps6105x_platform_data mop500_tps61052_data = {
218 .mode = TPS6105X_MODE_VOLTAGE,
219 .regulator_data = &tps61052_regulator,
226 static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
228 struct device *parent = NULL;
230 /* FIXME: Is the sdi actually part of tc3589x? */
231 parent = tc3589x->dev;
233 mop500_sdi_tc35892_init(parent);
236 static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
237 .gpio_base = MOP500_EGPIO(0),
238 .setup = mop500_tc35892_init,
241 static struct tc3589x_platform_data mop500_tc35892_data = {
242 .block = TC3589x_BLOCK_GPIO,
243 .gpio = &mop500_tc35892_gpio_data,
244 .irq_base = MOP500_EGPIO_IRQ_BASE,
247 static struct lp5521_led_config lp5521_pri_led[] = {
265 static struct lp5521_platform_data __initdata lp5521_pri_data = {
266 .label = "lp5521_pri",
267 .led_config = &lp5521_pri_led[0],
269 .clock_mode = LP5521_CLOCK_EXT,
272 static struct lp5521_led_config lp5521_sec_led[] = {
290 static struct lp5521_platform_data __initdata lp5521_sec_data = {
291 .label = "lp5521_sec",
292 .led_config = &lp5521_sec_led[0],
294 .clock_mode = LP5521_CLOCK_EXT,
297 static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
299 I2C_BOARD_INFO("tc3589x", 0x42),
300 .irq = NOMADIK_GPIO_TO_IRQ(217),
301 .platform_data = &mop500_tc35892_data,
303 /* I2C0 devices only available prior to HREFv60 */
305 I2C_BOARD_INFO("tps61052", 0x33),
306 .platform_data = &mop500_tps61052_data,
310 #define NUM_PRE_V60_I2C0_DEVICES 1
312 static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
314 /* lp5521 LED driver, 1st device */
315 I2C_BOARD_INFO("lp5521", 0x33),
316 .platform_data = &lp5521_pri_data,
319 /* lp5521 LED driver, 2st device */
320 I2C_BOARD_INFO("lp5521", 0x34),
321 .platform_data = &lp5521_sec_data,
324 /* Light sensor Rohm BH1780GLI */
325 I2C_BOARD_INFO("bh1780", 0x29),
329 static void __init mop500_i2c_init(struct device *parent)
331 db8500_add_i2c0(parent, NULL);
332 db8500_add_i2c1(parent, NULL);
333 db8500_add_i2c2(parent, NULL);
334 db8500_add_i2c3(parent, NULL);
337 static struct gpio_keys_button mop500_gpio_keys[] = {
339 .desc = "SFH7741 Proximity Sensor",
341 .code = SW_FRONT_PROXIMITY,
347 static struct regulator *prox_regulator;
348 static int mop500_prox_activate(struct device *dev);
349 static void mop500_prox_deactivate(struct device *dev);
351 static struct gpio_keys_platform_data mop500_gpio_keys_data = {
352 .buttons = mop500_gpio_keys,
353 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
354 .enable = mop500_prox_activate,
355 .disable = mop500_prox_deactivate,
358 static struct platform_device mop500_gpio_keys_device = {
362 .platform_data = &mop500_gpio_keys_data,
366 static int mop500_prox_activate(struct device *dev)
368 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
370 if (IS_ERR(prox_regulator)) {
371 dev_err(&mop500_gpio_keys_device.dev,
373 return PTR_ERR(prox_regulator);
375 regulator_enable(prox_regulator);
379 static void mop500_prox_deactivate(struct device *dev)
381 regulator_disable(prox_regulator);
382 regulator_put(prox_regulator);
385 static struct cryp_platform_data u8500_cryp1_platform_data = {
387 .dir = STEDMA40_MEM_TO_PERIPH,
388 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
389 .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
390 .src_info.data_width = STEDMA40_WORD_WIDTH,
391 .dst_info.data_width = STEDMA40_WORD_WIDTH,
392 .mode = STEDMA40_MODE_LOGICAL,
393 .src_info.psize = STEDMA40_PSIZE_LOG_4,
394 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
397 .dir = STEDMA40_PERIPH_TO_MEM,
398 .src_dev_type = DB8500_DMA_DEV48_CAC1_RX,
399 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
400 .src_info.data_width = STEDMA40_WORD_WIDTH,
401 .dst_info.data_width = STEDMA40_WORD_WIDTH,
402 .mode = STEDMA40_MODE_LOGICAL,
403 .src_info.psize = STEDMA40_PSIZE_LOG_4,
404 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
408 static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
409 .dir = STEDMA40_MEM_TO_PERIPH,
410 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
411 .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
412 .src_info.data_width = STEDMA40_WORD_WIDTH,
413 .dst_info.data_width = STEDMA40_WORD_WIDTH,
414 .mode = STEDMA40_MODE_LOGICAL,
415 .src_info.psize = STEDMA40_PSIZE_LOG_16,
416 .dst_info.psize = STEDMA40_PSIZE_LOG_16,
419 static struct hash_platform_data u8500_hash1_platform_data = {
420 .mem_to_engine = &u8500_hash_dma_cfg_tx,
421 .dma_filter = stedma40_filter,
424 /* add any platform devices here - TODO */
425 static struct platform_device *mop500_platform_devs[] __initdata = {
426 &mop500_gpio_keys_device,
429 #ifdef CONFIG_STE_DMA40
430 static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
431 .mode = STEDMA40_MODE_LOGICAL,
432 .dir = STEDMA40_PERIPH_TO_MEM,
433 .src_dev_type = DB8500_DMA_DEV8_SSP0_RX,
434 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
435 .src_info.data_width = STEDMA40_BYTE_WIDTH,
436 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
439 static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
440 .mode = STEDMA40_MODE_LOGICAL,
441 .dir = STEDMA40_MEM_TO_PERIPH,
442 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
443 .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
444 .src_info.data_width = STEDMA40_BYTE_WIDTH,
445 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
449 static struct pl022_ssp_controller ssp0_plat = {
451 #ifdef CONFIG_STE_DMA40
453 .dma_filter = stedma40_filter,
454 .dma_rx_param = &ssp0_dma_cfg_rx,
455 .dma_tx_param = &ssp0_dma_cfg_tx,
459 /* on this platform, gpio 31,142,144,214 &
460 * 224 are connected as chip selects
465 static void __init mop500_spi_init(struct device *parent)
467 db8500_add_ssp0(parent, &ssp0_plat);
470 #ifdef CONFIG_STE_DMA40
471 static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
472 .mode = STEDMA40_MODE_LOGICAL,
473 .dir = STEDMA40_PERIPH_TO_MEM,
474 .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
475 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
476 .src_info.data_width = STEDMA40_BYTE_WIDTH,
477 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
480 static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
481 .mode = STEDMA40_MODE_LOGICAL,
482 .dir = STEDMA40_MEM_TO_PERIPH,
483 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
484 .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
485 .src_info.data_width = STEDMA40_BYTE_WIDTH,
486 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
489 static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
490 .mode = STEDMA40_MODE_LOGICAL,
491 .dir = STEDMA40_PERIPH_TO_MEM,
492 .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
493 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
494 .src_info.data_width = STEDMA40_BYTE_WIDTH,
495 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
498 static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
499 .mode = STEDMA40_MODE_LOGICAL,
500 .dir = STEDMA40_MEM_TO_PERIPH,
501 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
502 .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
503 .src_info.data_width = STEDMA40_BYTE_WIDTH,
504 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
507 static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
508 .mode = STEDMA40_MODE_LOGICAL,
509 .dir = STEDMA40_PERIPH_TO_MEM,
510 .src_dev_type = DB8500_DMA_DEV11_UART2_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,
516 static struct stedma40_chan_cfg uart2_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_DEV11_UART2_TX,
521 .src_info.data_width = STEDMA40_BYTE_WIDTH,
522 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
526 #define PRCC_K_SOFTRST_SET 0x18
527 #define PRCC_K_SOFTRST_CLEAR 0x1C
528 static void ux500_uart0_reset(void)
530 void __iomem *prcc_rst_set, *prcc_rst_clr;
532 prcc_rst_set = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
534 prcc_rst_clr = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
535 PRCC_K_SOFTRST_CLEAR);
537 /* Activate soft reset PRCC_K_SOFTRST_CLEAR */
538 writel((readl(prcc_rst_clr) | 0x1), prcc_rst_clr);
541 /* Release soft reset PRCC_K_SOFTRST_SET */
542 writel((readl(prcc_rst_set) | 0x1), prcc_rst_set);
546 static struct amba_pl011_data uart0_plat = {
547 #ifdef CONFIG_STE_DMA40
548 .dma_filter = stedma40_filter,
549 .dma_rx_param = &uart0_dma_cfg_rx,
550 .dma_tx_param = &uart0_dma_cfg_tx,
552 .reset = ux500_uart0_reset,
555 static struct amba_pl011_data uart1_plat = {
556 #ifdef CONFIG_STE_DMA40
557 .dma_filter = stedma40_filter,
558 .dma_rx_param = &uart1_dma_cfg_rx,
559 .dma_tx_param = &uart1_dma_cfg_tx,
563 static struct amba_pl011_data uart2_plat = {
564 #ifdef CONFIG_STE_DMA40
565 .dma_filter = stedma40_filter,
566 .dma_rx_param = &uart2_dma_cfg_rx,
567 .dma_tx_param = &uart2_dma_cfg_tx,
571 static void __init mop500_uart_init(struct device *parent)
573 db8500_add_uart0(parent, &uart0_plat);
574 db8500_add_uart1(parent, &uart1_plat);
575 db8500_add_uart2(parent, &uart2_plat);
578 static void __init u8500_cryp1_hash1_init(struct device *parent)
580 db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
581 db8500_add_hash1(parent, &u8500_hash1_platform_data);
584 static struct platform_device *snowball_platform_devs[] __initdata = {
590 static void __init mop500_init_machine(void)
592 struct device *parent = NULL;
596 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
598 mop500_pinmaps_init();
599 parent = u8500_init_devices(&ab8500_platdata);
601 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
602 mop500_platform_devs[i]->dev.parent = parent;
604 platform_add_devices(mop500_platform_devs,
605 ARRAY_SIZE(mop500_platform_devs));
607 mop500_i2c_init(parent);
608 mop500_sdi_init(parent);
609 mop500_spi_init(parent);
610 mop500_msp_init(parent);
611 mop500_uart_init(parent);
613 u8500_cryp1_hash1_init(parent);
615 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
617 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
618 i2c_register_board_info(2, mop500_i2c2_devices,
619 ARRAY_SIZE(mop500_i2c2_devices));
621 /* This board has full regulator constraints */
622 regulator_has_full_constraints();
627 static void __init snowball_init_machine(void)
629 struct device *parent = NULL;
632 snowball_pinmaps_init();
633 parent = u8500_init_devices(&ab8500_platdata);
635 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
636 snowball_platform_devs[i]->dev.parent = parent;
638 platform_add_devices(snowball_platform_devs,
639 ARRAY_SIZE(snowball_platform_devs));
641 mop500_i2c_init(parent);
642 snowball_sdi_init(parent);
643 mop500_spi_init(parent);
644 mop500_msp_init(parent);
645 mop500_uart_init(parent);
647 /* This board has full regulator constraints */
648 regulator_has_full_constraints();
651 static void __init hrefv60_init_machine(void)
653 struct device *parent = NULL;
658 * The HREFv60 board removed a GPIO expander and routed
659 * all these GPIO pins to the internal GPIO controller
662 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
664 hrefv60_pinmaps_init();
665 parent = u8500_init_devices(&ab8500_platdata);
667 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
668 mop500_platform_devs[i]->dev.parent = parent;
670 platform_add_devices(mop500_platform_devs,
671 ARRAY_SIZE(mop500_platform_devs));
673 mop500_i2c_init(parent);
674 hrefv60_sdi_init(parent);
675 mop500_spi_init(parent);
676 mop500_msp_init(parent);
677 mop500_uart_init(parent);
679 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
681 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
683 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
684 i2c_register_board_info(2, mop500_i2c2_devices,
685 ARRAY_SIZE(mop500_i2c2_devices));
687 /* This board has full regulator constraints */
688 regulator_has_full_constraints();
693 MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
694 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
695 .atag_offset = 0x100,
696 .map_io = u8500_map_io,
697 .init_irq = ux500_init_irq,
698 /* we re-use nomadik timer here */
699 .timer = &ux500_timer,
700 .handle_irq = gic_handle_irq,
701 .init_machine = mop500_init_machine,
702 .init_late = ux500_init_late,
705 MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
706 .atag_offset = 0x100,
707 .map_io = u8500_map_io,
708 .init_irq = ux500_init_irq,
709 .timer = &ux500_timer,
710 .handle_irq = gic_handle_irq,
711 .init_machine = hrefv60_init_machine,
712 .init_late = ux500_init_late,
715 MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
716 .atag_offset = 0x100,
717 .map_io = u8500_map_io,
718 .init_irq = ux500_init_irq,
719 /* we re-use nomadik timer here */
720 .timer = &ux500_timer,
721 .handle_irq = gic_handle_irq,
722 .init_machine = snowball_init_machine,
723 .init_late = ux500_init_late,
726 #ifdef CONFIG_MACH_UX500_DT
728 struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
729 /* Requires call-back bindings. */
730 OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata),
731 /* Requires DMA and call-back bindings. */
732 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
733 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
734 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
735 /* Requires DMA bindings. */
736 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
737 OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data),
738 OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", &mop500_sdi1_data),
739 OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2", &mop500_sdi2_data),
740 OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data),
741 /* Requires clock name bindings. */
742 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
743 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
744 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL),
745 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL),
746 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL),
747 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL),
748 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
749 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
750 OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
751 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80004000, "nmk-i2c.0", NULL),
752 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80122000, "nmk-i2c.1", NULL),
753 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL),
754 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL),
755 OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
756 /* Requires device name bindings. */
757 OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL),
761 static const struct of_device_id u8500_local_bus_nodes[] = {
762 /* only create devices below soc node */
763 { .compatible = "stericsson,db8500", },
764 { .compatible = "stericsson,db8500-prcmu", },
765 { .compatible = "simple-bus"},
769 static void __init u8500_init_machine(void)
771 struct device *parent = NULL;
775 /* Pinmaps must be in place before devices register */
776 if (of_machine_is_compatible("st-ericsson,mop500"))
777 mop500_pinmaps_init();
778 else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
779 snowball_pinmaps_init();
780 else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
781 hrefv60_pinmaps_init();
783 parent = u8500_of_init_devices();
785 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
786 mop500_platform_devs[i]->dev.parent = parent;
788 /* automatically probe child nodes of db8500 device */
789 of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent);
791 if (of_machine_is_compatible("st-ericsson,mop500")) {
792 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
794 platform_add_devices(mop500_platform_devs,
795 ARRAY_SIZE(mop500_platform_devs));
797 mop500_sdi_init(parent);
798 mop500_msp_init(parent);
799 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
800 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
801 i2c_register_board_info(2, mop500_i2c2_devices,
802 ARRAY_SIZE(mop500_i2c2_devices));
806 } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
807 mop500_of_msp_init(parent);
808 } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
810 * The HREFv60 board removed a GPIO expander and routed
811 * all these GPIO pins to the internal GPIO controller
814 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
815 platform_add_devices(mop500_platform_devs,
816 ARRAY_SIZE(mop500_platform_devs));
818 hrefv60_sdi_init(parent);
819 mop500_msp_init(parent);
821 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
822 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
824 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
825 i2c_register_board_info(2, mop500_i2c2_devices,
826 ARRAY_SIZE(mop500_i2c2_devices));
831 /* This board has full regulator constraints */
832 regulator_has_full_constraints();
835 static const char * u8500_dt_board_compat[] = {
836 "calaosystems,snowball-a9500",
837 "st-ericsson,hrefv60+",
839 "st-ericsson,mop500",
844 DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)")
845 .map_io = u8500_map_io,
846 .init_irq = ux500_init_irq,
847 /* we re-use nomadik timer here */
848 .timer = &ux500_timer,
849 .handle_irq = gic_handle_irq,
850 .init_machine = u8500_init_machine,
851 .init_late = ux500_init_late,
852 .dt_compat = u8500_dt_board_compat,