aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ux500
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-03-16 15:51:30 -0400
committerArnd Bergmann <arnd@arndb.de>2012-03-16 15:51:30 -0400
commitd4ef467aea0fdcd5e75a4bbfaf97e579bbe532f3 (patch)
tree5b91923fb5031c6963a60ee33ee7671d178f26b2 /arch/arm/mach-ux500
parent4acf18232f80c29906356f0f35b2d5f800b5953d (diff)
parent71de5c46e0600b72df58269e80da343e354ddbd7 (diff)
Merge branch 'ux500/dt' into next/dt2
* ux500/dt: ARM: ux500: Provide local timer support for Device Tree ARM: ux500: Enable PL022 SSP Controller in Device Tree ARM: ux500: Enable PL310 Level 2 Cache Controller in Device Tree ARM: ux500: Enable PL011 AMBA UART Controller for Device Tree ARM: ux500: Enable Cortex-A9 GIC (Generic Interrupt Controller) in Device Tree ARM: ux500: db8500: list most devices in the snowball device tree ARM: ux500: split dts file for snowball into generic part ARM: ux500: combine the board init functions for DT boot ARM: ux500: Initial Device Tree support for Snowball ARM: ux500: CONFIG: Enable Device Tree support for future endeavours ARM: ux500: fix compilation after local timer rework (adds dependency on localtimer branch, irqdomain branch and ux500/soc branch) Conflicts: arch/arm/mach-ux500/devices-common.c This adds patches from Lee Jones, Niklas Hernaeus and myself to provide initial device tree support on the ux500 platform. The pull request from Lee contained some other changes, so I rebased the patches on top of the branches that are actually dependencies for this. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm/mach-ux500')
-rw-r--r--arch/arm/mach-ux500/Kconfig7
-rw-r--r--arch/arm/mach-ux500/Makefile1
-rw-r--r--arch/arm/mach-ux500/Makefile.boot1
-rw-r--r--arch/arm/mach-ux500/board-mop500-sdi.c31
-rw-r--r--arch/arm/mach-ux500/board-mop500.c171
-rw-r--r--arch/arm/mach-ux500/board-mop500.h8
-rw-r--r--arch/arm/mach-ux500/board-u5500-sdi.c4
-rw-r--r--arch/arm/mach-ux500/board-u5500.c27
-rw-r--r--arch/arm/mach-ux500/cache-l2x0.c7
-rw-r--r--arch/arm/mach-ux500/cpu-db5500.c36
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c44
-rw-r--r--arch/arm/mach-ux500/cpu.c90
-rw-r--r--arch/arm/mach-ux500/devices-common.c79
-rw-r--r--arch/arm/mach-ux500/devices-common.h83
-rw-r--r--arch/arm/mach-ux500/devices-db5500.h116
-rw-r--r--arch/arm/mach-ux500/devices-db8500.h176
-rw-r--r--arch/arm/mach-ux500/dma-db5500.c3
-rw-r--r--arch/arm/mach-ux500/include/mach/db8500-regs.h3
-rw-r--r--arch/arm/mach-ux500/include/mach/setup.h11
-rw-r--r--arch/arm/mach-ux500/include/mach/usb.h4
-rw-r--r--arch/arm/mach-ux500/localtimer.c29
-rw-r--r--arch/arm/mach-ux500/timer.c44
-rw-r--r--arch/arm/mach-ux500/usb.c7
23 files changed, 632 insertions, 350 deletions
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 52af00446a63..afb3706bab2a 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -28,6 +28,7 @@ config MACH_U8500
28 bool "U8500 Development platform" 28 bool "U8500 Development platform"
29 depends on UX500_SOC_DB8500 29 depends on UX500_SOC_DB8500
30 select TPS6105X 30 select TPS6105X
31 select SOC_BUS
31 help 32 help
32 Include support for the mop500 development platform. 33 Include support for the mop500 development platform.
33 34
@@ -49,6 +50,12 @@ config MACH_U5500
49 depends on UX500_SOC_DB5500 50 depends on UX500_SOC_DB5500
50 help 51 help
51 Include support for the U5500 development platform. 52 Include support for the U5500 development platform.
53
54config MACH_UX500_DT
55 bool "Generic U8500 support using device tree"
56 depends on MACH_U8500
57 select USE_OF
58
52endmenu 59endmenu
53 60
54config UX500_DEBUG_UART 61config UX500_DEBUG_UART
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 6bd2f451c185..35b389442afe 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -15,7 +15,6 @@ obj-$(CONFIG_MACH_U8500) += board-mop500.o board-mop500-sdi.o \
15obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o 15obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o
16obj-$(CONFIG_SMP) += platsmp.o headsmp.o 16obj-$(CONFIG_SMP) += platsmp.o headsmp.o
17obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 17obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
18obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
19obj-$(CONFIG_U5500_MODEM_IRQ) += modem-irq-db5500.o 18obj-$(CONFIG_U5500_MODEM_IRQ) += modem-irq-db5500.o
20obj-$(CONFIG_U5500_MBOX) += mbox-db5500.o 19obj-$(CONFIG_U5500_MBOX) += mbox-db5500.o
21 20
diff --git a/arch/arm/mach-ux500/Makefile.boot b/arch/arm/mach-ux500/Makefile.boot
index ff0a4b5b0a82..dd5cd00e2554 100644
--- a/arch/arm/mach-ux500/Makefile.boot
+++ b/arch/arm/mach-ux500/Makefile.boot
@@ -2,3 +2,4 @@
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
5dtb-$(CONFIG_MACH_SNOWBALL) += snowball.dtb
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c
index 5dde4d4ebe88..479ebe04cf9c 100644
--- a/arch/arm/mach-ux500/board-mop500-sdi.c
+++ b/arch/arm/mach-ux500/board-mop500-sdi.c
@@ -104,7 +104,7 @@ static struct mmci_platform_data mop500_sdi0_data = {
104#endif 104#endif
105}; 105};
106 106
107static void sdi0_configure(void) 107static void sdi0_configure(struct device *parent)
108{ 108{
109 int ret; 109 int ret;
110 110
@@ -123,15 +123,15 @@ static void sdi0_configure(void)
123 gpio_direction_output(sdi0_en, 1); 123 gpio_direction_output(sdi0_en, 1);
124 124
125 /* Add the device, force v2 to subrevision 1 */ 125 /* Add the device, force v2 to subrevision 1 */
126 db8500_add_sdi0(&mop500_sdi0_data, U8500_SDI_V2_PERIPHID); 126 db8500_add_sdi0(parent, &mop500_sdi0_data, U8500_SDI_V2_PERIPHID);
127} 127}
128 128
129void mop500_sdi_tc35892_init(void) 129void mop500_sdi_tc35892_init(struct device *parent)
130{ 130{
131 mop500_sdi0_data.gpio_cd = GPIO_SDMMC_CD; 131 mop500_sdi0_data.gpio_cd = GPIO_SDMMC_CD;
132 sdi0_en = GPIO_SDMMC_EN; 132 sdi0_en = GPIO_SDMMC_EN;
133 sdi0_vsel = GPIO_SDMMC_1V8_3V_SEL; 133 sdi0_vsel = GPIO_SDMMC_1V8_3V_SEL;
134 sdi0_configure(); 134 sdi0_configure(parent);
135} 135}
136 136
137/* 137/*
@@ -246,12 +246,13 @@ static struct mmci_platform_data mop500_sdi4_data = {
246#endif 246#endif
247}; 247};
248 248
249void __init mop500_sdi_init(void) 249void __init mop500_sdi_init(struct device *parent)
250{ 250{
251 /* PoP:ed eMMC */ 251 /* PoP:ed eMMC */
252 db8500_add_sdi2(&mop500_sdi2_data, U8500_SDI_V2_PERIPHID); 252 db8500_add_sdi2(parent, &mop500_sdi2_data, U8500_SDI_V2_PERIPHID);
253 /* On-board eMMC */ 253 /* On-board eMMC */
254 db8500_add_sdi4(&mop500_sdi4_data, U8500_SDI_V2_PERIPHID); 254 db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
255
255 /* 256 /*
256 * On boards with the TC35892 GPIO expander, sdi0 will finally 257 * On boards with the TC35892 GPIO expander, sdi0 will finally
257 * be added when the TC35892 initializes and calls 258 * be added when the TC35892 initializes and calls
@@ -259,31 +260,31 @@ void __init mop500_sdi_init(void)
259 */ 260 */
260} 261}
261 262
262void __init snowball_sdi_init(void) 263void __init snowball_sdi_init(struct device *parent)
263{ 264{
264 /* On Snowball MMC_CAP_SD_HIGHSPEED isn't supported (Hardware issue?) */ 265 /* On Snowball MMC_CAP_SD_HIGHSPEED isn't supported (Hardware issue?) */
265 mop500_sdi0_data.capabilities &= ~MMC_CAP_SD_HIGHSPEED; 266 mop500_sdi0_data.capabilities &= ~MMC_CAP_SD_HIGHSPEED;
266 /* On-board eMMC */ 267 /* On-board eMMC */
267 db8500_add_sdi4(&mop500_sdi4_data, U8500_SDI_V2_PERIPHID); 268 db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
268 /* External Micro SD slot */ 269 /* External Micro SD slot */
269 mop500_sdi0_data.gpio_cd = SNOWBALL_SDMMC_CD_GPIO; 270 mop500_sdi0_data.gpio_cd = SNOWBALL_SDMMC_CD_GPIO;
270 mop500_sdi0_data.cd_invert = true; 271 mop500_sdi0_data.cd_invert = true;
271 sdi0_en = SNOWBALL_SDMMC_EN_GPIO; 272 sdi0_en = SNOWBALL_SDMMC_EN_GPIO;
272 sdi0_vsel = SNOWBALL_SDMMC_1V8_3V_GPIO; 273 sdi0_vsel = SNOWBALL_SDMMC_1V8_3V_GPIO;
273 sdi0_configure(); 274 sdi0_configure(parent);
274} 275}
275 276
276void __init hrefv60_sdi_init(void) 277void __init hrefv60_sdi_init(struct device *parent)
277{ 278{
278 /* PoP:ed eMMC */ 279 /* PoP:ed eMMC */
279 db8500_add_sdi2(&mop500_sdi2_data, U8500_SDI_V2_PERIPHID); 280 db8500_add_sdi2(parent, &mop500_sdi2_data, U8500_SDI_V2_PERIPHID);
280 /* On-board eMMC */ 281 /* On-board eMMC */
281 db8500_add_sdi4(&mop500_sdi4_data, U8500_SDI_V2_PERIPHID); 282 db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
282 /* External Micro SD slot */ 283 /* External Micro SD slot */
283 mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO; 284 mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO;
284 sdi0_en = HREFV60_SDMMC_EN_GPIO; 285 sdi0_en = HREFV60_SDMMC_EN_GPIO;
285 sdi0_vsel = HREFV60_SDMMC_1V8_3V_GPIO; 286 sdi0_vsel = HREFV60_SDMMC_1V8_3V_GPIO;
286 sdi0_configure(); 287 sdi0_configure(parent);
287 /* WLAN SDIO channel */ 288 /* WLAN SDIO channel */
288 db8500_add_sdi1(&mop500_sdi1_data, U8500_SDI_V2_PERIPHID); 289 db8500_add_sdi1(parent, &mop500_sdi1_data, U8500_SDI_V2_PERIPHID);
289} 290}
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 5c00712907d1..d0799d592218 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -30,6 +30,9 @@
30#include <linux/gpio_keys.h> 30#include <linux/gpio_keys.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32 32
33#include <linux/of.h>
34#include <linux/of_platform.h>
35
33#include <linux/leds.h> 36#include <linux/leds.h>
34#include <asm/mach-types.h> 37#include <asm/mach-types.h>
35#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
@@ -226,7 +229,12 @@ static struct tps6105x_platform_data mop500_tps61052_data = {
226 229
227static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base) 230static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
228{ 231{
229 mop500_sdi_tc35892_init(); 232 struct device *parent = NULL;
233#if 0
234 /* FIXME: Is the sdi actually part of tc3589x? */
235 parent = tc3589x->dev;
236#endif
237 mop500_sdi_tc35892_init(parent);
230} 238}
231 239
232static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = { 240static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
@@ -353,12 +361,12 @@ U8500_I2C_CONTROLLER(1, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
353U8500_I2C_CONTROLLER(2, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); 361U8500_I2C_CONTROLLER(2, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
354U8500_I2C_CONTROLLER(3, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); 362U8500_I2C_CONTROLLER(3, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
355 363
356static void __init mop500_i2c_init(void) 364static void __init mop500_i2c_init(struct device *parent)
357{ 365{
358 db8500_add_i2c0(&u8500_i2c0_data); 366 db8500_add_i2c0(parent, &u8500_i2c0_data);
359 db8500_add_i2c1(&u8500_i2c1_data); 367 db8500_add_i2c1(parent, &u8500_i2c1_data);
360 db8500_add_i2c2(&u8500_i2c2_data); 368 db8500_add_i2c2(parent, &u8500_i2c2_data);
361 db8500_add_i2c3(&u8500_i2c3_data); 369 db8500_add_i2c3(parent, &u8500_i2c3_data);
362} 370}
363 371
364static struct gpio_keys_button mop500_gpio_keys[] = { 372static struct gpio_keys_button mop500_gpio_keys[] = {
@@ -435,7 +443,7 @@ static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
435}; 443};
436#endif 444#endif
437 445
438static struct pl022_ssp_controller ssp0_platform_data = { 446static struct pl022_ssp_controller ssp0_plat = {
439 .bus_id = 0, 447 .bus_id = 0,
440#ifdef CONFIG_STE_DMA40 448#ifdef CONFIG_STE_DMA40
441 .enable_dma = 1, 449 .enable_dma = 1,
@@ -451,9 +459,9 @@ static struct pl022_ssp_controller ssp0_platform_data = {
451 .num_chipselect = 5, 459 .num_chipselect = 5,
452}; 460};
453 461
454static void __init mop500_spi_init(void) 462static void __init mop500_spi_init(struct device *parent)
455{ 463{
456 db8500_add_ssp0(&ssp0_platform_data); 464 db8500_add_ssp0(parent, &ssp0_plat);
457} 465}
458 466
459#ifdef CONFIG_STE_DMA40 467#ifdef CONFIG_STE_DMA40
@@ -587,11 +595,11 @@ static struct amba_pl011_data uart2_plat = {
587#endif 595#endif
588}; 596};
589 597
590static void __init mop500_uart_init(void) 598static void __init mop500_uart_init(struct device *parent)
591{ 599{
592 db8500_add_uart0(&uart0_plat); 600 db8500_add_uart0(parent, &uart0_plat);
593 db8500_add_uart1(&uart1_plat); 601 db8500_add_uart1(parent, &uart1_plat);
594 db8500_add_uart2(&uart2_plat); 602 db8500_add_uart2(parent, &uart2_plat);
595} 603}
596 604
597static struct platform_device *snowball_platform_devs[] __initdata = { 605static struct platform_device *snowball_platform_devs[] __initdata = {
@@ -603,21 +611,27 @@ static struct platform_device *snowball_platform_devs[] __initdata = {
603 611
604static void __init mop500_init_machine(void) 612static void __init mop500_init_machine(void)
605{ 613{
614 struct device *parent = NULL;
606 int i2c0_devs; 615 int i2c0_devs;
616 int i;
607 617
608 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; 618 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
609 619
610 u8500_init_devices(); 620 parent = u8500_init_devices();
611 621
612 mop500_pins_init(); 622 mop500_pins_init();
613 623
624 /* FIXME: parent of ab8500 should be prcmu */
625 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
626 mop500_platform_devs[i]->dev.parent = parent;
627
614 platform_add_devices(mop500_platform_devs, 628 platform_add_devices(mop500_platform_devs,
615 ARRAY_SIZE(mop500_platform_devs)); 629 ARRAY_SIZE(mop500_platform_devs));
616 630
617 mop500_i2c_init(); 631 mop500_i2c_init(parent);
618 mop500_sdi_init(); 632 mop500_sdi_init(parent);
619 mop500_spi_init(); 633 mop500_spi_init(parent);
620 mop500_uart_init(); 634 mop500_uart_init(parent);
621 635
622 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); 636 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
623 637
@@ -631,19 +645,24 @@ static void __init mop500_init_machine(void)
631 645
632static void __init snowball_init_machine(void) 646static void __init snowball_init_machine(void)
633{ 647{
648 struct device *parent = NULL;
634 int i2c0_devs; 649 int i2c0_devs;
650 int i;
635 651
636 u8500_init_devices(); 652 parent = u8500_init_devices();
637 653
638 snowball_pins_init(); 654 snowball_pins_init();
639 655
656 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
657 snowball_platform_devs[i]->dev.parent = parent;
658
640 platform_add_devices(snowball_platform_devs, 659 platform_add_devices(snowball_platform_devs,
641 ARRAY_SIZE(snowball_platform_devs)); 660 ARRAY_SIZE(snowball_platform_devs));
642 661
643 mop500_i2c_init(); 662 mop500_i2c_init(parent);
644 snowball_sdi_init(); 663 snowball_sdi_init(parent);
645 mop500_spi_init(); 664 mop500_spi_init(parent);
646 mop500_uart_init(); 665 mop500_uart_init(parent);
647 666
648 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); 667 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
649 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); 668 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
@@ -656,7 +675,9 @@ static void __init snowball_init_machine(void)
656 675
657static void __init hrefv60_init_machine(void) 676static void __init hrefv60_init_machine(void)
658{ 677{
678 struct device *parent = NULL;
659 int i2c0_devs; 679 int i2c0_devs;
680 int i;
660 681
661 /* 682 /*
662 * The HREFv60 board removed a GPIO expander and routed 683 * The HREFv60 board removed a GPIO expander and routed
@@ -665,17 +686,20 @@ static void __init hrefv60_init_machine(void)
665 */ 686 */
666 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; 687 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
667 688
668 u8500_init_devices(); 689 parent = u8500_init_devices();
669 690
670 hrefv60_pins_init(); 691 hrefv60_pins_init();
671 692
693 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
694 mop500_platform_devs[i]->dev.parent = parent;
695
672 platform_add_devices(mop500_platform_devs, 696 platform_add_devices(mop500_platform_devs,
673 ARRAY_SIZE(mop500_platform_devs)); 697 ARRAY_SIZE(mop500_platform_devs));
674 698
675 mop500_i2c_init(); 699 mop500_i2c_init(parent);
676 hrefv60_sdi_init(); 700 hrefv60_sdi_init(parent);
677 mop500_spi_init(); 701 mop500_spi_init(parent);
678 mop500_uart_init(); 702 mop500_uart_init(parent);
679 703
680 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); 704 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
681 705
@@ -718,3 +742,94 @@ MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
718 .handle_irq = gic_handle_irq, 742 .handle_irq = gic_handle_irq,
719 .init_machine = snowball_init_machine, 743 .init_machine = snowball_init_machine,
720MACHINE_END 744MACHINE_END
745
746#ifdef CONFIG_MACH_UX500_DT
747
748struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
749 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
750 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
751 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
752 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
753 {},
754};
755
756static const struct of_device_id u8500_soc_node[] = {
757 /* only create devices below soc node */
758 { .compatible = "stericsson,db8500", },
759 { },
760};
761
762static void __init u8500_init_machine(void)
763{
764 struct device *parent = NULL;
765 int i2c0_devs;
766 int i;
767
768 parent = u8500_init_devices();
769 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
770
771 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
772 mop500_platform_devs[i]->dev.parent = parent;
773 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
774 snowball_platform_devs[i]->dev.parent = parent;
775
776 /* automatically probe child nodes of db8500 device */
777 of_platform_populate(NULL, u8500_soc_node, u8500_auxdata_lookup, parent);
778
779 if (of_machine_is_compatible("st-ericsson,mop500")) {
780 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
781 mop500_pins_init();
782
783 platform_add_devices(mop500_platform_devs,
784 ARRAY_SIZE(mop500_platform_devs));
785
786 mop500_sdi_init(parent);
787 } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
788 snowball_pins_init();
789 platform_add_devices(snowball_platform_devs,
790 ARRAY_SIZE(snowball_platform_devs));
791
792 snowball_sdi_init(parent);
793 } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
794 /*
795 * The HREFv60 board removed a GPIO expander and routed
796 * all these GPIO pins to the internal GPIO controller
797 * instead.
798 */
799 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
800 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
801 hrefv60_pins_init();
802 platform_add_devices(mop500_platform_devs,
803 ARRAY_SIZE(mop500_platform_devs));
804
805 hrefv60_sdi_init(parent);
806 }
807 mop500_i2c_init(parent);
808
809 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
810 i2c_register_board_info(2, mop500_i2c2_devices,
811 ARRAY_SIZE(mop500_i2c2_devices));
812
813 /* This board has full regulator constraints */
814 regulator_has_full_constraints();
815}
816
817static const char * u8500_dt_board_compat[] = {
818 "calaosystems,snowball-a9500",
819 "st-ericsson,hrefv60+",
820 "st-ericsson,u8500",
821 "st-ericsson,mop500",
822 NULL,
823};
824
825
826DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)")
827 .map_io = u8500_map_io,
828 .init_irq = ux500_init_irq,
829 /* we re-use nomadik timer here */
830 .timer = &ux500_timer,
831 .handle_irq = gic_handle_irq,
832 .init_machine = u8500_init_machine,
833 .dt_compat = u8500_dt_board_compat,
834MACHINE_END
835#endif
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index f926d3db6207..3d594c24bfee 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -75,10 +75,10 @@
75 75
76struct i2c_board_info; 76struct i2c_board_info;
77 77
78extern void mop500_sdi_init(void); 78extern void mop500_sdi_init(struct device *parent);
79extern void snowball_sdi_init(void); 79extern void snowball_sdi_init(struct device *parent);
80extern void hrefv60_sdi_init(void); 80extern void hrefv60_sdi_init(struct device *parent);
81extern void mop500_sdi_tc35892_init(void); 81extern void mop500_sdi_tc35892_init(struct device *parent);
82void __init mop500_u8500uib_init(void); 82void __init mop500_u8500uib_init(void);
83void __init mop500_stuib_init(void); 83void __init mop500_stuib_init(void);
84void __init mop500_pins_init(void); 84void __init mop500_pins_init(void);
diff --git a/arch/arm/mach-ux500/board-u5500-sdi.c b/arch/arm/mach-ux500/board-u5500-sdi.c
index 63c3f8058ffc..836112eedde7 100644
--- a/arch/arm/mach-ux500/board-u5500-sdi.c
+++ b/arch/arm/mach-ux500/board-u5500-sdi.c
@@ -66,9 +66,9 @@ static struct mmci_platform_data u5500_sdi0_data = {
66#endif 66#endif
67}; 67};
68 68
69void __init u5500_sdi_init(void) 69void __init u5500_sdi_init(struct device *parent)
70{ 70{
71 nmk_config_pins(u5500_sdi_pins, ARRAY_SIZE(u5500_sdi_pins)); 71 nmk_config_pins(u5500_sdi_pins, ARRAY_SIZE(u5500_sdi_pins));
72 72
73 db5500_add_sdi0(&u5500_sdi0_data); 73 db5500_add_sdi0(parent, &u5500_sdi0_data);
74} 74}
diff --git a/arch/arm/mach-ux500/board-u5500.c b/arch/arm/mach-ux500/board-u5500.c
index 9de9e9c4dbbb..0ff4be72a809 100644
--- a/arch/arm/mach-ux500/board-u5500.c
+++ b/arch/arm/mach-ux500/board-u5500.c
@@ -97,9 +97,9 @@ static struct i2c_board_info __initdata u5500_i2c2_devices[] = {
97 }, 97 },
98}; 98};
99 99
100static void __init u5500_i2c_init(void) 100static void __init u5500_i2c_init(struct device *parent)
101{ 101{
102 db5500_add_i2c2(&u5500_i2c2_data); 102 db5500_add_i2c2(parent, &u5500_i2c2_data);
103 i2c_register_board_info(2, ARRAY_AND_SIZE(u5500_i2c2_devices)); 103 i2c_register_board_info(2, ARRAY_AND_SIZE(u5500_i2c2_devices));
104} 104}
105 105
@@ -126,20 +126,27 @@ static struct platform_device *u5500_platform_devices[] __initdata = {
126 &ab5500_device, 126 &ab5500_device,
127}; 127};
128 128
129static void __init u5500_uart_init(void) 129static void __init u5500_uart_init(struct device *parent)
130{ 130{
131 db5500_add_uart0(NULL); 131 db5500_add_uart0(parent, NULL);
132 db5500_add_uart1(NULL); 132 db5500_add_uart1(parent, NULL);
133 db5500_add_uart2(NULL); 133 db5500_add_uart2(parent, NULL);
134} 134}
135 135
136static void __init u5500_init_machine(void) 136static void __init u5500_init_machine(void)
137{ 137{
138 u5500_init_devices(); 138 struct device *parent = NULL;
139 int i;
140
141 parent = u5500_init_devices();
139 nmk_config_pins(u5500_pins, ARRAY_SIZE(u5500_pins)); 142 nmk_config_pins(u5500_pins, ARRAY_SIZE(u5500_pins));
140 u5500_i2c_init(); 143
141 u5500_sdi_init(); 144 u5500_i2c_init(parent);
142 u5500_uart_init(); 145 u5500_sdi_init(parent);
146 u5500_uart_init(parent);
147
148 for (i = 0; i < ARRAY_SIZE(u5500_platform_devices); i++)
149 u5500_platform_devices[i]->dev.parent = parent;
143 150
144 platform_add_devices(u5500_platform_devices, 151 platform_add_devices(u5500_platform_devices,
145 ARRAY_SIZE(u5500_platform_devices)); 152 ARRAY_SIZE(u5500_platform_devices));
diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.c
index da5569d83d58..77a75ed0df67 100644
--- a/arch/arm/mach-ux500/cache-l2x0.c
+++ b/arch/arm/mach-ux500/cache-l2x0.c
@@ -5,6 +5,8 @@
5 */ 5 */
6 6
7#include <linux/io.h> 7#include <linux/io.h>
8#include <linux/of.h>
9
8#include <asm/cacheflush.h> 10#include <asm/cacheflush.h>
9#include <asm/hardware/cache-l2x0.h> 11#include <asm/hardware/cache-l2x0.h>
10#include <mach/hardware.h> 12#include <mach/hardware.h>
@@ -45,7 +47,10 @@ static int __init ux500_l2x0_init(void)
45 ux500_l2x0_unlock(); 47 ux500_l2x0_unlock();
46 48
47 /* 64KB way size, 8 way associativity, force WA */ 49 /* 64KB way size, 8 way associativity, force WA */
48 l2x0_init(l2x0_base, 0x3e060000, 0xc0000fff); 50 if (of_have_populated_dt())
51 l2x0_of_init(0x3e060000, 0xc0000fff);
52 else
53 l2x0_init(l2x0_base, 0x3e060000, 0xc0000fff);
49 54
50 /* 55 /*
51 * We can't disable l2 as we are in non secure mode, currently 56 * We can't disable l2 as we are in non secure mode, currently
diff --git a/arch/arm/mach-ux500/cpu-db5500.c b/arch/arm/mach-ux500/cpu-db5500.c
index 18aa5c05c69e..bca47f32082f 100644
--- a/arch/arm/mach-ux500/cpu-db5500.c
+++ b/arch/arm/mach-ux500/cpu-db5500.c
@@ -147,13 +147,13 @@ static resource_size_t __initdata db5500_gpio_base[] = {
147 U5500_GPIOBANK7_BASE, 147 U5500_GPIOBANK7_BASE,
148}; 148};
149 149
150static void __init db5500_add_gpios(void) 150static void __init db5500_add_gpios(struct device *parent)
151{ 151{
152 struct nmk_gpio_platform_data pdata = { 152 struct nmk_gpio_platform_data pdata = {
153 /* No custom data yet */ 153 /* No custom data yet */
154 }; 154 };
155 155
156 dbx500_add_gpios(ARRAY_AND_SIZE(db5500_gpio_base), 156 dbx500_add_gpios(parent, ARRAY_AND_SIZE(db5500_gpio_base),
157 IRQ_DB5500_GPIO0, &pdata); 157 IRQ_DB5500_GPIO0, &pdata);
158} 158}
159 159
@@ -212,14 +212,36 @@ static int usb_db5500_tx_dma_cfg[] = {
212 DB5500_DMA_DEV38_USB_OTG_OEP_8 212 DB5500_DMA_DEV38_USB_OTG_OEP_8
213}; 213};
214 214
215void __init u5500_init_devices(void) 215static const char *db5500_read_soc_id(void)
216{ 216{
217 db5500_add_gpios(); 217 return kasprintf(GFP_KERNEL, "u5500 currently unsupported\n");
218}
219
220static struct device * __init db5500_soc_device_init(void)
221{
222 const char *soc_id = db5500_read_soc_id();
223
224 return ux500_soc_device_init(soc_id);
225}
226
227struct device * __init u5500_init_devices(void)
228{
229 struct device *parent;
230 int i;
231
232 parent = db5500_soc_device_init();
233
234 db5500_add_gpios(parent);
218 db5500_pmu_init(); 235 db5500_pmu_init();
219 db5500_dma_init(); 236 db5500_dma_init(parent);
220 db5500_add_rtc(); 237 db5500_add_rtc(parent);
221 db5500_add_usb(usb_db5500_rx_dma_cfg, usb_db5500_tx_dma_cfg); 238 db5500_add_usb(parent, usb_db5500_rx_dma_cfg, usb_db5500_tx_dma_cfg);
239
240 for (i = 0; i < ARRAY_SIZE(db5500_platform_devs); i++)
241 db5500_platform_devs[i]->dev.parent = parent;
222 242
223 platform_add_devices(db5500_platform_devs, 243 platform_add_devices(db5500_platform_devs,
224 ARRAY_SIZE(db5500_platform_devs)); 244 ARRAY_SIZE(db5500_platform_devs));
245
246 return parent;
225} 247}
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 7176ee7491ab..9bd8163896cf 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -24,6 +24,7 @@
24#include <mach/setup.h> 24#include <mach/setup.h>
25#include <mach/devices.h> 25#include <mach/devices.h>
26#include <mach/usb.h> 26#include <mach/usb.h>
27#include <mach/db8500-regs.h>
27 28
28#include "devices-db8500.h" 29#include "devices-db8500.h"
29#include "ste-dma40-db8500.h" 30#include "ste-dma40-db8500.h"
@@ -132,13 +133,13 @@ static resource_size_t __initdata db8500_gpio_base[] = {
132 U8500_GPIOBANK8_BASE, 133 U8500_GPIOBANK8_BASE,
133}; 134};
134 135
135static void __init db8500_add_gpios(void) 136static void __init db8500_add_gpios(struct device *parent)
136{ 137{
137 struct nmk_gpio_platform_data pdata = { 138 struct nmk_gpio_platform_data pdata = {
138 .supports_sleepmode = true, 139 .supports_sleepmode = true,
139 }; 140 };
140 141
141 dbx500_add_gpios(ARRAY_AND_SIZE(db8500_gpio_base), 142 dbx500_add_gpios(parent, ARRAY_AND_SIZE(db8500_gpio_base),
142 IRQ_DB8500_GPIO0, &pdata); 143 IRQ_DB8500_GPIO0, &pdata);
143} 144}
144 145
@@ -164,17 +165,44 @@ static int usb_db8500_tx_dma_cfg[] = {
164 DB8500_DMA_DEV39_USB_OTG_OEP_8 165 DB8500_DMA_DEV39_USB_OTG_OEP_8
165}; 166};
166 167
168static const char *db8500_read_soc_id(void)
169{
170 void __iomem *uid = __io_address(U8500_BB_UID_BASE);
171
172 return kasprintf(GFP_KERNEL, "%08x%08x%08x%08x%08x",
173 readl((u32 *)uid+1),
174 readl((u32 *)uid+1), readl((u32 *)uid+2),
175 readl((u32 *)uid+3), readl((u32 *)uid+4));
176}
177
178static struct device * __init db8500_soc_device_init(void)
179{
180 const char *soc_id = db8500_read_soc_id();
181
182 return ux500_soc_device_init(soc_id);
183}
184
167/* 185/*
168 * This function is called from the board init 186 * This function is called from the board init
169 */ 187 */
170void __init u8500_init_devices(void) 188struct device * __init u8500_init_devices(void)
171{ 189{
172 db8500_add_rtc(); 190 struct device *parent;
173 db8500_add_gpios(); 191 int i;
174 db8500_add_usb(usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg); 192
193 parent = db8500_soc_device_init();
194
195 db8500_add_rtc(parent);
196 db8500_add_gpios(parent);
197 db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg);
198
199 platform_device_register_data(parent,
200 "cpufreq-u8500", -1, NULL, 0);
201
202 for (i = 0; i < ARRAY_SIZE(platform_devs); i++)
203 platform_devs[i]->dev.parent = parent;
175 204
176 platform_device_register_simple("cpufreq-u8500", -1, NULL, 0);
177 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); 205 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));
178 206
179 return ; 207 return parent;
180} 208}
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index f41857494375..d11f3892a27d 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -2,6 +2,7 @@
2 * Copyright (C) ST-Ericsson SA 2010 2 * Copyright (C) ST-Ericsson SA 2010
3 * 3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson 4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * Author: Lee Jones <lee.jones@linaro.org> for ST-Ericsson
5 * License terms: GNU General Public License (GPL) version 2 6 * License terms: GNU General Public License (GPL) version 2
6 */ 7 */
7 8
@@ -11,10 +12,15 @@
11#include <linux/mfd/db8500-prcmu.h> 12#include <linux/mfd/db8500-prcmu.h>
12#include <linux/mfd/db5500-prcmu.h> 13#include <linux/mfd/db5500-prcmu.h>
13#include <linux/clksrc-dbx500-prcmu.h> 14#include <linux/clksrc-dbx500-prcmu.h>
15#include <linux/sys_soc.h>
16#include <linux/err.h>
17#include <linux/slab.h>
18#include <linux/stat.h>
19#include <linux/of.h>
20#include <linux/of_irq.h>
14 21
15#include <asm/hardware/gic.h> 22#include <asm/hardware/gic.h>
16#include <asm/mach/map.h> 23#include <asm/mach/map.h>
17#include <asm/localtimer.h>
18 24
19#include <mach/hardware.h> 25#include <mach/hardware.h>
20#include <mach/setup.h> 26#include <mach/setup.h>
@@ -24,6 +30,11 @@
24 30
25void __iomem *_PRCMU_BASE; 31void __iomem *_PRCMU_BASE;
26 32
33static const struct of_device_id ux500_dt_irq_match[] = {
34 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
35 {},
36};
37
27void __init ux500_init_irq(void) 38void __init ux500_init_irq(void)
28{ 39{
29 void __iomem *dist_base; 40 void __iomem *dist_base;
@@ -38,7 +49,12 @@ void __init ux500_init_irq(void)
38 } else 49 } else
39 ux500_unknown_soc(); 50 ux500_unknown_soc();
40 51
41 gic_init(0, 29, dist_base, cpu_base); 52#ifdef CONFIG_OF
53 if (of_have_populated_dt())
54 of_irq_init(ux500_dt_irq_match);
55 else
56#endif
57 gic_init(0, 29, dist_base, cpu_base);
42 58
43 /* 59 /*
44 * Init clocks here so that they are available for system timer 60 * Init clocks here so that they are available for system timer
@@ -50,3 +66,73 @@ void __init ux500_init_irq(void)
50 db8500_prcmu_early_init(); 66 db8500_prcmu_early_init();
51 clk_init(); 67 clk_init();
52} 68}
69
70static const char * __init ux500_get_machine(void)
71{
72 return kasprintf(GFP_KERNEL, "DB%4x", dbx500_partnumber());
73}
74
75static const char * __init ux500_get_family(void)
76{
77 return kasprintf(GFP_KERNEL, "ux500");
78}
79
80static const char * __init ux500_get_revision(void)
81{
82 unsigned int rev = dbx500_revision();
83
84 if (rev == 0x01)
85 return kasprintf(GFP_KERNEL, "%s", "ED");
86 else if (rev >= 0xA0)
87 return kasprintf(GFP_KERNEL, "%d.%d",
88 (rev >> 4) - 0xA + 1, rev & 0xf);
89
90 return kasprintf(GFP_KERNEL, "%s", "Unknown");
91}
92
93static ssize_t ux500_get_process(struct device *dev,
94 struct device_attribute *attr,
95 char *buf)
96{
97 if (dbx500_id.process == 0x00)
98 return sprintf(buf, "Standard\n");
99
100 return sprintf(buf, "%02xnm\n", dbx500_id.process);
101}
102
103static void __init soc_info_populate(struct soc_device_attribute *soc_dev_attr,
104 const char *soc_id)
105{
106 soc_dev_attr->soc_id = soc_id;
107 soc_dev_attr->machine = ux500_get_machine();
108 soc_dev_attr->family = ux500_get_family();
109 soc_dev_attr->revision = ux500_get_revision();
110}
111
112struct device_attribute ux500_soc_attr =
113 __ATTR(process, S_IRUGO, ux500_get_process, NULL);
114
115struct device * __init ux500_soc_device_init(const char *soc_id)
116{
117 struct device *parent;
118 struct soc_device *soc_dev;
119 struct soc_device_attribute *soc_dev_attr;
120
121 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
122 if (!soc_dev_attr)
123 return ERR_PTR(-ENOMEM);
124
125 soc_info_populate(soc_dev_attr, soc_id);
126
127 soc_dev = soc_device_register(soc_dev_attr);
128 if (IS_ERR_OR_NULL(soc_dev)) {
129 kfree(soc_dev_attr);
130 return NULL;
131 }
132
133 parent = soc_device_to_device(soc_dev);
134 if (!IS_ERR_OR_NULL(parent))
135 device_create_file(parent, &ux500_soc_attr);
136
137 return parent;
138}
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c
index 898a64517b09..c5312a4b49f5 100644
--- a/arch/arm/mach-ux500/devices-common.c
+++ b/arch/arm/mach-ux500/devices-common.c
@@ -20,8 +20,9 @@
20#include "devices-common.h" 20#include "devices-common.h"
21 21
22struct amba_device * 22struct amba_device *
23dbx500_add_amba_device(const char *name, resource_size_t base, 23dbx500_add_amba_device(struct device *parent, const char *name,
24 int irq, void *pdata, unsigned int periphid) 24 resource_size_t base, int irq, void *pdata,
25 unsigned int periphid)
25{ 26{
26 struct amba_device *dev; 27 struct amba_device *dev;
27 int ret; 28 int ret;
@@ -39,6 +40,8 @@ dbx500_add_amba_device(const char *name, resource_size_t base,
39 40
40 dev->dev.platform_data = pdata; 41 dev->dev.platform_data = pdata;
41 42
43 dev->dev.parent = parent;
44
42 ret = amba_device_add(dev, &iomem_resource); 45 ret = amba_device_add(dev, &iomem_resource);
43 if (ret) { 46 if (ret) {
44 amba_device_put(dev); 47 amba_device_put(dev);
@@ -49,60 +52,7 @@ dbx500_add_amba_device(const char *name, resource_size_t base,
49} 52}
50 53
51static struct platform_device * 54static struct platform_device *
52dbx500_add_platform_device(const char *name, int id, void *pdata, 55dbx500_add_gpio(struct device *parent, int id, resource_size_t addr, int irq,
53 struct resource *res, int resnum)
54{
55 struct platform_device *dev;
56 int ret;
57
58 dev = platform_device_alloc(name, id);
59 if (!dev)
60 return ERR_PTR(-ENOMEM);
61
62 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
63 dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
64
65 ret = platform_device_add_resources(dev, res, resnum);
66 if (ret)
67 goto out_free;
68
69 dev->dev.platform_data = pdata;
70
71 ret = platform_device_add(dev);
72 if (ret)
73 goto out_free;
74
75 return dev;
76
77out_free:
78 platform_device_put(dev);
79 return ERR_PTR(ret);
80}
81
82struct platform_device *
83dbx500_add_platform_device_4k1irq(const char *name, int id,
84 resource_size_t base,
85 int irq, void *pdata)
86{
87 struct resource resources[] = {
88 [0] = {
89 .start = base,
90 .end = base + SZ_4K - 1,
91 .flags = IORESOURCE_MEM,
92 },
93 [1] = {
94 .start = irq,
95 .end = irq,
96 .flags = IORESOURCE_IRQ,
97 }
98 };
99
100 return dbx500_add_platform_device(name, id, pdata, resources,
101 ARRAY_SIZE(resources));
102}
103
104static struct platform_device *
105dbx500_add_gpio(int id, resource_size_t addr, int irq,
106 struct nmk_gpio_platform_data *pdata) 56 struct nmk_gpio_platform_data *pdata)
107{ 57{
108 struct resource resources[] = { 58 struct resource resources[] = {
@@ -118,13 +68,18 @@ dbx500_add_gpio(int id, resource_size_t addr, int irq,
118 } 68 }
119 }; 69 };
120 70
121 return platform_device_register_resndata(NULL, "gpio", id, 71 return platform_device_register_resndata(
122 resources, ARRAY_SIZE(resources), 72 parent,
123 pdata, sizeof(*pdata)); 73 "gpio",
74 id,
75 resources,
76 ARRAY_SIZE(resources),
77 pdata,
78 sizeof(*pdata));
124} 79}
125 80
126void dbx500_add_gpios(resource_size_t *base, int num, int irq, 81void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num,
127 struct nmk_gpio_platform_data *pdata) 82 int irq, struct nmk_gpio_platform_data *pdata)
128{ 83{
129 int first = 0; 84 int first = 0;
130 int i; 85 int i;
@@ -134,6 +89,6 @@ void dbx500_add_gpios(resource_size_t *base, int num, int irq,
134 pdata->first_irq = NOMADIK_GPIO_TO_IRQ(first); 89 pdata->first_irq = NOMADIK_GPIO_TO_IRQ(first);
135 pdata->num_gpio = 32; 90 pdata->num_gpio = 32;
136 91
137 dbx500_add_gpio(i, base[i], irq, pdata); 92 dbx500_add_gpio(parent, i, base[i], irq, pdata);
138 } 93 }
139} 94}
diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h
index 7825705033bf..39c74ec82add 100644
--- a/arch/arm/mach-ux500/devices-common.h
+++ b/arch/arm/mach-ux500/devices-common.h
@@ -8,80 +8,89 @@
8#ifndef __DEVICES_COMMON_H 8#ifndef __DEVICES_COMMON_H
9#define __DEVICES_COMMON_H 9#define __DEVICES_COMMON_H
10 10
11extern struct amba_device * 11#include <linux/platform_device.h>
12dbx500_add_amba_device(const char *name, resource_size_t base, 12#include <linux/dma-mapping.h>
13 int irq, void *pdata, unsigned int periphid); 13#include <linux/sys_soc.h>
14#include <plat/i2c.h>
14 15
15extern struct platform_device * 16extern struct amba_device *
16dbx500_add_platform_device_4k1irq(const char *name, int id, 17dbx500_add_amba_device(struct device *parent, const char *name,
17 resource_size_t base, 18 resource_size_t base, int irq, void *pdata,
18 int irq, void *pdata); 19 unsigned int periphid);
19 20
20struct spi_master_cntlr; 21struct spi_master_cntlr;
21 22
22static inline struct amba_device * 23static inline struct amba_device *
23dbx500_add_msp_spi(const char *name, resource_size_t base, int irq, 24dbx500_add_msp_spi(struct device *parent, const char *name,
25 resource_size_t base, int irq,
24 struct spi_master_cntlr *pdata) 26 struct spi_master_cntlr *pdata)
25{ 27{
26 return dbx500_add_amba_device(name, base, irq, pdata, 0); 28 return dbx500_add_amba_device(parent, name, base, irq,
29 pdata, 0);
27} 30}
28 31
29static inline struct amba_device * 32static inline struct amba_device *
30dbx500_add_spi(const char *name, resource_size_t base, int irq, 33dbx500_add_spi(struct device *parent, const char *name, resource_size_t base,
31 struct spi_master_cntlr *pdata, 34 int irq, struct spi_master_cntlr *pdata,
32 u32 periphid) 35 u32 periphid)
33{ 36{
34 return dbx500_add_amba_device(name, base, irq, pdata, periphid); 37 return dbx500_add_amba_device(parent, name, base, irq,
38 pdata, periphid);
35} 39}
36 40
37struct mmci_platform_data; 41struct mmci_platform_data;
38 42
39static inline struct amba_device * 43static inline struct amba_device *
40dbx500_add_sdi(const char *name, resource_size_t base, int irq, 44dbx500_add_sdi(struct device *parent, const char *name, resource_size_t base,
41 struct mmci_platform_data *pdata, 45 int irq, struct mmci_platform_data *pdata, u32 periphid)
42 u32 periphid)
43{ 46{
44 return dbx500_add_amba_device(name, base, irq, pdata, periphid); 47 return dbx500_add_amba_device(parent, name, base, irq,
48 pdata, periphid);
45} 49}
46 50
47struct amba_pl011_data; 51struct amba_pl011_data;
48 52
49static inline struct amba_device * 53static inline struct amba_device *
50dbx500_add_uart(const char *name, resource_size_t base, int irq, 54dbx500_add_uart(struct device *parent, const char *name, resource_size_t base,
51 struct amba_pl011_data *pdata) 55 int irq, struct amba_pl011_data *pdata)
52{ 56{
53 return dbx500_add_amba_device(name, base, irq, pdata, 0); 57 return dbx500_add_amba_device(parent, name, base, irq, pdata, 0);
54} 58}
55 59
56struct nmk_i2c_controller; 60struct nmk_i2c_controller;
57 61
58static inline struct platform_device * 62static inline struct platform_device *
59dbx500_add_i2c(int id, resource_size_t base, int irq, 63dbx500_add_i2c(struct device *parent, int id, resource_size_t base, int irq,
60 struct nmk_i2c_controller *pdata) 64 struct nmk_i2c_controller *data)
61{
62 return dbx500_add_platform_device_4k1irq("nmk-i2c", id, base, irq,
63 pdata);
64}
65
66struct msp_i2s_platform_data;
67
68static inline struct platform_device *
69dbx500_add_msp_i2s(int id, resource_size_t base, int irq,
70 struct msp_i2s_platform_data *pdata)
71{ 65{
72 return dbx500_add_platform_device_4k1irq("MSP_I2S", id, base, irq, 66 struct resource res[] = {
73 pdata); 67 DEFINE_RES_MEM(base, SZ_4K),
68 DEFINE_RES_IRQ(irq),
69 };
70
71 struct platform_device_info pdevinfo = {
72 .parent = parent,
73 .name = "nmk-i2c",
74 .id = id,
75 .res = res,
76 .num_res = ARRAY_SIZE(res),
77 .data = data,
78 .size_data = sizeof(*data),
79 .dma_mask = DMA_BIT_MASK(32),
80 };
81
82 return platform_device_register_full(&pdevinfo);
74} 83}
75 84
76static inline struct amba_device * 85static inline struct amba_device *
77dbx500_add_rtc(resource_size_t base, int irq) 86dbx500_add_rtc(struct device *parent, resource_size_t base, int irq)
78{ 87{
79 return dbx500_add_amba_device("rtc-pl031", base, irq, NULL, 0); 88 return dbx500_add_amba_device(parent, "rtc-pl031", base, irq, NULL, 0);
80} 89}
81 90
82struct nmk_gpio_platform_data; 91struct nmk_gpio_platform_data;
83 92
84void dbx500_add_gpios(resource_size_t *base, int num, int irq, 93void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num,
85 struct nmk_gpio_platform_data *pdata); 94 int irq, struct nmk_gpio_platform_data *pdata);
86 95
87#endif 96#endif
diff --git a/arch/arm/mach-ux500/devices-db5500.h b/arch/arm/mach-ux500/devices-db5500.h
index 0c4bccd02b90..e70955502c35 100644
--- a/arch/arm/mach-ux500/devices-db5500.h
+++ b/arch/arm/mach-ux500/devices-db5500.h
@@ -10,70 +10,90 @@
10 10
11#include "devices-common.h" 11#include "devices-common.h"
12 12
13#define db5500_add_i2c1(pdata) \ 13#define db5500_add_i2c1(parent, pdata) \
14 dbx500_add_i2c(1, U5500_I2C1_BASE, IRQ_DB5500_I2C1, pdata) 14 dbx500_add_i2c(parent, 1, U5500_I2C1_BASE, IRQ_DB5500_I2C1, pdata)
15#define db5500_add_i2c2(pdata) \ 15#define db5500_add_i2c2(parent, pdata) \
16 dbx500_add_i2c(2, U5500_I2C2_BASE, IRQ_DB5500_I2C2, pdata) 16 dbx500_add_i2c(parent, 2, U5500_I2C2_BASE, IRQ_DB5500_I2C2, pdata)
17#define db5500_add_i2c3(pdata) \ 17#define db5500_add_i2c3(parent, pdata) \
18 dbx500_add_i2c(3, U5500_I2C3_BASE, IRQ_DB5500_I2C3, pdata) 18 dbx500_add_i2c(parent, 3, U5500_I2C3_BASE, IRQ_DB5500_I2C3, pdata)
19 19
20#define db5500_add_msp0_i2s(pdata) \ 20#define db5500_add_msp0_spi(parent, pdata) \
21 dbx500_add_msp_i2s(0, U5500_MSP0_BASE, IRQ_DB5500_MSP0, pdata) 21 dbx500_add_msp_spi(parent, "msp0", U5500_MSP0_BASE, \
22#define db5500_add_msp1_i2s(pdata) \ 22 IRQ_DB5500_MSP0, pdata)
23 dbx500_add_msp_i2s(1, U5500_MSP1_BASE, IRQ_DB5500_MSP1, pdata) 23#define db5500_add_msp1_spi(parent, pdata) \
24#define db5500_add_msp2_i2s(pdata) \ 24 dbx500_add_msp_spi(parent, "msp1", U5500_MSP1_BASE, \
25 dbx500_add_msp_i2s(2, U5500_MSP2_BASE, IRQ_DB5500_MSP2, pdata) 25 IRQ_DB5500_MSP1, pdata)
26#define db5500_add_msp2_spi(parent, pdata) \
27 dbx500_add_msp_spi(parent, "msp2", U5500_MSP2_BASE, \
28 IRQ_DB5500_MSP2, pdata)
26 29
27#define db5500_add_msp0_spi(pdata) \ 30#define db5500_add_msp0_spi(parent, pdata) \
28 dbx500_add_msp_spi("msp0", U5500_MSP0_BASE, IRQ_DB5500_MSP0, pdata) 31 dbx500_add_msp_spi(parent, "msp0", U5500_MSP0_BASE, \
29#define db5500_add_msp1_spi(pdata) \ 32 IRQ_DB5500_MSP0, pdata)
30 dbx500_add_msp_spi("msp1", U5500_MSP1_BASE, IRQ_DB5500_MSP1, pdata) 33#define db5500_add_msp1_spi(parent, pdata) \
31#define db5500_add_msp2_spi(pdata) \ 34 dbx500_add_msp_spi(parent, "msp1", U5500_MSP1_BASE, \
32 dbx500_add_msp_spi("msp2", U5500_MSP2_BASE, IRQ_DB5500_MSP2, pdata) 35 IRQ_DB5500_MSP1, pdata)
36#define db5500_add_msp2_spi(parent, pdata) \
37 dbx500_add_msp_spi(parent, "msp2", U5500_MSP2_BASE, \
38 IRQ_DB5500_MSP2, pdata)
33 39
34#define db5500_add_rtc() \ 40#define db5500_add_rtc(parent) \
35 dbx500_add_rtc(U5500_RTC_BASE, IRQ_DB5500_RTC); 41 dbx500_add_rtc(parent, U5500_RTC_BASE, IRQ_DB5500_RTC);
36 42
37#define db5500_add_usb(rx_cfg, tx_cfg) \ 43#define db5500_add_usb(parent, rx_cfg, tx_cfg) \
38 ux500_add_usb(U5500_USBOTG_BASE, IRQ_DB5500_USBOTG, rx_cfg, tx_cfg) 44 ux500_add_usb(parent, U5500_USBOTG_BASE, \
45 IRQ_DB5500_USBOTG, rx_cfg, tx_cfg)
39 46
40#define db5500_add_sdi0(pdata) \ 47#define db5500_add_sdi0(parent, pdata) \
41 dbx500_add_sdi("sdi0", U5500_SDI0_BASE, IRQ_DB5500_SDMMC0, pdata, \ 48 dbx500_add_sdi(parent, "sdi0", U5500_SDI0_BASE, \
49 IRQ_DB5500_SDMMC0, pdata, \
42 0x10480180) 50 0x10480180)
43#define db5500_add_sdi1(pdata) \ 51#define db5500_add_sdi1(parent, pdata) \
44 dbx500_add_sdi("sdi1", U5500_SDI1_BASE, IRQ_DB5500_SDMMC1, pdata, \ 52 dbx500_add_sdi(parent, "sdi1", U5500_SDI1_BASE, \
53 IRQ_DB5500_SDMMC1, pdata, \
45 0x10480180) 54 0x10480180)
46#define db5500_add_sdi2(pdata) \ 55#define db5500_add_sdi2(parent, pdata) \
47 dbx500_add_sdi("sdi2", U5500_SDI2_BASE, IRQ_DB5500_SDMMC2, pdata \ 56 dbx500_add_sdi(parent, "sdi2", U5500_SDI2_BASE, \
57 IRQ_DB5500_SDMMC2, pdata \
48 0x10480180) 58 0x10480180)
49#define db5500_add_sdi3(pdata) \ 59#define db5500_add_sdi3(parent, pdata) \
50 dbx500_add_sdi("sdi3", U5500_SDI3_BASE, IRQ_DB5500_SDMMC3, pdata \ 60 dbx500_add_sdi(parent, "sdi3", U5500_SDI3_BASE, \
61 IRQ_DB5500_SDMMC3, pdata \
51 0x10480180) 62 0x10480180)
52#define db5500_add_sdi4(pdata) \ 63#define db5500_add_sdi4(parent, pdata) \
53 dbx500_add_sdi("sdi4", U5500_SDI4_BASE, IRQ_DB5500_SDMMC4, pdata \ 64 dbx500_add_sdi(parent, "sdi4", U5500_SDI4_BASE, \
65 IRQ_DB5500_SDMMC4, pdata \
54 0x10480180) 66 0x10480180)
55 67
56/* This one has a bad peripheral ID in the U5500 silicon */ 68/* This one has a bad peripheral ID in the U5500 silicon */
57#define db5500_add_spi0(pdata) \ 69#define db5500_add_spi0(parent, pdata) \
58 dbx500_add_spi("spi0", U5500_SPI0_BASE, IRQ_DB5500_SPI0, pdata, \ 70 dbx500_add_spi(parent, "spi0", U5500_SPI0_BASE, \
71 IRQ_DB5500_SPI0, pdata, \
59 0x10080023) 72 0x10080023)
60#define db5500_add_spi1(pdata) \ 73#define db5500_add_spi1(parent, pdata) \
61 dbx500_add_spi("spi1", U5500_SPI1_BASE, IRQ_DB5500_SPI1, pdata, \ 74 dbx500_add_spi(parent, "spi1", U5500_SPI1_BASE, \
75 IRQ_DB5500_SPI1, pdata, \
62 0x10080023) 76 0x10080023)
63#define db5500_add_spi2(pdata) \ 77#define db5500_add_spi2(parent, pdata) \
64 dbx500_add_spi("spi2", U5500_SPI2_BASE, IRQ_DB5500_SPI2, pdata \ 78 dbx500_add_spi(parent, "spi2", U5500_SPI2_BASE, \
79 IRQ_DB5500_SPI2, pdata \
65 0x10080023) 80 0x10080023)
66#define db5500_add_spi3(pdata) \ 81#define db5500_add_spi3(parent, pdata) \
67 dbx500_add_spi("spi3", U5500_SPI3_BASE, IRQ_DB5500_SPI3, pdata \ 82 dbx500_add_spi(parent, "spi3", U5500_SPI3_BASE, \
83 IRQ_DB5500_SPI3, pdata \
68 0x10080023) 84 0x10080023)
69 85
70#define db5500_add_uart0(plat) \ 86#define db5500_add_uart0(parent, plat) \
71 dbx500_add_uart("uart0", U5500_UART0_BASE, IRQ_DB5500_UART0, plat) 87 dbx500_add_uart(parent, "uart0", U5500_UART0_BASE, \
72#define db5500_add_uart1(plat) \ 88 IRQ_DB5500_UART0, plat)
73 dbx500_add_uart("uart1", U5500_UART1_BASE, IRQ_DB5500_UART1, plat) 89#define db5500_add_uart1(parent, plat) \
74#define db5500_add_uart2(plat) \ 90 dbx500_add_uart(parent, "uart1", U5500_UART1_BASE, \
75 dbx500_add_uart("uart2", U5500_UART2_BASE, IRQ_DB5500_UART2, plat) 91 IRQ_DB5500_UART1, plat)
76#define db5500_add_uart3(plat) \ 92#define db5500_add_uart2(parent, plat) \
77 dbx500_add_uart("uart3", U5500_UART3_BASE, IRQ_DB5500_UART3, plat) 93 dbx500_add_uart(parent, "uart2", U5500_UART2_BASE, \
94 IRQ_DB5500_UART2, plat)
95#define db5500_add_uart3(parent, plat) \
96 dbx500_add_uart(parent, "uart3", U5500_UART3_BASE, \
97 IRQ_DB5500_UART3, plat)
78 98
79#endif 99#endif
diff --git a/arch/arm/mach-ux500/devices-db8500.h b/arch/arm/mach-ux500/devices-db8500.h
index cbd4a9ae8109..9fd93e9da529 100644
--- a/arch/arm/mach-ux500/devices-db8500.h
+++ b/arch/arm/mach-ux500/devices-db8500.h
@@ -14,88 +14,114 @@ struct ske_keypad_platform_data;
14struct pl022_ssp_controller; 14struct pl022_ssp_controller;
15 15
16static inline struct platform_device * 16static inline struct platform_device *
17db8500_add_ske_keypad(struct ske_keypad_platform_data *pdata) 17db8500_add_ske_keypad(struct device *parent,
18 struct ske_keypad_platform_data *pdata,
19 size_t size)
18{ 20{
19 return dbx500_add_platform_device_4k1irq("nmk-ske-keypad", -1, 21 struct resource resources[] = {
20 U8500_SKE_BASE, 22 DEFINE_RES_MEM(U8500_SKE_BASE, SZ_4K),
21 IRQ_DB8500_KB, pdata); 23 DEFINE_RES_IRQ(IRQ_DB8500_KB),
24 };
25
26 return platform_device_register_resndata(parent, "nmk-ske-keypad", -1,
27 resources, 2, pdata, size);
22} 28}
23 29
24static inline struct amba_device * 30static inline struct amba_device *
25db8500_add_ssp(const char *name, resource_size_t base, int irq, 31db8500_add_ssp(struct device *parent, const char *name, resource_size_t base,
26 struct pl022_ssp_controller *pdata) 32 int irq, struct pl022_ssp_controller *pdata)
27{ 33{
28 return dbx500_add_amba_device(name, base, irq, pdata, 0); 34 return dbx500_add_amba_device(parent, name, base, irq, pdata, 0);
29} 35}
30 36
31 37
32#define db8500_add_i2c0(pdata) \ 38#define db8500_add_i2c0(parent, pdata) \
33 dbx500_add_i2c(0, U8500_I2C0_BASE, IRQ_DB8500_I2C0, pdata) 39 dbx500_add_i2c(parent, 0, U8500_I2C0_BASE, IRQ_DB8500_I2C0, pdata)
34#define db8500_add_i2c1(pdata) \ 40#define db8500_add_i2c1(parent, pdata) \
35 dbx500_add_i2c(1, U8500_I2C1_BASE, IRQ_DB8500_I2C1, pdata) 41 dbx500_add_i2c(parent, 1, U8500_I2C1_BASE, IRQ_DB8500_I2C1, pdata)
36#define db8500_add_i2c2(pdata) \ 42#define db8500_add_i2c2(parent, pdata) \
37 dbx500_add_i2c(2, U8500_I2C2_BASE, IRQ_DB8500_I2C2, pdata) 43 dbx500_add_i2c(parent, 2, U8500_I2C2_BASE, IRQ_DB8500_I2C2, pdata)
38#define db8500_add_i2c3(pdata) \ 44#define db8500_add_i2c3(parent, pdata) \
39 dbx500_add_i2c(3, U8500_I2C3_BASE, IRQ_DB8500_I2C3, pdata) 45 dbx500_add_i2c(parent, 3, U8500_I2C3_BASE, IRQ_DB8500_I2C3, pdata)
40#define db8500_add_i2c4(pdata) \ 46#define db8500_add_i2c4(parent, pdata) \
41 dbx500_add_i2c(4, U8500_I2C4_BASE, IRQ_DB8500_I2C4, pdata) 47 dbx500_add_i2c(parent, 4, U8500_I2C4_BASE, IRQ_DB8500_I2C4, pdata)
42 48
43#define db8500_add_msp0_i2s(pdata) \ 49#define db8500_add_msp0_i2s(parent, pdata) \
44 dbx500_add_msp_i2s(0, U8500_MSP0_BASE, IRQ_DB8500_MSP0, pdata) 50 dbx500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0, pdata)
45#define db8500_add_msp1_i2s(pdata) \ 51#define db8500_add_msp1_i2s(parent, pdata) \
46 dbx500_add_msp_i2s(1, U8500_MSP1_BASE, IRQ_DB8500_MSP1, pdata) 52 dbx500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1, pdata)
47#define db8500_add_msp2_i2s(pdata) \ 53#define db8500_add_msp2_i2s(parent, pdata) \
48 dbx500_add_msp_i2s(2, U8500_MSP2_BASE, IRQ_DB8500_MSP2, pdata) 54 dbx500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2, pdata)
49#define db8500_add_msp3_i2s(pdata) \ 55#define db8500_add_msp3_i2s(parent, pdata) \
50 dbx500_add_msp_i2s(3, U8500_MSP3_BASE, IRQ_DB8500_MSP1, pdata) 56 dbx500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1, pdata)
51 57
52#define db8500_add_msp0_spi(pdata) \ 58#define db8500_add_msp0_spi(parent, pdata) \
53 dbx500_add_msp_spi("msp0", U8500_MSP0_BASE, IRQ_DB8500_MSP0, pdata) 59 dbx500_add_msp_spi(parent, "msp0", U8500_MSP0_BASE, \
54#define db8500_add_msp1_spi(pdata) \ 60 IRQ_DB8500_MSP0, pdata)
55 dbx500_add_msp_spi("msp1", U8500_MSP1_BASE, IRQ_DB8500_MSP1, pdata) 61#define db8500_add_msp1_spi(parent, pdata) \
56#define db8500_add_msp2_spi(pdata) \ 62 dbx500_add_msp_spi(parent, "msp1", U8500_MSP1_BASE, \
57 dbx500_add_msp_spi("msp2", U8500_MSP2_BASE, IRQ_DB8500_MSP2, pdata) 63 IRQ_DB8500_MSP1, pdata)
58#define db8500_add_msp3_spi(pdata) \ 64#define db8500_add_msp2_spi(parent, pdata) \
59 dbx500_add_msp_spi("msp3", U8500_MSP3_BASE, IRQ_DB8500_MSP1, pdata) 65 dbx500_add_msp_spi(parent, "msp2", U8500_MSP2_BASE, \
60 66 IRQ_DB8500_MSP2, pdata)
61#define db8500_add_rtc() \ 67#define db8500_add_msp3_spi(parent, pdata) \
62 dbx500_add_rtc(U8500_RTC_BASE, IRQ_DB8500_RTC); 68 dbx500_add_msp_spi(parent, "msp3", U8500_MSP3_BASE, \
63 69 IRQ_DB8500_MSP1, pdata)
64#define db8500_add_usb(rx_cfg, tx_cfg) \ 70
65 ux500_add_usb(U8500_USBOTG_BASE, IRQ_DB8500_USBOTG, rx_cfg, tx_cfg) 71#define db8500_add_rtc(parent) \
66 72 dbx500_add_rtc(parent, U8500_RTC_BASE, IRQ_DB8500_RTC);
67#define db8500_add_sdi0(pdata, pid) \ 73
68 dbx500_add_sdi("sdi0", U8500_SDI0_BASE, IRQ_DB8500_SDMMC0, pdata, pid) 74#define db8500_add_usb(parent, rx_cfg, tx_cfg) \
69#define db8500_add_sdi1(pdata, pid) \ 75 ux500_add_usb(parent, U8500_USBOTG_BASE, \
70 dbx500_add_sdi("sdi1", U8500_SDI1_BASE, IRQ_DB8500_SDMMC1, pdata, pid) 76 IRQ_DB8500_USBOTG, rx_cfg, tx_cfg)
71#define db8500_add_sdi2(pdata, pid) \ 77
72 dbx500_add_sdi("sdi2", U8500_SDI2_BASE, IRQ_DB8500_SDMMC2, pdata, pid) 78#define db8500_add_sdi0(parent, pdata, pid) \
73#define db8500_add_sdi3(pdata, pid) \ 79 dbx500_add_sdi(parent, "sdi0", U8500_SDI0_BASE, \
74 dbx500_add_sdi("sdi3", U8500_SDI3_BASE, IRQ_DB8500_SDMMC3, pdata, pid) 80 IRQ_DB8500_SDMMC0, pdata, pid)
75#define db8500_add_sdi4(pdata, pid) \ 81#define db8500_add_sdi1(parent, pdata, pid) \
76 dbx500_add_sdi("sdi4", U8500_SDI4_BASE, IRQ_DB8500_SDMMC4, pdata, pid) 82 dbx500_add_sdi(parent, "sdi1", U8500_SDI1_BASE, \
77#define db8500_add_sdi5(pdata, pid) \ 83 IRQ_DB8500_SDMMC1, pdata, pid)
78 dbx500_add_sdi("sdi5", U8500_SDI5_BASE, IRQ_DB8500_SDMMC5, pdata, pid) 84#define db8500_add_sdi2(parent, pdata, pid) \
79 85 dbx500_add_sdi(parent, "sdi2", U8500_SDI2_BASE, \
80#define db8500_add_ssp0(pdata) \ 86 IRQ_DB8500_SDMMC2, pdata, pid)
81 db8500_add_ssp("ssp0", U8500_SSP0_BASE, IRQ_DB8500_SSP0, pdata) 87#define db8500_add_sdi3(parent, pdata, pid) \
82#define db8500_add_ssp1(pdata) \ 88 dbx500_add_sdi(parent, "sdi3", U8500_SDI3_BASE, \
83 db8500_add_ssp("ssp1", U8500_SSP1_BASE, IRQ_DB8500_SSP1, pdata) 89 IRQ_DB8500_SDMMC3, pdata, pid)
84 90#define db8500_add_sdi4(parent, pdata, pid) \
85#define db8500_add_spi0(pdata) \ 91 dbx500_add_sdi(parent, "sdi4", U8500_SDI4_BASE, \
86 dbx500_add_spi("spi0", U8500_SPI0_BASE, IRQ_DB8500_SPI0, pdata, 0) 92 IRQ_DB8500_SDMMC4, pdata, pid)
87#define db8500_add_spi1(pdata) \ 93#define db8500_add_sdi5(parent, pdata, pid) \
88 dbx500_add_spi("spi1", U8500_SPI1_BASE, IRQ_DB8500_SPI1, pdata, 0) 94 dbx500_add_sdi(parent, "sdi5", U8500_SDI5_BASE, \
89#define db8500_add_spi2(pdata) \ 95 IRQ_DB8500_SDMMC5, pdata, pid)
90 dbx500_add_spi("spi2", U8500_SPI2_BASE, IRQ_DB8500_SPI2, pdata, 0) 96
91#define db8500_add_spi3(pdata) \ 97#define db8500_add_ssp0(parent, pdata) \
92 dbx500_add_spi("spi3", U8500_SPI3_BASE, IRQ_DB8500_SPI3, pdata, 0) 98 db8500_add_ssp(parent, "ssp0", U8500_SSP0_BASE, \
93 99 IRQ_DB8500_SSP0, pdata)
94#define db8500_add_uart0(pdata) \ 100#define db8500_add_ssp1(parent, pdata) \
95 dbx500_add_uart("uart0", U8500_UART0_BASE, IRQ_DB8500_UART0, pdata) 101 db8500_add_ssp(parent, "ssp1", U8500_SSP1_BASE, \
96#define db8500_add_uart1(pdata) \ 102 IRQ_DB8500_SSP1, pdata)
97 dbx500_add_uart("uart1", U8500_UART1_BASE, IRQ_DB8500_UART1, pdata) 103
98#define db8500_add_uart2(pdata) \ 104#define db8500_add_spi0(parent, pdata) \
99 dbx500_add_uart("uart2", U8500_UART2_BASE, IRQ_DB8500_UART2, pdata) 105 dbx500_add_spi(parent, "spi0", U8500_SPI0_BASE, \
106 IRQ_DB8500_SPI0, pdata, 0)
107#define db8500_add_spi1(parent, pdata) \
108 dbx500_add_spi(parent, "spi1", U8500_SPI1_BASE, \
109 IRQ_DB8500_SPI1, pdata, 0)
110#define db8500_add_spi2(parent, pdata) \
111 dbx500_add_spi(parent, "spi2", U8500_SPI2_BASE, \
112 IRQ_DB8500_SPI2, pdata, 0)
113#define db8500_add_spi3(parent, pdata) \
114 dbx500_add_spi(parent, "spi3", U8500_SPI3_BASE, \
115 IRQ_DB8500_SPI3, pdata, 0)
116
117#define db8500_add_uart0(parent, pdata) \
118 dbx500_add_uart(parent, "uart0", U8500_UART0_BASE, \
119 IRQ_DB8500_UART0, pdata)
120#define db8500_add_uart1(parent, pdata) \
121 dbx500_add_uart(parent, "uart1", U8500_UART1_BASE, \
122 IRQ_DB8500_UART1, pdata)
123#define db8500_add_uart2(parent, pdata) \
124 dbx500_add_uart(parent, "uart2", U8500_UART2_BASE, \
125 IRQ_DB8500_UART2, pdata)
100 126
101#endif 127#endif
diff --git a/arch/arm/mach-ux500/dma-db5500.c b/arch/arm/mach-ux500/dma-db5500.c
index 1cfab68ae417..41e9470fa0e6 100644
--- a/arch/arm/mach-ux500/dma-db5500.c
+++ b/arch/arm/mach-ux500/dma-db5500.c
@@ -125,10 +125,11 @@ static struct platform_device dma40_device = {
125 .resource = dma40_resources 125 .resource = dma40_resources
126}; 126};
127 127
128void __init db5500_dma_init(void) 128void __init db5500_dma_init(struct device *parent)
129{ 129{
130 int ret; 130 int ret;
131 131
132 dma40_device.dev.parent = parent;
132 ret = platform_device_register(&dma40_device); 133 ret = platform_device_register(&dma40_device);
133 if (ret) 134 if (ret)
134 dev_err(&dma40_device.dev, "unable to register device: %d\n", ret); 135 dev_err(&dma40_device.dev, "unable to register device: %d\n", ret);
diff --git a/arch/arm/mach-ux500/include/mach/db8500-regs.h b/arch/arm/mach-ux500/include/mach/db8500-regs.h
index 80e10f50282e..9ec20b96d8f2 100644
--- a/arch/arm/mach-ux500/include/mach/db8500-regs.h
+++ b/arch/arm/mach-ux500/include/mach/db8500-regs.h
@@ -161,4 +161,7 @@
161#define U8500_MODEM_BASE 0xe000000 161#define U8500_MODEM_BASE 0xe000000
162#define U8500_APE_BASE 0x6000000 162#define U8500_APE_BASE 0x6000000
163 163
164/* SoC identification number information */
165#define U8500_BB_UID_BASE (U8500_BACKUPRAM1_BASE + 0xFC0)
166
164#endif 167#endif
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
index a7d363fdb4cd..3dc00ffa7bfa 100644
--- a/arch/arm/mach-ux500/include/mach/setup.h
+++ b/arch/arm/mach-ux500/include/mach/setup.h
@@ -18,17 +18,16 @@ void __init ux500_map_io(void);
18extern void __init u5500_map_io(void); 18extern void __init u5500_map_io(void);
19extern void __init u8500_map_io(void); 19extern void __init u8500_map_io(void);
20 20
21extern void __init u5500_init_devices(void); 21extern struct device * __init u5500_init_devices(void);
22extern void __init u8500_init_devices(void); 22extern struct device * __init u8500_init_devices(void);
23 23
24extern void __init ux500_init_irq(void); 24extern void __init ux500_init_irq(void);
25 25
26extern void __init u5500_sdi_init(void); 26extern void __init u5500_sdi_init(struct device *parent);
27 27
28extern void __init db5500_dma_init(void); 28extern void __init db5500_dma_init(struct device *parent);
29 29
30/* We re-use nomadik_timer for this platform */ 30extern struct device *ux500_soc_device_init(const char *soc_id);
31extern void nmdk_timer_init(void);
32 31
33struct amba_device; 32struct amba_device;
34extern void __init amba_add_devices(struct amba_device *devs[], int num); 33extern void __init amba_add_devices(struct amba_device *devs[], int num);
diff --git a/arch/arm/mach-ux500/include/mach/usb.h b/arch/arm/mach-ux500/include/mach/usb.h
index d3739d418813..4c1cc50a595a 100644
--- a/arch/arm/mach-ux500/include/mach/usb.h
+++ b/arch/arm/mach-ux500/include/mach/usb.h
@@ -20,6 +20,6 @@ struct ux500_musb_board_data {
20 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 20 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
21}; 21};
22 22
23void ux500_add_usb(resource_size_t base, int irq, int *dma_rx_cfg, 23void ux500_add_usb(struct device *parent, resource_size_t base,
24 int *dma_tx_cfg); 24 int irq, int *dma_rx_cfg, int *dma_tx_cfg);
25#endif 25#endif
diff --git a/arch/arm/mach-ux500/localtimer.c b/arch/arm/mach-ux500/localtimer.c
deleted file mode 100644
index 5ba113309a0b..000000000000
--- a/arch/arm/mach-ux500/localtimer.c
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Copyright (C) 2008-2009 ST-Ericsson
3 * Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
4 *
5 * This file is heavily based on relaview platform, almost a copy.
6 *
7 * Copyright (C) 2002 ARM Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <linux/init.h>
14#include <linux/smp.h>
15#include <linux/clockchips.h>
16
17#include <asm/irq.h>
18#include <asm/smp_twd.h>
19#include <asm/localtimer.h>
20
21/*
22 * Setup the local clock events for a CPU.
23 */
24int __cpuinit local_timer_setup(struct clock_event_device *evt)
25{
26 evt->irq = IRQ_LOCALTIMER;
27 twd_timer_setup(evt);
28 return 0;
29}
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c
index aea467d04ff7..d37df98b5c32 100644
--- a/arch/arm/mach-ux500/timer.c
+++ b/arch/arm/mach-ux500/timer.c
@@ -7,29 +7,52 @@
7#include <linux/io.h> 7#include <linux/io.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/clksrc-dbx500-prcmu.h> 9#include <linux/clksrc-dbx500-prcmu.h>
10#include <linux/of.h>
10 11
11#include <asm/localtimer.h> 12#include <asm/smp_twd.h>
12 13
13#include <plat/mtu.h> 14#include <plat/mtu.h>
14 15
15#include <mach/setup.h> 16#include <mach/setup.h>
16#include <mach/hardware.h> 17#include <mach/hardware.h>
18#include <mach/irqs.h>
19
20#ifdef CONFIG_HAVE_ARM_TWD
21static DEFINE_TWD_LOCAL_TIMER(u5500_twd_local_timer,
22 U5500_TWD_BASE, IRQ_LOCALTIMER);
23static DEFINE_TWD_LOCAL_TIMER(u8500_twd_local_timer,
24 U8500_TWD_BASE, IRQ_LOCALTIMER);
25
26static void __init ux500_twd_init(void)
27{
28 struct twd_local_timer *twd_local_timer;
29 int err;
30
31 twd_local_timer = cpu_is_u5500() ? &u5500_twd_local_timer :
32 &u8500_twd_local_timer;
33
34 if (of_have_populated_dt())
35 twd_local_timer_of_register();
36 else {
37 err = twd_local_timer_register(twd_local_timer);
38 if (err)
39 pr_err("twd_local_timer_register failed %d\n", err);
40 }
41}
42#else
43#define ux500_twd_init() do { } while(0)
44#endif
17 45
18static void __init ux500_timer_init(void) 46static void __init ux500_timer_init(void)
19{ 47{
48 void __iomem *mtu_timer_base;
20 void __iomem *prcmu_timer_base; 49 void __iomem *prcmu_timer_base;
21 50
22 if (cpu_is_u5500()) { 51 if (cpu_is_u5500()) {
23#ifdef CONFIG_LOCAL_TIMERS 52 mtu_timer_base = __io_address(U5500_MTU0_BASE);
24 twd_base = __io_address(U5500_TWD_BASE);
25#endif
26 mtu_base = __io_address(U5500_MTU0_BASE);
27 prcmu_timer_base = __io_address(U5500_PRCMU_TIMER_3_BASE); 53 prcmu_timer_base = __io_address(U5500_PRCMU_TIMER_3_BASE);
28 } else if (cpu_is_u8500()) { 54 } else if (cpu_is_u8500()) {
29#ifdef CONFIG_LOCAL_TIMERS 55 mtu_timer_base = __io_address(U8500_MTU0_BASE);
30 twd_base = __io_address(U8500_TWD_BASE);
31#endif
32 mtu_base = __io_address(U8500_MTU0_BASE);
33 prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); 56 prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE);
34 } else { 57 } else {
35 ux500_unknown_soc(); 58 ux500_unknown_soc();
@@ -52,8 +75,9 @@ static void __init ux500_timer_init(void)
52 * 75 *
53 */ 76 */
54 77
55 nmdk_timer_init(); 78 nmdk_timer_init(mtu_timer_base);
56 clksrc_dbx500_prcmu_init(prcmu_timer_base); 79 clksrc_dbx500_prcmu_init(prcmu_timer_base);
80 ux500_twd_init();
57} 81}
58 82
59static void ux500_timer_reset(void) 83static void ux500_timer_reset(void)
diff --git a/arch/arm/mach-ux500/usb.c b/arch/arm/mach-ux500/usb.c
index 9f9e1c203061..a74af389bc63 100644
--- a/arch/arm/mach-ux500/usb.c
+++ b/arch/arm/mach-ux500/usb.c
@@ -7,6 +7,7 @@
7#include <linux/platform_device.h> 7#include <linux/platform_device.h>
8#include <linux/usb/musb.h> 8#include <linux/usb/musb.h>
9#include <linux/dma-mapping.h> 9#include <linux/dma-mapping.h>
10
10#include <plat/ste_dma40.h> 11#include <plat/ste_dma40.h>
11#include <mach/hardware.h> 12#include <mach/hardware.h>
12#include <mach/usb.h> 13#include <mach/usb.h>
@@ -140,8 +141,8 @@ static inline void ux500_usb_dma_update_tx_ch_config(int *dst_dev_type)
140 musb_dma_tx_ch[idx].dst_dev_type = dst_dev_type[idx]; 141 musb_dma_tx_ch[idx].dst_dev_type = dst_dev_type[idx];
141} 142}
142 143
143void ux500_add_usb(resource_size_t base, int irq, int *dma_rx_cfg, 144void ux500_add_usb(struct device *parent, resource_size_t base, int irq,
144 int *dma_tx_cfg) 145 int *dma_rx_cfg, int *dma_tx_cfg)
145{ 146{
146 ux500_musb_device.resource[0].start = base; 147 ux500_musb_device.resource[0].start = base;
147 ux500_musb_device.resource[0].end = base + SZ_64K - 1; 148 ux500_musb_device.resource[0].end = base + SZ_64K - 1;
@@ -151,5 +152,7 @@ void ux500_add_usb(resource_size_t base, int irq, int *dma_rx_cfg,
151 ux500_usb_dma_update_rx_ch_config(dma_rx_cfg); 152 ux500_usb_dma_update_rx_ch_config(dma_rx_cfg);
152 ux500_usb_dma_update_tx_ch_config(dma_tx_cfg); 153 ux500_usb_dma_update_tx_ch_config(dma_tx_cfg);
153 154
155 ux500_musb_device.dev.parent = parent;
156
154 platform_device_register(&ux500_musb_device); 157 platform_device_register(&ux500_musb_device);
155} 158}