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