Support for GS-Oolite v1 module on big development board with two relays
authorPiotr Dymacz <pepe2k@gmail.com>
Thu, 16 Jan 2014 01:58:28 +0000 (02:58 +0100)
committerPiotr Dymacz <pepe2k@gmail.com>
Thu, 16 Jan 2014 01:58:28 +0000 (02:58 +0100)
Makefile
u-boot/Makefile
u-boot/board/ar7240/ap121/ap121.c
u-boot/include/configs/ap121.h

index de58fda4643ef6ac55d3132181f9132bbf7ac39f..48425382adcc2d00e129671e5d3223c1985deaa8 100755 (executable)
--- 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:
index b8db5721ec67c666afd3fdf778e40b41bbae3c3d..292e048a2a2468d3313411140e897bf35b1cff2b 100755 (executable)
@@ -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
index 99e5409942b692f8b76f027a433bd3b397fc30ca..4aa13defbd8fc48bef58509a8a70e90c2b0fa8ca 100755 (executable)
@@ -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
index b39e6d363c6868169c1b3c77a41361e2bb191fe6..9f09014eb9f5e5bf956981cf4db4fb098efa4575 100755 (executable)
 
        #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)"
 #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)
        #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
 #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