aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-01-24 17:36:47 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-02-09 10:34:15 -0500
commit9590e898742cd6cd50aab1109a115faf42befaf7 (patch)
treee9fde9b05f0b61a051169fc8cf07908582ae0cb1 /arch/arm/mach-sa1100
parentae14c2e28cd6d78a975dda853d2fdb00a3219c16 (diff)
ARM: sa11x0: neponset: dynamically create neponset child devices
Use platform_device_register_full() to dynamically create the various neponset child platform devices, and place them below the neponset device itself to ensure proper PM ordering and device structure. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-sa1100')
-rw-r--r--arch/arm/mach-sa1100/neponset.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 6f0aa91d5d34..164bc9801ed7 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -1,6 +1,7 @@
1/* 1/*
2 * linux/arch/arm/mach-sa1100/neponset.c 2 * linux/arch/arm/mach-sa1100/neponset.c
3 */ 3 */
4#include <linux/err.h>
4#include <linux/init.h> 5#include <linux/init.h>
5#include <linux/ioport.h> 6#include <linux/ioport.h>
6#include <linux/kernel.h> 7#include <linux/kernel.h>
@@ -22,6 +23,8 @@
22#include <mach/neponset.h> 23#include <mach/neponset.h>
23 24
24struct neponset_drvdata { 25struct neponset_drvdata {
26 struct platform_device *sa1111;
27 struct platform_device *smc91x;
25#ifdef CONFIG_PM_SLEEP 28#ifdef CONFIG_PM_SLEEP
26 u32 ncr0; 29 u32 ncr0;
27 u32 mdm_ctl_0; 30 u32 mdm_ctl_0;
@@ -178,20 +181,6 @@ static struct sa1111_platform_data sa1111_info = {
178 .irq_base = IRQ_BOARD_END, 181 .irq_base = IRQ_BOARD_END,
179}; 182};
180 183
181static u64 sa1111_dmamask = 0xffffffffUL;
182
183static struct platform_device sa1111_device = {
184 .name = "sa1111",
185 .id = 0,
186 .dev = {
187 .dma_mask = &sa1111_dmamask,
188 .coherent_dma_mask = 0xffffffff,
189 .platform_data = &sa1111_info,
190 },
191 .num_resources = ARRAY_SIZE(sa1111_resources),
192 .resource = sa1111_resources,
193};
194
195static struct resource smc91x_resources[] = { 184static struct resource smc91x_resources[] = {
196 [0] = DEFINE_RES_MEM_NAMED(SA1100_CS3_PHYS, 0x02000000, "smc91x-regs"), 185 [0] = DEFINE_RES_MEM_NAMED(SA1100_CS3_PHYS, 0x02000000, "smc91x-regs"),
197 [1] = DEFINE_RES_IRQ(IRQ_NEPONSET_SMC9196), 186 [1] = DEFINE_RES_IRQ(IRQ_NEPONSET_SMC9196),
@@ -199,16 +188,26 @@ static struct resource smc91x_resources[] = {
199 0x02000000, "smc91x-attrib"), 188 0x02000000, "smc91x-attrib"),
200}; 189};
201 190
202static struct platform_device smc91x_device = {
203 .name = "smc91x",
204 .id = 0,
205 .num_resources = ARRAY_SIZE(smc91x_resources),
206 .resource = smc91x_resources,
207};
208
209static int __devinit neponset_probe(struct platform_device *dev) 191static int __devinit neponset_probe(struct platform_device *dev)
210{ 192{
211 struct neponset_drvdata *d; 193 struct neponset_drvdata *d;
194 struct platform_device_info sa1111_devinfo = {
195 .parent = &dev->dev,
196 .name = "sa1111",
197 .id = 0,
198 .res = sa1111_resources,
199 .num_res = ARRAY_SIZE(sa1111_resources),
200 .data = &sa1111_info,
201 .size_data = sizeof(sa1111_info),
202 .dma_mask = 0xffffffffUL,
203 };
204 struct platform_device_info smc91x_devinfo = {
205 .parent = &dev->dev,
206 .name = "smc91x",
207 .id = 0,
208 .res = smc91x_resources,
209 .num_res = ARRAY_SIZE(smc91x_resources),
210 };
212 int ret; 211 int ret;
213 212
214 d = kzalloc(sizeof(*d), GFP_KERNEL); 213 d = kzalloc(sizeof(*d), GFP_KERNEL);
@@ -251,6 +250,9 @@ static int __devinit neponset_probe(struct platform_device *dev)
251 */ 250 */
252 NCR_0 = NCR_GP01_OFF; 251 NCR_0 = NCR_GP01_OFF;
253 252
253 d->sa1111 = platform_device_register_full(&sa1111_devinfo);
254 d->smc91x = platform_device_register_full(&smc91x_devinfo);
255
254 platform_set_drvdata(dev, d); 256 platform_set_drvdata(dev, d);
255 257
256 return 0; 258 return 0;
@@ -263,6 +265,10 @@ static int __devexit neponset_remove(struct platform_device *dev)
263{ 265{
264 struct neponset_drvdata *d = platform_get_drvdata(dev); 266 struct neponset_drvdata *d = platform_get_drvdata(dev);
265 267
268 if (!IS_ERR(d->sa1111))
269 platform_device_unregister(d->sa1111);
270 if (!IS_ERR(d->smc91x))
271 platform_device_unregister(d->smc91x);
266 irq_set_chained_handler(IRQ_GPIO25, NULL); 272 irq_set_chained_handler(IRQ_GPIO25, NULL);
267 273
268 kfree(d); 274 kfree(d);
@@ -318,12 +324,6 @@ static struct platform_device neponset_device = {
318 .resource = neponset_resources, 324 .resource = neponset_resources,
319}; 325};
320 326
321static struct platform_device *devices[] __initdata = {
322 &neponset_device,
323 &sa1111_device,
324 &smc91x_device,
325};
326
327extern void sa1110_mb_disable(void); 327extern void sa1110_mb_disable(void);
328 328
329static int __init neponset_init(void) 329static int __init neponset_init(void)
@@ -354,7 +354,7 @@ static int __init neponset_init(void)
354 return -ENODEV; 354 return -ENODEV;
355 } 355 }
356 356
357 return platform_add_devices(devices, ARRAY_SIZE(devices)); 357 return platform_device_register(&neponset_device);
358} 358}
359 359
360subsys_initcall(neponset_init); 360subsys_initcall(neponset_init);