blob: 0ab95dd431b3c0b33fd400dd631ae183c796d8c2 [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001// SPDX-License-Identifier: GPL-2.0
2#include "bcm47xx_private.h"
3
4#include <linux/gpio.h>
5#include <bcm47xx_board.h>
6#include <bcm47xx.h>
7
David Brazdil0f672f62019-12-10 10:32:29 +00008static void __init bcm47xx_workarounds_enable_usb_power(int usb_power)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009{
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010 int err;
11
12 err = gpio_request_one(usb_power, GPIOF_OUT_INIT_HIGH, "usb_power");
13 if (err)
14 pr_err("Failed to request USB power gpio: %d\n", err);
15 else
16 gpio_free(usb_power);
17}
18
19void __init bcm47xx_workarounds(void)
20{
21 enum bcm47xx_board board = bcm47xx_board_get();
22
23 switch (board) {
24 case BCM47XX_BOARD_NETGEAR_WNR3500L:
David Brazdil0f672f62019-12-10 10:32:29 +000025 bcm47xx_workarounds_enable_usb_power(12);
26 break;
27 case BCM47XX_BOARD_NETGEAR_WNDR3400V2:
28 case BCM47XX_BOARD_NETGEAR_WNDR3400_V3:
29 bcm47xx_workarounds_enable_usb_power(21);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000030 break;
31 default:
32 /* No workaround(s) needed */
33 break;
34 }
35}