aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/ar7
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2009-07-15 06:09:34 -0400
committerRalf Baechle <ralf@linux-mips.org>2009-09-17 14:07:48 -0400
commitd47fbb5996269f3081deb7a1b4ba717557256555 (patch)
tree7f2c8fce4a9d8d37708692a9a654974f197d362c /arch/mips/ar7
parent6f4c7b32e156ac67ae170554cfba0929272c7adf (diff)
MIPS: AR7: Make board code register ar7_wdt as a platform device
This patch makes the board code register the ar7_wdt driver as a platform device. We move the dynamic resource calculation here since the driver should not be aware of the AR7 SoC version it is running on. Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/ar7')
-rw-r--r--arch/mips/ar7/platform.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
index cf50fa29b198..e2278c04459d 100644
--- a/arch/mips/ar7/platform.c
+++ b/arch/mips/ar7/platform.c
@@ -417,6 +417,20 @@ static struct platform_device ar7_udc = {
417 .num_resources = ARRAY_SIZE(usb_res), 417 .num_resources = ARRAY_SIZE(usb_res),
418}; 418};
419 419
420static struct resource ar7_wdt_res = {
421 .name = "regs",
422 .start = -1, /* Filled at runtime */
423 .end = -1, /* Filled at runtime */
424 .flags = IORESOURCE_MEM,
425};
426
427static struct platform_device ar7_wdt = {
428 .id = -1,
429 .name = "ar7_wdt",
430 .resource = &ar7_wdt_res,
431 .num_resources = 1,
432};
433
420static inline unsigned char char2hex(char h) 434static inline unsigned char char2hex(char h)
421{ 435{
422 switch (h) { 436 switch (h) {
@@ -487,6 +501,7 @@ static void __init detect_leds(void)
487 501
488static int __init ar7_register_devices(void) 502static int __init ar7_register_devices(void)
489{ 503{
504 u16 chip_id;
490 int res; 505 int res;
491#ifdef CONFIG_SERIAL_8250 506#ifdef CONFIG_SERIAL_8250
492 static struct uart_port uart_port[2]; 507 static struct uart_port uart_port[2];
@@ -565,6 +580,23 @@ static int __init ar7_register_devices(void)
565 580
566 res = platform_device_register(&ar7_udc); 581 res = platform_device_register(&ar7_udc);
567 582
583 chip_id = ar7_chip_id();
584 switch (chip_id) {
585 case AR7_CHIP_7100:
586 case AR7_CHIP_7200:
587 ar7_wdt_res.start = AR7_REGS_WDT;
588 break;
589 case AR7_CHIP_7300:
590 ar7_wdt_res.start = UR8_REGS_WDT;
591 break;
592 default:
593 break;
594 }
595
596 ar7_wdt_res.end = ar7_wdt_res.start + 0x20;
597
598 res = platform_device_register(&ar7_wdt);
599
568 return res; 600 return res;
569} 601}
570arch_initcall(ar7_register_devices); 602arch_initcall(ar7_register_devices);