brcm47xx: add initial support for kernel 3.14
[openwrt.git] / target / linux / brcm47xx / patches-3.14 / 141-MIPS-BCM47XX-add-detection-and-GPIO-config-for-Sieme.patch
1 From c546fa49901252cbc1e4046d7188858b2f9e130f Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Fri, 10 Jan 2014 23:55:43 +0100
4 Subject: [PATCH 2/2] MIPS: BCM47XX: add detection and GPIO config for Siemens
5  SE505v2
6
7 This adds board detection for the Siemens SE505v2 and the led gpio
8 configuration. This board does not have any buttons.
9 This is based on OpenWrt broadcom-diag and Manuel Munz's nvram dump.
10
11 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
12 ---
13  arch/mips/bcm47xx/board.c                          |   17 +++++++++++++++++
14  arch/mips/bcm47xx/leds.c                           |   12 ++++++++++++
15  arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h |    2 ++
16  3 files changed, 31 insertions(+)
17
18 --- a/arch/mips/bcm47xx/board.c
19 +++ b/arch/mips/bcm47xx/board.c
20 @@ -181,6 +181,13 @@ struct bcm47xx_board_type_list3 bcm47xx_
21         { {0}, NULL},
22  };
23  
24 +/* boardtype, boardrev */
25 +static const
26 +struct bcm47xx_board_type_list2 bcm47xx_board_list_board_type_rev[] __initconst = {
27 +       {{BCM47XX_BOARD_SIEMENS_SE505V2, "Siemens SE505 V2"}, "0x0101", "0x10"},
28 +       { {0}, NULL},
29 +};
30 +
31  static const
32  struct bcm47xx_board_type bcm47xx_board_unknown[] __initconst = {
33         {BCM47XX_BOARD_UNKNOWN, "Unknown Board"},
34 @@ -274,6 +281,16 @@ static __init const struct bcm47xx_board
35                                 return &e3->board;
36                 }
37         }
38 +
39 +       if (bcm47xx_nvram_getenv("boardtype", buf1, sizeof(buf1)) >= 0 &&
40 +           bcm47xx_nvram_getenv("boardrev", buf2, sizeof(buf2)) >= 0 &&
41 +           bcm47xx_nvram_getenv("boardnum", buf3, sizeof(buf3)) ==  -ENOENT) {
42 +               for (e2 = bcm47xx_board_list_board_type_rev; e2->value1; e2++) {
43 +                       if (!strcmp(buf1, e2->value1) &&
44 +                           !strcmp(buf2, e2->value2))
45 +                               return &e2->board;
46 +               }
47 +       }
48         return bcm47xx_board_unknown;
49  }
50  
51 --- a/arch/mips/bcm47xx/leds.c
52 +++ b/arch/mips/bcm47xx/leds.c
53 @@ -383,6 +383,14 @@ bcm47xx_leds_netgear_wnr834bv2[] __initc
54         BCM47XX_GPIO_LED(7, "unk", "connected", 0, LEDS_GPIO_DEFSTATE_OFF),
55  };
56  
57 +/* Siemens */
58 +static const struct gpio_led
59 +bcm47xx_leds_siemens_se505v2[] __initconst = {
60 +       BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
61 +       BCM47XX_GPIO_LED(3, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
62 +       BCM47XX_GPIO_LED(5, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
63 +};
64 +
65  /* SimpleTech */
66  
67  static const struct gpio_led
68 @@ -562,6 +570,10 @@ void __init bcm47xx_leds_register(void)
69                 bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr834bv2);
70                 break;
71  
72 +       case BCM47XX_BOARD_SIEMENS_SE505V2:
73 +               bcm47xx_set_pdata(bcm47xx_leds_siemens_se505v2);
74 +               break;
75 +
76         case BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE:
77                 bcm47xx_set_pdata(bcm47xx_leds_simpletech_simpleshare);
78                 break;
79 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
80 +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
81 @@ -94,6 +94,8 @@ enum bcm47xx_board {
82  
83         BCM47XX_BOARD_PHICOMM_M1,
84  
85 +       BCM47XX_BOARD_SIEMENS_SE505V2,
86 +
87         BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE,
88  
89         BCM47XX_BOARD_ZTE_H218N,