Support for Village Telco Mesh Potato 2 (which is based on Dragino 2 hardware)
authorPiotr Dymacz <pepe2k@gmail.com>
Mon, 8 Sep 2014 01:34:28 +0000 (03:34 +0200)
committerPiotr Dymacz <pepe2k@gmail.com>
Mon, 8 Sep 2014 01:34:28 +0000 (03:34 +0200)
Makefile
u-boot/Makefile
u-boot/board/ar7240/ap121/ap121.c
u-boot/common/cmd_bootm.c
u-boot/common/cmd_custom.c
u-boot/include/common.h
u-boot/include/configs/ap121.h
u-boot/lib_mips/mips_linux.c

index d2b33d6cfe079ffd4541134c56c42724e4021f45..4245a0acb3f2059d2dc8b174ff330184227346f6 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -192,6 +192,14 @@ dragino_v2_ms14:
        @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all
        @make --no-print-directory show_size
 
+villagetelco_mp2:      export UBOOT_FILE_NAME=uboot_for_villagetelco_mp2
+villagetelco_mp2:      export MAX_UBOOT_SIZE=192
+villagetelco_mp2:      export DEVICE_VENDOR=villagetelco
+villagetelco_mp2:
+       @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) villagetelco_mp2_config
+       @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
index 89b280ac5f5fd2ea72d7a512c8e99ff265cfcc9f..302f3e06c91ebd266d829b6bf8f82df900fafa1a 100755 (executable)
@@ -531,6 +531,27 @@ dragino_v2_ms14_config : unconfig hornet_common_config
        
        @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
 
