From dec6d3836435e07ecaa4b512a211081ca4365e30 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Tue, 22 Mar 2016 00:17:34 +0100 Subject: [PATCH] Add support for TP-Link TL-WR802N (QCA9533) --- Makefile | 11 +++++++++++ u-boot/Makefile | 14 ++++++++++++++ u-boot/include/configs/ap143.h | 16 ++++++++++++++-- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4905f23..59d0536 100644 --- a/Makefile +++ b/Makefile @@ -184,6 +184,17 @@ tplink_wr820n_CN: @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all @make --no-print-directory show_size +tplink_wr802n: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-wr802n +tplink_wr802n: export CONFIG_MAX_UBOOT_SIZE_KB=123 +ifndef CONFIG_SKIP_LOWLEVEL_INIT +tplink_wr802n: export COMPRESSED_UBOOT=1 +endif +tplink_wr802n: export ETH_CONFIG=_s27 +tplink_wr802n: + @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) wr802n_config + @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all + @make --no-print-directory show_size + dlink_dir505: export UBOOT_FILE_NAME=uboot_for_d-link_dir-505 dlink_dir505: export CONFIG_MAX_UBOOT_SIZE_KB=64 ifndef CONFIG_SKIP_LOWLEVEL_INIT diff --git a/u-boot/Makefile b/u-boot/Makefile index e9f81ad..384e75f 100644 --- a/u-boot/Makefile +++ b/u-boot/Makefile @@ -613,6 +613,20 @@ wr820n_CN_config : unconfig ap143_common_config @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240 +wr802n_config : unconfig ap143_common_config + @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR802N at:' `date` '\e[0m' + @echo "#define SOC_TYPE QCA_QCA953X_SOC" >> include/config.h + @echo "#define CONFIG_FOR_TPLINK_WR802N 1" >> include/config.h + @echo "#define CFG_ATHRS27_PHY 1" >> include/config.h + @echo "#define CFG_ATH_GMAC_NMACS 2" >> include/config.h + @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h + @echo "#define CONFIG_GPIO_RESET_BTN 12" >> include/config.h + @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h + @echo "#define CONFIG_TPLINK_IMAGE_HEADER 1" >> include/config.h + @echo "#define CONFIG_BOARD_CUSTOM_STRING \"TP-Link TL-WR802N\"" >> include/config.h + + @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240 + wr841n_v9_config : unconfig ap143_common_config @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR841N/D v9 at:' `date` '\e[0m' @echo "#define SOC_TYPE QCA_QCA953X_SOC" >> include/config.h diff --git a/u-boot/include/configs/ap143.h b/u-boot/include/configs/ap143.h index cc7749d..a0b2a92 100644 --- a/u-boot/include/configs/ap143.h +++ b/u-boot/include/configs/ap143.h @@ -12,7 +12,8 @@ /* * GPIO configuration */ -#if defined(CONFIG_FOR_TPLINK_WR820N_CN) +#if defined(CONFIG_FOR_TPLINK_WR820N_CN) ||\ + defined(CONFIG_FOR_TPLINK_WR802N) /* LEDs */ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO GPIO13 @@ -103,7 +104,8 @@ #undef CONFIG_BOOTARGS #if defined(CONFIG_FOR_TPLINK_WR820N_CN) #define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=squashfs init=/sbin/init mtdparts=ath-nor0:32k(u-boot1),32k(u-boot2),3008k(rootfs),896k(uImage),64k(mib0),64k(ART)" -#elif defined(CONFIG_FOR_TPLINK_WR841N_V9) +#elif defined(CONFIG_FOR_TPLINK_WR841N_V9) ||\ + defined(CONFIG_FOR_TPLINK_WR802N) #define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=squashfs init=/sbin/init mtdparts=ath-nor0:128k(u-boot),1024k(kernel),2816k(rootfs),64k(config),64k(art)" #endif @@ -117,6 +119,7 @@ #define CONFIG_LOADADDR 0x80800000 #if defined(CONFIG_FOR_TPLINK_WR820N_CN) ||\ + defined(CONFIG_FOR_TPLINK_WR802N) ||\ defined(CONFIG_FOR_TPLINK_WR841N_V9) #define CFG_LOAD_ADDR 0x9F020000 #define UPDATE_SCRIPT_FW_ADDR "0x9F020000" @@ -135,6 +138,7 @@ #define CFG_HZ bd->bi_cfg_hz #if defined(CONFIG_FOR_TPLINK_WR820N_CN) ||\ + defined(CONFIG_FOR_TPLINK_WR802N) ||\ defined(CONFIG_FOR_TPLINK_WR841N_V9) #define CONFIG_QCA_PLL QCA_PLL_PRESET_550_400_200 #endif @@ -157,6 +161,7 @@ #undef CFG_ENV_IS_NOWHERE #if defined(CONFIG_FOR_TPLINK_WR820N_CN) ||\ + defined(CONFIG_FOR_TPLINK_WR802N) ||\ defined(CONFIG_FOR_TPLINK_WR841N_V9) #define CFG_ENV_ADDR 0x9F01EC00 #define CFG_ENV_SIZE 0x1000 @@ -167,6 +172,7 @@ * Available commands */ #if defined(CONFIG_FOR_TPLINK_WR820N_CN) ||\ + defined(CONFIG_FOR_TPLINK_WR802N) ||\ defined(CONFIG_FOR_TPLINK_WR841N_V9) #define CONFIG_COMMANDS (CFG_CMD_MEMORY | \ CFG_CMD_DHCP | \ @@ -195,6 +201,7 @@ // Firmware partition offset #if defined(CONFIG_FOR_TPLINK_WR820N_CN) ||\ + defined(CONFIG_FOR_TPLINK_WR802N) ||\ defined(CONFIG_FOR_TPLINK_WR841N_V9) #define WEBFAILSAFE_UPLOAD_KERNEL_ADDRESS WEBFAILSAFE_UPLOAD_UBOOT_ADDRESS + 0x20000 #endif @@ -204,6 +211,7 @@ // TODO: should be == CONFIG_MAX_UBOOT_SIZE_KB #if defined(CONFIG_FOR_TPLINK_WR820N_CN) ||\ + defined(CONFIG_FOR_TPLINK_WR802N) ||\ defined(CONFIG_FOR_TPLINK_WR841N_V9) #define UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES "0x1EC00" #define UPDATE_SCRIPT_UBOOT_BACKUP_SIZE_IN_BYTES "0x20000" @@ -215,6 +223,7 @@ // max. firmware size <= (FLASH_SIZE - WEBFAILSAFE_UPLOAD_LIMITED_AREA_IN_BYTES) // TP-Link: 64k(U-Boot),64k(MAC/model/WPS pin block),64k(ART) #if defined(CONFIG_FOR_TPLINK_WR820N_CN) ||\ + defined(CONFIG_FOR_TPLINK_WR802N) ||\ defined(CONFIG_FOR_TPLINK_WR841N_V9) #define WEBFAILSAFE_UPLOAD_LIMITED_AREA_IN_BYTES (192 * 1024) #endif @@ -270,6 +279,7 @@ #define CONFIG_NET_MULTI #define CONFIG_PCI 1 #if defined(CONFIG_FOR_TPLINK_WR820N_CN) ||\ + defined(CONFIG_FOR_TPLINK_WR802N) ||\ defined(CONFIG_FOR_TPLINK_WR841N_V9) #define WLANCAL 0x9fff1000 #define BOARDCAL 0x9fff0000 @@ -281,6 +291,7 @@ /* MAC address, model and PIN number offsets in FLASH */ #if defined(CONFIG_FOR_TPLINK_WR820N_CN) ||\ + defined(CONFIG_FOR_TPLINK_WR802N) ||\ defined(CONFIG_FOR_TPLINK_WR841N_V9) #define OFFSET_MAC_DATA_BLOCK 0x010000 #define OFFSET_MAC_DATA_BLOCK_LENGTH 0x010000 @@ -293,6 +304,7 @@ * PLL and clocks configurations from FLASH */ #if defined(CONFIG_FOR_TPLINK_WR820N_CN) ||\ + defined(CONFIG_FOR_TPLINK_WR802N) ||\ defined(CONFIG_FOR_TPLINK_WR841N_V9) /* * All TP-Link routers have a lot of unused space -- 2.25.1