From 673793d753717dc49e5a6f9b1bba52658cae63fc Mon Sep 17 00:00:00 2001 From: Tim Thorpe Date: Mon, 25 Sep 2017 04:38:49 -0500 Subject: ar71xx: add support for TP-Link TL-WR1043N v5 TP-Link TL-WR1043N v5 appears to be identical to the TL-WR1043ND v4, except that the USB port has been removed and there is no longer a removable antenna option. The software is more in line with the Archer series in that it uses a nested bootloader scheme. Specifications: - QCA9563 at 775 MHz - 64 MB RAM - 16 MB flash - 3 (non-detachable) Antennas / 450 Mbit - 1x/4x WAN/LAN Gbps Ethernet (QCA8337) - reset and Wi-Fi buttons Signed-off-by: Tim Thorpe Signed-off-by: Ludwig Thomeczek --- .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 9 +++ .../files/arch/mips/ath79/mach-tl-wr1043nd-v4.c | 82 ++++++++++++++++++++++ .../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 + 3 files changed, 92 insertions(+) (limited to 'target/linux/ar71xx/files/arch') diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt index aa29052316..1198fcb74b 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -1810,6 +1810,15 @@ config ATH79_MACH_TL_WR1041N_V2 select ATH79_DEV_USB select ATH79_DEV_WMAC +config ATH79_MACH_TL_WR1043N_V5 + bool "TP-LINK TL-WR1043N v5 support" + select SOC_QCA956X + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + select ATH79_DEV_WMAC + config ATH79_MACH_TL_WR1043ND bool "TP-LINK TL-WR1043ND support" select SOC_AR913X diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c index b1539c5d71..450819a9e6 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c @@ -5,6 +5,7 @@ * Copyright (C) 2016 Matthias Schiffer * Copyright (C) 2016 Andreas Ziegler * Copyright (C) 2016 Ludwig Thomeczek + * Copyright (C) 2017 Tim Thorpe * * Derived from: mach-dir-869-a1.c * @@ -62,6 +63,8 @@ #define TL_WR1043_V4_EEPROM_ADDR 0x1fff0000 #define TL_WR1043_V4_WMAC_CALDATA_OFFSET 0x1000 +#define TL_WR1043N_V5_MAC_LOCATION 0x1ff00008 + static struct gpio_led tl_wr1043nd_v4_leds_gpio[] __initdata = { { .name = "tp-link:green:wps", @@ -188,3 +191,82 @@ static void __init tl_wr1043nd_v4_setup(void) MIPS_MACHINE(ATH79_MACH_TL_WR1043ND_V4, "TL-WR1043ND-v4", "TP-LINK TL-WR1043ND v4", tl_wr1043nd_v4_setup); + +static struct gpio_led tl_wr1043n_v5_leds_gpio[] __initdata = { + { + .name = "tp-link:green:wps", + .gpio = TL_WR1043_V4_GPIO_LED_WPS, + .active_low = 1, + }, + { + .name = "tp-link:green:system", + .gpio = TL_WR1043_V4_GPIO_LED_SYSTEM, + .active_low = 1, + }, + { + .name = "tp-link:green:wlan", + .gpio = TL_WR1043_V4_GPIO_LED_WLAN, + .active_low = 1, + }, + { + .name = "tp-link:green:wan", + .gpio = TL_WR1043_V4_GPIO_LED_WAN, + .active_low = 1, + }, + { + .name = "tp-link:green:lan1", + .gpio = TL_WR1043_V4_GPIO_LED_LAN1, + .active_low = 1, + }, + { + .name = "tp-link:green:lan2", + .gpio = TL_WR1043_V4_GPIO_LED_LAN2, + .active_low = 1, + }, + { + .name = "tp-link:green:lan3", + .gpio = TL_WR1043_V4_GPIO_LED_LAN3, + .active_low = 1, + }, + { + .name = "tp-link:green:lan4", + .gpio = TL_WR1043_V4_GPIO_LED_LAN4, + .active_low = 1, + }, +}; + +/* The 1043Nv5 is identical to the 1043NDv4, + * only missing the usb and small firmware layout changes */ +static void __init tl_wr1043nv5_setup(void) +{ + u8 *art = (u8 *) KSEG1ADDR(TL_WR1043_V4_EEPROM_ADDR); + u8 *mac = (u8 *) KSEG1ADDR(TL_WR1043N_V5_MAC_LOCATION); + + ath79_register_m25p80(NULL); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr1043n_v5_leds_gpio), + tl_wr1043n_v5_leds_gpio); + ath79_register_gpio_keys_polled(-1, TL_WR1043_V4_KEYS_POLL_INTERVAL, + ARRAY_SIZE(tl_wr1043nd_v4_gpio_keys), + tl_wr1043nd_v4_gpio_keys); + + platform_device_register(&ath79_mdio0_device); + + mdiobus_register_board_info(tl_wr1043nd_v4_mdio0_info, + ARRAY_SIZE(tl_wr1043nd_v4_mdio0_info)); + + ath79_register_wmac(art + TL_WR1043_V4_WMAC_CALDATA_OFFSET, mac); + + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); + + /* 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); +} + +MIPS_MACHINE(ATH79_MACH_TL_WR1043N_V5, "TL-WR1043N-v5", "TP-LINK TL-WR1043N v5", + tl_wr1043nv5_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h index 146a79d048..0f536f0ec5 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -247,6 +247,7 @@ enum ath79_mach_type { ATH79_MACH_TL_WDR6500_V2, /* TP-LINK TL-WDR6500 v2 */ ATH79_MACH_TL_WPA8630, /* TP-Link TL-WPA8630 */ ATH79_MACH_TL_WR1041N_V2, /* TP-LINK TL-WR1041N v2 */ + ATH79_MACH_TL_WR1043N_V5, /* TP-LINK TL-WR1043N v5 */ ATH79_MACH_TL_WR1043ND, /* TP-LINK TL-WR1043ND */ ATH79_MACH_TL_WR1043ND_V2, /* TP-LINK TL-WR1043ND v2 */ ATH79_MACH_TL_WR1043ND_V4, /* TP-LINK TL-WR1043ND v4 */ -- cgit v1.2.3