+villagetelco_mp2_config : unconfig hornet_common_config
+       @/bin/echo -e '\e[32m> Configuring for Village Telco Mesh Potato 2 at:' `date` '\e[0m'
+       @echo "#define CONFIG_FOR_MESH_POTATO_V2            1" >> include/config.h
+       @echo "#undef  COMPRESSED_UBOOT"                       >> 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_WAN_LED_BIT                    17" >> include/config.h
+       @echo "#define GPIO_WAN_LED_ON                      0" >> include/config.h
+       @echo "#define GPIO_LAN_LED_BIT                    13" >> include/config.h
+       @echo "#define GPIO_LAN_LED_ON                      0" >> include/config.h
+       @echo "#define GPIO_INTERNET_LED_BIT               28" >> include/config.h
+       @echo "#define GPIO_INTERNET_LED_ON                 1" >> include/config.h
+       @echo "#define GPIO_RST_BUTTON_BIT                 11" >> include/config.h
+       @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW        1" >> include/config.h
+       @echo "#define DEFAULT_FLASH_SIZE_IN_MB            16" >> include/config.h
+       @echo "#define WEBFAILSAFE_DISABLE_ART_UPGRADE      1" >> include/config.h
+       @echo "#define WEBFAILSAFE_DISABLE_UBOOT_UPGRADE    1" >> include/config.h
+       @echo "#define BOARD_CUSTOM_STRING                  \"AP121 (AR9331) U-Boot for Village Telco Mesh Potato 2\"" >> include/config.h
+       
+       @./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
index acd43f789500eeacf2189adb05c7e933e72d711d..cdaec8038d29f78e255d4afd032d10becf40d6c8 100755 (executable)
@@ -36,7 +36,7 @@ void led_toggle(void){
        gpio ^= 1 << GPIO_SYS_LED_BIT;
 #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
        gpio ^= 1 << GPIO_WLAN_LED_BIT;
-#elif defined(CONFIG_FOR_DRAGINO_V2)
+#elif defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2)
        gpio ^= 1 << GPIO_WLAN_LED_BIT;
 #elif defined(CONFIG_FOR_GL_INET)
        gpio ^= 1 << GPIO_WLAN_LED_BIT;
@@ -87,7 +87,7 @@ void all_led_on(void){
        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);
-#elif defined(CONFIG_FOR_DRAGINO_V2)
+#elif defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2)
        SETBITVAL(gpio, GPIO_WLAN_LED_BIT,     GPIO_WLAN_LED_ON);
        SETBITVAL(gpio, GPIO_WAN_LED_BIT,      GPIO_WAN_LED_ON);
        SETBITVAL(gpio, GPIO_LAN_LED_BIT,      GPIO_LAN_LED_ON);
@@ -142,7 +142,7 @@ void all_led_off(void){
        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);
-#elif defined(CONFIG_FOR_DRAGINO_V2)
+#elif defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2)
        SETBITVAL(gpio, GPIO_WLAN_LED_BIT,     !GPIO_WLAN_LED_ON);
        SETBITVAL(gpio, GPIO_WAN_LED_BIT,      !GPIO_WAN_LED_ON);
        SETBITVAL(gpio, GPIO_LAN_LED_BIT,      !GPIO_LAN_LED_ON);
@@ -316,7 +316,7 @@ void gpio_config(void){
        //ar7240_reg_wr (AR7240_GPIO_FUNC, (ar7240_reg_rd(AR7240_GPIO_FUNC) & 0xffe7e07f));
 #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
        // TODO: check GPIO config for C2
-#elif defined(CONFIG_FOR_DRAGINO_V2)
+#elif defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2)
 
        /* LED's GPIOs on MR3220v2:
         *
index c71d293867d9657087d88767730d4b54fc05dd52..510953bbae6a330dc3d1a246b0e602e827e1ad5e 100755 (executable)
@@ -73,7 +73,8 @@ ulong load_addr = CFG_LOAD_ADDR; /* default load address */
 
 #if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && \
        !defined(CONFIG_FOR_DLINK_DIR505_A1)     && \
-       !defined(CONFIG_FOR_DRAGINO_V2)
+       !defined(CONFIG_FOR_DRAGINO_V2)          && \
+       !defined(CONFIG_FOR_MESH_POTATO_V2)
 void fake_image_header(image_header_t *hdr, tplink_image_header_t *tpl_hdr){
        memset(hdr, 0, sizeof(image_header_t));
 
@@ -92,7 +93,7 @@ void fake_image_header(image_header_t *hdr, tplink_image_header_t *tpl_hdr){
 
        strncpy((char *)hdr->ih_name, (char *)tpl_hdr->signiture_1, IH_NMLEN);
 }
-#endif /* if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && !defined(CONFIG_FOR_DLINK_DIR505_A1) && !defined(CONFIG_FOR_DRAGINO_V2) */
+#endif /* if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && !defined(CONFIG_FOR_DLINK_DIR505_A1) && !defined(CONFIG_FOR_DRAGINO_V2) && !defined(CONFIG_FOR_MESH_POTATO_V2) */
 
 int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){
        ulong addr, data, len;
@@ -101,7 +102,8 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){
        image_header_t *hdr = &header;
 #if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && \
        !defined(CONFIG_FOR_DLINK_DIR505_A1)     && \
-       !defined(CONFIG_FOR_DRAGINO_V2)
+       !defined(CONFIG_FOR_DRAGINO_V2)          && \
+       !defined(CONFIG_FOR_MESH_POTATO_V2)
        tplink_image_header_t *fileTag;
 #endif
 
@@ -115,7 +117,8 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){
 
 #if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
        defined(CONFIG_FOR_DLINK_DIR505_A1)     || \
-       defined(CONFIG_FOR_DRAGINO_V2)
+       defined(CONFIG_FOR_DRAGINO_V2)          || \
+       defined(CONFIG_FOR_MESH_POTATO_V2)
        memmove(&header, (char *)addr, sizeof(image_header_t));
        print_image_hdr(hdr);
 
@@ -222,7 +225,8 @@ static void fixup_silent_linux(){
 
 #if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
        defined(CONFIG_FOR_DLINK_DIR505_A1)     || \
-       defined(CONFIG_FOR_DRAGINO_V2)
+       defined(CONFIG_FOR_DRAGINO_V2)          || \
+       defined(CONFIG_FOR_MESH_POTATO_V2)
 static void print_type(image_header_t *hdr){
        char *os, *arch, *type, *comp;
 
@@ -399,7 +403,7 @@ void print_image_hdr(tplink_image_header_t *hdr){
        print_size(ntohl(hdr->kernelLen), "\n");
        printf("   Load address: 0x%08X\n   Entry point:  0x%08X\n\n", ntohl(hdr->kernelTextAddr), ntohl(hdr->kernelEntryPoint));
 }
-#endif /* defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || defined(CONFIG_FOR_DLINK_DIR505_A1) || defined(CONFIG_FOR_DRAGINO_V2) */
+#endif /* defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || defined(CONFIG_FOR_DLINK_DIR505_A1) || defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2) */
 
 #if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
 int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){
index 59f59810089d2a1b797a48b2b500c8fa9132b8c8..46a994d555dfcc991cbed7eb46fc59750c9350c7 100755 (executable)
@@ -198,7 +198,8 @@ U_BOOT_CMD(startsc, 1, 0, do_start_sc, "start serial console\n", NULL);
 #endif /* if defined(CONFIG_NETCONSOLE) */
 
 #if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
-    defined(CONFIG_FOR_DRAGINO_V2)
+    defined(CONFIG_FOR_DRAGINO_V2)          || \
+    defined(CONFIG_FOR_MESH_POTATO_V2)
 /*
  * Erase environment sector
  */
@@ -235,7 +236,7 @@ int do_default_env(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]){
 }
 
 U_BOOT_CMD(defenv, 1, 0, do_default_env, "reset environment variables to their default values\n", NULL);
-#endif /* if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || defined(CONFIG_FOR_DRAGINO_V2) */
+#endif /* if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2) */
 
 #if defined(PLL_IN_FLASH_MAGIC_OFFSET)
 
index 6a85284dbda69ff4141120541520122fabe3f4dc..89ce9dc14cce832d8e658bf5385902b4323740f6 100755 (executable)
@@ -196,14 +196,16 @@ int       autoscript (ulong addr);
  */
 #if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && \
        !defined(CONFIG_FOR_DLINK_DIR505_A1)     && \
-       !defined(CONFIG_FOR_DRAGINO_V2)
+       !defined(CONFIG_FOR_DRAGINO_V2)          && \
+       !defined(CONFIG_FOR_MESH_POTATO_V2)
 #include "tpLinuxTag.h"
 #endif
 
 /* common/cmd_bootm.c */
 #if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
        defined(CONFIG_FOR_DLINK_DIR505_A1)     || \
-       defined(CONFIG_FOR_DRAGINO_V2)
+       defined(CONFIG_FOR_DRAGINO_V2)          || \
+       defined(CONFIG_FOR_MESH_POTATO_V2)
 void print_image_hdr(image_header_t *hdr);
 #else
 void print_image_hdr(tplink_image_header_t *hdr);
index 2a3947d2e6dcfdffbef094ac370b20c65ffe749f..4a1e91526b10d61c08c146b93a3b1aa8c5f58060 100755 (executable)
@@ -62,7 +62,8 @@
 
        #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_DRAGINO_V2)
+#elif defined(CONFIG_FOR_DRAGINO_V2) || \
+      defined(CONFIG_FOR_MESH_POTATO_V2)
 
        #define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=squashfs init=/sbin/init mtdparts=ar7240-nor0:192k(u-boot),64k(u-boot-env),16064k(firmware),64k(ART)"
 
@@ -83,7 +84,8 @@
 #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
        #define CFG_LOAD_ADDR                    0x9F050000
        #define UPDATE_SCRIPT_FW_ADDR   "0x9F050000"
-#elif defined(CONFIG_FOR_DRAGINO_V2)
+#elif defined(CONFIG_FOR_DRAGINO_V2) || \
+      defined(CONFIG_FOR_MESH_POTATO_V2)
        #define CFG_LOAD_ADDR                    0x9F040000
        #define UPDATE_SCRIPT_FW_ADDR   "0x9F040000"
 #else
@@ -95,7 +97,8 @@
        #define CONFIG_BOOTCOMMAND "bootm 0x9F080000"
 #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
        #define CONFIG_BOOTCOMMAND "bootm 0x9F050000"
-#elif defined(CONFIG_FOR_DRAGINO_V2)
+#elif defined(CONFIG_FOR_DRAGINO_V2) || \
+      defined(CONFIG_FOR_MESH_POTATO_V2)
        #define CONFIG_BOOTCOMMAND "bootm 0x9F040000"
 #else
        #define CONFIG_BOOTCOMMAND "bootm 0x9F020000"
 /*
  * Dragino 2 uses different prompt
  */
-#if defined(CONFIG_FOR_DRAGINO_V2)
+#if defined(CONFIG_FOR_DRAGINO_V2) || \
+    defined(CONFIG_FOR_MESH_POTATO_V2)
        #if defined(CFG_PROMPT)
                #undef CFG_PROMPT
        #endif
  * Address and size of Primary Environment Sector
  */
 #if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
-       defined(CONFIG_FOR_DRAGINO_V2)
+       defined(CONFIG_FOR_DRAGINO_V2) || \
+       defined(CONFIG_FOR_MESH_POTATO_V2)
        #define CFG_ENV_IS_IN_FLASH     1
        #undef CFG_ENV_IS_NOWHERE
 #else
        #define CFG_ENV_IS_NOWHERE      1
 #endif
 
-#if defined(CONFIG_FOR_DRAGINO_V2)
+#if defined(CONFIG_FOR_DRAGINO_V2) || \
+       defined(CONFIG_FOR_MESH_POTATO_V2)
        #define CFG_ENV_ADDR            0x9F030000
        #define CFG_ENV_SIZE            0x8000
        #define CFG_ENV_SECT_SIZE       0x10000
                                                         CFG_CMD_IMI)
 
 #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
-      defined(CONFIG_FOR_DRAGINO_V2)
+      defined(CONFIG_FOR_DRAGINO_V2) || \
+      defined(CONFIG_FOR_MESH_POTATO_V2)
 
        #define CONFIG_COMMANDS (CFG_CMD_MEMORY | \
                                                         CFG_CMD_DHCP   | \
 #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
        #define WEBFAILSAFE_UPLOAD_UBOOT_SIZE_IN_BYTES          (256 * 1024)
        #define UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES                       "0x40000"
-#elif defined(CONFIG_FOR_DRAGINO_V2)
+#elif defined(CONFIG_FOR_DRAGINO_V2) || \
+      defined(CONFIG_FOR_MESH_POTATO_V2)
        #define WEBFAILSAFE_UPLOAD_UBOOT_SIZE_IN_BYTES          (192 * 1024)
        #define UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES                       "0x30000"
 #else
        #define WEBFAILSAFE_UPLOAD_KERNEL_ADDRESS                       WEBFAILSAFE_UPLOAD_UBOOT_ADDRESS + 0x80000
 #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
        #define WEBFAILSAFE_UPLOAD_KERNEL_ADDRESS                       WEBFAILSAFE_UPLOAD_UBOOT_ADDRESS + 0x50000
-#elif defined(CONFIG_FOR_DRAGINO_V2)
+#elif defined(CONFIG_FOR_DRAGINO_V2) || \
+      defined(CONFIG_FOR_MESH_POTATO_V2)
        #define WEBFAILSAFE_UPLOAD_KERNEL_ADDRESS                       WEBFAILSAFE_UPLOAD_UBOOT_ADDRESS + 0x40000
 #else
        #define WEBFAILSAFE_UPLOAD_KERNEL_ADDRESS                       WEBFAILSAFE_UPLOAD_UBOOT_ADDRESS + 0x20000
 #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_DRAGINO_V2)
+#elif defined(CONFIG_FOR_DRAGINO_V2) || \
+      defined(CONFIG_FOR_MESH_POTATO_V2)
        // Dragino 2: 192k(U-Boot),64k(U-Boot env),64k(ART)
        #define WEBFAILSAFE_UPLOAD_LIMITED_AREA_IN_BYTES        (320 * 1024)
 #elif defined(CONFIG_FOR_GS_OOLITE_V1_DEV)
        //#define OFFSET_MAC_ADDRESS                            0x000004
        //#define OFFSET_MAC_ADDRESS2                           0x000016
 #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
-      defined(CONFIG_FOR_DRAGINO_V2)
+      defined(CONFIG_FOR_DRAGINO_V2) || \
+      defined(CONFIG_FOR_MESH_POTATO_V2)
        // Carambola 2 and Dragino 2 have two MAC addresses at the beginning of ART partition
        #define OFFSET_MAC_DATA_BLOCK                   0xFF0000
        #define OFFSET_MAC_DATA_BLOCK_LENGTH    0x010000
        !defined(CONFIG_FOR_DLINK_DIR505_A1)     && \
        !defined(CONFIG_FOR_GS_OOLITE_V1_DEV)    && \
        !defined(CONFIG_FOR_DRAGINO_V2)          && \
+       !defined(CONFIG_FOR_MESH_POTATO_V2)      && \
        !defined(CONFIG_FOR_GL_INET)
 #define OFFSET_ROUTER_MODEL                                    0x00FD00
 #endif
        #define PLL_IN_FLASH_DATA_BLOCK_OFFSET  0x00040000
        #define PLL_IN_FLASH_DATA_BLOCK_LENGTH  0x00010000
        #define PLL_IN_FLASH_MAGIC_OFFSET               0x0000FFF0      // last 16 bytes
-#elif defined(CONFIG_FOR_DRAGINO_V2)
+#elif defined(CONFIG_FOR_DRAGINO_V2) || \
+      defined(CONFIG_FOR_MESH_POTATO_V2)
        /*
         * We will store PLL and CLOCK registers
         * configuration at the end of environment
index ec210e06c733d66bd6700dd720ed4705eab1aa16..35558cebebf16e7e1c7772da11b3234b567e4fc5 100755 (executable)
@@ -119,7 +119,7 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]){
        wasp_set_cca();
 #endif
 
-#if defined(CONFIG_FOR_DRAGINO_V2)
+#if defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2)
        // Restore WAN/LAN LEDs (BIT 3 and 7 in GPIO_FUNCTION_1)
        ar7240_reg_wr(AR7240_GPIO_FUNC, (ar7240_reg_rd(AR7240_GPIO_FUNC) | 0x88));
 #endif