adm8668: drop 3.14
[openwrt.git] / target / linux / brcm47xx / patches-3.14 / 128-MIPS-BCM47XX-Add-new-file-for-device-specific-workar.patch
1 From 1f3e1c682a0b5273e3ee8799b54319971f426e6a Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Wed, 29 Jan 2014 18:06:52 +0100
4 Subject: [RFC V2][PATCH] MIPS: BCM47XX: Add new file for device specific workarounds
5
6 ---
7 V2: Drop pr_debug for devices we don't need workarounds for. It was too
8     load and not useful at all.
9 ---
10  arch/mips/bcm47xx/Makefile          |  2 +-
11  arch/mips/bcm47xx/bcm47xx_private.h |  3 +++
12  arch/mips/bcm47xx/setup.c           |  1 +
13  arch/mips/bcm47xx/workarounds.c     | 25 +++++++++++++++++++++++++
14  4 files changed, 30 insertions(+), 1 deletion(-)
15  create mode 100644 arch/mips/bcm47xx/workarounds.c
16
17 --- a/arch/mips/bcm47xx/Makefile
18 +++ b/arch/mips/bcm47xx/Makefile
19 @@ -4,4 +4,4 @@
20  #
21  
22  obj-y                          += irq.o nvram.o prom.o serial.o setup.o time.o sprom.o
23 -obj-y                          += board.o buttons.o leds.o
24 +obj-y                          += board.o buttons.o leds.o workarounds.o
25 --- a/arch/mips/bcm47xx/bcm47xx_private.h
26 +++ b/arch/mips/bcm47xx/bcm47xx_private.h
27 @@ -9,4 +9,7 @@ int __init bcm47xx_buttons_register(void
28  /* leds.c */
29  void __init bcm47xx_leds_register(void);
30  
31 +/* workarounds.c */
32 +void __init bcm47xx_workarounds(void);
33 +
34  #endif
35 --- a/arch/mips/bcm47xx/setup.c
36 +++ b/arch/mips/bcm47xx/setup.c
37 @@ -286,6 +286,7 @@ static int __init bcm47xx_register_bus_c
38         }
39         bcm47xx_buttons_register();
40         bcm47xx_leds_register();
41 +       bcm47xx_workarounds();
42  
43         fixed_phy_add(PHY_POLL, 0, &bcm47xx_fixed_phy_status);
44         return 0;
45 --- /dev/null
46 +++ b/arch/mips/bcm47xx/workarounds.c
47 @@ -0,0 +1,31 @@
48 +#include "bcm47xx_private.h"
49 +
50 +#include <linux/gpio.h>
51 +#include <bcm47xx_board.h>
52 +#include <bcm47xx.h>
53 +
54 +static void __init bcm47xx_workarounds_netgear_wnr3500l(void)
55 +{
56 +       const int usb_power = 12;
57 +       int err;
58 +
59 +       err = gpio_request_one(usb_power, GPIOF_OUT_INIT_HIGH, "usb_power");
60 +       if (err)
61 +               pr_err("Failed to request USB power gpio: %d\n", err);
62 +       else
63 +               gpio_free(usb_power);
64 +}
65 +
66 +void __init bcm47xx_workarounds(void)
67 +{
68 +       enum bcm47xx_board board = bcm47xx_board_get();
69 +
70 +       switch (board) {
71 +       case BCM47XX_BOARD_NETGEAR_WNR3500L:
72 +               bcm47xx_workarounds_netgear_wnr3500l();
73 +               break;
74 +       default:
75 +               /* No workaround(s) needed */
76 +               break;
77 +       }
78 +}