summaryrefslogtreecommitdiff
path: root/target/linux/bcm53xx/patches-3.14/131-ARM-BCM5301X-add-restart-support.patch
blob: 46464dc04261af690b804add6e386c86a86cdf0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From 28b11a8b1258214b3b5d58bb6e3bbcb0fc9fd4fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
Date: Thu, 31 Jul 2014 07:28:05 +0200
Subject: [PATCH] ARM: BCM5301X: add restart support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 arch/arm/mach-bcm/bcm_5301x.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

--- a/arch/arm/mach-bcm/bcm_5301x.c
+++ b/arch/arm/mach-bcm/bcm_5301x.c
@@ -12,9 +12,26 @@
 #include <asm/siginfo.h>
 #include <asm/signal.h>
 
+#include <linux/bcma/bcma.h>
 
 static bool first_fault = true;
 
+static struct bcma_bus *bcm5301x_get_bcma_bus(void)
+{
+	struct device_node *np;
+	struct platform_device *pdev;
+
+	np = of_find_compatible_node(NULL, NULL, "brcm,bus-aix");
+	if (!np)
+		return NULL;
+
+	pdev = of_find_device_by_node(np);
+	if (!pdev)
+		return NULL;
+
+	return platform_get_drvdata(pdev);
+}
+
 static int bcm5301x_abort_handler(unsigned long addr, unsigned int fsr,
 				 struct pt_regs *regs)
 {
@@ -49,6 +66,19 @@ static void __init bcm5301x_dt_init(void
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
+static void bcm5301x_restart(enum reboot_mode mode, const char *cmd)
+{
+	struct bcma_bus *bus = bcm5301x_get_bcma_bus();
+
+	if (bus)
+		bcma_chipco_watchdog_timer_set(&bus->drv_cc, 1);
+	else
+		pr_warn("Unable to access bcma bus\n");
+
+	while (1)
+		;
+}
+
 static const char __initconst *bcm5301x_dt_compat[] = {
 	"brcm,bcm4708",
 	NULL,
@@ -57,5 +87,6 @@ static const char __initconst *bcm5301x_
 DT_MACHINE_START(BCM5301X, "BCM5301X")
 	.init_early	= bcm5301x_init_early,
 	.init_machine	= bcm5301x_dt_init,
+	.restart	= bcm5301x_restart,
 	.dt_compat	= bcm5301x_dt_compat,
 MACHINE_END