2 * Copyright (C) 2008-2012 ST-Ericsson
4 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
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.
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/interrupt.h>
14 #include <linux/platform_device.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>
37 #include <linux/of_platform.h>
38 #include <linux/leds.h>
39 #include <linux/pinctrl/consumer.h>
40 #include <linux/platform_data/pinctrl-nomadik.h>
42 #include <asm/mach-types.h>
43 #include <asm/mach/arch.h>
44 #include <asm/hardware/gic.h>
46 #include <plat/ste_dma40.h>
48 #include <mach/hardware.h>
49 #include <mach/setup.h>
50 #include <mach/devices.h>
51 #include <mach/irqs.h>
52 #include <linux/platform_data/crypto-ux500.h>
54 #include "ste-dma40-db8500.h"
55 #include "devices-db8500.h"
56 #include "board-mop500.h"
57 #include "board-mop500-regulators.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 fixed_voltage_config snowball_gpio_en_3v3_data = {
80 .supply_name = "EN-3V3",
81 .gpio = SNOWBALL_EN_3V3_ETH_GPIO,
82 .microvolts = 3300000,
84 .init_data = &gpio_en_3v3_regulator,
85 .startup_delay = 5000, /* 1200us */
88 static struct platform_device snowball_gpio_en_3v3_regulator_dev = {
89 .name = "reg-fixed-voltage",
92 .platform_data = &snowball_gpio_en_3v3_data,
96 static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
97 .gpio_base = MOP500_AB8500_PIN_GPIO(1),
98 .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
99 /* config_reg is the initial configuration of ab8500 pins.
100 * The pins can be configured as GPIO or alt functions based
101 * on value present in GpioSel1 to GpioSel6 and AlternatFunction
102 * register. This is the array of 7 configuration settings.
103 * One has to compile time decide these settings. Below is the
104 * explanation of these setting
105 * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
106 * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
107 * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
108 * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO
109 * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO
110 * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO
111 * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured
112 * as GPIO then this register selectes the alternate fucntions
114 .config_reg = {0x00, 0x1E, 0x80, 0x01,
119 static struct ab8500_codec_platform_data ab8500_codec_pdata = {
121 .mic1_type = AMIC_TYPE_DIFFERENTIAL,
122 .mic2_type = AMIC_TYPE_DIFFERENTIAL,
123 .mic1a_micbias = AMIC_MICBIAS_VAMIC1,
124 .mic1b_micbias = AMIC_MICBIAS_VAMIC1,
125 .mic2_micbias = AMIC_MICBIAS_VAMIC2
127 .ear_cmv = EAR_CMV_0_95V
130 static struct gpio_keys_button snowball_key_array[] = {
137 .debounce_interval = 50,
146 .debounce_interval = 50,
155 .debounce_interval = 50,
164 .debounce_interval = 50,
173 .debounce_interval = 50,
178 static struct gpio_keys_platform_data snowball_key_data = {
179 .buttons = snowball_key_array,
180 .nbuttons = ARRAY_SIZE(snowball_key_array),
183 static struct platform_device snowball_key_dev = {
187 .platform_data = &snowball_key_data,
191 static struct smsc911x_platform_config snowball_sbnet_cfg = {
192 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
193 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
194 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
198 static struct resource sbnet_res[] = {
200 .name = "smsc911x-memory",
201 .start = (0x5000 << 16),
202 .end = (0x5000 << 16) + 0xffff,
203 .flags = IORESOURCE_MEM,
206 .start = NOMADIK_GPIO_TO_IRQ(140),
207 .end = NOMADIK_GPIO_TO_IRQ(140),
208 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
212 static struct platform_device snowball_sbnet_dev = {
214 .num_resources = ARRAY_SIZE(sbnet_res),
215 .resource = sbnet_res,
217 .platform_data = &snowball_sbnet_cfg,
221 static struct ab8500_platform_data ab8500_platdata = {
222 .irq_base = MOP500_AB8500_IRQ_BASE,
223 .regulator_reg_init = ab8500_regulator_reg_init,
224 .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
225 .regulator = ab8500_regulators,
226 .num_regulator = ARRAY_SIZE(ab8500_regulators),
227 .gpio = &ab8500_gpio_pdata,
228 .codec = &ab8500_codec_pdata,
235 static struct resource db8500_thsens_resources[] = {
237 .name = "IRQ_HOTMON_LOW",
238 .start = IRQ_PRCMU_HOTMON_LOW,
239 .end = IRQ_PRCMU_HOTMON_LOW,
240 .flags = IORESOURCE_IRQ,
243 .name = "IRQ_HOTMON_HIGH",
244 .start = IRQ_PRCMU_HOTMON_HIGH,
245 .end = IRQ_PRCMU_HOTMON_HIGH,
246 .flags = IORESOURCE_IRQ,
250 static struct db8500_thsens_platform_data db8500_thsens_data = {
253 .type = THERMAL_TRIP_ACTIVE,
255 [0] = "thermal-cpufreq-0",
260 .type = THERMAL_TRIP_ACTIVE,
262 [0] = "thermal-cpufreq-0",
267 .type = THERMAL_TRIP_ACTIVE,
269 [0] = "thermal-cpufreq-0",
274 .type = THERMAL_TRIP_CRITICAL,
279 static struct platform_device u8500_thsens_device = {
280 .name = "db8500-thermal",
281 .resource = db8500_thsens_resources,
282 .num_resources = ARRAY_SIZE(db8500_thsens_resources),
284 .platform_data = &db8500_thsens_data,
288 static struct platform_device u8500_cpufreq_cooling_device = {
289 .name = "db8500-cpufreq-cooling",
296 static struct tps6105x_platform_data mop500_tps61052_data = {
297 .mode = TPS6105X_MODE_VOLTAGE,
298 .regulator_data = &tps61052_regulator,
305 static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
307 struct device *parent = NULL;
309 /* FIXME: Is the sdi actually part of tc3589x? */
310 parent = tc3589x->dev;
312 mop500_sdi_tc35892_init(parent);
315 static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
316 .gpio_base = MOP500_EGPIO(0),
317 .setup = mop500_tc35892_init,
320 static struct tc3589x_platform_data mop500_tc35892_data = {
321 .block = TC3589x_BLOCK_GPIO,
322 .gpio = &mop500_tc35892_gpio_data,
323 .irq_base = MOP500_EGPIO_IRQ_BASE,
326 static struct lp5521_led_config lp5521_pri_led[] = {
344 static struct lp5521_platform_data __initdata lp5521_pri_data = {
345 .label = "lp5521_pri",
346 .led_config = &lp5521_pri_led[0],
348 .clock_mode = LP5521_CLOCK_EXT,
351 static struct lp5521_led_config lp5521_sec_led[] = {
369 static struct lp5521_platform_data __initdata lp5521_sec_data = {
370 .label = "lp5521_sec",
371 .led_config = &lp5521_sec_led[0],
373 .clock_mode = LP5521_CLOCK_EXT,
376 static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
378 I2C_BOARD_INFO("tc3589x", 0x42),
379 .irq = NOMADIK_GPIO_TO_IRQ(217),
380 .platform_data = &mop500_tc35892_data,
382 /* I2C0 devices only available prior to HREFv60 */
384 I2C_BOARD_INFO("tps61052", 0x33),
385 .platform_data = &mop500_tps61052_data,
389 #define NUM_PRE_V60_I2C0_DEVICES 1
391 static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
393 /* lp5521 LED driver, 1st device */
394 I2C_BOARD_INFO("lp5521", 0x33),
395 .platform_data = &lp5521_pri_data,
398 /* lp5521 LED driver, 2st device */
399 I2C_BOARD_INFO("lp5521", 0x34),
400 .platform_data = &lp5521_sec_data,
403 /* Light sensor Rohm BH1780GLI */
404 I2C_BOARD_INFO("bh1780", 0x29),
408 static void __init mop500_i2c_init(struct device *parent)
410 db8500_add_i2c0(parent, NULL);
411 db8500_add_i2c1(parent, NULL);
412 db8500_add_i2c2(parent, NULL);
413 db8500_add_i2c3(parent, NULL);
416 static struct gpio_keys_button mop500_gpio_keys[] = {
418 .desc = "SFH7741 Proximity Sensor",
420 .code = SW_FRONT_PROXIMITY,
426 static struct regulator *prox_regulator;
427 static int mop500_prox_activate(struct device *dev);
428 static void mop500_prox_deactivate(struct device *dev);
430 static struct gpio_keys_platform_data mop500_gpio_keys_data = {
431 .buttons = mop500_gpio_keys,
432 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
433 .enable = mop500_prox_activate,
434 .disable = mop500_prox_deactivate,
437 static struct platform_device mop500_gpio_keys_device = {
441 .platform_data = &mop500_gpio_keys_data,
445 static int mop500_prox_activate(struct device *dev)
447 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
449 if (IS_ERR(prox_regulator)) {
450 dev_err(&mop500_gpio_keys_device.dev,
452 return PTR_ERR(prox_regulator);
454 regulator_enable(prox_regulator);
458 static void mop500_prox_deactivate(struct device *dev)
460 regulator_disable(prox_regulator);
461 regulator_put(prox_regulator);
464 static struct cryp_platform_data u8500_cryp1_platform_data = {
466 .dir = STEDMA40_MEM_TO_PERIPH,
467 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
468 .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
469 .src_info.data_width = STEDMA40_WORD_WIDTH,
470 .dst_info.data_width = STEDMA40_WORD_WIDTH,
471 .mode = STEDMA40_MODE_LOGICAL,
472 .src_info.psize = STEDMA40_PSIZE_LOG_4,
473 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
476 .dir = STEDMA40_PERIPH_TO_MEM,
477 .src_dev_type = DB8500_DMA_DEV48_CAC1_RX,
478 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
479 .src_info.data_width = STEDMA40_WORD_WIDTH,
480 .dst_info.data_width = STEDMA40_WORD_WIDTH,
481 .mode = STEDMA40_MODE_LOGICAL,
482 .src_info.psize = STEDMA40_PSIZE_LOG_4,
483 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
487 static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
488 .dir = STEDMA40_MEM_TO_PERIPH,
489 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
490 .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
491 .src_info.data_width = STEDMA40_WORD_WIDTH,
492 .dst_info.data_width = STEDMA40_WORD_WIDTH,
493 .mode = STEDMA40_MODE_LOGICAL,
494 .src_info.psize = STEDMA40_PSIZE_LOG_16,
495 .dst_info.psize = STEDMA40_PSIZE_LOG_16,
498 static struct hash_platform_data u8500_hash1_platform_data = {
499 .mem_to_engine = &u8500_hash_dma_cfg_tx,
500 .dma_filter = stedma40_filter,
503 /* add any platform devices here - TODO */
504 static struct platform_device *mop500_platform_devs[] __initdata = {
505 &mop500_gpio_keys_device,
508 #ifdef CONFIG_STE_DMA40
509 static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
510 .mode = STEDMA40_MODE_LOGICAL,
511 .dir = STEDMA40_PERIPH_TO_MEM,
512 .src_dev_type = DB8500_DMA_DEV8_SSP0_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 ssp0_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_DEV8_SSP0_TX,
523 .src_info.data_width = STEDMA40_BYTE_WIDTH,
524 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
528 static struct pl022_ssp_controller ssp0_plat = {
530 #ifdef CONFIG_STE_DMA40
532 .dma_filter = stedma40_filter,
533 .dma_rx_param = &ssp0_dma_cfg_rx,
534 .dma_tx_param = &ssp0_dma_cfg_tx,
538 /* on this platform, gpio 31,142,144,214 &
539 * 224 are connected as chip selects
544 static void __init mop500_spi_init(struct device *parent)
546 db8500_add_ssp0(parent, &ssp0_plat);
549 #ifdef CONFIG_STE_DMA40
550 static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
551 .mode = STEDMA40_MODE_LOGICAL,
552 .dir = STEDMA40_PERIPH_TO_MEM,
553 .src_dev_type = DB8500_DMA_DEV13_UART0_RX,
554 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
555 .src_info.data_width = STEDMA40_BYTE_WIDTH,
556 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
559 static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
560 .mode = STEDMA40_MODE_LOGICAL,
561 .dir = STEDMA40_MEM_TO_PERIPH,
562 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
563 .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
564 .src_info.data_width = STEDMA40_BYTE_WIDTH,
565 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
568 static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
569 .mode = STEDMA40_MODE_LOGICAL,
570 .dir = STEDMA40_PERIPH_TO_MEM,
571 .src_dev_type = DB8500_DMA_DEV12_UART1_RX,
572 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
573 .src_info.data_width = STEDMA40_BYTE_WIDTH,
574 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
577 static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
578 .mode = STEDMA40_MODE_LOGICAL,
579 .dir = STEDMA40_MEM_TO_PERIPH,
580 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
581 .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
582 .src_info.data_width = STEDMA40_BYTE_WIDTH,
583 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
586 static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
587 .mode = STEDMA40_MODE_LOGICAL,
588 .dir = STEDMA40_PERIPH_TO_MEM,
589 .src_dev_type = DB8500_DMA_DEV11_UART2_RX,
590 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
591 .src_info.data_width = STEDMA40_BYTE_WIDTH,
592 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
595 static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
596 .mode = STEDMA40_MODE_LOGICAL,
597 .dir = STEDMA40_MEM_TO_PERIPH,
598 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
599 .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
600 .src_info.data_width = STEDMA40_BYTE_WIDTH,
601 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
605 static struct amba_pl011_data uart0_plat = {
606 #ifdef CONFIG_STE_DMA40
607 .dma_filter = stedma40_filter,
608 .dma_rx_param = &uart0_dma_cfg_rx,
609 .dma_tx_param = &uart0_dma_cfg_tx,
613 static struct amba_pl011_data uart1_plat = {
614 #ifdef CONFIG_STE_DMA40
615 .dma_filter = stedma40_filter,
616 .dma_rx_param = &uart1_dma_cfg_rx,
617 .dma_tx_param = &uart1_dma_cfg_tx,
621 static struct amba_pl011_data uart2_plat = {
622 #ifdef CONFIG_STE_DMA40
623 .dma_filter = stedma40_filter,
624 .dma_rx_param = &uart2_dma_cfg_rx,
625 .dma_tx_param = &uart2_dma_cfg_tx,
629 static void __init mop500_uart_init(struct device *parent)
631 db8500_add_uart0(parent, &uart0_plat);
632 db8500_add_uart1(parent, &uart1_plat);
633 db8500_add_uart2(parent, &uart2_plat);
636 static void __init u8500_cryp1_hash1_init(struct device *parent)
638 db8500_add_cryp1(parent, &u8500_cryp1_platform_data);
639 db8500_add_hash1(parent, &u8500_hash1_platform_data);
642 static struct platform_device *snowball_platform_devs[] __initdata = {
646 &snowball_gpio_en_3v3_regulator_dev,
647 &u8500_thsens_device,
648 &u8500_cpufreq_cooling_device,
651 static void __init mop500_init_machine(void)
653 struct device *parent = NULL;
657 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
659 mop500_pinmaps_init();
660 parent = u8500_init_devices(&ab8500_platdata);
662 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
663 mop500_platform_devs[i]->dev.parent = parent;
665 platform_add_devices(mop500_platform_devs,
666 ARRAY_SIZE(mop500_platform_devs));
668 mop500_i2c_init(parent);
669 mop500_sdi_init(parent);
670 mop500_spi_init(parent);
671 mop500_audio_init(parent);
672 mop500_uart_init(parent);
674 u8500_cryp1_hash1_init(parent);
676 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
678 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
679 i2c_register_board_info(2, mop500_i2c2_devices,
680 ARRAY_SIZE(mop500_i2c2_devices));
682 /* This board has full regulator constraints */
683 regulator_has_full_constraints();
688 static void __init snowball_init_machine(void)
690 struct device *parent = NULL;
693 snowball_pinmaps_init();
694 parent = u8500_init_devices(&ab8500_platdata);
696 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
697 snowball_platform_devs[i]->dev.parent = parent;
699 platform_add_devices(snowball_platform_devs,
700 ARRAY_SIZE(snowball_platform_devs));
702 mop500_i2c_init(parent);
703 snowball_sdi_init(parent);
704 mop500_spi_init(parent);
705 mop500_audio_init(parent);
706 mop500_uart_init(parent);
708 /* This board has full regulator constraints */
709 regulator_has_full_constraints();
712 static void __init hrefv60_init_machine(void)
714 struct device *parent = NULL;
719 * The HREFv60 board removed a GPIO expander and routed
720 * all these GPIO pins to the internal GPIO controller
723 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
725 hrefv60_pinmaps_init();
726 parent = u8500_init_devices(&ab8500_platdata);
728 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
729 mop500_platform_devs[i]->dev.parent = parent;
731 platform_add_devices(mop500_platform_devs,
732 ARRAY_SIZE(mop500_platform_devs));
734 mop500_i2c_init(parent);
735 hrefv60_sdi_init(parent);
736 mop500_spi_init(parent);
737 mop500_audio_init(parent);
738 mop500_uart_init(parent);
740 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
742 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
744 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
745 i2c_register_board_info(2, mop500_i2c2_devices,
746 ARRAY_SIZE(mop500_i2c2_devices));
748 /* This board has full regulator constraints */
749 regulator_has_full_constraints();
754 MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
755 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
756 .atag_offset = 0x100,
757 .smp = smp_ops(ux500_smp_ops),
758 .map_io = u8500_map_io,
759 .init_irq = ux500_init_irq,
760 /* we re-use nomadik timer here */
761 .timer = &ux500_timer,
762 .handle_irq = gic_handle_irq,
763 .init_machine = mop500_init_machine,
764 .init_late = ux500_init_late,
767 MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520")
768 .atag_offset = 0x100,
769 .map_io = u8500_map_io,
770 .init_irq = ux500_init_irq,
771 .timer = &ux500_timer,
772 .handle_irq = gic_handle_irq,
773 .init_machine = mop500_init_machine,
774 .init_late = ux500_init_late,
777 MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
778 .atag_offset = 0x100,
779 .smp = smp_ops(ux500_smp_ops),
780 .map_io = u8500_map_io,
781 .init_irq = ux500_init_irq,
782 .timer = &ux500_timer,
783 .handle_irq = gic_handle_irq,
784 .init_machine = hrefv60_init_machine,
785 .init_late = ux500_init_late,
788 MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
789 .atag_offset = 0x100,
790 .smp = smp_ops(ux500_smp_ops),
791 .map_io = u8500_map_io,
792 .init_irq = ux500_init_irq,
793 /* we re-use nomadik timer here */
794 .timer = &ux500_timer,
795 .handle_irq = gic_handle_irq,
796 .init_machine = snowball_init_machine,
797 .init_late = ux500_init_late,
800 #ifdef CONFIG_MACH_UX500_DT
802 struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
803 /* Requires call-back bindings. */
804 OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata),
805 /* Requires DMA and call-back bindings. */
806 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
807 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
808 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
809 /* Requires DMA bindings. */
810 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
811 OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data),
812 OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", &mop500_sdi1_data),
813 OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2", &mop500_sdi2_data),
814 OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data),
815 /* Requires clock name bindings. */
816 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
817 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
818 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL),
819 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL),
820 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL),
821 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL),
822 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
823 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
824 OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
825 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80004000, "nmk-i2c.0", NULL),
826 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80122000, "nmk-i2c.1", NULL),
827 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL),
828 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL),
829 OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
830 /* Requires device name bindings. */
831 OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL),
832 /* Requires clock name and DMA bindings. */
833 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000,
834 "ux500-msp-i2s.0", &msp0_platform_data),
835 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000,
836 "ux500-msp-i2s.1", &msp1_platform_data),
837 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80117000,
838 "ux500-msp-i2s.2", &msp2_platform_data),
839 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000,
840 "ux500-msp-i2s.3", &msp3_platform_data),
844 static const struct of_device_id u8500_local_bus_nodes[] = {
845 /* only create devices below soc node */
846 { .compatible = "stericsson,db8500", },
847 { .compatible = "stericsson,db8500-prcmu", },
848 { .compatible = "simple-bus"},
852 static void __init u8500_init_machine(void)
854 struct device *parent = NULL;
858 /* Pinmaps must be in place before devices register */
859 if (of_machine_is_compatible("st-ericsson,mop500"))
860 mop500_pinmaps_init();
861 else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
862 snowball_pinmaps_init();
863 else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
864 hrefv60_pinmaps_init();
866 parent = u8500_of_init_devices();
868 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
869 mop500_platform_devs[i]->dev.parent = parent;
871 /* automatically probe child nodes of db8500 device */
872 of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent);
874 if (of_machine_is_compatible("st-ericsson,mop500")) {
875 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
877 platform_add_devices(mop500_platform_devs,
878 ARRAY_SIZE(mop500_platform_devs));
880 mop500_sdi_init(parent);
881 mop500_audio_init(parent);
882 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
883 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
884 i2c_register_board_info(2, mop500_i2c2_devices,
885 ARRAY_SIZE(mop500_i2c2_devices));
889 } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
890 mop500_of_audio_init(parent);
891 } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
893 * The HREFv60 board removed a GPIO expander and routed
894 * all these GPIO pins to the internal GPIO controller
897 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
898 platform_add_devices(mop500_platform_devs,
899 ARRAY_SIZE(mop500_platform_devs));
904 /* This board has full regulator constraints */
905 regulator_has_full_constraints();
908 static const char * u8500_dt_board_compat[] = {
909 "calaosystems,snowball-a9500",
910 "st-ericsson,hrefv60+",
912 "st-ericsson,mop500",
917 DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)")
918 .smp = smp_ops(ux500_smp_ops),
919 .map_io = u8500_map_io,
920 .init_irq = ux500_init_irq,
921 /* we re-use nomadik timer here */
922 .timer = &ux500_timer,
923 .handle_irq = gic_handle_irq,
924 .init_machine = u8500_init_machine,
925 .init_late = ux500_init_late,
926 .dt_compat = u8500_dt_board_compat,