aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-ux500/Makefile2
-rw-r--r--arch/arm/mach-ux500/board-mop500-sdi.c11
-rw-r--r--arch/arm/mach-ux500/board-mop500.c46
-rw-r--r--arch/arm/mach-ux500/board-u5500.c16
-rw-r--r--arch/arm/mach-ux500/cpu-db5500.c5
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c7
-rw-r--r--arch/arm/mach-ux500/cpu.c10
-rw-r--r--arch/arm/mach-ux500/devices-common.c107
-rw-r--r--arch/arm/mach-ux500/devices-common.h77
-rw-r--r--arch/arm/mach-ux500/devices-db5500.h66
-rw-r--r--arch/arm/mach-ux500/devices-db8500.c131
-rw-r--r--arch/arm/mach-ux500/devices-db8500.h98
-rw-r--r--arch/arm/mach-ux500/devices.c63
-rw-r--r--arch/arm/mach-ux500/include/mach/devices.h17
-rw-r--r--arch/arm/mach-ux500/include/mach/setup.h2
15 files changed, 395 insertions, 263 deletions
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 9e27a84433cb..061201388dac 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel, U8500 machine. 2# Makefile for the linux kernel, U8500 machine.
3# 3#
4 4
5obj-y := clock.o cpu.o devices.o 5obj-y := clock.o cpu.o devices.o devices-common.o
6obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o devices-db5500.o 6obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o devices-db5500.o
7obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o prcmu.o 7obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o prcmu.o
8obj-$(CONFIG_MACH_U8500_MOP) += board-mop500.o board-mop500-sdi.o 8obj-$(CONFIG_MACH_U8500_MOP) += board-mop500.o board-mop500-sdi.o
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c
index 2fbaa2013fdb..be5e8ccb97cc 100644
--- a/arch/arm/mach-ux500/board-mop500-sdi.c
+++ b/arch/arm/mach-ux500/board-mop500-sdi.c
@@ -16,6 +16,7 @@
16#include <mach/devices.h> 16#include <mach/devices.h>
17#include <mach/hardware.h> 17#include <mach/hardware.h>
18 18
19#include "devices-db8500.h"
19#include "pins-db8500.h" 20#include "pins-db8500.h"
20#include "board-mop500.h" 21#include "board-mop500.h"
21 22
@@ -108,7 +109,7 @@ void mop500_sdi_tc35892_init(void)
108 gpio_direction_output(GPIO_SDMMC_1V8_3V_SEL, 1); 109 gpio_direction_output(GPIO_SDMMC_1V8_3V_SEL, 1);
109 gpio_direction_output(GPIO_SDMMC_EN, 0); 110 gpio_direction_output(GPIO_SDMMC_EN, 0);
110 111
111 amba_device_register(&u8500_sdi0_device, &iomem_resource); 112 db8500_add_sdi0(&mop500_sdi0_data);
112} 113}
113 114
114/* 115/*
@@ -140,15 +141,11 @@ void mop500_sdi_init(void)
140{ 141{
141 nmk_config_pins(mop500_sdi_pins, ARRAY_SIZE(mop500_sdi_pins)); 142 nmk_config_pins(mop500_sdi_pins, ARRAY_SIZE(mop500_sdi_pins));
142 143
143 u8500_sdi0_device.dev.platform_data = &mop500_sdi0_data;
144 u8500_sdi2_device.dev.platform_data = &mop500_sdi2_data;
145 u8500_sdi4_device.dev.platform_data = &mop500_sdi4_data;
146
147 if (!cpu_is_u8500ed()) { 144 if (!cpu_is_u8500ed()) {
148 nmk_config_pins(mop500_sdi2_pins, ARRAY_SIZE(mop500_sdi2_pins)); 145 nmk_config_pins(mop500_sdi2_pins, ARRAY_SIZE(mop500_sdi2_pins));
149 amba_device_register(&u8500_sdi2_device, &iomem_resource); 146 db8500_add_sdi2(&mop500_sdi2_data);
150 } 147 }
151 148
152 /* On-board eMMC */ 149 /* On-board eMMC */
153 amba_device_register(&u8500_sdi4_device, &iomem_resource); 150 db8500_add_sdi4(&mop500_sdi4_data);
154} 151}
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 9aeefc403f35..8edc27f41f0d 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -34,6 +34,7 @@
34#include <mach/devices.h> 34#include <mach/devices.h>
35#include <mach/irqs.h> 35#include <mach/irqs.h>
36 36
37#include "devices-db8500.h"
37#include "pins-db8500.h" 38#include "pins-db8500.h"
38#include "board-mop500.h" 39#include "board-mop500.h"
39 40
@@ -192,12 +193,13 @@ U8500_I2C_CONTROLLER(1, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
192U8500_I2C_CONTROLLER(2, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); 193U8500_I2C_CONTROLLER(2, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
193U8500_I2C_CONTROLLER(3, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD); 194U8500_I2C_CONTROLLER(3, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
194 195
195static struct amba_device *amba_devs[] __initdata = { 196static void __init mop500_i2c_init(void)
196 &ux500_uart0_device, 197{
197 &ux500_uart1_device, 198 db8500_add_i2c0(&u8500_i2c0_data);
198 &ux500_uart2_device, 199 db8500_add_i2c1(&u8500_i2c1_data);
199 &u8500_ssp0_device, 200 db8500_add_i2c2(&u8500_i2c2_data);
200}; 201 db8500_add_i2c3(&u8500_i2c3_data);
202}
201 203
202static const unsigned int ux500_keymap[] = { 204static const unsigned int ux500_keymap[] = {
203 KEY(2, 5, KEY_END), 205 KEY(2, 5, KEY_END),
@@ -308,36 +310,34 @@ static struct ske_keypad_platform_data ske_keypad_board = {
308 310
309/* add any platform devices here - TODO */ 311/* add any platform devices here - TODO */
310static struct platform_device *platform_devs[] __initdata = { 312static struct platform_device *platform_devs[] __initdata = {
311 &u8500_i2c0_device,
312 &ux500_i2c1_device,
313 &ux500_i2c2_device,
314 &ux500_i2c3_device,
315 &ux500_ske_keypad_device, 313 &ux500_ske_keypad_device,
316}; 314};
317 315
318static void __init u8500_init_machine(void) 316static void __init mop500_spi_init(void)
319{ 317{
320 int i; 318 db8500_add_ssp0(&ssp0_platform_data);
319}
321 320
321static void __init mop500_uart_init(void)
322{
323 db8500_add_uart0();
324 db8500_add_uart1();
325 db8500_add_uart2();
326}
327
328static void __init u8500_init_machine(void)
329{
322 u8500_init_devices(); 330 u8500_init_devices();
323 331
324 nmk_config_pins(mop500_pins, ARRAY_SIZE(mop500_pins)); 332 nmk_config_pins(mop500_pins, ARRAY_SIZE(mop500_pins));
325 333
326 u8500_i2c0_device.dev.platform_data = &u8500_i2c0_data;
327 ux500_i2c1_device.dev.platform_data = &u8500_i2c1_data;
328 ux500_i2c2_device.dev.platform_data = &u8500_i2c2_data;
329 ux500_i2c3_device.dev.platform_data = &u8500_i2c3_data;
330 ux500_ske_keypad_device.dev.platform_data = &ske_keypad_board; 334 ux500_ske_keypad_device.dev.platform_data = &ske_keypad_board;
331
332 u8500_ssp0_device.dev.platform_data = &ssp0_platform_data;
333
334 /* Register the active AMBA devices on this board */
335 for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
336 amba_device_register(amba_devs[i], &iomem_resource);
337
338 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); 335 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));
339 336
337 mop500_i2c_init();
340 mop500_sdi_init(); 338 mop500_sdi_init();
339 mop500_spi_init();
340 mop500_uart_init();
341 341
342 /* If HW is early drop (ED) or V1.0 then use SPI to access AB8500 */ 342 /* If HW is early drop (ED) or V1.0 then use SPI to access AB8500 */
343 if (cpu_is_u8500ed() || cpu_is_u8500v10()) 343 if (cpu_is_u8500ed() || cpu_is_u8500v10())
diff --git a/arch/arm/mach-ux500/board-u5500.c b/arch/arm/mach-ux500/board-u5500.c
index 1ca094a45e71..9a5db956deba 100644
--- a/arch/arm/mach-ux500/board-u5500.c
+++ b/arch/arm/mach-ux500/board-u5500.c
@@ -9,6 +9,7 @@
9#include <linux/platform_device.h> 9#include <linux/platform_device.h>
10#include <linux/amba/bus.h> 10#include <linux/amba/bus.h>
11#include <linux/gpio.h> 11#include <linux/gpio.h>
12#include <linux/irq.h>
12 13
13#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
14#include <asm/mach-types.h> 15#include <asm/mach-types.h>
@@ -17,17 +18,20 @@
17#include <mach/devices.h> 18#include <mach/devices.h>
18#include <mach/setup.h> 19#include <mach/setup.h>
19 20
20static struct amba_device *amba_board_devs[] __initdata = { 21#include "devices-db5500.h"
21 &ux500_uart0_device, 22
22 &ux500_uart1_device, 23static void __init u5500_uart_init(void)
23 &ux500_uart2_device, 24{
24}; 25 db5500_add_uart0();
26 db5500_add_uart1();
27 db5500_add_uart2();
28}
25 29
26static void __init u5500_init_machine(void) 30static void __init u5500_init_machine(void)
27{ 31{
28 u5500_init_devices(); 32 u5500_init_devices();
29 33
30 amba_add_devices(amba_board_devs, ARRAY_SIZE(amba_board_devs)); 34 u5500_uart_init();
31} 35}
32 36
33MACHINE_START(U8500, "ST-Ericsson U5500 Platform") 37MACHINE_START(U8500, "ST-Ericsson U5500 Platform")
diff --git a/arch/arm/mach-ux500/cpu-db5500.c b/arch/arm/mach-ux500/cpu-db5500.c
index 2f87075e9d6f..bcc0fd4fdc29 100644
--- a/arch/arm/mach-ux500/cpu-db5500.c
+++ b/arch/arm/mach-ux500/cpu-db5500.c
@@ -8,6 +8,7 @@
8#include <linux/platform_device.h> 8#include <linux/platform_device.h>
9#include <linux/amba/bus.h> 9#include <linux/amba/bus.h>
10#include <linux/io.h> 10#include <linux/io.h>
11#include <linux/irq.h>
11 12
12#include <asm/mach/map.h> 13#include <asm/mach/map.h>
13 14
@@ -16,6 +17,8 @@
16#include <mach/setup.h> 17#include <mach/setup.h>
17#include <mach/irqs.h> 18#include <mach/irqs.h>
18 19
20#include "devices-db5500.h"
21
19static struct map_desc u5500_io_desc[] __initdata = { 22static struct map_desc u5500_io_desc[] __initdata = {
20 __IO_DEV_DESC(U5500_GPIO0_BASE, SZ_4K), 23 __IO_DEV_DESC(U5500_GPIO0_BASE, SZ_4K),
21 __IO_DEV_DESC(U5500_GPIO1_BASE, SZ_4K), 24 __IO_DEV_DESC(U5500_GPIO1_BASE, SZ_4K),
@@ -132,7 +135,7 @@ void __init u5500_map_io(void)
132 135
133void __init u5500_init_devices(void) 136void __init u5500_init_devices(void)
134{ 137{
135 ux500_init_devices(); 138 db5500_add_rtc();
136 139
137 platform_add_devices(u5500_platform_devs, 140 platform_add_devices(u5500_platform_devs,
138 ARRAY_SIZE(u5500_platform_devs)); 141 ARRAY_SIZE(u5500_platform_devs));
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 4acab7544b3c..5966f353890f 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -22,6 +22,8 @@
22#include <mach/setup.h> 22#include <mach/setup.h>
23#include <mach/devices.h> 23#include <mach/devices.h>
24 24
25#include "devices-db8500.h"
26
25static struct platform_device *platform_devs[] __initdata = { 27static struct platform_device *platform_devs[] __initdata = {
26 &u8500_gpio_devs[0], 28 &u8500_gpio_devs[0],
27 &u8500_gpio_devs[1], 29 &u8500_gpio_devs[1],
@@ -152,12 +154,11 @@ void __init u8500_init_devices(void)
152 else 154 else
153 pr_warning("ASIC: UNKNOWN SILICON VERSION!\n"); 155 pr_warning("ASIC: UNKNOWN SILICON VERSION!\n");
154 156
155 ux500_init_devices();
156
157 if (cpu_is_u8500ed()) 157 if (cpu_is_u8500ed())
158 dma40_u8500ed_fixup(); 158 dma40_u8500ed_fixup();
159 159
160 /* Register the platform devices */ 160 db8500_add_rtc();
161
161 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); 162 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));
162 163
163 return ; 164 return ;
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index 608a1372b172..2bc0efbac584 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -6,7 +6,6 @@
6 */ 6 */
7 7
8#include <linux/platform_device.h> 8#include <linux/platform_device.h>
9#include <linux/amba/bus.h>
10#include <linux/io.h> 9#include <linux/io.h>
11#include <linux/clk.h> 10#include <linux/clk.h>
12 11
@@ -45,20 +44,11 @@ static struct map_desc ux500_io_desc[] __initdata = {
45 __IO_DEV_DESC(UX500_BACKUPRAM0_BASE, SZ_8K), 44 __IO_DEV_DESC(UX500_BACKUPRAM0_BASE, SZ_8K),
46}; 45};
47 46
48static struct amba_device *ux500_amba_devs[] __initdata = {
49 &ux500_pl031_device,
50};
51
52void __init ux500_map_io(void) 47void __init ux500_map_io(void)
53{ 48{
54 iotable_init(ux500_io_desc, ARRAY_SIZE(ux500_io_desc)); 49 iotable_init(ux500_io_desc, ARRAY_SIZE(ux500_io_desc));
55} 50}
56 51
57void __init ux500_init_devices(void)
58{
59 amba_add_devices(ux500_amba_devs, ARRAY_SIZE(ux500_amba_devs));
60}
61
62void __init ux500_init_irq(void) 52void __init ux500_init_irq(void)
63{ 53{
64 gic_dist_init(0, __io_address(UX500_GIC_DIST_BASE), 29); 54 gic_dist_init(0, __io_address(UX500_GIC_DIST_BASE), 29);
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c
new file mode 100644
index 000000000000..9376a246f862
--- /dev/null
+++ b/arch/arm/mach-ux500/devices-common.c
@@ -0,0 +1,107 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2.
6 */
7
8#include <linux/kernel.h>
9#include <linux/dma-mapping.h>
10#include <linux/err.h>
11#include <linux/irq.h>
12#include <linux/slab.h>
13#include <linux/platform_device.h>
14#include <linux/amba/bus.h>
15
16#include <mach/hardware.h>
17
18#include "devices-common.h"
19
20struct amba_device *
21dbx500_add_amba_device(const char *name, resource_size_t base,
22 int irq, void *pdata, unsigned int periphid)
23{
24 struct amba_device *dev;
25 int ret;
26
27 dev = kzalloc(sizeof *dev, GFP_KERNEL);
28 if (!dev)
29 return ERR_PTR(-ENOMEM);
30
31 dev->dev.init_name = name;
32
33 dev->res.start = base;
34 dev->res.end = base + SZ_4K - 1;
35 dev->res.flags = IORESOURCE_MEM;
36
37 dev->dma_mask = DMA_BIT_MASK(32);
38 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
39
40 dev->irq[0] = irq;
41 dev->irq[1] = NO_IRQ;
42
43 dev->periphid = periphid;
44
45 dev->dev.platform_data = pdata;
46
47 ret = amba_device_register(dev, &iomem_resource);
48 if (ret) {
49 kfree(dev);
50 return ERR_PTR(ret);
51 }
52
53 return dev;
54}
55
56static struct platform_device *
57dbx500_add_platform_device(const char *name, int id, void *pdata,
58 struct resource *res, int resnum)
59{
60 struct platform_device *dev;
61 int ret;
62
63 dev = platform_device_alloc(name, id);
64 if (!dev)
65 return ERR_PTR(-ENOMEM);
66
67 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
68 dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
69
70 ret = platform_device_add_resources(dev, res, resnum);
71 if (ret)
72 goto out_free;
73
74 dev->dev.platform_data = pdata;
75
76 ret = platform_device_add(dev);
77 if (ret)
78 goto out_free;
79
80 return dev;
81
82out_free:
83 platform_device_put(dev);
84 return ERR_PTR(ret);
85}
86
87struct platform_device *
88dbx500_add_platform_device_4k1irq(const char *name, int id,
89 resource_size_t base,
90 int irq, void *pdata)
91{
92 struct resource resources[] = {
93 [0] = {
94 .start = base,
95 .end = base + SZ_4K - 1,
96 .flags = IORESOURCE_MEM,
97 },
98 [1] = {
99 .start = irq,
100 .end = irq,
101 .flags = IORESOURCE_IRQ,
102 }
103 };
104
105 return dbx500_add_platform_device(name, id, pdata, resources,
106 ARRAY_SIZE(resources));
107}
diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h
new file mode 100644
index 000000000000..2e1de0e19717
--- /dev/null
+++ b/arch/arm/mach-ux500/devices-common.h
@@ -0,0 +1,77 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2.
6 */
7
8#ifndef __DEVICES_COMMON_H
9#define __DEVICES_COMMON_H
10
11extern struct amba_device *
12dbx500_add_amba_device(const char *name, resource_size_t base,
13 int irq, void *pdata, unsigned int periphid);
14
15extern struct platform_device *
16dbx500_add_platform_device_4k1irq(const char *name, int id,
17 resource_size_t base,
18 int irq, void *pdata);
19
20struct spi_master_cntlr;
21
22static inline struct amba_device *
23dbx500_add_msp_spi(const char *name, resource_size_t base, int irq,
24 struct spi_master_cntlr *pdata)
25{
26 return dbx500_add_amba_device(name, base, irq, pdata, 0);
27}
28
29static inline struct amba_device *
30dbx500_add_spi(const char *name, resource_size_t base, int irq,
31 struct spi_master_cntlr *pdata)
32{
33 return dbx500_add_amba_device(name, base, irq, pdata, 0);
34}
35
36struct mmci_platform_data;
37
38static inline struct amba_device *
39dbx500_add_sdi(const char *name, resource_size_t base, int irq,
40 struct mmci_platform_data *pdata)
41{
42 return dbx500_add_amba_device(name, base, irq, pdata, 0);
43}
44
45static inline struct amba_device *
46dbx500_add_uart(const char *name, resource_size_t base, int irq)
47{
48 return dbx500_add_amba_device(name, base, irq, NULL, 0);
49}
50
51struct nmk_i2c_controller;
52
53static inline struct platform_device *
54dbx500_add_i2c(int id, resource_size_t base, int irq,
55 struct nmk_i2c_controller *pdata)
56{
57 return dbx500_add_platform_device_4k1irq("nmk-i2c", id, base, irq,
58 pdata);
59}
60
61struct msp_i2s_platform_data;
62
63static inline struct platform_device *
64dbx500_add_msp_i2s(int id, resource_size_t base, int irq,
65 struct msp_i2s_platform_data *pdata)
66{
67 return dbx500_add_platform_device_4k1irq("MSP_I2S", id, base, irq,
68 pdata);
69}
70
71static inline struct amba_device *
72dbx500_add_rtc(resource_size_t base, int irq)
73{
74 return dbx500_add_amba_device("rtc-pl031", base, irq, NULL, 0);
75}
76
77#endif
diff --git a/arch/arm/mach-ux500/devices-db5500.h b/arch/arm/mach-ux500/devices-db5500.h
new file mode 100644
index 000000000000..c8d7901c1f2d
--- /dev/null
+++ b/arch/arm/mach-ux500/devices-db5500.h
@@ -0,0 +1,66 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2.
6 */
7
8#ifndef __DEVICES_DB5500_H
9#define __DEVICES_DB5500_H
10
11#include "devices-common.h"
12
13#define db5500_add_i2c1(pdata) \
14 dbx500_add_i2c(1, U5500_I2C1_BASE, IRQ_DB5500_I2C1, pdata)
15#define db5500_add_i2c2(pdata) \
16 dbx500_add_i2c(2, U5500_I2C2_BASE, IRQ_DB5500_I2C2, pdata)
17#define db5500_add_i2c3(pdata) \
18 dbx500_add_i2c(3, U5500_I2C3_BASE, IRQ_DB5500_I2C3, pdata)
19
20#define db5500_add_msp0_i2s(pdata) \
21 dbx500_add_msp_i2s(0, U5500_MSP0_BASE, IRQ_DB5500_MSP0, pdata)
22#define db5500_add_msp1_i2s(pdata) \
23 dbx500_add_msp_i2s(1, U5500_MSP1_BASE, IRQ_DB5500_MSP1, pdata)
24#define db5500_add_msp2_i2s(pdata) \
25 dbx500_add_msp_i2s(2, U5500_MSP2_BASE, IRQ_DB5500_MSP2, pdata)
26
27#define db5500_add_msp0_spi(pdata) \
28 dbx500_add_msp_spi("msp0", U5500_MSP0_BASE, IRQ_DB5500_MSP0, pdata)
29#define db5500_add_msp1_spi(pdata) \
30 dbx500_add_msp_spi("msp1", U5500_MSP1_BASE, IRQ_DB5500_MSP1, pdata)
31#define db5500_add_msp2_spi(pdata) \
32 dbx500_add_msp_spi("msp2", U5500_MSP2_BASE, IRQ_DB5500_MSP2, pdata)
33
34#define db5500_add_rtc() \
35 dbx500_add_rtc(U5500_RTC_BASE, IRQ_DB5500_RTC);
36
37#define db5500_add_sdi0(pdata) \
38 dbx500_add_sdi("sdi0", U5500_SDI0_BASE, IRQ_DB5500_SDMMC0, pdata)
39#define db5500_add_sdi1(pdata) \
40 dbx500_add_sdi("sdi1", U5500_SDI1_BASE, IRQ_DB5500_SDMMC1, pdata)
41#define db5500_add_sdi2(pdata) \
42 dbx500_add_sdi("sdi2", U5500_SDI2_BASE, IRQ_DB5500_SDMMC2, pdata)
43#define db5500_add_sdi3(pdata) \
44 dbx500_add_sdi("sdi3", U5500_SDI3_BASE, IRQ_DB5500_SDMMC3, pdata)
45#define db5500_add_sdi4(pdata) \
46 dbx500_add_sdi("sdi4", U5500_SDI4_BASE, IRQ_DB5500_SDMMC4, pdata)
47
48#define db5500_add_spi0(pdata) \
49 dbx500_add_spi("spi0", U5500_SPI0_BASE, IRQ_DB5500_SPI0, pdata)
50#define db5500_add_spi1(pdata) \
51 dbx500_add_spi("spi1", U5500_SPI1_BASE, IRQ_DB5500_SPI1, pdata)
52#define db5500_add_spi2(pdata) \
53 dbx500_add_spi("spi2", U5500_SPI2_BASE, IRQ_DB5500_SPI2, pdata)
54#define db5500_add_spi3(pdata) \
55 dbx500_add_spi("spi3", U5500_SPI3_BASE, IRQ_DB5500_SPI3, pdata)
56
57#define db5500_add_uart0() \
58 dbx500_add_uart("uart0", U5500_UART0_BASE, IRQ_DB5500_UART0)
59#define db5500_add_uart1() \
60 dbx500_add_uart("uart1", U5500_UART1_BASE, IRQ_DB5500_UART1)
61#define db5500_add_uart2() \
62 dbx500_add_uart("uart2", U5500_UART2_BASE, IRQ_DB5500_UART2)
63#define db5500_add_uart3() \
64 dbx500_add_uart("uart3", U5500_UART3_BASE, IRQ_DB5500_UART3)
65
66#endif
diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c
index 4a94be3304b9..1edcf82299fa 100644
--- a/arch/arm/mach-ux500/devices-db8500.c
+++ b/arch/arm/mach-ux500/devices-db8500.c
@@ -55,137 +55,6 @@ struct platform_device u8500_gpio_devs[] = {
55 GPIO_DEVICE(8), 55 GPIO_DEVICE(8),
56}; 56};
57 57
58struct amba_device u8500_ssp0_device = {
59 .dev = {
60 .coherent_dma_mask = ~0,
61 .init_name = "ssp0",
62 },
63 .res = {
64 .start = U8500_SSP0_BASE,
65 .end = U8500_SSP0_BASE + SZ_4K - 1,
66 .flags = IORESOURCE_MEM,
67 },
68 .irq = {IRQ_DB8500_SSP0, NO_IRQ },
69 /* ST-Ericsson modified id */
70 .periphid = SSP_PER_ID,
71};
72
73static struct resource u8500_i2c0_resources[] = {
74 [0] = {
75 .start = U8500_I2C0_BASE,
76 .end = U8500_I2C0_BASE + SZ_4K - 1,
77 .flags = IORESOURCE_MEM,
78 },
79 [1] = {
80 .start = IRQ_DB8500_I2C0,
81 .end = IRQ_DB8500_I2C0,
82 .flags = IORESOURCE_IRQ,
83 }
84};
85
86struct platform_device u8500_i2c0_device = {
87 .name = "nmk-i2c",
88 .id = 0,
89 .resource = u8500_i2c0_resources,
90 .num_resources = ARRAY_SIZE(u8500_i2c0_resources),
91};
92
93static struct resource u8500_i2c4_resources[] = {
94 [0] = {
95 .start = U8500_I2C4_BASE,
96 .end = U8500_I2C4_BASE + SZ_4K - 1,
97 .flags = IORESOURCE_MEM,
98 },
99 [1] = {
100 .start = IRQ_DB8500_I2C4,
101 .end = IRQ_DB8500_I2C4,
102 .flags = IORESOURCE_IRQ,
103 }
104};
105
106struct platform_device u8500_i2c4_device = {
107 .name = "nmk-i2c",
108 .id = 4,
109 .resource = u8500_i2c4_resources,
110 .num_resources = ARRAY_SIZE(u8500_i2c4_resources),
111};
112
113/*
114 * SD/MMC
115 */
116
117struct amba_device u8500_sdi0_device = {
118 .dev = {
119 .init_name = "sdi0",
120 },
121 .res = {
122 .start = U8500_SDI0_BASE,
123 .end = U8500_SDI0_BASE + SZ_4K - 1,
124 .flags = IORESOURCE_MEM,
125 },
126 .irq = {IRQ_DB8500_SDMMC0, NO_IRQ},
127};
128
129struct amba_device u8500_sdi1_device = {
130 .dev = {
131 .init_name = "sdi1",
132 },
133 .res = {
134 .start = U8500_SDI1_BASE,
135 .end = U8500_SDI1_BASE + SZ_4K - 1,
136 .flags = IORESOURCE_MEM,
137 },
138 .irq = {IRQ_DB8500_SDMMC1, NO_IRQ},
139};
140
141struct amba_device u8500_sdi2_device = {
142 .dev = {
143 .init_name = "sdi2",
144 },
145 .res = {
146 .start = U8500_SDI2_BASE,
147 .end = U8500_SDI2_BASE + SZ_4K - 1,
148 .flags = IORESOURCE_MEM,
149 },
150 .irq = {IRQ_DB8500_SDMMC2, NO_IRQ},
151};
152
153struct amba_device u8500_sdi3_device = {
154 .dev = {
155 .init_name = "sdi3",
156 },
157 .res = {
158 .start = U8500_SDI3_BASE,
159 .end = U8500_SDI3_BASE + SZ_4K - 1,
160 .flags = IORESOURCE_MEM,
161 },
162 .irq = {IRQ_DB8500_SDMMC3, NO_IRQ},
163};
164
165struct amba_device u8500_sdi4_device = {
166 .dev = {
167 .init_name = "sdi4",
168 },
169 .res = {
170 .start = U8500_SDI4_BASE,
171 .end = U8500_SDI4_BASE + SZ_4K - 1,
172 .flags = IORESOURCE_MEM,
173 },
174 .irq = {IRQ_DB8500_SDMMC4, NO_IRQ},
175};
176
177struct amba_device u8500_sdi5_device = {
178 .dev = {
179 .init_name = "sdi5",
180 },
181 .res = {
182 .start = U8500_SDI5_BASE,
183 .end = U8500_SDI5_BASE + SZ_4K - 1,
184 .flags = IORESOURCE_MEM,
185 },
186 .irq = {IRQ_DB8500_SDMMC5, NO_IRQ},
187};
188
189static struct resource dma40_resources[] = { 58static struct resource dma40_resources[] = {
190 [0] = { 59 [0] = {
191 .start = U8500_DMA_BASE, 60 .start = U8500_DMA_BASE,
diff --git a/arch/arm/mach-ux500/devices-db8500.h b/arch/arm/mach-ux500/devices-db8500.h
new file mode 100644
index 000000000000..3a770c756979
--- /dev/null
+++ b/arch/arm/mach-ux500/devices-db8500.h
@@ -0,0 +1,98 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2.
6 */
7
8#ifndef __DEVICES_DB8500_H
9#define __DEVICES_DB8500_H
10
11#include "devices-common.h"
12
13struct ske_keypad_platform_data;
14struct pl022_ssp_controller;
15
16static inline struct platform_device *
17db8500_add_ske_keypad(struct ske_keypad_platform_data *pdata)
18{
19 return dbx500_add_platform_device_4k1irq("nmk-ske-keypad", -1,
20 U8500_SKE_BASE,
21 IRQ_DB8500_KB, pdata);
22}
23
24static inline struct amba_device *
25db8500_add_ssp(const char *name, resource_size_t base, int irq,
26 struct pl022_ssp_controller *pdata)
27{
28 return dbx500_add_amba_device(name, base, irq, pdata, SSP_PER_ID);
29}
30
31
32#define db8500_add_i2c0(pdata) \
33 dbx500_add_i2c(0, U8500_I2C0_BASE, IRQ_DB8500_I2C0, pdata)
34#define db8500_add_i2c1(pdata) \
35 dbx500_add_i2c(1, U8500_I2C1_BASE, IRQ_DB8500_I2C1, pdata)
36#define db8500_add_i2c2(pdata) \
37 dbx500_add_i2c(2, U8500_I2C2_BASE, IRQ_DB8500_I2C2, pdata)
38#define db8500_add_i2c3(pdata) \
39 dbx500_add_i2c(3, U8500_I2C3_BASE, IRQ_DB8500_I2C3, pdata)
40#define db8500_add_i2c4(pdata) \
41 dbx500_add_i2c(4, U8500_I2C4_BASE, IRQ_DB8500_I2C4, pdata)
42
43#define db8500_add_msp0_i2s(pdata) \
44 dbx500_add_msp_i2s(0, U8500_MSP0_BASE, IRQ_DB8500_MSP0, pdata)
45#define db8500_add_msp1_i2s(pdata) \
46 dbx500_add_msp_i2s(1, U8500_MSP1_BASE, IRQ_DB8500_MSP1, pdata)
47#define db8500_add_msp2_i2s(pdata) \
48 dbx500_add_msp_i2s(2, U8500_MSP2_BASE, IRQ_DB8500_MSP2, pdata)
49#define db8500_add_msp3_i2s(pdata) \
50 dbx500_add_msp_i2s(3, U8500_MSP3_BASE, IRQ_DB8500_MSP1, pdata)
51
52#define db8500_add_msp0_spi(pdata) \
53 dbx500_add_msp_spi("msp0", U8500_MSP0_BASE, IRQ_DB8500_MSP0, pdata)
54#define db8500_add_msp1_spi(pdata) \
55 dbx500_add_msp_spi("msp1", U8500_MSP1_BASE, IRQ_DB8500_MSP1, pdata)
56#define db8500_add_msp2_spi(pdata) \
57 dbx500_add_msp_spi("msp2", U8500_MSP2_BASE, IRQ_DB8500_MSP2, pdata)
58#define db8500_add_msp3_spi(pdata) \
59 dbx500_add_msp_spi("msp3", U8500_MSP3_BASE, IRQ_DB8500_MSP1, pdata)
60
61#define db8500_add_rtc() \
62 dbx500_add_rtc(U8500_RTC_BASE, IRQ_DB8500_RTC);
63
64#define db8500_add_sdi0(pdata) \
65 dbx500_add_sdi("sdi0", U8500_SDI0_BASE, IRQ_DB8500_SDMMC0, pdata)
66#define db8500_add_sdi1(pdata) \
67 dbx500_add_sdi("sdi1", U8500_SDI1_BASE, IRQ_DB8500_SDMMC1, pdata)
68#define db8500_add_sdi2(pdata) \
69 dbx500_add_sdi("sdi2", U8500_SDI2_BASE, IRQ_DB8500_SDMMC2, pdata)
70#define db8500_add_sdi3(pdata) \
71 dbx500_add_sdi("sdi3", U8500_SDI3_BASE, IRQ_DB8500_SDMMC3, pdata)
72#define db8500_add_sdi4(pdata) \
73 dbx500_add_sdi("sdi4", U8500_SDI4_BASE, IRQ_DB8500_SDMMC4, pdata)
74#define db8500_add_sdi5(pdata) \
75 dbx500_add_sdi("sdi5", U8500_SDI5_BASE, IRQ_DB8500_SDMMC5, pdata)
76
77#define db8500_add_ssp0(pdata) \
78 db8500_add_ssp("ssp0", U8500_SSP0_BASE, IRQ_DB8500_SSP0, pdata)
79#define db8500_add_ssp1(pdata) \
80 db8500_add_ssp("ssp1", U8500_SSP1_BASE, IRQ_DB8500_SSP1, pdata)
81
82#define db8500_add_spi0(pdata) \
83 dbx500_add_spi("spi0", U8500_SPI0_BASE, IRQ_DB8500_SPI0, pdata)
84#define db8500_add_spi1(pdata) \
85 dbx500_add_spi("spi1", U8500_SPI1_BASE, IRQ_DB8500_SPI1, pdata)
86#define db8500_add_spi2(pdata) \
87 dbx500_add_spi("spi2", U8500_SPI2_BASE, IRQ_DB8500_SPI2, pdata)
88#define db8500_add_spi3(pdata) \
89 dbx500_add_spi("spi3", U8500_SPI3_BASE, IRQ_DB8500_SPI3, pdata)
90
91#define db8500_add_uart0() \
92 dbx500_add_uart("uart0", U8500_UART0_BASE, IRQ_DB8500_UART0)
93#define db8500_add_uart1() \
94 dbx500_add_uart("uart1", U8500_UART1_BASE, IRQ_DB8500_UART1)
95#define db8500_add_uart2() \
96 dbx500_add_uart("uart2", U8500_UART2_BASE, IRQ_DB8500_UART2)
97
98#endif
diff --git a/arch/arm/mach-ux500/devices.c b/arch/arm/mach-ux500/devices.c
index 8a268893cb7f..ea0a2f92ca70 100644
--- a/arch/arm/mach-ux500/devices.c
+++ b/arch/arm/mach-ux500/devices.c
@@ -14,69 +14,6 @@
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <mach/setup.h> 15#include <mach/setup.h>
16 16
17#define __MEM_4K_RESOURCE(x) \
18 .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM}
19
20struct amba_device ux500_pl031_device = {
21 .dev = {
22 .init_name = "pl031",
23 },
24 .res = {
25 .start = UX500_RTC_BASE,
26 .end = UX500_RTC_BASE + SZ_4K - 1,
27 .flags = IORESOURCE_MEM,
28 },
29 .irq = {IRQ_RTC_RTT, NO_IRQ},
30};
31
32struct amba_device ux500_uart0_device = {
33 .dev = { .init_name = "uart0" },
34 __MEM_4K_RESOURCE(UX500_UART0_BASE),
35 .irq = {IRQ_UART0, NO_IRQ},
36};
37
38struct amba_device ux500_uart1_device = {
39 .dev = { .init_name = "uart1" },
40 __MEM_4K_RESOURCE(UX500_UART1_BASE),
41 .irq = {IRQ_UART1, NO_IRQ},
42};
43
44struct amba_device ux500_uart2_device = {
45 .dev = { .init_name = "uart2" },
46 __MEM_4K_RESOURCE(UX500_UART2_BASE),
47 .irq = {IRQ_UART2, NO_IRQ},
48};
49
50#define UX500_I2C_RESOURCES(id, size) \
51static struct resource ux500_i2c##id##_resources[] = { \
52 [0] = { \
53 .start = UX500_I2C##id##_BASE, \
54 .end = UX500_I2C##id##_BASE + size - 1, \
55 .flags = IORESOURCE_MEM, \
56 }, \
57 [1] = { \
58 .start = IRQ_I2C##id, \
59 .end = IRQ_I2C##id, \
60 .flags = IORESOURCE_IRQ \
61 } \
62}
63
64UX500_I2C_RESOURCES(1, SZ_4K);
65UX500_I2C_RESOURCES(2, SZ_4K);
66UX500_I2C_RESOURCES(3, SZ_4K);
67
68#define UX500_I2C_PDEVICE(cid) \
69struct platform_device ux500_i2c##cid##_device = { \
70 .name = "nmk-i2c", \
71 .id = cid, \
72 .num_resources = 2, \
73 .resource = ux500_i2c##cid##_resources, \
74}
75
76UX500_I2C_PDEVICE(1);
77UX500_I2C_PDEVICE(2);
78UX500_I2C_PDEVICE(3);
79
80void __init amba_add_devices(struct amba_device *devs[], int num) 17void __init amba_add_devices(struct amba_device *devs[], int num)
81{ 18{
82 int i; 19 int i;
diff --git a/arch/arm/mach-ux500/include/mach/devices.h b/arch/arm/mach-ux500/include/mach/devices.h
index b91a4d1211a2..020b6369a30a 100644
--- a/arch/arm/mach-ux500/include/mach/devices.h
+++ b/arch/arm/mach-ux500/include/mach/devices.h
@@ -14,27 +14,10 @@ extern struct platform_device u5500_gpio_devs[];
14extern struct platform_device u8500_gpio_devs[]; 14extern struct platform_device u8500_gpio_devs[];
15 15
16extern struct amba_device ux500_pl031_device; 16extern struct amba_device ux500_pl031_device;
17extern struct amba_device u8500_ssp0_device;
18extern struct amba_device ux500_uart0_device;
19extern struct amba_device ux500_uart1_device;
20extern struct amba_device ux500_uart2_device;
21 17
22extern struct platform_device ux500_i2c1_device;
23extern struct platform_device ux500_i2c2_device;
24extern struct platform_device ux500_i2c3_device;
25
26extern struct platform_device u8500_i2c0_device;
27extern struct platform_device u8500_i2c4_device;
28extern struct platform_device u8500_dma40_device; 18extern struct platform_device u8500_dma40_device;
29extern struct platform_device ux500_ske_keypad_device; 19extern struct platform_device ux500_ske_keypad_device;
30 20
31extern struct amba_device u8500_sdi0_device;
32extern struct amba_device u8500_sdi1_device;
33extern struct amba_device u8500_sdi2_device;
34extern struct amba_device u8500_sdi3_device;
35extern struct amba_device u8500_sdi4_device;
36extern struct amba_device u8500_sdi5_device;
37
38void dma40_u8500ed_fixup(void); 21void dma40_u8500ed_fixup(void);
39 22
40#endif 23#endif
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
index 54bbe648bf58..322a1c1f2bae 100644
--- a/arch/arm/mach-ux500/include/mach/setup.h
+++ b/arch/arm/mach-ux500/include/mach/setup.h
@@ -18,7 +18,6 @@ extern 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 ux500_init_devices(void);
22extern void __init u5500_init_devices(void); 21extern void __init u5500_init_devices(void);
23extern void __init u8500_init_devices(void); 22extern void __init u8500_init_devices(void);
24 23
@@ -26,6 +25,7 @@ extern void __init ux500_init_irq(void);
26/* We re-use nomadik_timer for this platform */ 25/* We re-use nomadik_timer for this platform */
27extern void nmdk_timer_init(void); 26extern void nmdk_timer_init(void);
28 27
28struct amba_device;
29extern void __init amba_add_devices(struct amba_device *devs[], int num); 29extern void __init amba_add_devices(struct amba_device *devs[], int num);
30 30
31struct sys_timer; 31struct sys_timer;