Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[MIPS] TXx9 watchdog support for rbhma3100,rbhma4200,rbhma4500

This patch adds support for txx9wdt driver to rbhma3100, rbhma4200 and
rbhma4500 platform.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Atsushi Nemoto and committed by
Ralf Baechle
2064ba23 68efdb81

+178 -3
+14 -1
arch/mips/configs/jmr3927_defconfig
··· 464 464 CONFIG_LEGACY_PTYS=y 465 465 CONFIG_LEGACY_PTY_COUNT=256 466 466 # CONFIG_IPMI_HANDLER is not set 467 - # CONFIG_WATCHDOG is not set 468 467 # CONFIG_HW_RANDOM is not set 469 468 # CONFIG_RTC is not set 470 469 # CONFIG_R3964 is not set ··· 481 482 # CONFIG_W1 is not set 482 483 # CONFIG_POWER_SUPPLY is not set 483 484 # CONFIG_HWMON is not set 485 + CONFIG_WATCHDOG=y 486 + # CONFIG_WATCHDOG_NOWAYOUT is not set 487 + 488 + # 489 + # Watchdog Device Drivers 490 + # 491 + # CONFIG_SOFT_WATCHDOG is not set 492 + CONFIG_TXX9_WDT=y 493 + 494 + # 495 + # PCI-based Watchdog Cards 496 + # 497 + # CONFIG_PCIPCWATCHDOG is not set 498 + # CONFIG_WDTPCI is not set 484 499 485 500 # 486 501 # Multifunction device drivers
+14 -1
arch/mips/configs/rbhma4200_defconfig
··· 431 431 CONFIG_LEGACY_PTYS=y 432 432 CONFIG_LEGACY_PTY_COUNT=256 433 433 # CONFIG_IPMI_HANDLER is not set 434 - # CONFIG_WATCHDOG is not set 435 434 # CONFIG_HW_RANDOM is not set 436 435 # CONFIG_RTC is not set 437 436 # CONFIG_R3964 is not set ··· 448 449 # CONFIG_W1 is not set 449 450 # CONFIG_POWER_SUPPLY is not set 450 451 # CONFIG_HWMON is not set 452 + CONFIG_WATCHDOG=y 453 + # CONFIG_WATCHDOG_NOWAYOUT is not set 454 + 455 + # 456 + # Watchdog Device Drivers 457 + # 458 + # CONFIG_SOFT_WATCHDOG is not set 459 + CONFIG_TXX9_WDT=m 460 + 461 + # 462 + # PCI-based Watchdog Cards 463 + # 464 + # CONFIG_PCIPCWATCHDOG is not set 465 + # CONFIG_WDTPCI is not set 451 466 452 467 # 453 468 # Multifunction device drivers
+14 -1
arch/mips/configs/rbhma4500_defconfig
··· 450 450 CONFIG_LEGACY_PTYS=y 451 451 CONFIG_LEGACY_PTY_COUNT=256 452 452 # CONFIG_IPMI_HANDLER is not set 453 - # CONFIG_WATCHDOG is not set 454 453 # CONFIG_HW_RANDOM is not set 455 454 # CONFIG_RTC is not set 456 455 # CONFIG_R3964 is not set ··· 478 479 # CONFIG_W1 is not set 479 480 # CONFIG_POWER_SUPPLY is not set 480 481 # CONFIG_HWMON is not set 482 + CONFIG_WATCHDOG=y 483 + # CONFIG_WATCHDOG_NOWAYOUT is not set 484 + 485 + # 486 + # Watchdog Device Drivers 487 + # 488 + # CONFIG_SOFT_WATCHDOG is not set 489 + CONFIG_TXX9_WDT=m 490 + 491 + # 492 + # PCI-based Watchdog Cards 493 + # 494 + # CONFIG_PCIPCWATCHDOG is not set 495 + # CONFIG_WDTPCI is not set 481 496 482 497 # 483 498 # Multifunction device drivers
+55
arch/mips/jmr3927/rbhma3100/setup.c
··· 35 35 #include <linux/delay.h> 36 36 #include <linux/pm.h> 37 37 #include <linux/platform_device.h> 38 + #include <linux/clk.h> 38 39 #ifdef CONFIG_SERIAL_TXX9 39 40 #include <linux/serial_core.h> 40 41 #endif ··· 234 233 tx3927_ccfgptr->ccfg &= ~TX3927_CCFG_BEOW; 235 234 /* Disable PCI snoop */ 236 235 tx3927_ccfgptr->ccfg &= ~TX3927_CCFG_PSNP; 236 + /* do reset on watchdog */ 237 + tx3927_ccfgptr->ccfg |= TX3927_CCFG_WR; 237 238 238 239 #ifdef DO_WRITE_THROUGH 239 240 /* Enable PCI SNOOP - with write through only */ ··· 386 383 return IS_ERR(dev) ? PTR_ERR(dev) : 0; 387 384 } 388 385 device_initcall(jmr3927_rtc_init); 386 + 387 + /* Watchdog support */ 388 + 389 + static int __init txx9_wdt_init(unsigned long base) 390 + { 391 + struct resource res = { 392 + .start = base, 393 + .end = base + 0x100 - 1, 394 + .flags = IORESOURCE_MEM, 395 + }; 396 + struct platform_device *dev = 397 + platform_device_register_simple("txx9wdt", -1, &res, 1); 398 + return IS_ERR(dev) ? PTR_ERR(dev) : 0; 399 + } 400 + 401 + static int __init jmr3927_wdt_init(void) 402 + { 403 + return txx9_wdt_init(TX3927_TMR_REG(2)); 404 + } 405 + device_initcall(jmr3927_wdt_init); 406 + 407 + /* Minimum CLK support */ 408 + 409 + struct clk *clk_get(struct device *dev, const char *id) 410 + { 411 + if (!strcmp(id, "imbus_clk")) 412 + return (struct clk *)JMR3927_IMCLK; 413 + return ERR_PTR(-ENOENT); 414 + } 415 + EXPORT_SYMBOL(clk_get); 416 + 417 + int clk_enable(struct clk *clk) 418 + { 419 + return 0; 420 + } 421 + EXPORT_SYMBOL(clk_enable); 422 + 423 + void clk_disable(struct clk *clk) 424 + { 425 + } 426 + EXPORT_SYMBOL(clk_disable); 427 + 428 + unsigned long clk_get_rate(struct clk *clk) 429 + { 430 + return (unsigned long)clk; 431 + } 432 + EXPORT_SYMBOL(clk_get_rate); 433 + 434 + void clk_put(struct clk *clk) 435 + { 436 + } 437 + EXPORT_SYMBOL(clk_put);
+55
arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
··· 50 50 #include <linux/pci.h> 51 51 #include <linux/pm.h> 52 52 #include <linux/platform_device.h> 53 + #include <linux/clk.h> 53 54 54 55 #include <asm/bootinfo.h> 55 56 #include <asm/io.h> ··· 804 803 } 805 804 806 805 /* CCFG */ 806 + /* do reset on watchdog */ 807 + tx4927_ccfgptr->ccfg |= TX4927_CCFG_WR; 807 808 /* enable Timeout BusError */ 808 809 if (tx4927_ccfg_toeon) 809 810 tx4927_ccfgptr->ccfg |= TX4927_CCFG_TOE; ··· 947 944 return IS_ERR(dev) ? PTR_ERR(dev) : 0; 948 945 } 949 946 device_initcall(rbtx4927_ne_init); 947 + 948 + /* Watchdog support */ 949 + 950 + static int __init txx9_wdt_init(unsigned long base) 951 + { 952 + struct resource res = { 953 + .start = base, 954 + .end = base + 0x100 - 1, 955 + .flags = IORESOURCE_MEM, 956 + }; 957 + struct platform_device *dev = 958 + platform_device_register_simple("txx9wdt", -1, &res, 1); 959 + return IS_ERR(dev) ? PTR_ERR(dev) : 0; 960 + } 961 + 962 + static int __init rbtx4927_wdt_init(void) 963 + { 964 + return txx9_wdt_init(TX4927_TMR_REG(2) & 0xfffffffffULL); 965 + } 966 + device_initcall(rbtx4927_wdt_init); 967 + 968 + /* Minimum CLK support */ 969 + 970 + struct clk *clk_get(struct device *dev, const char *id) 971 + { 972 + if (!strcmp(id, "imbus_clk")) 973 + return (struct clk *)50000000; 974 + return ERR_PTR(-ENOENT); 975 + } 976 + EXPORT_SYMBOL(clk_get); 977 + 978 + int clk_enable(struct clk *clk) 979 + { 980 + return 0; 981 + } 982 + EXPORT_SYMBOL(clk_enable); 983 + 984 + void clk_disable(struct clk *clk) 985 + { 986 + } 987 + EXPORT_SYMBOL(clk_disable); 988 + 989 + unsigned long clk_get_rate(struct clk *clk) 990 + { 991 + return (unsigned long)clk; 992 + } 993 + EXPORT_SYMBOL(clk_get_rate); 994 + 995 + void clk_put(struct clk *clk) 996 + { 997 + } 998 + EXPORT_SYMBOL(clk_put);
+25
arch/mips/tx4938/toshiba_rbtx4938/setup.c
··· 724 724 /* CCFG */ 725 725 /* clear WatchDogReset,BusErrorOnWrite flag (W1C) */ 726 726 tx4938_ccfgptr->ccfg |= TX4938_CCFG_WDRST | TX4938_CCFG_BEOW; 727 + /* do reset on watchdog */ 728 + tx4938_ccfgptr->ccfg |= TX4938_CCFG_WR; 727 729 /* clear PCIC1 reset */ 728 730 if (tx4938_ccfgptr->clkctr & TX4938_CLKCTR_PCIC1RST) 729 731 tx4938_ccfgptr->clkctr &= ~TX4938_CLKCTR_PCIC1RST; ··· 1123 1121 } 1124 1122 arch_initcall(rbtx4938_spi_init); 1125 1123 1124 + /* Watchdog support */ 1125 + 1126 + static int __init txx9_wdt_init(unsigned long base) 1127 + { 1128 + struct resource res = { 1129 + .start = base, 1130 + .end = base + 0x100 - 1, 1131 + .flags = IORESOURCE_MEM, 1132 + .parent = &tx4938_reg_resource, 1133 + }; 1134 + struct platform_device *dev = 1135 + platform_device_register_simple("txx9wdt", -1, &res, 1); 1136 + return IS_ERR(dev) ? PTR_ERR(dev) : 0; 1137 + } 1138 + 1139 + static int __init rbtx4938_wdt_init(void) 1140 + { 1141 + return txx9_wdt_init(TX4938_TMR_REG(2) & 0xfffffffffULL); 1142 + } 1143 + device_initcall(rbtx4938_wdt_init); 1144 + 1126 1145 /* Minimum CLK support */ 1127 1146 1128 1147 struct clk *clk_get(struct device *dev, const char *id) 1129 1148 { 1130 1149 if (!strcmp(id, "spi-baseclk")) 1131 1150 return (struct clk *)(txx9_gbus_clock / 2 / 4); 1151 + if (!strcmp(id, "imbus_clk")) 1152 + return (struct clk *)(txx9_gbus_clock / 2); 1132 1153 return ERR_PTR(-ENOENT); 1133 1154 } 1134 1155 EXPORT_SYMBOL(clk_get);
+1
include/asm-mips/tx4927/tx4927_pci.h
··· 9 9 #define __ASM_TX4927_TX4927_PCI_H 10 10 11 11 #define TX4927_CCFG_TOE 0x00004000 12 + #define TX4927_CCFG_WR 0x00008000 12 13 #define TX4927_CCFG_TINTDIS 0x01000000 13 14 14 15 #define TX4927_PCIMEM 0x08000000