aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/patches-4.0/830-huawei_e970_support.patch
blob: fdb6c19cd23392209e9c558bb627fc8434b26f43 (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
pre { line-height: 125%; margin: 0; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #ffffff; }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attri
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -36,6 +36,7 @@
 #include <linux/ssb/ssb.h>
 #include <linux/ssb/ssb_embedded.h>
 #include <linux/bcma/bcma_soc.h>
+#include <linux/old_gpio_wdt.h>
 #include <asm/bootinfo.h>
 #include <asm/idle.h>
 #include <asm/prom.h>
@@ -245,6 +246,33 @@ static struct fixed_phy_status bcm47xx_f
 	.duplex	= DUPLEX_FULL,
 };
 
+static struct gpio_wdt_platform_data gpio_wdt_data;
+
+static struct platform_device gpio_wdt_device = {
+	.name			= "gpio-wdt",
+	.id			= 0,
+	.dev			= {
+		.platform_data	= &gpio_wdt_data,
+	},
+};
+
+static int __init bcm47xx_register_gpio_watchdog(void)
+{
+	enum bcm47xx_board board = bcm47xx_board_get();
+
+	switch (board) {
+	case BCM47XX_BOARD_HUAWEI_E970:
+		pr_info("bcm47xx: detected Huawei E970 or similar, starting early gpio_wdt timer\n");
+		gpio_wdt_data.gpio = 7;
+		gpio_wdt_data.interval = HZ;
+		gpio_wdt_data.first_interval = HZ / 5;
+		return platform_device_register(&gpio_wdt_device);
+	default:
+		/* Nothing to do */
+		return 0;
+	}
+}
+
 static int __init bcm47xx_register_bus_complete(void)
 {
 	switch (bcm47xx_bus_type) {
@@ -264,6 +292,7 @@ static int __init bcm47xx_register_bus_c
 	bcm47xx_workarounds();
 
 	fixed_phy_add(PHY_POLL, 0, &bcm47xx_fixed_phy_status);
+	bcm47xx_register_gpio_watchdog();
 	return 0;
 }
 device_initcall(bcm47xx_register_bus_complete);
--- a/arch/mips/configs/bcm47xx_defconfig
+++ b/arch/mips/configs/bcm47xx_defconfig
@@ -67,6 +67,7 @@ CONFIG_HW_RANDOM=y
 CONFIG_GPIO_SYSFS=y
 CONFIG_WATCHDOG=y
 CONFIG_BCM47XX_WDT=y
+CONFIG_GPIO_WDT=y
 CONFIG_SSB_DEBUG=y
 CONFIG_SSB_DRIVER_GIGE=y
 CONFIG_BCMA_DRIVER_GMAC_CMN=y
--- a/drivers/ssb/embedded.c
+++ b/drivers/ssb/embedded.c
@@ -34,11 +34,36 @@ int ssb_watchdog_timer_set(struct ssb_bu
 }
 EXPORT_SYMBOL(ssb_watchdog_timer_set);
 
+#ifdef CONFIG_BCM47XX
+#include <bcm47xx_board.h>
+
+static bool ssb_watchdog_supported(void)
+{
+	enum bcm47xx_board board = bcm47xx_board_get();
+
+	/* The Huawei E970 has a hardware watchdog using a GPIO */
+	switch (board) {
+	case BCM47XX_BOARD_HUAWEI_E970:
+		return false;
+	default:
+		return true;
+	}
+}
+#else
+static bool ssb_watchdog_supported(void)
+{
+	return true;
+}
+#endif
+
 int ssb_watchdog_register(struct ssb_bus *bus)
 {
 	struct bcm47xx_wdt wdt = {};
 	struct platform_device *pdev;
 
+	if (!ssb_watchdog_supported())
+		return 0;
+
 	if (ssb_chipco_available(&bus->chipco)) {
 		wdt.driver_data = &bus->chipco;
 		wdt.timer_set = ssb_chipco_watchdog_timer_set_wdt;