workarounds.c 823 B

123456789101112131415161718192021222324252627282930313233343536
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include "bcm47xx_private.h"
  3. #include <linux/gpio.h>
  4. #include <bcm47xx_board.h>
  5. #include <bcm47xx.h>
  6. static void __init bcm47xx_workarounds_enable_usb_power(int usb_power)
  7. {
  8. int err;
  9. err = gpio_request_one(usb_power, GPIOF_OUT_INIT_HIGH, "usb_power");
  10. if (err)
  11. pr_err("Failed to request USB power gpio: %d\n", err);
  12. else
  13. gpio_free(usb_power);
  14. }
  15. void __init bcm47xx_workarounds(void)
  16. {
  17. enum bcm47xx_board board = bcm47xx_board_get();
  18. switch (board) {
  19. case BCM47XX_BOARD_NETGEAR_WNR3500L:
  20. case BCM47XX_BOARD_NETGEAR_WNR3500L_V2:
  21. bcm47xx_workarounds_enable_usb_power(12);
  22. break;
  23. case BCM47XX_BOARD_NETGEAR_WNDR3400V2:
  24. case BCM47XX_BOARD_NETGEAR_WNDR3400_V3:
  25. bcm47xx_workarounds_enable_usb_power(21);
  26. break;
  27. default:
  28. /* No workaround(s) needed */
  29. break;
  30. }
  31. }