aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/lantiq/xway/reset.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/lantiq/xway/reset.c')
-rw-r--r--arch/mips/lantiq/xway/reset.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/arch/mips/lantiq/xway/reset.c b/arch/mips/lantiq/xway/reset.c
index 22c55f73aa9d..2799212ab7db 100644
--- a/arch/mips/lantiq/xway/reset.c
+++ b/arch/mips/lantiq/xway/reset.c
@@ -34,11 +34,12 @@
34/* reset cause */ 34/* reset cause */
35#define RCU_STAT_SHIFT 26 35#define RCU_STAT_SHIFT 26
36/* boot selection */ 36/* boot selection */
37#define RCU_BOOT_SEL_SHIFT 26 37#define RCU_BOOT_SEL(x) ((x >> 18) & 0x7)
38#define RCU_BOOT_SEL_MASK 0x7 38#define RCU_BOOT_SEL_XRX200(x) (((x >> 17) & 0xf) | ((x >> 8) & 0x10))
39 39
40/* remapped base addr of the reset control unit */ 40/* remapped base addr of the reset control unit */
41static void __iomem *ltq_rcu_membase; 41static void __iomem *ltq_rcu_membase;
42static struct device_node *ltq_rcu_np;
42 43
43/* This function is used by the watchdog driver */ 44/* This function is used by the watchdog driver */
44int ltq_reset_cause(void) 45int ltq_reset_cause(void)
@@ -52,7 +53,11 @@ EXPORT_SYMBOL_GPL(ltq_reset_cause);
52unsigned char ltq_boot_select(void) 53unsigned char ltq_boot_select(void)
53{ 54{
54 u32 val = ltq_rcu_r32(RCU_RST_STAT); 55 u32 val = ltq_rcu_r32(RCU_RST_STAT);
55 return (val >> RCU_BOOT_SEL_SHIFT) & RCU_BOOT_SEL_MASK; 56
57 if (of_device_is_compatible(ltq_rcu_np, "lantiq,rcu-xrx200"))
58 return RCU_BOOT_SEL_XRX200(val);
59
60 return RCU_BOOT_SEL(val);
56} 61}
57 62
58/* reset a io domain for u micro seconds */ 63/* reset a io domain for u micro seconds */
@@ -85,14 +90,17 @@ static void ltq_machine_power_off(void)
85static int __init mips_reboot_setup(void) 90static int __init mips_reboot_setup(void)
86{ 91{
87 struct resource res; 92 struct resource res;
88 struct device_node *np = 93
89 of_find_compatible_node(NULL, NULL, "lantiq,rcu-xway"); 94 ltq_rcu_np = of_find_compatible_node(NULL, NULL, "lantiq,rcu-xway");
95 if (!ltq_rcu_np)
96 ltq_rcu_np = of_find_compatible_node(NULL, NULL,
97 "lantiq,rcu-xrx200");
90 98
91 /* check if all the reset register range is available */ 99 /* check if all the reset register range is available */
92 if (!np) 100 if (!ltq_rcu_np)
93 panic("Failed to load reset resources from devicetree"); 101 panic("Failed to load reset resources from devicetree");
94 102
95 if (of_address_to_resource(np, 0, &res)) 103 if (of_address_to_resource(ltq_rcu_np, 0, &res))
96 panic("Failed to get rcu memory range"); 104 panic("Failed to get rcu memory range");
97 105
98 if (request_mem_region(res.start, resource_size(&res), res.name) < 0) 106 if (request_mem_region(res.start, resource_size(&res), res.name) < 0)