X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=target%2Flinux%2Far71xx%2Ffiles%2Farch%2Fmips%2Fath79%2Fmach-cf-e316n-v2.c;h=90937a4503c0ccf156283b210da686f9918889af;hb=bf66bb8c969c58ef658407165a74afbfb4055997;hp=82fe83f01ec1ca9b15ece54cb03d0c24a5fb5f10;hpb=f17173f5a36999f070a2ccbde2953d5d0d98001b;p=openwrt%2Fopenwrt.git diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e316n-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e316n-v2.c index 82fe83f01e..90937a4503 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e316n-v2.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e316n-v2.c @@ -3,6 +3,7 @@ * - CF-E316N v2 (AR9341) * - CF-E320N v2 (QCA9531) * - CF-E355AC (QCA9531) + * - CF-E375AC (QCA9563 + QCA9886 + QCA8337) * - CF-E380AC v1/v2 (QCA9558) * - CF-E520N/CF-E530N (QCA9531) * @@ -16,6 +17,7 @@ */ #include +#include #include #include #include @@ -167,6 +169,65 @@ static struct gpio_keys_button cf_e355ac_gpio_keys[] __initdata = { }, }; +#define CF_E375AC_GPIO_XWDT_TRIGGER 6 + +#define CF_E375AC_GPIO_BTN_RESET_WPS 2 + +#define CF_E375AC_GPIO_LED_WAN 15 +#define CF_E375AC_GPIO_LED_LAN 17 +#define CF_E375AC_GPIO_LED_WLAN 16 + +static struct gpio_led cf_e375ac_leds_gpio[] __initdata = { + { + .name = "comfast:red:wan", + .gpio = CF_E375AC_GPIO_LED_WAN, + .active_low = 0, + }, { + .name = "comfast:green:lan", + .gpio = CF_E375AC_GPIO_LED_LAN, + .active_low = 0, + }, { + .name = "comfast:blue:wlan", + .gpio = CF_E375AC_GPIO_LED_WLAN, + .active_low = 0, + }, +}; + +static struct gpio_keys_button cf_e375ac_gpio_keys[] __initdata = { + { + .desc = "Reset button/WPS button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = CF_EXXXN_KEYS_DEBOUNCE_INTERVAL, + .gpio = CF_E375AC_GPIO_BTN_RESET_WPS, + .active_low = 1, + }, +}; + +static struct ar8327_pad_cfg cf_e375ac_ar8337_pad0_cfg = { + .mode = AR8327_PAD_MAC_SGMII, + .sgmii_delay_en = true, +}; + +static struct ar8327_platform_data cf_e375ac_ar8337_data = { + .pad0_cfg = &cf_e375ac_ar8337_pad0_cfg, + .port0_cfg = { + .force_link = 1, + .speed = AR8327_PORT_SPEED_1000, + .duplex = 1, + .txpause = 1, + .rxpause = 1, + }, +}; + +static struct mdio_board_info cf_e375ac_mdio0_info[] = { + { + .bus_id = "ag71xx-mdio.0", + .phy_addr = 0, + .platform_data = &cf_e375ac_ar8337_data, + }, +}; + /* CF-E380AC v1/v2 */ #define CF_E380AC_V1V2_GPIO_LED_LAN 0 #define CF_E380AC_V1V2_GPIO_LED_WLAN2G 2 @@ -420,6 +481,49 @@ static void __init cf_e355ac_setup(void) MIPS_MACHINE(ATH79_MACH_CF_E355AC, "CF-E355AC", "COMFAST CF-E355AC", cf_e355ac_setup); +static void __init cf_e375ac_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f040000); + u8 *art = (u8 *) KSEG1ADDR(0x1f040000); + u8 wlan1_mac[ETH_ALEN]; + + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); + ath79_init_mac(wlan1_mac, art, 3); + + /* Disable JTAG, enabling GPIOs 0-3 */ + /* Configure OBS4 line, for GPIO 4*/ + ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, 0); + + cf_exxxn_common_setup(0x40000, CF_E375AC_GPIO_XWDT_TRIGGER); + + ath79_gpio_output_select(CF_E375AC_GPIO_LED_WAN, 0); + ath79_gpio_output_select(CF_E375AC_GPIO_LED_LAN, 0); + ath79_gpio_output_select(CF_E375AC_GPIO_LED_WLAN, 0); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e375ac_leds_gpio), + cf_e375ac_leds_gpio); + ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL, + ARRAY_SIZE(cf_e375ac_gpio_keys), + cf_e375ac_gpio_keys); + + platform_device_register(&ath79_mdio0_device); + + mdiobus_register_board_info(cf_e375ac_mdio0_info, + ARRAY_SIZE(cf_e375ac_mdio0_info)); + + /* GMAC0 is connected to an AR8337 switch */ + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; + ath79_eth0_data.speed = SPEED_1000; + ath79_eth0_data.duplex = DUPLEX_FULL; + ath79_eth0_data.phy_mask = BIT(0); + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + ath79_register_eth(0); + + ap91_pci_init(art + 0x5000, wlan1_mac); +} +MIPS_MACHINE(ATH79_MACH_CF_E375AC, "CF-E375AC", "COMFAST CF-E375AC", cf_e375ac_setup); + static void __init cf_e380ac_v1v2_common_setup(unsigned long art_ofs) { u8 *mac = (u8 *) KSEG1ADDR(0x1f000000 + art_ofs);