aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100/neponset.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-01-26 06:50:23 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-02-09 10:34:17 -0500
commitbab50a35ee703955bd708a4a44cd56ed30e601c8 (patch)
tree595780bfbab2e3e5ce9b27c3b7faf44ae785949c /arch/arm/mach-sa1100/neponset.c
parent51f93390c21a4154b0520c3a8a34733e4072a7db (diff)
ARM: sa11x0: assabet/neponest: create neponset device in assabet.c
The neponset board is a daughter board for the Assabet. Create the neponset platform device in assabet.c, where we don't have to wrap it with machine_is_assabet() stuff. We also create this device dynamically rather than keeping it as a static device. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-sa1100/neponset.c')
-rw-r--r--arch/arm/mach-sa1100/neponset.c56
1 files changed, 13 insertions, 43 deletions
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 59223baa7c1d..2a9e1e2223f0 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -27,6 +27,8 @@
27#define NEP_IRQ_SA1111 2 27#define NEP_IRQ_SA1111 2
28#define NEP_IRQ_NR 3 28#define NEP_IRQ_NR 3
29 29
30extern void sa1110_mb_disable(void);
31
30struct neponset_drvdata { 32struct neponset_drvdata {
31 struct platform_device *sa1111; 33 struct platform_device *sa1111;
32 struct platform_device *smc91x; 34 struct platform_device *smc91x;
@@ -222,6 +224,13 @@ static int __devinit neponset_probe(struct platform_device *dev)
222 goto err_alloc; 224 goto err_alloc;
223 } 225 }
224 226
227 if (WHOAMI != 0x11) {
228 dev_warn(&dev->dev, "Neponset board detected, but wrong ID: %02x\n",
229 WHOAMI);
230 ret = -ENODEV;
231 goto err_alloc;
232 }
233
225 d = kzalloc(sizeof(*d), GFP_KERNEL); 234 d = kzalloc(sizeof(*d), GFP_KERNEL);
226 if (!d) { 235 if (!d) {
227 ret = -ENOMEM; 236 ret = -ENOMEM;
@@ -264,6 +273,9 @@ static int __devinit neponset_probe(struct platform_device *dev)
264 273
265 sa1100_register_uart_fns(&neponset_port_fns); 274 sa1100_register_uart_fns(&neponset_port_fns);
266 275
276 /* Ensure that the memory bus request/grant signals are setup */
277 sa1110_mb_disable();
278
267 /* Disable GPIO 0/1 drivers so the buttons work on the Assabet */ 279 /* Disable GPIO 0/1 drivers so the buttons work on the Assabet */
268 NCR_0 = NCR_GP01_OFF; 280 NCR_0 = NCR_GP01_OFF;
269 281
@@ -346,51 +358,9 @@ static struct platform_driver neponset_device_driver = {
346 }, 358 },
347}; 359};
348 360
349static struct resource neponset_resources[] = {
350 DEFINE_RES_MEM(0x10000000, 0x08000000),
351 DEFINE_RES_MEM(0x18000000, 0x04000000),
352 DEFINE_RES_MEM(0x40000000, SZ_8K),
353 DEFINE_RES_IRQ(IRQ_GPIO25),
354};
355
356static struct platform_device neponset_device = {
357 .name = "neponset",
358 .id = 0,
359 .num_resources = ARRAY_SIZE(neponset_resources),
360 .resource = neponset_resources,
361};
362
363extern void sa1110_mb_disable(void);
364
365static int __init neponset_init(void) 361static int __init neponset_init(void)
366{ 362{
367 platform_driver_register(&neponset_device_driver); 363 return platform_driver_register(&neponset_device_driver);
368
369 /*
370 * The Neponset is only present on the Assabet machine type.
371 */
372 if (!machine_is_assabet())
373 return -ENODEV;
374
375 /*
376 * Ensure that the memory bus request/grant signals are setup,
377 * and the grant is held in its inactive state, whether or not
378 * we actually have a Neponset attached.
379 */
380 sa1110_mb_disable();
381
382 if (!machine_has_neponset()) {
383 printk(KERN_DEBUG "Neponset expansion board not present\n");
384 return -ENODEV;
385 }
386
387 if (WHOAMI != 0x11) {
388 printk(KERN_WARNING "Neponset board detected, but "
389 "wrong ID: %02x\n", WHOAMI);
390 return -ENODEV;
391 }
392
393 return platform_device_register(&neponset_device);
394} 364}
395 365
396subsys_initcall(neponset_init); 366subsys_initcall(neponset_init);