2 * Belkin AC1750DB (F9K1115V2) board support
4 * Copyright (C) 2014 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2014 Imre Kaloz <kaloz@openwrt.org>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
12 #include <linux/gpio.h>
13 #include <linux/platform_device.h>
14 #include <linux/ar8216_platform.h>
16 #include <asm/mach-ath79/ar71xx_regs.h>
20 #include "dev-gpio-buttons.h"
22 #include "dev-leds-gpio.h"
23 #include "dev-m25p80.h"
26 #include "machtypes.h"
28 #define F9K1115V2_GPIO_LED_USB2 4
29 #define F9K1115V2_GPIO_LED_WPS_AMBER 14
30 #define F9K1115V2_GPIO_LED_STATUS_AMBER 15
31 #define F9K1115V2_GPIO_LED_WPS_BLUE 19
32 #define F9K1115V2_GPIO_LED_STATUS_BLUE 20
34 #define F9K1115V2_GPIO_BTN_WPS 16
35 #define F9K1115V2_GPIO_BTN_RESET 17
37 #define F9K1115V2_GPIO_USB2_POWER 21
39 #define F9K1115V2_KEYS_POLL_INTERVAL 20 /* msecs */
40 #define F9K1115V2_KEYS_DEBOUNCE_INTERVAL (3 * F9K1115V2_KEYS_POLL_INTERVAL)
42 #define F9K1115V2_WAN_MAC_OFFSET 0
43 #define F9K1115V2_LAN_MAC_OFFSET 6
44 #define F9K1115V2_WMAC_CALDATA_OFFSET 0x1000
45 #define F9K1115V2_PCIE_CALDATA_OFFSET 0x5000
47 static struct gpio_led f9k1115v2_leds_gpio[] __initdata = {
49 .name = "belkin:amber:status",
50 .gpio = F9K1115V2_GPIO_LED_STATUS_AMBER,
54 .name = "belkin:blue:status",
55 .gpio = F9K1115V2_GPIO_LED_STATUS_BLUE,
59 .name = "belkin:blue:wps",
60 .gpio = F9K1115V2_GPIO_LED_WPS_BLUE,
64 .name = "belkin:amber:wps",
65 .gpio = F9K1115V2_GPIO_LED_WPS_AMBER,
69 .name = "belkin:green:usb2",
70 .gpio = F9K1115V2_GPIO_LED_USB2,
75 static struct gpio_keys_button f9k1115v2_gpio_keys[] __initdata = {
77 .desc = "Reset button",
80 .debounce_interval = F9K1115V2_KEYS_DEBOUNCE_INTERVAL,
81 .gpio = F9K1115V2_GPIO_BTN_RESET,
87 .code = KEY_WPS_BUTTON,
88 .debounce_interval = F9K1115V2_KEYS_DEBOUNCE_INTERVAL,
89 .gpio = F9K1115V2_GPIO_BTN_WPS,
94 static struct ar8327_pad_cfg f9k1115v2_ar8327_pad0_cfg = {
95 /* Use the RGMII interface for the GMAC0 of the AR8337 switch */
96 .mode = AR8327_PAD_MAC_RGMII,
97 .txclk_delay_en = true,
98 .rxclk_delay_en = true,
99 .txclk_delay_sel = AR8327_CLK_DELAY_SEL1,
100 .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2,
101 .mac06_exchange_en = true,
104 static struct ar8327_pad_cfg f9k1115v2_ar8327_pad6_cfg = {
105 /* Use the SGMII interface for the GMAC6 of the AR8337 switch */
106 .mode = AR8327_PAD_MAC_SGMII,
107 .rxclk_delay_en = true,
108 .rxclk_delay_sel = AR8327_CLK_DELAY_SEL0,
111 static struct ar8327_platform_data f9k1115v2_ar8327_data = {
112 .pad0_cfg = &f9k1115v2_ar8327_pad0_cfg,
113 .pad6_cfg = &f9k1115v2_ar8327_pad6_cfg,
116 .speed = AR8327_PORT_SPEED_1000,
123 .speed = AR8327_PORT_SPEED_1000,
130 static struct mdio_board_info f9k1115v2_mdio0_info[] = {
132 .bus_id = "ag71xx-mdio.0",
134 .platform_data = &f9k1115v2_ar8327_data,
138 static void __init f9k1115v2_setup(void)
140 u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
142 ath79_register_m25p80(NULL);
144 ath79_register_leds_gpio(-1, ARRAY_SIZE(f9k1115v2_leds_gpio),
145 f9k1115v2_leds_gpio);
146 ath79_register_gpio_keys_polled(-1, F9K1115V2_KEYS_POLL_INTERVAL,
147 ARRAY_SIZE(f9k1115v2_gpio_keys),
148 f9k1115v2_gpio_keys);
150 ath79_register_wmac(art + F9K1115V2_WMAC_CALDATA_OFFSET, NULL);
152 ath79_register_mdio(0, 0x0);
153 mdiobus_register_board_info(f9k1115v2_mdio0_info,
154 ARRAY_SIZE(f9k1115v2_mdio0_info));
156 ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN);
158 ath79_init_mac(ath79_eth0_data.mac_addr,
159 art + F9K1115V2_WAN_MAC_OFFSET, 0);
161 ath79_init_mac(ath79_eth1_data.mac_addr,
162 art + F9K1115V2_LAN_MAC_OFFSET, 0);
164 ath79_eth0_pll_data.pll_1000 = 0xa6000000;
165 ath79_eth1_pll_data.pll_1000 = 0x03000101;
167 /* GMAC0 is connected to the RMGII interface */
168 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
169 ath79_eth0_data.phy_mask = BIT(0);
170 ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
172 ath79_register_eth(0);
174 /* GMAC1 is connected to the SGMII interface */
175 ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
176 ath79_eth1_data.speed = SPEED_1000;
177 ath79_eth1_data.duplex = DUPLEX_FULL;
179 ath79_register_eth(1);
181 ath79_register_pci();
183 ath79_register_usb();
184 gpio_request_one(F9K1115V2_GPIO_USB2_POWER,
185 GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
189 MIPS_MACHINE(ATH79_MACH_F9K1115V2, "F9K1115V2", "Belkin AC1750DB",