1 --- a/arch/mips/ath79/mach-ap136.c
2 +++ b/arch/mips/ath79/mach-ap136.c
7 -#include <linux/pci.h>
8 -#include <linux/ath9k_platform.h>
9 +#include <linux/platform_device.h>
10 +#include <linux/ar8216_platform.h>
12 -#include "machtypes.h"
13 +#include <asm/mach-ath79/ar71xx_regs.h>
17 +#include "dev-ap9x-pci.h"
18 #include "dev-gpio-buttons.h"
20 #include "dev-leds-gpio.h"
22 +#include "dev-m25p80.h"
27 +#include "machtypes.h"
29 -#define AP136_GPIO_LED_STATUS_RED 14
30 -#define AP136_GPIO_LED_STATUS_GREEN 19
31 #define AP136_GPIO_LED_USB 4
32 -#define AP136_GPIO_LED_WLAN_2G 13
33 #define AP136_GPIO_LED_WLAN_5G 12
34 +#define AP136_GPIO_LED_WLAN_2G 13
35 +#define AP136_GPIO_LED_STATUS_RED 14
36 #define AP136_GPIO_LED_WPS_RED 15
37 +#define AP136_GPIO_LED_STATUS_GREEN 19
38 #define AP136_GPIO_LED_WPS_GREEN 20
40 #define AP136_GPIO_BTN_WPS 16
42 #define AP136_KEYS_POLL_INTERVAL 20 /* msecs */
43 #define AP136_KEYS_DEBOUNCE_INTERVAL (3 * AP136_KEYS_POLL_INTERVAL)
45 -#define AP136_WMAC_CALDATA_OFFSET 0x1000
46 -#define AP136_PCIE_CALDATA_OFFSET 0x5000
47 +#define AP136_MAC0_OFFSET 0
48 +#define AP136_MAC1_OFFSET 6
49 +#define AP136_WMAC_CALDATA_OFFSET 0x1000
50 +#define AP136_PCIE_CALDATA_OFFSET 0x5000
52 static struct gpio_led ap136_leds_gpio[] __initdata = {
54 - .name = "qca:green:status",
55 + .name = "ap136:green:status",
56 .gpio = AP136_GPIO_LED_STATUS_GREEN,
60 - .name = "qca:red:status",
61 + .name = "ap136:red:status",
62 .gpio = AP136_GPIO_LED_STATUS_RED,
66 - .name = "qca:green:wps",
67 + .name = "ap136:green:wps",
68 .gpio = AP136_GPIO_LED_WPS_GREEN,
72 - .name = "qca:red:wps",
73 + .name = "ap136:red:wps",
74 .gpio = AP136_GPIO_LED_WPS_RED,
78 - .name = "qca:red:wlan-2g",
79 + .name = "ap136:red:wlan-2g",
80 .gpio = AP136_GPIO_LED_WLAN_2G,
84 - .name = "qca:red:usb",
85 + .name = "ap136:red:usb",
86 .gpio = AP136_GPIO_LED_USB,
89 @@ -98,59 +106,151 @@ static struct gpio_keys_button ap136_gpi
93 -static struct spi_board_info ap136_spi_info[] = {
97 - .max_speed_hz = 25000000,
98 - .modalias = "mx25l6405d",
100 +static struct ar8327_pad_cfg ap136_ar8327_pad0_cfg;
101 +static struct ar8327_pad_cfg ap136_ar8327_pad6_cfg;
103 +static struct ar8327_platform_data ap136_ar8327_data = {
104 + .pad0_cfg = &ap136_ar8327_pad0_cfg,
105 + .pad6_cfg = &ap136_ar8327_pad6_cfg,
108 + .speed = AR8327_PORT_SPEED_1000,
115 + .speed = AR8327_PORT_SPEED_1000,
122 -static struct ath79_spi_platform_data ap136_spi_data = {
124 - .num_chipselect = 1,
125 +static struct mdio_board_info ap136_mdio0_info[] = {
127 + .bus_id = "ag71xx-mdio.0",
129 + .platform_data = &ap136_ar8327_data,
134 -static struct ath9k_platform_data ap136_ath9k_data;
135 +static void __init ap136_common_setup(void)
137 + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
139 + ath79_register_m25p80(NULL);
141 + ath79_register_leds_gpio(-1, ARRAY_SIZE(ap136_leds_gpio),
143 + ath79_register_gpio_keys_polled(-1, AP136_KEYS_POLL_INTERVAL,
144 + ARRAY_SIZE(ap136_gpio_keys),
147 + ath79_register_usb();
148 + ath79_register_nfc();
150 + ath79_register_wmac(art + AP136_WMAC_CALDATA_OFFSET, NULL);
152 + ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN);
154 -static int ap136_pci_plat_dev_init(struct pci_dev *dev)
155 + ath79_register_mdio(0, 0x0);
156 + ath79_init_mac(ath79_eth0_data.mac_addr, art + AP136_MAC0_OFFSET, 0);
158 + mdiobus_register_board_info(ap136_mdio0_info,
159 + ARRAY_SIZE(ap136_mdio0_info));
161 + /* GMAC0 is connected to the RMGII interface */
162 + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
163 + ath79_eth0_data.phy_mask = BIT(0);
164 + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
166 + ath79_register_eth(0);
168 + /* GMAC1 is connected tot eh SGMII interface */
169 + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
170 + ath79_eth1_data.speed = SPEED_1000;
171 + ath79_eth1_data.duplex = DUPLEX_FULL;
173 + ath79_register_eth(1);
176 +static void __init ap136_010_setup(void)
178 - if (dev->bus->number == 1 && (PCI_SLOT(dev->devfn)) == 0)
179 - dev->dev.platform_data = &ap136_ath9k_data;
180 + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
183 + /* GMAC0 of the AR8327 switch is connected to GMAC0 via RGMII */
184 + ap136_ar8327_pad0_cfg.mode = AR8327_PAD_MAC_RGMII;
185 + ap136_ar8327_pad0_cfg.txclk_delay_en = true;
186 + ap136_ar8327_pad0_cfg.rxclk_delay_en = true;
187 + ap136_ar8327_pad0_cfg.txclk_delay_sel = AR8327_CLK_DELAY_SEL1;
188 + ap136_ar8327_pad0_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL2;
190 + /* GMAC6 of the AR8327 switch is connected to GMAC1 via SGMII */
191 + ap136_ar8327_pad6_cfg.mode = AR8327_PAD_MAC_SGMII;
192 + ap136_ar8327_pad6_cfg.rxclk_delay_en = true;
193 + ap136_ar8327_pad6_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL0;
195 + ath79_eth0_pll_data.pll_1000 = 0xa6000000;
196 + ath79_eth1_pll_data.pll_1000 = 0x03000101;
198 + ap136_common_setup();
199 + ap91_pci_init(art + AP136_PCIE_CALDATA_OFFSET, NULL);
202 -static void __init ap136_pci_init(u8 *eeprom)
203 +MIPS_MACHINE(ATH79_MACH_AP136_010, "AP136-010",
204 + "Atheros AP136-010 reference board",
207 +static void __init ap136_020_common_setup(void)
209 - memcpy(ap136_ath9k_data.eeprom_data, eeprom,
210 - sizeof(ap136_ath9k_data.eeprom_data));
211 + /* GMAC0 of the AR8327 switch is connected to GMAC1 via SGMII */
212 + ap136_ar8327_pad0_cfg.mode = AR8327_PAD_MAC_SGMII;
213 + ap136_ar8327_pad0_cfg.sgmii_delay_en = true;
215 + /* GMAC6 of the AR8327 switch is connected to GMAC0 via RGMII */
216 + ap136_ar8327_pad6_cfg.mode = AR8327_PAD_MAC_RGMII;
217 + ap136_ar8327_pad6_cfg.txclk_delay_en = true;
218 + ap136_ar8327_pad6_cfg.rxclk_delay_en = true;
219 + ap136_ar8327_pad6_cfg.txclk_delay_sel = AR8327_CLK_DELAY_SEL1;
220 + ap136_ar8327_pad6_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL2;
222 - ath79_pci_set_plat_dev_init(ap136_pci_plat_dev_init);
223 - ath79_register_pci();
224 + ath79_eth0_pll_data.pll_1000 = 0x56000000;
225 + ath79_eth1_pll_data.pll_1000 = 0x03000101;
227 + ap136_common_setup();
230 -static inline void ap136_pci_init(u8 *eeprom) {}
231 -#endif /* CONFIG_PCI */
233 -static void __init ap136_setup(void)
234 +static void __init ap136_020_setup(void)
236 u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
238 - ath79_register_leds_gpio(-1, ARRAY_SIZE(ap136_leds_gpio),
240 - ath79_register_gpio_keys_polled(-1, AP136_KEYS_POLL_INTERVAL,
241 - ARRAY_SIZE(ap136_gpio_keys),
243 - ath79_register_spi(&ap136_spi_data, ap136_spi_info,
244 - ARRAY_SIZE(ap136_spi_info));
245 - ath79_register_usb();
246 - ath79_register_wmac(art + AP136_WMAC_CALDATA_OFFSET);
247 - ap136_pci_init(art + AP136_PCIE_CALDATA_OFFSET);
248 + ap136_020_common_setup();
249 + ap91_pci_init(art + AP136_PCIE_CALDATA_OFFSET, NULL);
252 -MIPS_MACHINE(ATH79_MACH_AP136_010, "AP136-010",
253 - "Atheros AP136-010 reference board",
255 +MIPS_MACHINE(ATH79_MACH_AP136_020, "AP136-020",
256 + "Atheros AP136-020 reference board",
260 + * AP135-020 is similar to AP136-020, any future AP135 specific init
261 + * code can be added here.
263 +static void __init ap135_020_setup(void)
265 + ap136_leds_gpio[0].name = "ap135:green:status";
266 + ap136_leds_gpio[1].name = "ap135:red:status";
267 + ap136_leds_gpio[2].name = "ap135:green:wps";
268 + ap136_leds_gpio[3].name = "ap135:red:wps";
269 + ap136_leds_gpio[4].name = "ap135:red:wlan-2g";
270 + ap136_leds_gpio[5].name = "ap135:red:usb";
272 + ap136_020_common_setup();
273 + ath79_register_pci();
276 +MIPS_MACHINE(ATH79_MACH_AP135_020, "AP135-020",
277 + "Atheros AP135-020 reference board",
279 --- a/arch/mips/ath79/Kconfig
280 +++ b/arch/mips/ath79/Kconfig
281 @@ -16,16 +16,17 @@ config ATH79_MACH_AP121
282 Atheros AP121 reference board.
284 config ATH79_MACH_AP136
285 - bool "Atheros AP136 reference board"
286 + bool "Atheros AP136/AP135 reference board"
288 select ATH79_DEV_GPIO_BUTTONS
289 select ATH79_DEV_LEDS_GPIO
290 + select ATH79_DEV_NFC
293 select ATH79_DEV_WMAC
295 Say 'Y' here if you want your kernel to support the
296 - Atheros AP136 reference board.
297 + Atheros AP136 or AP135 reference boards.
299 config ATH79_MACH_AP81
300 bool "Atheros AP81 reference board"