From: Piotr Dymacz Date: Mon, 6 Jan 2014 20:16:24 +0000 (+0100) Subject: Support for WA830RE v2 (AR9341) X-Git-Tag: 2014-11-19~49^2~1 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=751607937d5c135d284941c7ca13f54190aab9c2;p=oweals%2Fu-boot_mod.git Support for WA830RE v2 (AR9341) --- diff --git a/Makefile b/Makefile index a994b82..b3e54ab 100755 --- a/Makefile +++ b/Makefile @@ -107,6 +107,16 @@ tplink_wr841n_v8: @cp $(BUILD_TOPDIR)/u-boot/tuboot.bin $(BUILD_TOPDIR)/bin/temp.bin @make show_size +tplink_wa830re_v2: export UBOOT_FILE_NAME=uboot_for_tp-link_tl-wa830re_v2 +tplink_wa830re_v2: export MAX_UBOOT_SIZE=64 +tplink_wa830re_v2: export COMPRESSED_UBOOT=1 +tplink_wa830re_v2: export ETH_CONFIG=_s27 +tplink_wa830re_v2: + @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) wa830re_v2_config + @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all + @cp $(BUILD_TOPDIR)/u-boot/tuboot.bin $(BUILD_TOPDIR)/bin/temp.bin + @make show_size + dlink_dir505: export UBOOT_FILE_NAME=uboot_for_d-link_dir-505 dlink_dir505: export MAX_UBOOT_SIZE=64 dlink_dir505: export COMPRESSED_UBOOT=1 diff --git a/u-boot/Makefile b/u-boot/Makefile index ac2a4bf..f782eaf 100755 --- a/u-boot/Makefile +++ b/u-boot/Makefile @@ -500,7 +500,7 @@ wdr3600_43x0_config : unconfig wasp_common_config @./mkconfig -a db12x mips mips db12x ar7240 ar7240 wr841n_v8_config : unconfig wasp_common_config - @echo '======= Configuring for TP-Link TL-WR841N/D at:' `date` '=======' + @echo '======= Configuring for TP-Link TL-WR841N/D v8 at:' `date` '=======' @echo "#define CONFIG_FOR_TPLINK_WR841N_V8 1" >> include/config.h @echo "#define CONFIG_AP123 1" >> include/config.h @echo "#define DDR2_32BIT_SUPPORT 1" >> include/config.h @@ -529,6 +529,28 @@ wr841n_v8_config : unconfig wasp_common_config @./mkconfig -a db12x mips mips db12x ar7240 ar7240 +wa830re_v2_config : unconfig wasp_common_config + @echo '======= Configuring for TP-Link TL-WA830RE v2 at:' `date` '=======' + @echo "#define CONFIG_FOR_TPLINK_WA830RE_V2 1" >> include/config.h + @echo "#define CONFIG_AP123 1" >> include/config.h + @echo "#define DDR2_32BIT_SUPPORT 1" >> include/config.h + @echo "#define CFG_ATHRS27_PHY 1" >> include/config.h + @echo "#define CFG_AG7240_NMACS 2" >> include/config.h + @echo "#define GPIO_SYS_LED_BIT 14" >> include/config.h + @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h + @echo "#define GPIO_LAN_LED_BIT 18" >> include/config.h + @echo "#define GPIO_LAN_LED_ON 0" >> include/config.h + @echo "#define GPIO_WLAN_LED_BIT 13" >> include/config.h + @echo "#define GPIO_WLAN_LED_ON 0" >> include/config.h + @echo "#define GPIO_QSS_LED_BIT 15" >> include/config.h + @echo "#define GPIO_QSS_LED_ON 0" >> include/config.h + @echo "#define GPIO_RST_BUTTON_BIT 17" >> include/config.h + @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW 1" >> include/config.h + @echo "#define DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h + @echo "#define BOARD_CUSTOM_STRING \"AP123 (AR9341) U-Boot for TL-WA830RE v2\"" >> include/config.h + + @./mkconfig -a db12x mips mips db12x ar7240 ar7240 + ######################################################################### ######################################################################### ######################################################################### diff --git a/u-boot/board/ar7240/db12x/db12x.c b/u-boot/board/ar7240/db12x/db12x.c index b1a362a..3933972 100755 --- a/u-boot/board/ar7240/db12x/db12x.c +++ b/u-boot/board/ar7240/db12x/db12x.c @@ -16,9 +16,9 @@ void led_toggle(void){ gpio = ar7240_reg_rd(AR934X_GPIO_OUT); -#if defined(CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1) - gpio ^= 1 << GPIO_SYS_LED_BIT; -#elif defined(CONFIG_FOR_TPLINK_WR841N_V8) +#if defined(CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1) || \ + defined(CONFIG_FOR_TPLINK_WR841N_V8) || \ + defined(CONFIG_FOR_TPLINK_WA830RE_V2) gpio ^= 1 << GPIO_SYS_LED_BIT; #else #error "Custom GPIO in leg_toggle() not defined!" @@ -47,6 +47,11 @@ void all_led_on(void){ SETBITVAL(gpio, GPIO_LAN3_LED_BIT, GPIO_LAN3_LED_ON); SETBITVAL(gpio, GPIO_LAN4_LED_BIT, GPIO_LAN4_LED_ON); SETBITVAL(gpio, GPIO_QSS_LED_BIT, GPIO_QSS_LED_ON); +#elif defined(CONFIG_FOR_TPLINK_WA830RE_V2) + SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON); + SETBITVAL(gpio, GPIO_LAN_LED_BIT, GPIO_LAN_LED_ON); + SETBITVAL(gpio, GPIO_WLAN_LED_BIT, GPIO_WLAN_LED_ON); + SETBITVAL(gpio, GPIO_QSS_LED_BIT, GPIO_QSS_LED_ON); #else #error "Custom GPIO in all_led_on() not defined!" #endif @@ -74,6 +79,11 @@ void all_led_off(void){ SETBITVAL(gpio, GPIO_LAN3_LED_BIT, !GPIO_LAN3_LED_ON); SETBITVAL(gpio, GPIO_LAN4_LED_BIT, !GPIO_LAN4_LED_ON); SETBITVAL(gpio, GPIO_QSS_LED_BIT, !GPIO_QSS_LED_ON); +#elif defined(CONFIG_FOR_TPLINK_WA830RE_V2) + SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON); + SETBITVAL(gpio, GPIO_LAN_LED_BIT, !GPIO_LAN_LED_ON); + SETBITVAL(gpio, GPIO_WLAN_LED_BIT, !GPIO_WLAN_LED_ON); + SETBITVAL(gpio, GPIO_QSS_LED_BIT, !GPIO_QSS_LED_ON); #else #error "Custom GPIO in all_led_off() not defined!" #endif diff --git a/u-boot/cpu/mips/start_bootstrap.S b/u-boot/cpu/mips/start_bootstrap.S index 0188535..4cd85b6 100755 --- a/u-boot/cpu/mips/start_bootstrap.S +++ b/u-boot/cpu/mips/start_bootstrap.S @@ -265,6 +265,7 @@ reset: * 20 => LAN2 * 21 => LAN3 * + * 16 => Wi-Fi switch * 17 => Reset button (already set as input) * * All used GPIOs are active LOW! @@ -292,11 +293,44 @@ reset: sw v1, 0(a1) // Turn off GPIOs - li a1, AR934X_GPIO_OUT + li a1, AR934X_GPIO_SET + li v1, 0x3CF000 + sw v1, 0(a1) + +#elif defined(CONFIG_FOR_TPLINK_WA830RE_V2) + /* + * LED's/Reset GPIOs on WR841N/D v8: + * + * 13 => WLAN + * 14 => SYS + * 15 => QSS + * 18 => LAN + * + * 16 => Range Extender + * 17 => Reset button (already set as input) + * + * All used GPIOs are active LOW! + */ + + // GPIOs init + li a1, AR934X_GPIO_OE lw v1, 0(a1) - li v0, ~(0xFFC30FFF) - or v1, v1, v0 + li v0, 0xFFFB1FFF + and v1, v1, v0 + sw v1, 0(a1) + + // Set gpio function for GPIOs 13~15 + li a1, AR934X_GPIO_OUT_FUNCTION3 + lw v1, 0(a1) + li v0, 0xFF + and v1, v1, v0 + sw v1, 0(a1) + + // Turn off GPIOs + li a1, AR934X_GPIO_SET + li v1, 0x4E000 sw v1, 0(a1) + #endif #endif /* #if defined(CONFIG_WASP_SUPPORT) */ diff --git a/u-boot/include/configs/db12x.h b/u-boot/include/configs/db12x.h index 98d6397..083be5d 100755 --- a/u-boot/include/configs/db12x.h +++ b/u-boot/include/configs/db12x.h @@ -32,7 +32,11 @@ * Default bootargs */ #undef CONFIG_BOOTARGS +#if defined(CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1) #define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=squashfs init=/sbin/init mtdparts=ath-nor0:256k(u-boot),64k(u-boot-env),6336k(rootfs),1408k(uImage),64k(mib0),64k(ART)" +#else +#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 /* * Other env default values @@ -102,9 +106,6 @@ #define CONFIG_NETCONSOLE #define CONFIG_NETCONSOLE_PORT 6666 -/* DDR init values */ -#define CONFIG_NR_DRAM_BANKS 2 - /* DDR settings for WASP */ #define CFG_DDR_REFRESH_VAL 0x4270 #define CFG_DDR_CONFIG_VAL 0xc7bc8cd0