diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2012-04-03 07:11:50 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-04-19 14:31:33 -0400 |
commit | 5002484b8ac93e8d32ca75e8a7504dbb9f7926fe (patch) | |
tree | 8a6a52698ba7d1df5138195b38039370590acb65 /arch/arm/mach-mxs | |
parent | 6026aa907b16677d32593c5b7dea134380f51f7f (diff) |
ARM: 7370/2: mxs: factor out dynamic amba device allocator
Replace the local amba device allocator with the core code from
the bus driver.
Acked-by: Shawn Guo <shawn.guo@linaro.org>
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-mxs')
-rw-r--r-- | arch/arm/mach-mxs/devices-mx23.h | 12 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices-mx28.h | 12 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/amba-duart.c | 40 | ||||
-rw-r--r-- | arch/arm/mach-mxs/include/mach/devices-common.h | 5 |
6 files changed, 18 insertions, 68 deletions
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h index 4d1329d59287..9acdd6387047 100644 --- a/arch/arm/mach-mxs/devices-mx23.h +++ b/arch/arm/mach-mxs/devices-mx23.h | |||
@@ -11,10 +11,16 @@ | |||
11 | #include <mach/mx23.h> | 11 | #include <mach/mx23.h> |
12 | #include <mach/devices-common.h> | 12 | #include <mach/devices-common.h> |
13 | #include <mach/mxsfb.h> | 13 | #include <mach/mxsfb.h> |
14 | #include <linux/amba/bus.h> | ||
14 | 15 | ||
15 | extern const struct amba_device mx23_duart_device __initconst; | 16 | static inline int mx23_add_duart(void) |
16 | #define mx23_add_duart() \ | 17 | { |
17 | mxs_add_duart(&mx23_duart_device) | 18 | struct amba_device *d; |
19 | |||
20 | d = amba_ahb_device_add(NULL, "duart", MX23_DUART_BASE_ADDR, SZ_8K, | ||
21 | MX23_INT_DUART, 0, 0, 0); | ||
22 | return IS_ERR(d) ? PTR_ERR(d) : 0; | ||
23 | } | ||
18 | 24 | ||
19 | extern const struct mxs_auart_data mx23_auart_data[] __initconst; | 25 | extern const struct mxs_auart_data mx23_auart_data[] __initconst; |
20 | #define mx23_add_auart(id) mxs_add_auart(&mx23_auart_data[id]) | 26 | #define mx23_add_auart(id) mxs_add_auart(&mx23_auart_data[id]) |
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h index 9dbeae130842..84b2960df117 100644 --- a/arch/arm/mach-mxs/devices-mx28.h +++ b/arch/arm/mach-mxs/devices-mx28.h | |||
@@ -11,10 +11,16 @@ | |||
11 | #include <mach/mx28.h> | 11 | #include <mach/mx28.h> |
12 | #include <mach/devices-common.h> | 12 | #include <mach/devices-common.h> |
13 | #include <mach/mxsfb.h> | 13 | #include <mach/mxsfb.h> |
14 | #include <linux/amba/bus.h> | ||
14 | 15 | ||
15 | extern const struct amba_device mx28_duart_device __initconst; | 16 | static inline int mx28_add_duart(void) |
16 | #define mx28_add_duart() \ | 17 | { |
17 | mxs_add_duart(&mx28_duart_device) | 18 | struct amba_device *d; |
19 | |||
20 | d = amba_ahb_device_add(NULL, "duart", MX28_DUART_BASE_ADDR, SZ_8K, | ||
21 | MX28_INT_DUART, 0, 0, 0); | ||
22 | return IS_ERR(d) ? PTR_ERR(d) : 0; | ||
23 | } | ||
18 | 24 | ||
19 | extern const struct mxs_auart_data mx28_auart_data[] __initconst; | 25 | extern const struct mxs_auart_data mx28_auart_data[] __initconst; |
20 | #define mx28_add_auart(id) mxs_add_auart(&mx28_auart_data[id]) | 26 | #define mx28_add_auart(id) mxs_add_auart(&mx28_auart_data[id]) |
diff --git a/arch/arm/mach-mxs/devices.c b/arch/arm/mach-mxs/devices.c index 01faffec3064..cf50b5a66dda 100644 --- a/arch/arm/mach-mxs/devices.c +++ b/arch/arm/mach-mxs/devices.c | |||
@@ -75,22 +75,6 @@ err: | |||
75 | return pdev; | 75 | return pdev; |
76 | } | 76 | } |
77 | 77 | ||
78 | int __init mxs_add_amba_device(const struct amba_device *dev) | ||
79 | { | ||
80 | struct amba_device *adev = amba_device_alloc(dev->dev.init_name, | ||
81 | dev->res.start, resource_size(&dev->res)); | ||
82 | |||
83 | if (!adev) { | ||
84 | pr_err("%s: failed to allocate memory", __func__); | ||
85 | return -ENOMEM; | ||
86 | } | ||
87 | |||
88 | adev->irq[0] = dev->irq[0]; | ||
89 | adev->irq[1] = dev->irq[1]; | ||
90 | |||
91 | return amba_device_add(adev, &iomem_resource); | ||
92 | } | ||
93 | |||
94 | struct device mxs_apbh_bus = { | 78 | struct device mxs_apbh_bus = { |
95 | .init_name = "mxs_apbh", | 79 | .init_name = "mxs_apbh", |
96 | .parent = &platform_bus, | 80 | .parent = &platform_bus, |
diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile index c8f5c9541a30..5f72d9787444 100644 --- a/arch/arm/mach-mxs/devices/Makefile +++ b/arch/arm/mach-mxs/devices/Makefile | |||
@@ -1,4 +1,3 @@ | |||
1 | obj-$(CONFIG_MXS_HAVE_AMBA_DUART) += amba-duart.o | ||
2 | obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o | 1 | obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o |
3 | obj-y += platform-dma.o | 2 | obj-y += platform-dma.o |
4 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o | 3 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o |
diff --git a/arch/arm/mach-mxs/devices/amba-duart.c b/arch/arm/mach-mxs/devices/amba-duart.c deleted file mode 100644 index a5479f766046..000000000000 --- a/arch/arm/mach-mxs/devices/amba-duart.c +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009-2010 Pengutronix | ||
3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> | ||
4 | * | ||
5 | * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it under | ||
8 | * the terms of the GNU General Public License version 2 as published by the | ||
9 | * Free Software Foundation. | ||
10 | */ | ||
11 | #include <asm/irq.h> | ||
12 | #include <mach/mx23.h> | ||
13 | #include <mach/mx28.h> | ||
14 | #include <mach/devices-common.h> | ||
15 | |||
16 | #define MXS_AMBA_DUART_DEVICE(name, soc) \ | ||
17 | const struct amba_device name##_device __initconst = { \ | ||
18 | .dev = { \ | ||
19 | .init_name = "duart", \ | ||
20 | }, \ | ||
21 | .res = { \ | ||
22 | .start = soc ## _DUART_BASE_ADDR, \ | ||
23 | .end = (soc ## _DUART_BASE_ADDR) + SZ_8K - 1, \ | ||
24 | .flags = IORESOURCE_MEM, \ | ||
25 | }, \ | ||
26 | .irq = {soc ## _INT_DUART}, \ | ||
27 | } | ||
28 | |||
29 | #ifdef CONFIG_SOC_IMX23 | ||
30 | MXS_AMBA_DUART_DEVICE(mx23_duart, MX23); | ||
31 | #endif | ||
32 | |||
33 | #ifdef CONFIG_SOC_IMX28 | ||
34 | MXS_AMBA_DUART_DEVICE(mx28_duart, MX28); | ||
35 | #endif | ||
36 | |||
37 | int __init mxs_add_duart(const struct amba_device *dev) | ||
38 | { | ||
39 | return mxs_add_amba_device(dev); | ||
40 | } | ||
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h index f2e383955d88..21e45a70d344 100644 --- a/arch/arm/mach-mxs/include/mach/devices-common.h +++ b/arch/arm/mach-mxs/include/mach/devices-common.h | |||
@@ -27,11 +27,6 @@ static inline struct platform_device *mxs_add_platform_device( | |||
27 | name, id, res, num_resources, data, size_data, 0); | 27 | name, id, res, num_resources, data, size_data, 0); |
28 | } | 28 | } |
29 | 29 | ||
30 | int __init mxs_add_amba_device(const struct amba_device *dev); | ||
31 | |||
32 | /* duart */ | ||
33 | int __init mxs_add_duart(const struct amba_device *dev); | ||
34 | |||
35 | /* auart */ | 30 | /* auart */ |
36 | struct mxs_auart_data { | 31 | struct mxs_auart_data { |
37 | int id; | 32 | int id; |