* [PATCH 1/2] ar7: make board code register ar7_wdt as a platform device
@ 2009-07-15 10:09 Florian Fainelli
2009-07-17 13:30 ` Ralf Baechle
0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2009-07-15 10:09 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Wim Van Sebroeck
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>
---
diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
index 5422449..06e3147 100644
--- a/arch/mips/ar7/platform.c
+++ b/arch/mips/ar7/platform.c
@@ -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);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] ar7: make board code register ar7_wdt as a platform device
2009-07-15 10:09 [PATCH 1/2] ar7: make board code register ar7_wdt as a platform device Florian Fainelli
@ 2009-07-17 13:30 ` Ralf Baechle
2009-07-17 14:43 ` Wim Van Sebroeck
0 siblings, 1 reply; 3+ messages in thread
From: Ralf Baechle @ 2009-07-17 13:30 UTC (permalink / raw)
To: Florian Fainelli; +Cc: linux-mips, Wim Van Sebroeck
On Wed, Jul 15, 2009 at 12:09:34PM +0200, Florian Fainelli wrote:
> 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>
Thanks, queued for 2.6.32. Haven't heared from Wim yet ...
Ralf
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] ar7: make board code register ar7_wdt as a platform device
2009-07-17 13:30 ` Ralf Baechle
@ 2009-07-17 14:43 ` Wim Van Sebroeck
0 siblings, 0 replies; 3+ messages in thread
From: Wim Van Sebroeck @ 2009-07-17 14:43 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Florian Fainelli, linux-mips, Wim Van Sebroeck
Hi All,
> > 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>
>
> Thanks, queued for 2.6.32. Haven't heared from Wim yet ...
Review planned this weekend.
Kind regards,
Wim.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-07-17 14:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-15 10:09 [PATCH 1/2] ar7: make board code register ar7_wdt as a platform device Florian Fainelli
2009-07-17 13:30 ` Ralf Baechle
2009-07-17 14:43 ` Wim Van Sebroeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).