aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2008-07-23 11:25:18 -0400
committerRalf Baechle <ralf@linux-mips.org>2008-07-30 16:54:39 -0400
commit683147254ef7e69ebbbe55280ba6a3c5ae2325d8 (patch)
tree4f242b09bcd54ab4563e9c6201dc0c8ded351fdc
parenta49297e8fc8a9a835ac4ec124aa83028abdcc7d5 (diff)
[MIPS] TXx9: Cleanup watchdog
Unify registration of txx9wdt platform device. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/txx9/generic/setup.c12
-rw-r--r--arch/mips/txx9/generic/setup_tx4927.c7
-rw-r--r--arch/mips/txx9/generic/setup_tx4938.c7
-rw-r--r--arch/mips/txx9/jmr3927/setup.c20
-rw-r--r--arch/mips/txx9/rbtx4927/setup.c21
-rw-r--r--arch/mips/txx9/rbtx4938/setup.c21
-rw-r--r--include/asm-mips/txx9/generic.h1
-rw-r--r--include/asm-mips/txx9/tx4927.h2
-rw-r--r--include/asm-mips/txx9/tx4938.h2
9 files changed, 32 insertions, 61 deletions
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 82272e85a042..7b5705d18deb 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -20,6 +20,7 @@
20#include <linux/clk.h> 20#include <linux/clk.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/platform_device.h>
23#include <asm/bootinfo.h> 24#include <asm/bootinfo.h>
24#include <asm/time.h> 25#include <asm/time.h>
25#include <asm/reboot.h> 26#include <asm/reboot.h>
@@ -208,6 +209,17 @@ static void __noreturn txx9_machine_halt(void)
208 } 209 }
209} 210}
210 211
212/* Watchdog support */
213void __init txx9_wdt_init(unsigned long base)
214{
215 struct resource res = {
216 .start = base,
217 .end = base + 0x100 - 1,
218 .flags = IORESOURCE_MEM,
219 };
220 platform_device_register_simple("txx9wdt", -1, &res, 1);
221}
222
211/* wrappers */ 223/* wrappers */
212void __init plat_mem_setup(void) 224void __init plat_mem_setup(void)
213{ 225{
diff --git a/arch/mips/txx9/generic/setup_tx4927.c b/arch/mips/txx9/generic/setup_tx4927.c
index 89d6e28add93..b42c85573d0d 100644
--- a/arch/mips/txx9/generic/setup_tx4927.c
+++ b/arch/mips/txx9/generic/setup_tx4927.c
@@ -21,7 +21,7 @@
21#include <asm/txx9/generic.h> 21#include <asm/txx9/generic.h>
22#include <asm/txx9/tx4927.h> 22#include <asm/txx9/tx4927.h>
23 23
24void __init tx4927_wdr_init(void) 24static void __init tx4927_wdr_init(void)
25{ 25{
26 /* clear WatchDogReset (W1C) */ 26 /* clear WatchDogReset (W1C) */
27 tx4927_ccfg_set(TX4927_CCFG_WDRST); 27 tx4927_ccfg_set(TX4927_CCFG_WDRST);
@@ -29,6 +29,11 @@ void __init tx4927_wdr_init(void)
29 tx4927_ccfg_set(TX4927_CCFG_WR); 29 tx4927_ccfg_set(TX4927_CCFG_WR);
30} 30}
31 31
32void __init tx4927_wdt_init(void)
33{
34 txx9_wdt_init(TX4927_TMR_REG(2) & 0xfffffffffULL);
35}
36
32static struct resource tx4927_sdram_resource[4]; 37static struct resource tx4927_sdram_resource[4];
33 38
34void __init tx4927_setup(void) 39void __init tx4927_setup(void)
diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
index 317378d8579d..b0a3dc8863fd 100644
--- a/arch/mips/txx9/generic/setup_tx4938.c
+++ b/arch/mips/txx9/generic/setup_tx4938.c
@@ -21,7 +21,7 @@
21#include <asm/txx9/generic.h> 21#include <asm/txx9/generic.h>
22#include <asm/txx9/tx4938.h> 22#include <asm/txx9/tx4938.h>
23 23
24void __init tx4938_wdr_init(void) 24static void __init tx4938_wdr_init(void)
25{ 25{
26 /* clear WatchDogReset (W1C) */ 26 /* clear WatchDogReset (W1C) */
27 tx4938_ccfg_set(TX4938_CCFG_WDRST); 27 tx4938_ccfg_set(TX4938_CCFG_WDRST);
@@ -29,6 +29,11 @@ void __init tx4938_wdr_init(void)
29 tx4938_ccfg_set(TX4938_CCFG_WR); 29 tx4938_ccfg_set(TX4938_CCFG_WR);
30} 30}
31 31
32void __init tx4938_wdt_init(void)
33{
34 txx9_wdt_init(TX4938_TMR_REG(2) & 0xfffffffffULL);
35}
36
32static struct resource tx4938_sdram_resource[4]; 37static struct resource tx4938_sdram_resource[4];
33static struct resource tx4938_sram_resource; 38static struct resource tx4938_sram_resource;
34 39
diff --git a/arch/mips/txx9/jmr3927/setup.c b/arch/mips/txx9/jmr3927/setup.c
index fa0503efc840..ae34e9a4a8ac 100644
--- a/arch/mips/txx9/jmr3927/setup.c
+++ b/arch/mips/txx9/jmr3927/setup.c
@@ -308,30 +308,16 @@ static int __init jmr3927_rtc_init(void)
308 return IS_ERR(dev) ? PTR_ERR(dev) : 0; 308 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
309} 309}
310 310
311/* Watchdog support */ 311static void __init tx3927_wdt_init(void)
312
313static int __init txx9_wdt_init(unsigned long base)
314{
315 struct resource res = {
316 .start = base,
317 .end = base + 0x100 - 1,
318 .flags = IORESOURCE_MEM,
319 };
320 struct platform_device *dev =
321 platform_device_register_simple("txx9wdt", -1, &res, 1);
322 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
323}
324
325static int __init jmr3927_wdt_init(void)
326{ 312{
327 return txx9_wdt_init(TX3927_TMR_REG(2)); 313 txx9_wdt_init(TX3927_TMR_REG(2));
328} 314}
329 315
330static void __init jmr3927_device_init(void) 316static void __init jmr3927_device_init(void)
331{ 317{
332 __swizzle_addr_b = jmr3927_swizzle_addr_b; 318 __swizzle_addr_b = jmr3927_swizzle_addr_b;
333 jmr3927_rtc_init(); 319 jmr3927_rtc_init();
334 jmr3927_wdt_init(); 320 tx3927_wdt_init();
335} 321}
336 322
337struct txx9_board_vec jmr3927_vec __initdata = { 323struct txx9_board_vec jmr3927_vec __initdata = {
diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
index 54c33c3e9f7d..f01af382e9a8 100644
--- a/arch/mips/txx9/rbtx4927/setup.c
+++ b/arch/mips/txx9/rbtx4927/setup.c
@@ -328,30 +328,11 @@ static int __init rbtx4927_ne_init(void)
328 return IS_ERR(dev) ? PTR_ERR(dev) : 0; 328 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
329} 329}
330 330
331/* Watchdog support */
332
333static int __init txx9_wdt_init(unsigned long base)
334{
335 struct resource res = {
336 .start = base,
337 .end = base + 0x100 - 1,
338 .flags = IORESOURCE_MEM,
339 };
340 struct platform_device *dev =
341 platform_device_register_simple("txx9wdt", -1, &res, 1);
342 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
343}
344
345static int __init rbtx4927_wdt_init(void)
346{
347 return txx9_wdt_init(TX4927_TMR_REG(2) & 0xfffffffffULL);
348}
349
350static void __init rbtx4927_device_init(void) 331static void __init rbtx4927_device_init(void)
351{ 332{
352 toshiba_rbtx4927_rtc_init(); 333 toshiba_rbtx4927_rtc_init();
353 rbtx4927_ne_init(); 334 rbtx4927_ne_init();
354 rbtx4927_wdt_init(); 335 tx4927_wdt_init();
355} 336}
356 337
357struct txx9_board_vec rbtx4927_vec __initdata = { 338struct txx9_board_vec rbtx4927_vec __initdata = {
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
index e1177b3b9103..ff5fda2151f2 100644
--- a/arch/mips/txx9/rbtx4938/setup.c
+++ b/arch/mips/txx9/rbtx4938/setup.c
@@ -352,30 +352,11 @@ static void __init rbtx4938_arch_init(void)
352 rbtx4938_spi_init(); 352 rbtx4938_spi_init();
353} 353}
354 354
355/* Watchdog support */
356
357static int __init txx9_wdt_init(unsigned long base)
358{
359 struct resource res = {
360 .start = base,
361 .end = base + 0x100 - 1,
362 .flags = IORESOURCE_MEM,
363 };
364 struct platform_device *dev =
365 platform_device_register_simple("txx9wdt", -1, &res, 1);
366 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
367}
368
369static int __init rbtx4938_wdt_init(void)
370{
371 return txx9_wdt_init(TX4938_TMR_REG(2) & 0xfffffffffULL);
372}
373
374static void __init rbtx4938_device_init(void) 355static void __init rbtx4938_device_init(void)
375{ 356{
376 rbtx4938_ethaddr_init(); 357 rbtx4938_ethaddr_init();
377 rbtx4938_ne_init(); 358 rbtx4938_ne_init();
378 rbtx4938_wdt_init(); 359 tx4938_wdt_init();
379} 360}
380 361
381struct txx9_board_vec rbtx4938_vec __initdata = { 362struct txx9_board_vec rbtx4938_vec __initdata = {
diff --git a/include/asm-mips/txx9/generic.h b/include/asm-mips/txx9/generic.h
index cbae37ec3d88..2b34d09e34c8 100644
--- a/include/asm-mips/txx9/generic.h
+++ b/include/asm-mips/txx9/generic.h
@@ -44,5 +44,6 @@ extern struct txx9_board_vec *txx9_board_vec;
44extern int (*txx9_irq_dispatch)(int pending); 44extern int (*txx9_irq_dispatch)(int pending);
45void prom_init_cmdline(void); 45void prom_init_cmdline(void);
46char *prom_getcmdline(void); 46char *prom_getcmdline(void);
47void txx9_wdt_init(unsigned long base);
47 48
48#endif /* __ASM_TXX9_GENERIC_H */ 49#endif /* __ASM_TXX9_GENERIC_H */
diff --git a/include/asm-mips/txx9/tx4927.h b/include/asm-mips/txx9/tx4927.h
index 2c26fd17cb4a..3d9fd7dcb33f 100644
--- a/include/asm-mips/txx9/tx4927.h
+++ b/include/asm-mips/txx9/tx4927.h
@@ -243,7 +243,7 @@ static inline void tx4927_ccfg_change(__u64 change, __u64 new)
243} 243}
244 244
245unsigned int tx4927_get_mem_size(void); 245unsigned int tx4927_get_mem_size(void);
246void tx4927_wdr_init(void); 246void tx4927_wdt_init(void);
247void tx4927_setup(void); 247void tx4927_setup(void);
248void tx4927_time_init(unsigned int tmrnr); 248void tx4927_time_init(unsigned int tmrnr);
249void tx4927_setup_serial(void); 249void tx4927_setup_serial(void);
diff --git a/include/asm-mips/txx9/tx4938.h b/include/asm-mips/txx9/tx4938.h
index 4fff1c9e08d4..d5d7cef7ee8d 100644
--- a/include/asm-mips/txx9/tx4938.h
+++ b/include/asm-mips/txx9/tx4938.h
@@ -276,7 +276,7 @@ struct tx4938_ccfg_reg {
276#define TX4938_EBUSC_SIZE(ch) TX4927_EBUSC_SIZE(ch) 276#define TX4938_EBUSC_SIZE(ch) TX4927_EBUSC_SIZE(ch)
277 277
278#define tx4938_get_mem_size() tx4927_get_mem_size() 278#define tx4938_get_mem_size() tx4927_get_mem_size()
279void tx4938_wdr_init(void); 279void tx4938_wdt_init(void);
280void tx4938_setup(void); 280void tx4938_setup(void);
281void tx4938_time_init(unsigned int tmrnr); 281void tx4938_time_init(unsigned int tmrnr);
282void tx4938_setup_serial(void); 282void tx4938_setup_serial(void);