@cp $(BUILD_TOPDIR)/u-boot/u-boot.bin $(BUILD_TOPDIR)/bin/temp.bin
@make show_size
+dragino_v2_ms14: export UBOOT_FILE_NAME=uboot_for_dragino_v2_ms14
+dragino_v2_ms14: export MAX_UBOOT_SIZE=192
+dragino_v2_ms14:
+ @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) dragino_v2_ms14_config
+ @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all
+ @cp $(BUILD_TOPDIR)/u-boot/u-boot.bin $(BUILD_TOPDIR)/bin/temp.bin
+ @make show_size
+
show_size:
@echo -e "\n======= Preparing $(MAX_UBOOT_SIZE)KB file filled with 0xFF... ======="
@`tr "\000" "\377" < /dev/zero | dd ibs=1k count=$(MAX_UBOOT_SIZE) of=$(BUILD_TOPDIR)/bin/$(UBOOT_FILE_NAME).bin`
@./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
+dragino_v2_ms14_config : unconfig hornet_common_config
+ @echo '======= Configuring for Dragino Dragino v2 (MS14) at:' `date` '======='
+ @echo "#define CONFIG_FOR_DRAGINO_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 BOARD_CUSTOM_STRING \"AP121 (AR9331) U-Boot for Dragino v2 MS14\"" >> 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
gpio ^= 1 << GPIO_SYS_LED_BIT;
#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
gpio ^= 1 << GPIO_WLAN_LED_BIT;
+#elif defined(CONFIG_FOR_DRAGINO_V2)
+ gpio ^= 1 << GPIO_WLAN_LED_BIT;
#else
#error "Custom GPIO in leg_toggle() not defined!"
#endif
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)
+ 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);
+ SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, GPIO_INTERNET_LED_ON);
#else
#error "Custom GPIO in all_led_on() not defined!"
#endif
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)
+ 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);
+ SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, !GPIO_INTERNET_LED_ON);
#else
#error "Custom GPIO in all_led_off() not defined!"
#endif
//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)
+
+ /* LED's GPIOs on MR3220v2:
+ *
+ * 0 => WLAN
+ * 13 => LAN
+ * 17 => WAN
+ * 28 => INTERNET
+ *
+ */
+
+ /* set GPIO_OE */
+ ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0x10022001));
+
#elif defined(CONFIG_FOR_DLINK_DIR505_A1)
/* LED's GPIOs on DIR-505:
ulong load_addr = CFG_LOAD_ADDR; /* default load address */
#if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && \
- !defined(CONFIG_FOR_DLINK_DIR505_A1)
+ !defined(CONFIG_FOR_DLINK_DIR505_A1) && \
+ !defined(CONFIG_FOR_DRAGINO_V2)
void fake_image_header(image_header_t *hdr, tplink_image_header_t *tpl_hdr){
memset(hdr, 0, sizeof(image_header_t));
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) */
+#endif /* if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && !defined(CONFIG_FOR_DLINK_DIR505_A1) && !defined(CONFIG_FOR_DRAGINO_V2) */
int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){
ulong addr, data, len;
int i;
image_header_t *hdr = &header;
#if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && \
- !defined(CONFIG_FOR_DLINK_DIR505_A1)
+ !defined(CONFIG_FOR_DLINK_DIR505_A1) && \
+ !defined(CONFIG_FOR_DRAGINO_V2)
tplink_image_header_t *fileTag;
#endif
printf("Booting image at: 0x%08lX\n", addr);
#if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
- defined(CONFIG_FOR_DLINK_DIR505_A1)
+ defined(CONFIG_FOR_DLINK_DIR505_A1) || \
+ defined(CONFIG_FOR_DRAGINO_V2)
memmove(&header, (char *)addr, sizeof(image_header_t));
print_image_hdr(hdr);
#endif /* CONFIG_SILENT_CONSOLE */
#if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
- defined(CONFIG_FOR_DLINK_DIR505_A1)
+ defined(CONFIG_FOR_DLINK_DIR505_A1) || \
+ defined(CONFIG_FOR_DRAGINO_V2)
static void print_type(image_header_t *hdr){
char *os, *arch, *type, *comp;
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) */
+#endif /* defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || defined(CONFIG_FOR_DLINK_DIR505_A1) || defined(CONFIG_FOR_DRAGINO_V2) */
#if (CONFIG_COMMANDS & CFG_CMD_IMI)
int do_iminfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){
#endif /* if defined(CONFIG_NETCONSOLE) */
-#if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
+#if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
+ defined(CONFIG_FOR_DRAGINO_V2)
/*
* Erase environment sector
*/
}
U_BOOT_CMD(eraseenv, 1, 1, do_erase_env, "erase environment sector in flash\n", NULL);
-#endif /* if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) */
+#endif /* if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || defined(CONFIG_FOR_DRAGINO_V2) */
#if defined(PLL_IN_FLASH_MAGIC_OFFSET)
* use different (simply) image header
*/
#if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && \
- !defined(CONFIG_FOR_DLINK_DIR505_A1)
+ !defined(CONFIG_FOR_DLINK_DIR505_A1) && \
+ !defined(CONFIG_FOR_DRAGINO_V2)
#include "tpLinuxTag.h"
#endif
/* common/cmd_bootm.c */
#if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
- defined(CONFIG_FOR_DLINK_DIR505_A1)
+ defined(CONFIG_FOR_DLINK_DIR505_A1) || \
+ defined(CONFIG_FOR_DRAGINO_V2)
void print_image_hdr(image_header_t *hdr);
#else
void print_image_hdr(tplink_image_header_t *hdr);
#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)
+
+ #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)"
+
#endif
/*
#define CFG_LOAD_ADDR 0x9F080000
#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
#define CFG_LOAD_ADDR 0x9F050000
+#elif defined(CONFIG_FOR_DRAGINO_V2)
+ #define CFG_LOAD_ADDR 0x9F040000
#else
#define CFG_LOAD_ADDR 0x9F020000
#endif
#define CONFIG_BOOTCOMMAND "bootm 0x9F080000"
#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
#define CONFIG_BOOTCOMMAND "bootm 0x9F050000"
+#elif defined(CONFIG_FOR_DRAGINO_V2)
+ #define CONFIG_BOOTCOMMAND "bootm 0x9F040000"
#else
#define CONFIG_BOOTCOMMAND "bootm 0x9F020000"
#endif
#define CONFIG_IPADDR 192.168.1.1
#define CONFIG_SERVERIP 192.168.1.2
+/*
+ * Dragino 2 uses different prompt
+ */
+#if defined(CONFIG_FOR_DRAGINO_V2)
+ #if defined(CFG_PROMPT)
+ #undef CFG_PROMPT
+ #endif
+ #define CFG_PROMPT "dr_boot> "
+#endif
+
#undef CFG_HZ
#define CFG_HZ bd->bi_cfg_hz
#undef CPU_PLL_CONFIG_VAL
/*
* Address and size of Primary Environment Sector
*/
-#if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
+#if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
+ defined(CONFIG_FOR_DRAGINO_V2)
#define CFG_ENV_IS_IN_FLASH 1
#undef CFG_ENV_IS_NOWHERE
#else
#define CFG_ENV_IS_NOWHERE 1
#endif
-#define CFG_ENV_ADDR 0x9F040000
+#if defined(CONFIG_FOR_DRAGINO_V2)
+ #define CFG_ENV_ADDR 0x9F030000
+#else
+ #define CFG_ENV_ADDR 0x9F040000
+#endif
#define CFG_ENV_SIZE 0x10000
/*
*/
#if defined(CONFIG_FOR_DLINK_DIR505_A1)
#define CONFIG_COMMANDS (CFG_CMD_MEMORY | CFG_CMD_DHCP | CFG_CMD_PING | CFG_CMD_FLASH | CFG_CMD_NET | CFG_CMD_RUN | CFG_CMD_DATE | CFG_CMD_IMI | CFG_CMD_SNTP )
-#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
+#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
+ defined(CONFIG_FOR_DRAGINO_V2)
#define CONFIG_COMMANDS (CFG_CMD_MEMORY | CFG_CMD_DHCP | CFG_CMD_PING | CFG_CMD_ENV | CFG_CMD_FLASH | CFG_CMD_NET | CFG_CMD_RUN | CFG_CMD_DATE | CFG_CMD_IMI | CFG_CMD_SNTP)
#else
#define CONFIG_COMMANDS (CFG_CMD_MEMORY | CFG_CMD_DHCP | CFG_CMD_PING | CFG_CMD_FLASH | CFG_CMD_NET | CFG_CMD_RUN | CFG_CMD_DATE | CFG_CMD_SNTP )
#define WEBFAILSAFE_UPLOAD_UBOOT_SIZE_IN_BYTES (64 * 1024)
#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
#define WEBFAILSAFE_UPLOAD_UBOOT_SIZE_IN_BYTES (256 * 1024)
+#elif defined(CONFIG_FOR_DRAGINO_V2)
+ #define WEBFAILSAFE_UPLOAD_UBOOT_SIZE_IN_BYTES (192 * 1024)
#else
#define WEBFAILSAFE_UPLOAD_UBOOT_SIZE_IN_BYTES (64 * 1024)
#endif
#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)
+ #define WEBFAILSAFE_UPLOAD_KERNEL_ADDRESS WEBFAILSAFE_UPLOAD_UBOOT_ADDRESS + 0x40000
#else
#define WEBFAILSAFE_UPLOAD_KERNEL_ADDRESS WEBFAILSAFE_UPLOAD_UBOOT_ADDRESS + 0x20000
#endif
#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)
+ // 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)
// GS-Oolite v1: 128k(U-Boot + MAC),64k(ART)
#define WEBFAILSAFE_UPLOAD_LIMITED_AREA_IN_BYTES (192 * 1024)
//#define OFFSET_MAC_DATA_BLOCK_LENGTH 0x010000
//#define OFFSET_MAC_ADDRESS 0x000004
//#define OFFSET_MAC_ADDRESS2 0x000016
-#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
+#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
+ defined(CONFIG_FOR_DRAGINO_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
- #define OFFSET_MAC_ADDRESS 0x000000 // Carambola 2 has two MAC addresses at the beginning of ART partition
+ #define OFFSET_MAC_ADDRESS 0x000000
#define OFFSET_MAC_ADDRESS2 0x000006
#elif defined (CONFIG_FOR_GS_OOLITE_V1_DEV)
// GS-OOlite has only one MAC, inside second block
#if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && \
!defined(CONFIG_FOR_DLINK_DIR505_A1) && \
- !defined (CONFIG_FOR_GS_OOLITE_V1_DEV)
+ !defined (CONFIG_FOR_GS_OOLITE_V1_DEV) && \
+ !defined(CONFIG_FOR_DRAGINO_V2)
#define OFFSET_ROUTER_MODEL 0x00FD00
#endif