From f66482e457e84a275cbfe719904355bafb022a81 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Tue, 16 Aug 2016 22:58:52 +0200 Subject: [PATCH] Add support for Zbtlink ZBT-WE1526 (QCA9531 based) --- Makefile | 8 ++++++ README.md | 2 ++ READMEPL.md | 2 ++ u-boot/Makefile | 13 ++++++++++ u-boot/include/configs/ap143.h | 45 +++++++++++++++++++++++++++++++--- 5 files changed, 66 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 6dd6170..0395cf5 100644 --- a/Makefile +++ b/Makefile @@ -293,6 +293,14 @@ wallys_dr531: @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all @make --no-print-directory show_size +zbtlink_zbt_we1526: export UBOOT_FILE_NAME=uboot_for_zbtlink_zbt-we1526 +zbtlink_zbt_we1526: export CONFIG_MAX_UBOOT_SIZE_KB=256 +zbtlink_zbt_we1526: export ETH_CONFIG=_s27 +zbtlink_zbt_we1526: + @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) zbt-we1526_config + @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all + @make --no-print-directory show_size + ifdef CONFIG_SKIP_LOWLEVEL_INIT show_size: export UBOOT_FILE_NAME_SUFFIX=__RAM endif diff --git a/README.md b/README.md index c2e9ea8..9fb3b0c 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ Currently supported devices: - TP-Link TL-WR820N (version for Chinese market) - TP-Link TL-WR802N - Wallys DR531 + - Zbtlink ZBT-WE1526 I tested this modification on most of these devices, with OpenWrt and OFW firmware. If you are not sure about the version of your device, please contact with me **before** you try to make an upgrade. Changing bootloader to a wrong version will probably damage your router and you will need special hardware to fix it, so please, **be very careful**. @@ -127,6 +128,7 @@ More information about supported devices: | [TP-Link TL-WR820N](https://wiki.openwrt.org/toh/tp-link/tl-wr820n) | QCA9531 | 4 MiB | 64 MiB DDR2 | 64 KiB, LZMA | RO | | [TP-Link TL-WR802N](https://wikidevi.com/wiki/TP-LINK_TL-WR802N_v1.0) | QCA9533 | 4 MiB | 32 MiB DDR1 | 64 KiB, LZMA | RO | | Wallys DR531 | QCA9531 | 8 MiB | 64 MiB DDR2 | 192 KiB | R/W | +| Zbtlink ZBT-WE1526 | QCA9531 | 16 MiB | 128 MiB DDR2 | 256 KiB | R/W | *(LZMA) - U-Boot binary image is compressed with LZMA.* *(R/W) - environment exists in separate FLASH block which allows you to save it and keep after power down.* diff --git a/READMEPL.md b/READMEPL.md index 1f23818..2e8df93 100644 --- a/READMEPL.md +++ b/READMEPL.md @@ -90,6 +90,7 @@ Lista obecnie wspieranych urządzeń: - TP-Link TL-WR820N (wersja przeznaczona na rynek chiński) - TP-Link TL-WR802N - Wallys DR531 + - Zbtlink ZBT-WE1526 Przetestowałem swoją modyfikację na większości z wymienionych powyżej urządzeń, z obrazami OpenWrt i oficjalnym firmware producenta. Jeżeli nie jesteś pewien wersji sprzętowej swojego urządzenia, proszę skontaktuj się ze mną **zanim** dokonasz wymiany obrazu bootloadera. Zmiana na niewłaściwą wersję najprawdopodobniej doprowadzi do uszkodzenia Twojego urządzenia i jedyną możliwością jego ponownego uruchomienia będzie przeprogramowanie kości FLASH w zewnętrznym programatorze. @@ -124,6 +125,7 @@ Dodatkowe informacje o wspieranych urządzeniach: | [TP-Link TL-WR820N](https://wiki.openwrt.org/toh/tp-link/tl-wr820n) | QCA9531 | 4 MiB | 64 MiB DDR2 | 64 KiB, LZMA | RO | | [TP-Link TL-WR802N](https://wikidevi.com/wiki/TP-LINK_TL-WR802N_v1.0) | QCA9533 | 4 MiB | 32 MiB DDR1 | 64 KiB, LZMA | RO | | Wallys DR531 | QCA9531 | 8 MiB | 64 MiB DDR2 | 192 KiB | R/W | +| Zbtlink ZBT-WE1526 | QCA9531 | 16 MiB | 128 MiB DDR2 | 256 KiB | R/W | *(LZMA) - obraz binarny U-Boot został dodatkowo skompresowany przy pomocy LZMA.* *(R/W) - zmienne środowiskowe przechowywane są w osobnym bloku FLASH, co pozwala na ich zachowanie po odłączeniu zasilaniu.* diff --git a/u-boot/Makefile b/u-boot/Makefile index 05794fc..07ecda5 100644 --- a/u-boot/Makefile +++ b/u-boot/Makefile @@ -615,6 +615,19 @@ wr841n_v9_config : unconfig ap143_common_config @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240 +zbt-we1526_config : unconfig ap143_common_config + @echo -e '\e[32m> Configuring for Zbtlink ZBT-WE1526 at:' `date` '\e[0m' + @echo "#define SOC_TYPE QCA_QCA953X_SOC" >> include/config.h + @echo "#define CONFIG_FOR_ZBTLINK_ZBT_WE1526 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 16" >> include/config.h + @echo "#define CONFIG_GPIO_RESET_BTN 17" >> include/config.h + @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW 1" >> include/config.h + @echo "#define CONFIG_BOARD_CUSTOM_STRING \"Zbtlink ZBT-WE1526\"" >> include/config.h + + @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240 + ######################################################################### ######################################################################### ######################################################################### diff --git a/u-boot/include/configs/ap143.h b/u-boot/include/configs/ap143.h index 03baa30..7bd6485 100644 --- a/u-boot/include/configs/ap143.h +++ b/u-boot/include/configs/ap143.h @@ -47,6 +47,18 @@ /* Initial states */ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO +#elif defined(CONFIG_FOR_ZBTLINK_ZBT_WE1526) + /* LEDs */ + #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO (GPIO4 | GPIO11 | GPIO12 | GPIO13 |\ + GPIO14 | GPIO15 | GPIO16) + + /* Outputs, inputs */ + #define CONFIG_QCA_GPIO_MASK_OUTPUTS CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO + #define CONFIG_QCA_GPIO_MASK_INPUTS GPIO17 + + /* Initial states */ + #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO + #endif /* @@ -114,6 +126,8 @@ #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)" #elif defined(CONFIG_FOR_WALLYS_DR531) #define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ath-nor0:256k(u-boot),64k(u-boot-env),6336k(rootfs),1408k" +#elif defined(CONFIG_FOR_ZBTLINK_ZBT_WE1526) + #define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=squashfs init=/sbin/init mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),14528k(rootfs),1472k(kernel),64k(ART),16000k(firmware)" #endif /* @@ -135,6 +149,10 @@ #define CFG_LOAD_ADDR 0x9F050000 #define UPDATE_SCRIPT_FW_ADDR "0x9F050000" #define CONFIG_BOOTCOMMAND "bootm 0x9F050000" +#elif defined(CONFIG_FOR_ZBTLINK_ZBT_WE1526) + #define CFG_LOAD_ADDR 0x9FE80000 + #define UPDATE_SCRIPT_FW_ADDR "0x9F050000" + #define CONFIG_BOOTCOMMAND "bootm 0x9FE80000" #endif #define CONFIG_IPADDR 192.168.1.1 @@ -152,7 +170,8 @@ defined(CONFIG_FOR_TPLINK_WR802N) ||\ defined(CONFIG_FOR_TPLINK_WR841N_V9) #define CONFIG_QCA_PLL QCA_PLL_PRESET_550_400_200 -#elif defined(CONFIG_FOR_WALLYS_DR531) +#elif defined(CONFIG_FOR_WALLYS_DR531) ||\ + defined(CONFIG_FOR_ZBTLINK_ZBT_WE1526) #define CONFIG_QCA_PLL QCA_PLL_PRESET_650_400_200 #endif @@ -183,6 +202,10 @@ #define CFG_ENV_ADDR 0x9F030000 #define CFG_ENV_SIZE 0xF800 #define CFG_ENV_SECT_SIZE 0x10000 +#elif defined(CONFIG_FOR_ZBTLINK_ZBT_WE1526) + #define CFG_ENV_ADDR 0x9F040000 + #define CFG_ENV_SIZE 0xFC00 + #define CFG_ENV_SECT_SIZE 0x10000 #endif /* @@ -218,7 +241,8 @@ defined(CONFIG_FOR_TPLINK_WR802N) ||\ defined(CONFIG_FOR_TPLINK_WR841N_V9) #define WEBFAILSAFE_UPLOAD_KERNEL_ADDRESS WEBFAILSAFE_UPLOAD_UBOOT_ADDRESS + 0x20000 -#elif defined(CONFIG_FOR_WALLYS_DR531) +#elif defined(CONFIG_FOR_WALLYS_DR531) ||\ + defined(CONFIG_FOR_ZBTLINK_ZBT_WE1526) #define WEBFAILSAFE_UPLOAD_KERNEL_ADDRESS WEBFAILSAFE_UPLOAD_UBOOT_ADDRESS + 0x50000 #endif @@ -234,6 +258,9 @@ #elif defined(CONFIG_FOR_WALLYS_DR531) #define UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES "0x30000" #define UPDATE_SCRIPT_UBOOT_BACKUP_SIZE_IN_BYTES UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES +#elif defined(CONFIG_FOR_ZBTLINK_ZBT_WE1526) + #define UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES "0x40000" + #define UPDATE_SCRIPT_UBOOT_BACKUP_SIZE_IN_BYTES UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES #endif // ART partition size @@ -245,8 +272,10 @@ defined(CONFIG_FOR_TPLINK_WR802N) ||\ defined(CONFIG_FOR_TPLINK_WR841N_V9) #define WEBFAILSAFE_UPLOAD_LIMITED_AREA_IN_BYTES (192 * 1024) -#elif defined(CONFIG_FOR_WALLYS_DR531) +#elif defined(CONFIG_FOR_WALLYS_DR531) ||\ + defined(CONFIG_FOR_ZBTLINK_ZBT_WE1526) // Wallys DR531: 192k(U-Boot),64k(U-Boot env),64k(partition-table),64k(ART) + // Zbtlink ZBT-WE1526: 256k(U-Boot),64k(U-Boot env),64k(ART) #define WEBFAILSAFE_UPLOAD_LIMITED_AREA_IN_BYTES (384 * 1024) #endif @@ -299,7 +328,8 @@ #if defined(CONFIG_FOR_TPLINK_WR820N_CN) ||\ defined(CONFIG_FOR_TPLINK_WR802N) ||\ defined(CONFIG_FOR_TPLINK_WR841N_V9) ||\ - defined(CONFIG_FOR_WALLYS_DR531) + defined(CONFIG_FOR_WALLYS_DR531) ||\ + defined(CONFIG_FOR_ZBTLINK_ZBT_WE1526) #define BOARDCAL 0x9fff0000 #endif #define CFG_MII0_RMII 1 @@ -320,6 +350,10 @@ #define OFFSET_MAC_DATA_BLOCK 0x030000 #define OFFSET_MAC_DATA_BLOCK_LENGTH 0x010000 #define OFFSET_MAC_ADDRESS 0x00F810 +#elif defined(CONFIG_FOR_ZBTLINK_ZBT_WE1526) + #define OFFSET_MAC_DATA_BLOCK 0xFF0000 + #define OFFSET_MAC_DATA_BLOCK_LENGTH 0x010000 + #define OFFSET_MAC_ADDRESS 0x000000 #endif /* @@ -340,6 +374,9 @@ #elif defined(CONFIG_FOR_WALLYS_DR531) #define CONFIG_QCA_PLL_IN_FLASH_BLOCK_OFFSET 0x00030000 #define CONFIG_QCA_PLL_IN_FLASH_BLOCK_SIZE 0x00010000 +#elif defined(CONFIG_FOR_ZBTLINK_ZBT_WE1526) + #define CONFIG_QCA_PLL_IN_FLASH_BLOCK_OFFSET 0x00040000 + #define CONFIG_QCA_PLL_IN_FLASH_BLOCK_SIZE 0x00010000 #endif #if defined(CONFIG_QCA_PLL_IN_FLASH_BLOCK_OFFSET) -- 2.25.1