From 3e98fc7a9c24a359de9dbfe2b14b723c10a8d85a Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Thu, 16 Jan 2014 02:58:28 +0100 Subject: [PATCH] Support for GS-Oolite v1 module on big development board with two relays --- Makefile | 9 ++++++ u-boot/Makefile | 17 ++++++++++++ u-boot/board/ar7240/ap121/ap121.c | 46 +++++++++++++++++++++++++++++++ u-boot/include/configs/ap121.h | 16 ++++++++++- 4 files changed, 87 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index de58fda..4842538 100755 --- a/Makefile +++ b/Makefile @@ -136,6 +136,15 @@ dlink_dir505: @cp $(BUILD_TOPDIR)/u-boot/tuboot.bin $(BUILD_TOPDIR)/bin/temp.bin @make show_size +gs-oolite_v1_dev: export UBOOT_FILE_NAME=uboot_for_gs-oolite_v1_dev +gs-oolite_v1_dev: export MAX_UBOOT_SIZE=64 +gs-oolite_v1_dev: export COMPRESSED_UBOOT=1 +gs-oolite_v1_dev: + @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) gs_oolite_v1_dev_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 + 8devices_carambola2: export UBOOT_FILE_NAME=uboot_for_8devices_carambola2 8devices_carambola2: export MAX_UBOOT_SIZE=256 8devices_carambola2: diff --git a/u-boot/Makefile b/u-boot/Makefile index b8db572..292e048 100755 --- a/u-boot/Makefile +++ b/u-boot/Makefile @@ -448,6 +448,23 @@ dir505_config : unconfig hornet_common_config @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 +gs_oolite_v1_dev_config : unconfig hornet_common_config + @echo '======= Configuring for GS-Oolite v1 with dev board at:' `date` '=======' + @echo "#define CONFIG_FOR_GS_OOLITE_V1_DEV 1" >> include/config.h + @echo "#define GPIO_SYS_LED_BIT 27" >> include/config.h + @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h + @echo "#define GPIO_WAN_LED_BIT 17" >> include/config.h + @echo "#define GPIO_WAN_LED_ON 0" >> include/config.h + @echo "#define GPIO_LAN1_LED_BIT 13" >> include/config.h + @echo "#define GPIO_LAN1_LED_ON 0" >> include/config.h + @echo "#define GPIO_LAN2_LED_BIT 15" >> include/config.h + @echo "#define GPIO_LAN2_LED_ON 0" >> include/config.h + @echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h + @echo "#define DEFAULT_FLASH_SIZE_IN_MB 16" >> include/config.h + @echo "#define BOARD_CUSTOM_STRING \"AP121 (AR9331) U-Boot for GS-Oolite v1\"" >> include/config.h + + @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240 + carambola2_config : unconfig hornet_common_config @echo '======= Configuring for 8devices Carambola 2 at:' `date` '=======' @echo "#define CONFIG_FOR_8DEVICES_CARAMBOLA2 1" >> include/config.h diff --git a/u-boot/board/ar7240/ap121/ap121.c b/u-boot/board/ar7240/ap121/ap121.c index 99e5409..4aa13de 100755 --- a/u-boot/board/ar7240/ap121/ap121.c +++ b/u-boot/board/ar7240/ap121/ap121.c @@ -31,6 +31,8 @@ void led_toggle(void){ gpio ^= 1 << GPIO_SYS_LED_BIT; #elif defined(CONFIG_FOR_DLINK_DIR505_A1) gpio ^= 1 << GPIO_SYS_LED_BIT; +#elif defined(CONFIG_FOR_GS_OOLITE_V1_DEV) + gpio ^= 1 << GPIO_SYS_LED_BIT; #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) gpio ^= 1 << GPIO_WLAN_LED_BIT; #else @@ -73,6 +75,11 @@ void all_led_on(void){ #endif #elif defined(CONFIG_FOR_DLINK_DIR505_A1) SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON); +#elif defined(CONFIG_FOR_GS_OOLITE_V1_DEV) + SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON); + SETBITVAL(gpio, GPIO_WAN_LED_BIT, GPIO_WAN_LED_ON); + SETBITVAL(gpio, GPIO_LAN1_LED_BIT, GPIO_LAN1_LED_ON); + SETBITVAL(gpio, GPIO_LAN2_LED_BIT, GPIO_LAN2_LED_ON); #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) SETBITVAL(gpio, GPIO_WLAN_LED_BIT, GPIO_WLAN_LED_ON); #else @@ -115,6 +122,11 @@ void all_led_off(void){ #endif #elif defined(CONFIG_FOR_DLINK_DIR505_A1) SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON); +#elif defined(CONFIG_FOR_GS_OOLITE_V1_DEV) + SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON); + SETBITVAL(gpio, GPIO_WAN_LED_BIT, !GPIO_WAN_LED_ON); + SETBITVAL(gpio, GPIO_LAN1_LED_BIT, !GPIO_LAN1_LED_ON); + SETBITVAL(gpio, GPIO_LAN2_LED_BIT, !GPIO_LAN2_LED_ON); #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) SETBITVAL(gpio, GPIO_WLAN_LED_BIT, !GPIO_WLAN_LED_ON); #else @@ -295,6 +307,40 @@ void gpio_config(void){ // turn off RED LED, we don't need it ar7240_reg_wr(AR7240_GPIO_OUT, (ar7240_reg_rd(AR7240_GPIO_OUT) | (0x1 << 26))); +#elif defined(CONFIG_FOR_GS_OOLITE_V1_DEV) + + /* LED's GPIOs on GS-Oolite v1 with development board: + * + * 13 => LAN2 + * 15 => LAN1 + * 17 => WAN + * 27 => SYS LED (green on dev board, red on module) + * + * I/O on development board: + * 0 => RED LED (active low) + * 1 => RED LED (active low) + * 6 => Switch 8 + * 7 => Switch 7 + * 8 => USB power + * 11 => Reset switch + * 14 => RED LED (active low) + * 16 => RED LED (active low) + * 18 => RED LED (active low) + * 19 => RED LED (active low) + * 20 => RED LED (active low) + * 21 => RED LED (active low) + * 22 => RED LED (active low) + * 23 => Relay 1 + * 24 => Relay 2 + * 26 => RED LED (active low) + * + */ + + // set GPIO_OE + ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0xDFFE103)); + + // turn on power on USB and turn off RED LEDs + ar7240_reg_wr(AR7240_GPIO_SET, 0x47D4103); #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 b39e6d3..9f09014 100755 --- a/u-boot/include/configs/ap121.h +++ b/u-boot/include/configs/ap121.h @@ -53,6 +53,10 @@ #define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:06 rootfstype=squashfs init=/sbin/init mtdparts=ar7240-nor0:64k(u-boot),64k(ART),64k(mac),64k(nvram),256k(language),1024k(uImage),6656k(rootfs)" +#elif defined(CONFIG_FOR_GS_OOLITE_V1_DEV) + + #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)" + #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) #define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=squashfs init=/sbin/init mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),16000k(firmware),64k(ART)" @@ -821,6 +825,9 @@ #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) // Carambola 2: 256k(U-Boot),64k(U-Boot env),64k(ART) #define WEBFAILSAFE_UPLOAD_LIMITED_AREA_IN_BYTES (384 * 1024) +#elif defined (CONFIG_FOR_GS_OOLITE_V1_DEV) + // GS-Oolite v1: 128k(U-Boot + MAC),64k(ART) + #define WEBFAILSAFE_UPLOAD_LIMITED_AREA_IN_BYTES (192 * 1024) #else // TP-Link: 64k(U-Boot),64k(MAC/model/WPS pin block),64k(ART) #define WEBFAILSAFE_UPLOAD_LIMITED_AREA_IN_BYTES (192 * 1024) @@ -861,6 +868,12 @@ #define OFFSET_MAC_DATA_BLOCK_LENGTH 0x010000 #define OFFSET_MAC_ADDRESS 0x000000 // Carambola 2 has two MAC addresses at the beginning of ART partition #define OFFSET_MAC_ADDRESS2 0x000006 +#elif defined (CONFIG_FOR_GS_OOLITE_V1_DEV) + // GS-OOlite has only one MAC, inside second block + // It's some kind of TP-Link clone + #define OFFSET_MAC_DATA_BLOCK 0x010000 + #define OFFSET_MAC_DATA_BLOCK_LENGTH 0x010000 + #define OFFSET_MAC_ADDRESS 0x00FC00 #else #define OFFSET_MAC_DATA_BLOCK 0x010000 #define OFFSET_MAC_DATA_BLOCK_LENGTH 0x010000 @@ -868,7 +881,8 @@ #endif #if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && \ - !defined(CONFIG_FOR_DLINK_DIR505_A1) + !defined(CONFIG_FOR_DLINK_DIR505_A1) && \ + !defined (CONFIG_FOR_GS_OOLITE_V1_DEV) #define OFFSET_ROUTER_MODEL 0x00FD00 #endif -- 2.25.1