Skip to content

Commit

Permalink
MIPS: AR7: Make board code register ar7_wdt as a platform device
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Florian Fainelli authored and Ralf Baechle committed Sep 17, 2009
1 parent 6f4c7b3 commit d47fbb5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions arch/mips/ar7/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,20 @@ static struct platform_device ar7_udc = {
.num_resources = ARRAY_SIZE(usb_res),
};

static struct resource ar7_wdt_res = {
.name = "regs",
.start = -1, /* Filled at runtime */
.end = -1, /* Filled at runtime */
.flags = IORESOURCE_MEM,
};

static struct platform_device ar7_wdt = {
.id = -1,
.name = "ar7_wdt",
.resource = &ar7_wdt_res,
.num_resources = 1,
};

static inline unsigned char char2hex(char h)
{
switch (h) {
Expand Down Expand Up @@ -487,6 +501,7 @@ static void __init detect_leds(void)

static int __init ar7_register_devices(void)
{
u16 chip_id;
int res;
#ifdef CONFIG_SERIAL_8250
static struct uart_port uart_port[2];
Expand Down Expand Up @@ -565,6 +580,23 @@ static int __init ar7_register_devices(void)

res = platform_device_register(&ar7_udc);

chip_id = ar7_chip_id();
switch (chip_id) {
case AR7_CHIP_7100:
case AR7_CHIP_7200:
ar7_wdt_res.start = AR7_REGS_WDT;
break;
case AR7_CHIP_7300:
ar7_wdt_res.start = UR8_REGS_WDT;
break;
default:
break;
}

ar7_wdt_res.end = ar7_wdt_res.start + 0x20;

res = platform_device_register(&ar7_wdt);

return res;
}
arch_initcall(ar7_register_devices);

0 comments on commit d47fbb5

Please sign in to comment.