830-huawei_e970_support.patch 2.5 KB

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