diff options
author | Tony Lindgren <tony@atomide.com> | 2012-04-23 18:56:36 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2012-05-09 19:35:12 -0400 |
commit | 5ff391d8ac555486de8af083068b94a66d32f4c2 (patch) | |
tree | c4dc8f0215f3f1fef233af7c1487269c97e35e4e | |
parent | 2fdad5c971ad7991d1798866ae0cb25846155423 (diff) |
ARM: OMAP: Move omap_mmc_add() to mach-omap1
Now that omap2420 is using hwmod for MMC, this code is omap1
only used on omap1.
Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r-- | arch/arm/mach-omap1/devices.c | 43 | ||||
-rw-r--r-- | arch/arm/plat-omap/devices.c | 48 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/mmc.h | 9 |
3 files changed, 43 insertions, 57 deletions
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c index b853f6110a44..21926765b16d 100644 --- a/arch/arm/mach-omap1/devices.c +++ b/arch/arm/mach-omap1/devices.c | |||
@@ -144,6 +144,49 @@ static inline void omap1_mmc_mux(struct omap_mmc_platform_data *mmc_controller, | |||
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
147 | #define OMAP_MMC_NR_RES 2 | ||
148 | |||
149 | /* | ||
150 | * Register MMC devices. | ||
151 | */ | ||
152 | static int __init omap_mmc_add(const char *name, int id, unsigned long base, | ||
153 | unsigned long size, unsigned int irq, | ||
154 | struct omap_mmc_platform_data *data) | ||
155 | { | ||
156 | struct platform_device *pdev; | ||
157 | struct resource res[OMAP_MMC_NR_RES]; | ||
158 | int ret; | ||
159 | |||
160 | pdev = platform_device_alloc(name, id); | ||
161 | if (!pdev) | ||
162 | return -ENOMEM; | ||
163 | |||
164 | memset(res, 0, OMAP_MMC_NR_RES * sizeof(struct resource)); | ||
165 | res[0].start = base; | ||
166 | res[0].end = base + size - 1; | ||
167 | res[0].flags = IORESOURCE_MEM; | ||
168 | res[1].start = res[1].end = irq; | ||
169 | res[1].flags = IORESOURCE_IRQ; | ||
170 | |||
171 | ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); | ||
172 | if (ret == 0) | ||
173 | ret = platform_device_add_data(pdev, data, sizeof(*data)); | ||
174 | if (ret) | ||
175 | goto fail; | ||
176 | |||
177 | ret = platform_device_add(pdev); | ||
178 | if (ret) | ||
179 | goto fail; | ||
180 | |||
181 | /* return device handle to board setup code */ | ||
182 | data->dev = &pdev->dev; | ||
183 | return 0; | ||
184 | |||
185 | fail: | ||
186 | platform_device_put(pdev); | ||
187 | return ret; | ||
188 | } | ||
189 | |||
147 | void __init omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, | 190 | void __init omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, |
148 | int nr_controllers) | 191 | int nr_controllers) |
149 | { | 192 | { |
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c index 1151d0b11c91..1cba9273d2cb 100644 --- a/arch/arm/plat-omap/devices.c +++ b/arch/arm/plat-omap/devices.c | |||
@@ -28,54 +28,6 @@ | |||
28 | #include <plat/menelaus.h> | 28 | #include <plat/menelaus.h> |
29 | #include <plat/omap44xx.h> | 29 | #include <plat/omap44xx.h> |
30 | 30 | ||
31 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ | ||
32 | defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) | ||
33 | |||
34 | #define OMAP_MMC_NR_RES 2 | ||
35 | |||
36 | /* | ||
37 | * Register MMC devices. Called from mach-omap1 and mach-omap2 device init. | ||
38 | */ | ||
39 | int __init omap_mmc_add(const char *name, int id, unsigned long base, | ||
40 | unsigned long size, unsigned int irq, | ||
41 | struct omap_mmc_platform_data *data) | ||
42 | { | ||
43 | struct platform_device *pdev; | ||
44 | struct resource res[OMAP_MMC_NR_RES]; | ||
45 | int ret; | ||
46 | |||
47 | pdev = platform_device_alloc(name, id); | ||
48 | if (!pdev) | ||
49 | return -ENOMEM; | ||
50 | |||
51 | memset(res, 0, OMAP_MMC_NR_RES * sizeof(struct resource)); | ||
52 | res[0].start = base; | ||
53 | res[0].end = base + size - 1; | ||
54 | res[0].flags = IORESOURCE_MEM; | ||
55 | res[1].start = res[1].end = irq; | ||
56 | res[1].flags = IORESOURCE_IRQ; | ||
57 | |||
58 | ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); | ||
59 | if (ret == 0) | ||
60 | ret = platform_device_add_data(pdev, data, sizeof(*data)); | ||
61 | if (ret) | ||
62 | goto fail; | ||
63 | |||
64 | ret = platform_device_add(pdev); | ||
65 | if (ret) | ||
66 | goto fail; | ||
67 | |||
68 | /* return device handle to board setup code */ | ||
69 | data->dev = &pdev->dev; | ||
70 | return 0; | ||
71 | |||
72 | fail: | ||
73 | platform_device_put(pdev); | ||
74 | return ret; | ||
75 | } | ||
76 | |||
77 | #endif | ||
78 | |||
79 | /*-------------------------------------------------------------------------*/ | 31 | /*-------------------------------------------------------------------------*/ |
80 | 32 | ||
81 | #if defined(CONFIG_HW_RANDOM_OMAP) || defined(CONFIG_HW_RANDOM_OMAP_MODULE) | 33 | #if defined(CONFIG_HW_RANDOM_OMAP) || defined(CONFIG_HW_RANDOM_OMAP_MODULE) |
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h index 3e7ae0f0215f..a7754a886d42 100644 --- a/arch/arm/plat-omap/include/plat/mmc.h +++ b/arch/arm/plat-omap/include/plat/mmc.h | |||
@@ -177,9 +177,6 @@ extern void omap_mmc_notify_cover_event(struct device *dev, int slot, | |||
177 | void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, | 177 | void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, |
178 | int nr_controllers); | 178 | int nr_controllers); |
179 | void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data); | 179 | void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data); |
180 | int omap_mmc_add(const char *name, int id, unsigned long base, | ||
181 | unsigned long size, unsigned int irq, | ||
182 | struct omap_mmc_platform_data *data); | ||
183 | #else | 180 | #else |
184 | static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, | 181 | static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, |
185 | int nr_controllers) | 182 | int nr_controllers) |
@@ -188,12 +185,6 @@ static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, | |||
188 | static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) | 185 | static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) |
189 | { | 186 | { |
190 | } | 187 | } |
191 | static inline int omap_mmc_add(const char *name, int id, unsigned long base, | ||
192 | unsigned long size, unsigned int irq, | ||
193 | struct omap_mmc_platform_data *data) | ||
194 | { | ||
195 | return 0; | ||
196 | } | ||
197 | 188 | ||
198 | #endif | 189 | #endif |
199 | 190 | ||