This commit is contained in:
haru 2022-07-17 18:53:29 +09:00
parent 136e3d5724
commit 08b5fcb4f0
2 changed files with 37 additions and 2 deletions

View File

@ -65,10 +65,10 @@
}; };
watchdog0: wd@801e1000 { watchdog0: wd@801e1000 {
compatible = "snps,dw-wdt"; compatible = "snps,dw-wdt", "cavium,cnc1800l-wdt";
reg = <0x801e1000 0x100>; reg = <0x801e1000 0x100>;
interrupts = <0>; interrupts = <0>;
clocks = <&pclk>; clocks = <&timclk>;
}; };

View File

@ -38,6 +38,40 @@ static void __init cnc1800l_init_machine(void)
return; return;
} }
//based on board_bcm281xx.c
static void cnc1800l_restart(enum reboot_mode mode, const char *cmd){
struct device_node *np_wdog;
unsigned short __iomem *p;
np_wdog = of_find_compatible_node(NULL, NULL, "cavium,cnc1800l-wdt");
if (!np_wdog) {
pr_emerg("Couldn't find cavium,cnc1800l-wdt\n");
return;
}
p = (unsigned short*)of_iomap(np_wdog, 0);
of_node_put(np_wdog);
if (!p) {
pr_emerg("failed to obtain wdt vaddress\n");
return;
}
/* WDT_TORR */
p[2] = 0x0;
p[3] = 0x0;
/* WDT_CCVR */
p[4] = 0x0;
p[5] = 0x0;
//reload
*((u32*)&p[6]) = 0x76;
/* WDT_CR, enable WDT and generated System Reset */
p[0] = 0x1;
while(1);
}
static const char * const cnc1800l_dt_match[] = { static const char * const cnc1800l_dt_match[] = {
"cavium,cnc1800l", "cavium,cnc1800l",
NULL NULL
@ -46,5 +80,6 @@ static const char * const cnc1800l_dt_match[] = {
DT_MACHINE_START(CNC1800L, "Cavium Celestial CNC1800L") DT_MACHINE_START(CNC1800L, "Cavium Celestial CNC1800L")
.map_io = cnc1800l_of_map_io, .map_io = cnc1800l_of_map_io,
.init_machine = cnc1800l_init_machine, .init_machine = cnc1800l_init_machine,
.restart = cnc1800l_restart,
.dt_compat = cnc1800l_dt_match, .dt_compat = cnc1800l_dt_match,
MACHINE_END MACHINE_END