workarounds.c 742 B

1234567891011121314151617181920212223242526272829303132333435
  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. bcm47xx_workarounds_enable_usb_power(12);
  21. break;
  22. case BCM47XX_BOARD_NETGEAR_WNDR3400_V3:
  23. bcm47xx_workarounds_enable_usb_power(21);
  24. break;
  25. default:
  26. /* No workaround(s) needed */
  27. break;
  28. }
  29. }