From: Piotr Dymacz Date: Mon, 8 Sep 2014 00:30:49 +0000 (+0200) Subject: Support for GL-CONNECT GL.iNet router X-Git-Tag: 2014-11-19~6 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d46bef51bd03f8a0a6429eab6f1acc9d04c73e40;p=oweals%2Fu-boot_mod.git Support for GL-CONNECT GL.iNet router --- diff --git a/Makefile b/Makefile index cb106ca..d2b33d6 100755 --- a/Makefile +++ b/Makefile @@ -192,6 +192,16 @@ dragino_v2_ms14: @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all @make --no-print-directory show_size +gl-inet: export UBOOT_FILE_NAME=uboot_for_gl-inet +gl-inet: export MAX_UBOOT_SIZE=64 +ifndef CONFIG_SKIP_LOWLEVEL_INIT +gl-inet: export COMPRESSED_UBOOT=1 +endif +gl-inet: + @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) gl-inet_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/u-boot/Makefile b/u-boot/Makefile index e9113ee..89b280a 100755 --- a/u-boot/Makefile +++ b/u-boot/Makefile @@ -531,6 +531,19 @@ dragino_v2_ms14_config : unconfig hornet_common_config @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 +gl-inet_config : unconfig hornet_common_config + @/bin/echo -e '\e[32m> Configuring for GL.iNet at:' `date` '\e[0m' + @echo "#define CONFIG_FOR_GL_INET 1" >> include/config.h + @echo "#define GPIO_WLAN_LED_BIT 0" >> include/config.h + @echo "#define GPIO_WLAN_LED_ON 1" >> include/config.h + @echo "#define GPIO_LAN_LED_BIT 13" >> include/config.h + @echo "#define GPIO_LAN_LED_ON 1" >> include/config.h + @echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h + @echo "#define DEFAULT_FLASH_SIZE_IN_MB 8" >> include/config.h + @echo "#define BOARD_CUSTOM_STRING \"AP121 (AR9331) U-Boot for GL.iNet\"" >> include/config.h + + @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 + wasp_common_config : common_config @echo "#define CONFIG_AR7240 1" >> include/config.h @echo "#define CONFIG_WASP 1" >> include/config.h diff --git a/u-boot/board/ar7240/ap121/ap121.c b/u-boot/board/ar7240/ap121/ap121.c index bd9d264..acd43f7 100755 --- a/u-boot/board/ar7240/ap121/ap121.c +++ b/u-boot/board/ar7240/ap121/ap121.c @@ -38,6 +38,8 @@ void led_toggle(void){ gpio ^= 1 << GPIO_WLAN_LED_BIT; #elif defined(CONFIG_FOR_DRAGINO_V2) gpio ^= 1 << GPIO_WLAN_LED_BIT; +#elif defined(CONFIG_FOR_GL_INET) + gpio ^= 1 << GPIO_WLAN_LED_BIT; #else #error "Custom GPIO in leg_toggle() not defined!" #endif @@ -90,6 +92,9 @@ void all_led_on(void){ SETBITVAL(gpio, GPIO_WAN_LED_BIT, GPIO_WAN_LED_ON); SETBITVAL(gpio, GPIO_LAN_LED_BIT, GPIO_LAN_LED_ON); SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, GPIO_INTERNET_LED_ON); +#elif defined(CONFIG_FOR_GL_INET) + SETBITVAL(gpio, GPIO_WLAN_LED_BIT, GPIO_WLAN_LED_ON); + SETBITVAL(gpio, GPIO_LAN_LED_BIT, GPIO_LAN_LED_ON); #else #error "Custom GPIO in all_led_on() not defined!" #endif @@ -142,6 +147,9 @@ void all_led_off(void){ SETBITVAL(gpio, GPIO_WAN_LED_BIT, !GPIO_WAN_LED_ON); SETBITVAL(gpio, GPIO_LAN_LED_BIT, !GPIO_LAN_LED_ON); SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, !GPIO_INTERNET_LED_ON); +#elif defined(CONFIG_FOR_GL_INET) + SETBITVAL(gpio, GPIO_WLAN_LED_BIT, !GPIO_WLAN_LED_ON); + SETBITVAL(gpio, GPIO_LAN_LED_BIT, !GPIO_LAN_LED_ON); #else #error "Custom GPIO in all_led_off() not defined!" #endif @@ -370,6 +378,18 @@ void gpio_config(void){ // turn on power on USB and turn off RED LEDs ar7240_reg_wr(AR7240_GPIO_SET, 0x47D4103); +#elif defined(CONFIG_FOR_GL_INET) + + /* LED's GPIOs on GL.iNet: + * + * 0 => WLAN + * 13 => LAN + * + */ + + /* set GPIO_OE */ + ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0x2001)); + #else #error "Custom GPIO config in gpio_config() not defined!" #endif diff --git a/u-boot/include/configs/ap121.h b/u-boot/include/configs/ap121.h index 52282fd..2a3947d 100755 --- a/u-boot/include/configs/ap121.h +++ b/u-boot/include/configs/ap121.h @@ -41,7 +41,8 @@ defined(CONFIG_FOR_TPLINK_MR10U_V1) || \ defined(CONFIG_FOR_TPLINK_WR740N_V4) || \ defined(CONFIG_FOR_TPLINK_MR3220_V2) || \ - defined(CONFIG_FOR_TPLINK_MR13U_V1) + defined(CONFIG_FOR_TPLINK_MR13U_V1) || \ + defined(CONFIG_FOR_GL_INET) #define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=squashfs init=/sbin/init mtdparts=ar7240-nor0:128k(u-boot),1024k(kernel),2816k(rootfs),64k(config),64k(ART)" @@ -1009,7 +1010,8 @@ #if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && \ !defined(CONFIG_FOR_DLINK_DIR505_A1) && \ !defined(CONFIG_FOR_GS_OOLITE_V1_DEV) && \ - !defined(CONFIG_FOR_DRAGINO_V2) + !defined(CONFIG_FOR_DRAGINO_V2) && \ + !defined(CONFIG_FOR_GL_INET) #define OFFSET_ROUTER_MODEL 0x00FD00 #endif