brcm63xx: use dtb board detection for NB6
[15.05/openwrt.git] / target / linux / brcm63xx / patches-3.14 / 528-board_nb6.patch
1 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
2 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
3 @@ -18,6 +18,7 @@
4  #if 0 /* FIXME: 3.14 removed non-DT support */
5  #include <linux/spi/74x164.h>
6  #endif
7 +#include <linux/rtl8367.h>
8  #include <asm/addrspace.h>
9  #include <bcm63xx_board.h>
10  #include <bcm63xx_cpu.h>
11 @@ -46,6 +47,8 @@
12  #define NB4_SPI_GPIO_MOSI      7
13  #define NB4_SPI_GPIO_CLK       6
14  #define NB4_74HC64_GPIO(X)     (NB4_74X164_GPIO_BASE + (X))
15 +#define NB6_GPIO_RTL8367_SDA   18
16 +#define NB6_GPIO_RTL8367_SCK   20
17  
18  #define CT6373_PID_OFFSET              0xff80
19  #define CT6373_74X164_GPIO_BASE        64
20 @@ -2717,6 +2720,105 @@ static struct board_info __initdata boar
21  };
22  #endif /* CONFIG_BCM63XX_CPU_6358 */
23  
24 +#ifdef CONFIG_BCM63XX_CPU_6362
25 +static struct rtl8367_extif_config nb6_rtl8367_extif0_cfg = {
26 +       .mode = RTL8367_EXTIF_MODE_RGMII,
27 +       .txdelay = 1,
28 +       .rxdelay = 5,
29 +       .ability = {
30 +               .force_mode = 1,
31 +               .txpause = 1,
32 +               .rxpause = 1,
33 +               .link = 1,
34 +               .duplex = 1,
35 +               .speed = RTL8367_PORT_SPEED_1000,
36 +       },
37 +};
38 +
39 +static struct rtl8367_platform_data nb6_rtl8367_data = {
40 +       .gpio_sda       = NB6_GPIO_RTL8367_SDA,
41 +       .gpio_sck       = NB6_GPIO_RTL8367_SCK,
42 +       .extif0_cfg     = &nb6_rtl8367_extif0_cfg,
43 +};
44 +
45 +static struct platform_device nb6_rtl8367_device = {
46 +       .name           = RTL8367_DRIVER_NAME,
47 +       .id             = -1,
48 +       .dev = {
49 +               .platform_data  = &nb6_rtl8367_data,
50 +       }
51 +};
52 +
53 +static struct platform_device * __initdata nb6_devices[] = {
54 +       &nb6_rtl8367_device,
55 +};
56 +
57 +static struct board_info __initdata board_nb6 = {
58 +       .name                           = "NB6",
59 +       .of_board_id                    = "sfr,nb6-ser-r0",
60 +       .expected_cpu_id                = 0x6362,
61 +
62 +       .has_uart0                      = 1,
63 +
64 +       .has_ohci0                      = 1,
65 +       .has_ehci0                      = 1,
66 +       .num_usbh_ports                 = 2,
67 +
68 +       .has_enetsw                     = 1,
69 +
70 +       .enetsw = {
71 +               .used_ports = {
72 +                       [4] = {
73 +                               .used   = 1,
74 +                               .phy_id = 0xff,
75 +                               .bypass_link = 1,
76 +                               .force_speed = 1000,
77 +                               .force_duplex_full = 1,
78 +                               .name   = "RGMII",
79 +                       },
80 +               },
81 +       },
82 +
83 +       .buttons = {
84 +               {
85 +                       .desc           = "reset",
86 +                       .gpio           = 24,
87 +                       .type           = EV_KEY,
88 +                       .code           = KEY_RESTART,
89 +                       .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
90 +                       .active_low     = 1,
91 +               },
92 +               {
93 +                       .desc           = "wps",
94 +                       .gpio           = 25,
95 +                       .type           = EV_KEY,
96 +                       .code           = KEY_WPS_BUTTON,
97 +                       .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
98 +                       .active_low     = 1,
99 +               },
100 +               {
101 +                       .desc           = "wlan",
102 +                       .gpio           = 12,
103 +                       .type           = EV_KEY,
104 +                       .code           = KEY_WLAN,
105 +                       .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
106 +                       .active_low     = 1,
107 +               },
108 +               {
109 +                       .desc           = "service",
110 +                       .gpio           = 10,
111 +                       .type           = EV_KEY,
112 +                       .code           = BTN_0,
113 +                       .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
114 +                       .active_low     = 1,
115 +               },
116 +       },
117 +
118 +       .devs = nb6_devices,
119 +       .num_devs = ARRAY_SIZE(nb6_devices),
120 +};
121 +#endif /* CONFIG_BCM63XX_CPU_6362 */
122 +
123  /*
124   * known 6368 boards
125   */
126 @@ -2923,6 +3025,10 @@ static const struct board_info __initcon
127         &board_DVAG3810BN,
128  #endif
129  
130 +#ifdef CONFIG_BCM63XX_CPU_6362
131 +       &board_nb6,
132 +#endif
133 +
134  #ifdef CONFIG_BCM63XX_CPU_6368
135         &board_96368mvwg,
136         &board_96368mvngr,