c61254db026d5b323695499eeae500d264350ab5
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-3.10 / 830-huawei_e970_support.patch
1 --- a/arch/mips/bcm47xx/setup.c
2 +++ b/arch/mips/bcm47xx/setup.c
3 @@ -34,6 +34,7 @@
4 #include <linux/ssb/ssb.h>
5 #include <linux/ssb/ssb_embedded.h>
6 #include <linux/bcma/bcma_soc.h>
7 +#include <linux/gpio_wdt.h>
8 #include <asm/bootinfo.h>
9 #include <asm/prom.h>
10 #include <asm/reboot.h>
11 @@ -248,6 +249,33 @@ static struct fixed_phy_status bcm47xx_f
12 .duplex = DUPLEX_FULL,
13 };
14
15 +static struct gpio_wdt_platform_data gpio_wdt_data;
16 +
17 +static struct platform_device gpio_wdt_device = {
18 + .name = "gpio-wdt",
19 + .id = 0,
20 + .dev = {
21 + .platform_data = &gpio_wdt_data,
22 + },
23 +};
24 +
25 +static int __init bcm47xx_register_gpio_watchdog(void)
26 +{
27 + enum bcm47xx_board board = bcm47xx_board_get();
28 +
29 + switch (board) {
30 + case BCM47XX_BOARD_HUAWEI_E970:
31 + pr_info("bcm47xx: detected Huawei E970 or similar, starting early gpio_wdt timer\n");
32 + gpio_wdt_data.gpio = 7;
33 + gpio_wdt_data.interval = HZ;
34 + gpio_wdt_data.first_interval = HZ / 5;
35 + return platform_device_register(&gpio_wdt_device);
36 + default:
37 + /* Nothing to do */
38 + return 0;
39 + }
40 +}
41 +
42 static int __init bcm47xx_register_bus_complete(void)
43 {
44 switch (bcm47xx_bus_type) {
45 @@ -263,6 +291,8 @@ static int __init bcm47xx_register_bus_c
46 #endif
47 }
48 fixed_phy_add(PHY_POLL, 0, &bcm47xx_fixed_phy_status);
49 + bcm47xx_register_gpio_watchdog();
50 +
51 return 0;
52 }
53 device_initcall(bcm47xx_register_bus_complete);
54 --- a/arch/mips/configs/bcm47xx_defconfig
55 +++ b/arch/mips/configs/bcm47xx_defconfig
56 @@ -379,6 +379,7 @@ CONFIG_THERMAL=y
57 CONFIG_WATCHDOG=y
58 CONFIG_WATCHDOG_NOWAYOUT=y
59 CONFIG_BCM47XX_WDT=y
60 +CONFIG_GPIO_WDT=y
61 CONFIG_SSB_DRIVER_GIGE=y
62 CONFIG_DISPLAY_SUPPORT=m
63 CONFIG_SOUND=m
64 --- a/drivers/ssb/embedded.c
65 +++ b/drivers/ssb/embedded.c
66 @@ -34,11 +34,36 @@ int ssb_watchdog_timer_set(struct ssb_bu
67 }
68 EXPORT_SYMBOL(ssb_watchdog_timer_set);
69
70 +#ifdef CONFIG_BCM47XX
71 +#include <bcm47xx_board.h>
72 +
73 +static bool ssb_watchdog_supported(void)
74 +{
75 + enum bcm47xx_board board = bcm47xx_board_get();
76 +
77 + /* The Huawei E970 has a hardware watchdog using a GPIO */
78 + switch (board) {
79 + case BCM47XX_BOARD_HUAWEI_E970:
80 + return false;
81 + default:
82 + return true;
83 + }
84 +}
85 +#else
86 +static bool ssb_watchdog_supported(void)
87 +{
88 + return true;
89 +}
90 +#endif
91 +
92 int ssb_watchdog_register(struct ssb_bus *bus)
93 {
94 struct bcm47xx_wdt wdt = {};
95 struct platform_device *pdev;
96
97 + if (!ssb_watchdog_supported())
98 + return 0;
99 +
100 if (ssb_chipco_available(&bus->chipco)) {
101 wdt.driver_data = &bus->chipco;
102 wdt.timer_set = ssb_chipco_watchdog_timer_set_wdt;