1 From 223f1c46e109a8420765aee099a5d1dc4ab7ee98 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Tue, 3 Sep 2013 13:18:12 +0200
4 Subject: [PATCH 05/36] MIPS: lantiq: add reset-controller api support
6 Add a reset-controller binding for the reset registers found on the lantiq
9 Signed-off-by: John Crispin <blogic@openwrt.org>
11 arch/mips/lantiq/xway/reset.c | 61 +++++++++++++++++++++++++++++++++++++++++
12 1 file changed, 61 insertions(+)
14 diff --git a/arch/mips/lantiq/xway/reset.c b/arch/mips/lantiq/xway/reset.c
15 index 1fa0f17..a1e06b7 100644
16 --- a/arch/mips/lantiq/xway/reset.c
17 +++ b/arch/mips/lantiq/xway/reset.c
19 #include <linux/delay.h>
20 #include <linux/of_address.h>
21 #include <linux/of_platform.h>
22 +#include <linux/reset-controller.h>
24 #include <asm/reboot.h>
26 @@ -113,6 +114,66 @@ void ltq_reset_once(unsigned int module, ulong u)
27 ltq_rcu_w32(ltq_rcu_r32(RCU_RST_REQ) & ~module, RCU_RST_REQ);
30 +static int ltq_assert_device(struct reset_controller_dev *rcdev,
38 + val = ltq_rcu_r32(RCU_RST_REQ);
40 + ltq_rcu_w32(val, RCU_RST_REQ);
45 +static int ltq_deassert_device(struct reset_controller_dev *rcdev,
53 + val = ltq_rcu_r32(RCU_RST_REQ);
55 + ltq_rcu_w32(val, RCU_RST_REQ);
60 +static int ltq_reset_device(struct reset_controller_dev *rcdev,
63 + ltq_assert_device(rcdev, id);
64 + return ltq_deassert_device(rcdev, id);
67 +static struct reset_control_ops reset_ops = {
68 + .reset = ltq_reset_device,
69 + .assert = ltq_assert_device,
70 + .deassert = ltq_deassert_device,
73 +static struct reset_controller_dev reset_dev = {
75 + .owner = THIS_MODULE,
77 + .of_reset_n_cells = 1,
80 +void ltq_rst_init(void)
82 + reset_dev.of_node = of_find_compatible_node(NULL, NULL,
83 + "lantiq,xway-reset");
84 + if (!reset_dev.of_node)
85 + pr_err("Failed to find reset controller node");
87 + reset_controller_register(&reset_dev);
90 static void ltq_machine_restart(char *command)