PATCHv3 changelog: * I hate whitespace. v2 is broken, sorry for the noise.
PATCHv2 changelog: * got ethernet almost right: eth1 = wan, eth0 = lan ports, reversed * added board to sysupgrade support WDR3500 is similar to WDR3600 except it doesn't have gigabit ethernet, and has only 1 USB port. So, this patch (over r35162) adds a new board type, based on mach-tl-wdr4300.c but replacing ethernet config with one franken-based on mach-tl-wr841n-v8.c a huge thanks goes out to Paul Fertser for hours of tireless advice! Pending issues: * Leds are not working at all (except power and wlan_5g) * LAN switch ethernet ports are reversed with respect to case label. [Label] -> soft device [LAN1] -> eth0.4 [LAN2] -> eth0.3 [LAN3] -> eth0.2 [LAN4] -> eth0.1 Anyone with experience fixing those details that cares to help, will be much appreciated! Thanks-to: Paul Fertser <fercer...@gmail.com> Signed-off-by: Gui Iribarren <g...@altermundi.net> --- target/linux/ar71xx/base-files/lib/ar71xx.sh | 6 + .../ar71xx/base-files/lib/upgrade/platform.sh | 1 + target/linux/ar71xx/config-3.7 | 1 + .../ar71xx/files/arch/mips/ath79/mach-tl-wdr3500.c | 153 ++++++++++++++++++++ target/linux/ar71xx/generic/profiles/tp-link.mk | 4 +- target/linux/ar71xx/image/Makefile | 3 +- .../610-MIPS-ath79-openwrt-machines.patch | 27 +++- 7 files changed, 185 insertions(+), 10 deletions(-) diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 31b6dde..a11c1c3 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -123,6 +123,9 @@ tplink_board_detect() { "342000"*) model="TP-Link TL-MR3420" ;; + "350000"*) + model="TP-Link TL-WDR3500" + ;; "360000"*) model="TP-Link TL-WDR3600" ;; @@ -366,6 +369,9 @@ ar71xx_board_detect() { *"TL-WA901ND v2") name="tl-wa901nd-v2" ;; + *"TL-WDR3500") + name="tl-wdr3500" + ;; *"TL-WDR3600/4300/4310") name="tl-wdr4300" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 3d5efdb..a952a9b 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -158,6 +158,7 @@ platform_check_image() { tl-wa7510n | \ tl-wa901nd | \ tl-wa901nd-v2 | \ + tl-wdr3500 | \ tl-wdr4300 | \ tl-wr703n | \ tl-wr741nd | \ diff --git a/target/linux/ar71xx/config-3.7 b/target/linux/ar71xx/config-3.7 index a13cf98..80e0e81 100644 --- a/target/linux/ar71xx/config-3.7 +++ b/target/linux/ar71xx/config-3.7 @@ -63,6 +63,7 @@ CONFIG_ATH79_MACH_TL_MR3020=y CONFIG_ATH79_MACH_TL_MR3X20=y CONFIG_ATH79_MACH_TL_WA901ND=y CONFIG_ATH79_MACH_TL_WA901ND_V2=y +CONFIG_ATH79_MACH_TL_WDR3500=y CONFIG_ATH79_MACH_TL_WDR4300=y CONFIG_ATH79_MACH_TL_WR1041N_V2=y CONFIG_ATH79_MACH_TL_WR1043ND=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr3500.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr3500.c new file mode 100644 index 0000000..05fe83d --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr3500.c @@ -0,0 +1,153 @@ +/* + * TP-LINK TL-WDR3500 board support + * + * Copyright (C) 2012 Gabor Juhos <juh...@openwrt.org> + * Copyright (C) 2013 Gui Iribarren <g...@altermundi.net> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/pci.h> +#include <linux/phy.h> +#include <linux/gpio.h> +#include <linux/platform_device.h> +#include <linux/ath9k_platform.h> +#include <linux/ar8216_platform.h> + +#include <asm/mach-ath79/ar71xx_regs.h> + +#include "common.h" +#include "dev-ap9x-pci.h" +#include "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-spi.h" +#include "dev-usb.h" +#include "dev-wmac.h" +#include "machtypes.h" + +#define WDR3500_GPIO_LED_USB1 11 +#define WDR3500_GPIO_LED_WLAN2G 13 +#define WDR3500_GPIO_LED_SYSTEM 14 +#define WDR3500_GPIO_LED_QSS 15 + +#define WDR3500_GPIO_BTN_WPS 16 +#define WDR3500_GPIO_BTN_RFKILL 17 + +#define WDR3500_GPIO_USB1_POWER 22 + +#define WDR3500_KEYS_POLL_INTERVAL 20 /* msecs */ +#define WDR3500_KEYS_DEBOUNCE_INTERVAL (3 * WDR3500_KEYS_POLL_INTERVAL) + +#define WDR3500_MAC0_OFFSET 0 +#define WDR3500_MAC1_OFFSET 6 +#define WDR3500_WMAC_CALDATA_OFFSET 0x1000 +#define WDR3500_PCIE_CALDATA_OFFSET 0x5000 + +static const char *wdr3500_part_probes[] = { + "tp-link", + NULL, +}; + +static struct flash_platform_data wdr3500_flash_data = { + .part_probes = wdr3500_part_probes, +}; + +static struct gpio_led wdr3500_leds_gpio[] __initdata = { + { + .name = "tp-link:green:qss", + .gpio = WDR3500_GPIO_LED_QSS, + .active_low = 1, + }, + { + .name = "tp-link:green:system", + .gpio = WDR3500_GPIO_LED_SYSTEM, + .active_low = 1, + }, + { + .name = "tp-link:green:usb1", + .gpio = WDR3500_GPIO_LED_USB1, + .active_low = 1, + }, + { + .name = "tp-link:green:wlan2g", + .gpio = WDR3500_GPIO_LED_WLAN2G, + .active_low = 1, + }, +}; + +static struct gpio_keys_button wdr3500_gpio_keys[] __initdata = { + { + .desc = "QSS button", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = WDR3500_KEYS_DEBOUNCE_INTERVAL, + .gpio = WDR3500_GPIO_BTN_WPS, + .active_low = 1, + }, + { + .desc = "RFKILL switch", + .type = EV_SW, + .code = KEY_RFKILL, + .debounce_interval = WDR3500_KEYS_DEBOUNCE_INTERVAL, + .gpio = WDR3500_GPIO_BTN_RFKILL, + }, +}; + + +static void __init wdr3500_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + u8 tmpmac[ETH_ALEN]; + + ath79_register_m25p80(&wdr3500_flash_data); + ath79_register_leds_gpio(-1, ARRAY_SIZE(wdr3500_leds_gpio), + wdr3500_leds_gpio); + ath79_register_gpio_keys_polled(-1, WDR3500_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wdr3500_gpio_keys), + wdr3500_gpio_keys); + + ath79_init_mac(tmpmac, mac, 0); + ath79_register_wmac(art + WDR3500_WMAC_CALDATA_OFFSET, tmpmac); + + ath79_init_mac(tmpmac, mac, 1); + ap9x_pci_setup_wmac_led_pin(0, 0); + ap91_pci_init(art + WDR3500_PCIE_CALDATA_OFFSET, tmpmac); + + ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); + + ath79_register_mdio(1, 0x0); + + /* LAN */ + ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); + + /* GMAC1 is connected to the internal switch */ + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; + + ath79_register_eth(1); + + /* WAN */ + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 2); + + /* GMAC0 is connected to the PHY4 of the internal switch */ + ath79_switch_data.phy4_mii_en = 1; + ath79_switch_data.phy_poll_mask = BIT(4); + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; + ath79_eth0_data.phy_mask = BIT(4); + ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; + + ath79_register_eth(0); + + gpio_request_one(WDR3500_GPIO_USB1_POWER, + GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, + "USB1 power"); + ath79_register_usb(); +} + +MIPS_MACHINE(ATH79_MACH_TL_WDR3500, "TL-WDR3500", + "TP-LINK TL-WDR3500", + wdr3500_setup); diff --git a/target/linux/ar71xx/generic/profiles/tp-link.mk b/target/linux/ar71xx/generic/profiles/tp-link.mk index a1018ed..f554e22 100644 --- a/target/linux/ar71xx/generic/profiles/tp-link.mk +++ b/target/linux/ar71xx/generic/profiles/tp-link.mk @@ -115,12 +115,12 @@ $(eval $(call Profile,TLWA901)) define Profile/TLWDR4300 - NAME:=TP-LINK TL-WDR3600/4300/4310 + NAME:=TP-LINK TL-WDR3500/3600/4300/4310 PACKAGES:=kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev endef define Profile/TLWDR4300/Description - Package set optimized for the TP-LINK TL-WDR3600/4300/4310. + Package set optimized for the TP-LINK TL-WDR3500/3600/4300/4310. endef $(eval $(call Profile,TLWDR4300)) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index f84d117..3375390 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -913,6 +913,7 @@ $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR741NV4,tl-wr741nd-v4,TL $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR841NV8,tl-wr841n-v8,TL-WR841N-v8,ttyS0,115200,0x08410008,1,4Mlzma)) $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR1041,tl-wr1041n-v2,TL-WR1041N-v2,ttyS0,115200,0x10410002,1,4Mlzma)) $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR2543,tl-wr2543-v1,TL-WR2543N,ttyS0,115200,0x25430001,1,8Mlzma,-v 3.13.99)) +$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWDR3500V1,tl-wdr3500-v1,TL-WDR3500,ttyS0,115200,0x35000001,1,8Mlzma)) $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWDR3600V1,tl-wdr3600-v1,TL-WDR4300,ttyS0,115200,0x36000001,1,8Mlzma)) $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWDR4300V1,tl-wdr4300-v1,TL-WDR4300,ttyS0,115200,0x43000001,1,8Mlzma)) $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWDR4310V1,tl-wdr4310-v1,TL-WDR4300,ttyS0,115200,0x43100001,1,8Mlzma)) @@ -963,7 +964,7 @@ $(eval $(call MultiProfile,TLWR740,TLWR740NV1 TLWR740NV3 TLWR740NV4)) $(eval $(call MultiProfile,TLWR741,TLWR741NV1 TLWR741NV2 TLWR741NV4)) $(eval $(call MultiProfile,TLWR841,TLWR841NV15 TLWR841NV3 TLWR841NV5 TLWR841NV7 TLWR841NV8)) $(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4)) -$(eval $(call MultiProfile,TLWDR4300,TLWDR3600V1 TLWDR4300V1 TLWDR4310V1)) +$(eval $(call MultiProfile,TLWDR4300,TLWDR3500V1 TLWDR3600V1 TLWDR4300V1 TLWDR4310V1)) $(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 UBNTBULLETM UBNTROCKETM UBNTNANOM UBNTUNIFI UBNTUNIFIOUTDOOR UAPPRO)) $(eval $(call MultiProfile,WNDR3700,WNDR3700V1 WNDR3700V2 WNDR3800 WNDRMAC WNDRMACV2)) $(eval $(call MultiProfile,WP543,WP543_2M WP543_4M WP543_8M WP543_16M)) diff --git a/target/linux/ar71xx/patches-3.7/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.7/610-MIPS-ath79-openwrt-machines.patch index 73253bb..259f1ff 100644 --- a/target/linux/ar71xx/patches-3.7/610-MIPS-ath79-openwrt-machines.patch +++ b/target/linux/ar71xx/patches-3.7/610-MIPS-ath79-openwrt-machines.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/machtypes.h +++ b/arch/mips/ath79/machtypes.h -@@ -16,22 +16,112 @@ +@@ -16,22 +16,113 @@ enum ath79_mach_type { ATH79_MACH_GENERIC = 0, @@ -70,6 +70,7 @@ + ATH79_MACH_TL_WA7510N_V1, /* TP-LINK TL-WA7510N v1*/ + ATH79_MACH_TL_WA901ND, /* TP-LINK TL-WA901ND */ + ATH79_MACH_TL_WA901ND_V2, /* TP-LINK TL-WA901ND v2 */ ++ ATH79_MACH_TL_WDR3500, /* TP-LINK TL-WDR3500 */ + ATH79_MACH_TL_WDR4300, /* TP-LINK TL-WDR4300 */ + ATH79_MACH_TL_WR1041N_V2, /* TP-LINK TL-WR1041N v2 */ + ATH79_MACH_TL_WR1043ND, /* TP-LINK TL-WR1043ND */ @@ -216,7 +217,7 @@ config ATH79_MACH_PB44 bool "Atheros PB44 reference board" select SOC_AR71XX -@@ -68,6 +148,488 @@ config ATH79_MACH_PB44 +@@ -68,6 +148,499 @@ config ATH79_MACH_PB44 Say 'Y' here if you want your kernel to support the Atheros PB44 reference board. @@ -563,6 +564,17 @@ + select ATH79_DEV_M25P80 + select ATH79_DEV_WMAC + ++config ATH79_MACH_TL_WDR3500 ++ bool "TP-LINK TL-WDR3500 board support" ++ select SOC_AR934X ++ select ATH79_DEV_AP9X_PCI if PCI ++ select ATH79_DEV_ETH ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_USB ++ select ATH79_DEV_WMAC ++ +config ATH79_MACH_TL_WDR4300 + bool "TP-LINK TL-WDR3600/4300/4310 board support" + select SOC_AR934X @@ -705,7 +717,7 @@ config ATH79_MACH_UBNT_XM bool "Ubiquiti Networks XM/UniFi boards" select SOC_AR724X -@@ -83,6 +645,24 @@ config ATH79_MACH_UBNT_XM +@@ -83,6 +656,24 @@ config ATH79_MACH_UBNT_XM Say 'Y' here if you want your kernel to support the Ubiquiti Networks XM (rev 1.0) board. @@ -730,7 +742,7 @@ endmenu config SOC_AR71XX -@@ -118,10 +698,6 @@ config SOC_QCA955X +@@ -118,10 +709,6 @@ config SOC_QCA955X select PCI_AR724X if PCI def_bool n @@ -741,7 +753,7 @@ config ATH79_DEV_AP9X_PCI select ATH79_PCI_ATH9K_FIXUP def_bool n -@@ -132,7 +708,14 @@ config ATH79_DEV_DSA +@@ -132,7 +719,14 @@ config ATH79_DEV_DSA config ATH79_DEV_ETH def_bool n @@ -757,7 +769,7 @@ def_bool n config ATH79_DEV_GPIO_BUTTONS -@@ -164,4 +747,7 @@ config ATH79_PCI_ATH9K_FIXUP +@@ -164,4 +758,7 @@ config ATH79_PCI_ATH9K_FIXUP config ATH79_ROUTERBOOT def_bool n @@ -767,7 +779,7 @@ endif --- a/arch/mips/ath79/Makefile +++ b/arch/mips/ath79/Makefile -@@ -38,9 +38,71 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route +@@ -38,9 +38,72 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route # # Machines # @@ -812,6 +824,7 @@ +obj-$(CONFIG_ATH79_MACH_TL_MR3X20) += mach-tl-mr3x20.o +obj-$(CONFIG_ATH79_MACH_TL_WA901ND) += mach-tl-wa901nd.o +obj-$(CONFIG_ATH79_MACH_TL_WA901ND_V2) += mach-tl-wa901nd-v2.o ++obj-$(CONFIG_ATH79_MACH_TL_WDR3500) += mach-tl-wdr3500.o +obj-$(CONFIG_ATH79_MACH_TL_WDR4300) += mach-tl-wdr4300.o +obj-$(CONFIG_ATH79_MACH_TL_WR741ND) += mach-tl-wr741nd.o +obj-$(CONFIG_ATH79_MACH_TL_WR741ND_V4) += mach-tl-wr741nd-v4.o _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel