brcm63xx: Add DT support for HG553
[15.05/openwrt.git] / target / linux / brcm63xx / patches-3.14 / 526-board_CT6373-1.patch
1 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
2 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
3 @@ -43,6 +43,12 @@
4  #define NB4_SPI_GPIO_CLK       6
5  #define NB4_74HC64_GPIO(X)     (NB4_74X164_GPIO_BASE + (X))
6  
7 +#define CT6373_PID_OFFSET              0xff80
8 +#define CT6373_74X164_GPIO_BASE        64
9 +#define CT6373_SPI_GPIO_MOSI   7
10 +#define CT6373_SPI_GPIO_CLK            6
11 +#define CT6373_74HC64_GPIO(X)  (CT6373_74X164_GPIO_BASE + (X))
12 +
13  /*
14   * known 3368 boards
15   */
16 @@ -2050,6 +2056,125 @@ static struct board_info __initdata boar
17         .num_spis = ARRAY_SIZE(nb4_spi_devices),
18  };
19  
20 +
21 +struct spi_gpio_platform_data ct6373_spi_gpio_data = {
22 +       .sck            = CT6373_SPI_GPIO_CLK,
23 +       .mosi           = CT6373_SPI_GPIO_MOSI,
24 +       .miso           = SPI_GPIO_NO_MISO,
25 +       .num_chipselect = 1,
26 +};
27 +
28 +static struct platform_device ct6373_spi_gpio = {
29 +       .name = "spi_gpio",
30 +       .id   = 1,
31 +       .dev = {
32 +               .platform_data = &ct6373_spi_gpio_data,
33 +       },
34 +};
35 +
36 +static struct platform_device * __initdata ct6373_devices[] = {
37 +       &ct6373_spi_gpio,
38 +};
39 +
40 +#if 0 /* FIXME: 3.14 dropped non-DT support */
41 +const struct gen_74x164_chip_platform_data ct6373_74x164_platform_data = {
42 +       .base = CT6373_74X164_GPIO_BASE
43 +};
44 +#endif
45 +
46 +static struct spi_board_info ct6373_spi_devices[] = {
47 +#if 0 /* FIXME: 3.14 dropped non-DT support */
48 +       {
49 +               .modalias = "74x164",
50 +               .max_speed_hz = 781000,
51 +               .bus_num = 1,
52 +               .controller_data = (void *) SPI_GPIO_NO_CHIPSELECT,
53 +               .mode = SPI_MODE_0,
54 +               .platform_data = &ct6373_74x164_platform_data
55 +       }
56 +#endif
57 +};
58 +
59 +static struct board_info __initdata board_ct6373_1 = {
60 +       .name                           = "CT6373-1",
61 +       .of_board_id            = "comtrend,ct-6373",
62 +       .expected_cpu_id        = 0x6358,
63 +
64 +       .has_uart0                      = 1,
65 +       .has_pci                        = 1,
66 +       .use_fallback_sprom             = 1,
67 +       .has_ohci0                      = 1,
68 +       .has_ehci0                      = 1,
69 +
70 +       .has_enet1                      = 1,
71 +       .enet1 = {
72 +               .has_phy                = 1,
73 +               .phy_id                 = 0,
74 +               .force_speed_100        = 1,
75 +               .force_duplex_full      = 1,
76 +       },
77 +
78 +       .leds = {
79 +               {
80 +                       .name           = "CT6373-1:green:power",
81 +                       .gpio           = 0,
82 +                       .default_trigger = "default-on",
83 +               },
84 +               {
85 +                       .name           = "CT6373-1:green:usb",
86 +                       .gpio           = 3,
87 +                       .active_low     = 1,
88 +               },
89 +               {
90 +                       .name           = "CT6373-1:green:wlan",
91 +                       .gpio           = 9,
92 +                       .active_low     = 1,
93 +               },
94 +               {
95 +                       .name           = "CT6373-1:green:adsl",
96 +                       .gpio           = CT6373_74HC64_GPIO(0),
97 +                       .active_low     = 1,
98 +               },
99 +               {
100 +                       .name           = "CT6373-1:green:line",
101 +                       .gpio           = CT6373_74HC64_GPIO(1),
102 +                       .active_low     = 1,
103 +               },
104 +               {
105 +                       .name           = "CT6373-1:green:fxs1",
106 +                       .gpio           = CT6373_74HC64_GPIO(2),
107 +                       .active_low     = 1,
108 +               },
109 +               {
110 +                       .name           = "CT6373-1:green:fxs2",
111 +                       .gpio           = CT6373_74HC64_GPIO(3),
112 +                       .active_low     = 1,
113 +               },
114 +       },
115 +
116 +       .buttons = {
117 +               {
118 +                       .desc           = "reset",
119 +                       .gpio           = 35,
120 +                       .active_low     = 1,
121 +                       .type           = EV_KEY,
122 +                       .code           = KEY_RESTART,
123 +                       .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
124 +               },
125 +       },
126 +
127 +       .fallback_sprom = {
128 +               .type                           = SPROM_BCM4318,
129 +               .pci_bus                        = 0,
130 +               .pci_dev                        = 1,
131 +       },
132 +
133 +       .devs = ct6373_devices,
134 +       .num_devs = ARRAY_SIZE(ct6373_devices),
135 +       .spis = ct6373_spi_devices,
136 +       .num_spis = ARRAY_SIZE(ct6373_spi_devices),
137 +};
138 +
139  static struct board_info __initdata board_HW553 = {
140         .name                           = "HW553",
141         .of_board_id                                    = "huawei,hg553",
142 @@ -2392,6 +2517,7 @@ static const struct board_info __initcon
143         &board_dsl_274xb_rev_c,
144         &board_nb4_ser_r0,
145         &board_nb4_fxc_r1,
146 +       &board_ct6373_1,
147         &board_HW553,
148         &board_spw303v,
149  #endif