Skip to contentSkip to conversation

ar7: make board code register ar7_wdt as a platform device

PATCH In review Florian Fainelli 3 participants 3 messages Jul 15, 2009 – Jul 17, 2009 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 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.

---

arch/mips/ar7/platform.c +32 -0
index 5422449..06e3147 100644
@@ -410,6 +410,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) {
@@ -482,6 +496,7 @@ static int __init ar7_register_devices(void)
 {
 	int res;
 	static struct uart_port uart_port[2];
+	u16 chip_id;
 
 	memset(uart_port, 0, sizeof(struct uart_port) * 2);
 
@@ -550,6 +565,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);
#1 lore raw
Quoted 6 lines · Florian Fainelli

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.

Thanks, queued for 2.6.32. Haven't heared from Wim yet ...

Ralf

#2 lore raw

Hi All,

Quoted 8 lines
Quoted 6 lines

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.

Thanks, queued for 2.6.32. Haven't heared from Wim yet ...

Review planned this weekend.

Kind regards,
Wim.