diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2012-04-03 07:00:18 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-04-19 14:31:34 -0400 |
commit | 08956a0e8a697edb566766536b2fbbb168ac6ecc (patch) | |
tree | bbde880150dc9cbb774003f2255ce5706067adfe /arch/arm/mach-ux500 | |
parent | 4ff35d863ea2cbce2dc6c708b80be12e5b74226b (diff) |
ARM: 7372/1: ux500: factor out dynamic amba device allocator
This replaces the dynamic device allocator in the ux500 machine
with the common device allocator in the bus code.
Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-ux500')
-rw-r--r-- | arch/arm/mach-ux500/devices-common.c | 33 | ||||
-rw-r--r-- | arch/arm/mach-ux500/devices-common.h | 23 | ||||
-rw-r--r-- | arch/arm/mach-ux500/devices-db8500.h | 2 |
3 files changed, 11 insertions, 47 deletions
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c index c5312a4b49f5..dfdd4a54668d 100644 --- a/arch/arm/mach-ux500/devices-common.c +++ b/arch/arm/mach-ux500/devices-common.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/irq.h> | 11 | #include <linux/irq.h> |
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/amba/bus.h> | ||
15 | 14 | ||
16 | #include <plat/gpio-nomadik.h> | 15 | #include <plat/gpio-nomadik.h> |
17 | 16 | ||
@@ -19,38 +18,6 @@ | |||
19 | 18 | ||
20 | #include "devices-common.h" | 19 | #include "devices-common.h" |
21 | 20 | ||
22 | struct amba_device * | ||
23 | dbx500_add_amba_device(struct device *parent, const char *name, | ||
24 | resource_size_t base, int irq, void *pdata, | ||
25 | unsigned int periphid) | ||
26 | { | ||
27 | struct amba_device *dev; | ||
28 | int ret; | ||
29 | |||
30 | dev = amba_device_alloc(name, base, SZ_4K); | ||
31 | if (!dev) | ||
32 | return ERR_PTR(-ENOMEM); | ||
33 | |||
34 | dev->dma_mask = DMA_BIT_MASK(32); | ||
35 | dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | ||
36 | |||
37 | dev->irq[0] = irq; | ||
38 | |||
39 | dev->periphid = periphid; | ||
40 | |||
41 | dev->dev.platform_data = pdata; | ||
42 | |||
43 | dev->dev.parent = parent; | ||
44 | |||
45 | ret = amba_device_add(dev, &iomem_resource); | ||
46 | if (ret) { | ||
47 | amba_device_put(dev); | ||
48 | return ERR_PTR(ret); | ||
49 | } | ||
50 | |||
51 | return dev; | ||
52 | } | ||
53 | |||
54 | static struct platform_device * | 21 | static struct platform_device * |
55 | dbx500_add_gpio(struct device *parent, int id, resource_size_t addr, int irq, | 22 | dbx500_add_gpio(struct device *parent, int id, resource_size_t addr, int irq, |
56 | struct nmk_gpio_platform_data *pdata) | 23 | struct nmk_gpio_platform_data *pdata) |
diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h index 39c74ec82add..f75bcb2ab13b 100644 --- a/arch/arm/mach-ux500/devices-common.h +++ b/arch/arm/mach-ux500/devices-common.h | |||
@@ -11,13 +11,9 @@ | |||
11 | #include <linux/platform_device.h> | 11 | #include <linux/platform_device.h> |
12 | #include <linux/dma-mapping.h> | 12 | #include <linux/dma-mapping.h> |
13 | #include <linux/sys_soc.h> | 13 | #include <linux/sys_soc.h> |
14 | #include <linux/amba/bus.h> | ||
14 | #include <plat/i2c.h> | 15 | #include <plat/i2c.h> |
15 | 16 | ||
16 | extern struct amba_device * | ||
17 | dbx500_add_amba_device(struct device *parent, const char *name, | ||
18 | resource_size_t base, int irq, void *pdata, | ||
19 | unsigned int periphid); | ||
20 | |||
21 | struct spi_master_cntlr; | 17 | struct spi_master_cntlr; |
22 | 18 | ||
23 | static inline struct amba_device * | 19 | static inline struct amba_device * |
@@ -25,8 +21,8 @@ dbx500_add_msp_spi(struct device *parent, const char *name, | |||
25 | resource_size_t base, int irq, | 21 | resource_size_t base, int irq, |
26 | struct spi_master_cntlr *pdata) | 22 | struct spi_master_cntlr *pdata) |
27 | { | 23 | { |
28 | return dbx500_add_amba_device(parent, name, base, irq, | 24 | return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, |
29 | pdata, 0); | 25 | pdata, 0); |
30 | } | 26 | } |
31 | 27 | ||
32 | static inline struct amba_device * | 28 | static inline struct amba_device * |
@@ -34,8 +30,8 @@ dbx500_add_spi(struct device *parent, const char *name, resource_size_t base, | |||
34 | int irq, struct spi_master_cntlr *pdata, | 30 | int irq, struct spi_master_cntlr *pdata, |
35 | u32 periphid) | 31 | u32 periphid) |
36 | { | 32 | { |
37 | return dbx500_add_amba_device(parent, name, base, irq, | 33 | return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, |
38 | pdata, periphid); | 34 | pdata, periphid); |
39 | } | 35 | } |
40 | 36 | ||
41 | struct mmci_platform_data; | 37 | struct mmci_platform_data; |
@@ -44,8 +40,8 @@ static inline struct amba_device * | |||
44 | dbx500_add_sdi(struct device *parent, const char *name, resource_size_t base, | 40 | dbx500_add_sdi(struct device *parent, const char *name, resource_size_t base, |
45 | int irq, struct mmci_platform_data *pdata, u32 periphid) | 41 | int irq, struct mmci_platform_data *pdata, u32 periphid) |
46 | { | 42 | { |
47 | return dbx500_add_amba_device(parent, name, base, irq, | 43 | return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, |
48 | pdata, periphid); | 44 | pdata, periphid); |
49 | } | 45 | } |
50 | 46 | ||
51 | struct amba_pl011_data; | 47 | struct amba_pl011_data; |
@@ -54,7 +50,7 @@ static inline struct amba_device * | |||
54 | dbx500_add_uart(struct device *parent, const char *name, resource_size_t base, | 50 | dbx500_add_uart(struct device *parent, const char *name, resource_size_t base, |
55 | int irq, struct amba_pl011_data *pdata) | 51 | int irq, struct amba_pl011_data *pdata) |
56 | { | 52 | { |
57 | return dbx500_add_amba_device(parent, name, base, irq, pdata, 0); | 53 | return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, pdata, 0); |
58 | } | 54 | } |
59 | 55 | ||
60 | struct nmk_i2c_controller; | 56 | struct nmk_i2c_controller; |
@@ -85,7 +81,8 @@ dbx500_add_i2c(struct device *parent, int id, resource_size_t base, int irq, | |||
85 | static inline struct amba_device * | 81 | static inline struct amba_device * |
86 | dbx500_add_rtc(struct device *parent, resource_size_t base, int irq) | 82 | dbx500_add_rtc(struct device *parent, resource_size_t base, int irq) |
87 | { | 83 | { |
88 | return dbx500_add_amba_device(parent, "rtc-pl031", base, irq, NULL, 0); | 84 | return amba_apb_device_add(parent, "rtc-pl031", base, SZ_4K, irq, |
85 | 0, NULL, 0); | ||
89 | } | 86 | } |
90 | 87 | ||
91 | struct nmk_gpio_platform_data; | 88 | struct nmk_gpio_platform_data; |
diff --git a/arch/arm/mach-ux500/devices-db8500.h b/arch/arm/mach-ux500/devices-db8500.h index 9fd93e9da529..6fc7eb24d9a0 100644 --- a/arch/arm/mach-ux500/devices-db8500.h +++ b/arch/arm/mach-ux500/devices-db8500.h | |||
@@ -31,7 +31,7 @@ static inline struct amba_device * | |||
31 | db8500_add_ssp(struct device *parent, const char *name, resource_size_t base, | 31 | db8500_add_ssp(struct device *parent, const char *name, resource_size_t base, |
32 | int irq, struct pl022_ssp_controller *pdata) | 32 | int irq, struct pl022_ssp_controller *pdata) |
33 | { | 33 | { |
34 | return dbx500_add_amba_device(parent, name, base, irq, pdata, 0); | 34 | return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, pdata, 0); |
35 | } | 35 | } |
36 | 36 | ||
37 | 37 | ||