1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (C) 2012 Thomas Langer <thomas.langer@lantiq.com>
5 * Copyright (C) 2012 John Crispin <john@phrozen.org>
8 #include <linux/init.h>
11 #include <asm/reboot.h>
12 #include <linux/export.h>
14 #include <lantiq_soc.h>
17 * Dummy implementation. Used to allow platform code to find out what
18 * source was booted from
20 unsigned char ltq_boot_select(void)
25 #define BOOT_REG_BASE (KSEG1 | 0x1F200000)
26 #define BOOT_PW1_REG (BOOT_REG_BASE | 0x20)
27 #define BOOT_PW2_REG (BOOT_REG_BASE | 0x24)
28 #define BOOT_PW1 0x4C545100
29 #define BOOT_PW2 0x0051544C
31 #define WDT_REG_BASE (KSEG1 | 0x1F8803F0)
32 #define WDT_PW1 0x00BE0000
33 #define WDT_PW2 0x00DC0000
35 static void machine_restart(char *command
)
40 ltq_w32(BOOT_PW1
, (void *)BOOT_PW1_REG
); /* 'LTQ\0' */
41 ltq_w32(BOOT_PW2
, (void *)BOOT_PW2_REG
); /* '\0QTL' */
42 ltq_w32(0, (void *)BOOT_REG_BASE
); /* reset Bootreg RVEC */
45 ltq_w32(WDT_PW1
, (void *)WDT_REG_BASE
);
47 (0x3 << 26) | /* PWL */
48 (0x2 << 24) | /* CLKDIV */
49 (0x1 << 31) | /* enable */
51 (void *)WDT_REG_BASE
);
55 static void machine_halt(void)
61 static void machine_power_off(void)
67 static int __init
mips_reboot_setup(void)
69 _machine_restart
= machine_restart
;
70 _machine_halt
= machine_halt
;
71 pm_power_off
= machine_power_off
;
75 arch_initcall(mips_reboot_setup
);