Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: BCM47XX: Add new file for device specific workarounds

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Patchwork: https://patchwork.linux-mips.org/patch/6627/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Rafał Miłecki and committed by
Ralf Baechle
a2bec078 40d4d331

+36 -1
+1 -1
arch/mips/bcm47xx/Makefile
··· 4 4 # 5 5 6 6 obj-y += irq.o nvram.o prom.o serial.o setup.o time.o sprom.o 7 - obj-y += board.o buttons.o leds.o 7 + obj-y += board.o buttons.o leds.o workarounds.o
+3
arch/mips/bcm47xx/bcm47xx_private.h
··· 9 9 /* leds.c */ 10 10 void __init bcm47xx_leds_register(void); 11 11 12 + /* workarounds.c */ 13 + void __init bcm47xx_workarounds(void); 14 + 12 15 #endif
+1
arch/mips/bcm47xx/setup.c
··· 282 282 } 283 283 bcm47xx_buttons_register(); 284 284 bcm47xx_leds_register(); 285 + bcm47xx_workarounds(); 285 286 286 287 fixed_phy_add(PHY_POLL, 0, &bcm47xx_fixed_phy_status); 287 288 return 0;
+31
arch/mips/bcm47xx/workarounds.c
··· 1 + #include "bcm47xx_private.h" 2 + 3 + #include <linux/gpio.h> 4 + #include <bcm47xx_board.h> 5 + #include <bcm47xx.h> 6 + 7 + static void __init bcm47xx_workarounds_netgear_wnr3500l(void) 8 + { 9 + const int usb_power = 12; 10 + 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 + 19 + void __init bcm47xx_workarounds(void) 20 + { 21 + enum bcm47xx_board board = bcm47xx_board_get(); 22 + 23 + switch (board) { 24 + case BCM47XX_BOARD_NETGEAR_WNR3500L: 25 + bcm47xx_workarounds_netgear_wnr3500l(); 26 + break; 27 + default: 28 + /* No workaround(s) needed */ 29 + break; 30 + } 31 + }