ar71xx: add user space support for the TL-WA801ND v2
[openwrt/openwrt.git] / target / linux / ar71xx / base-files / lib / upgrade / platform.sh
index 266bf3fd5c4bc679e7f88b75318249817bc06af1..4aeb88f023c6931804c88ff31cba27df9482850c 100755 (executable)
@@ -73,6 +73,22 @@ seama_get_type_magic() {
        get_image "$@" | dd bs=1 count=4 skip=53 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
 }
 
+cybertan_get_image_magic() {
+       get_image "$@" | dd bs=8 count=1 skip=0  2>/dev/null | hexdump -v -n 8 -e '1/1 "%02x"'
+}
+
+cybertan_check_image() {
+       local magic="$(cybertan_get_image_magic "$1")"
+       local fw_magic="$(cybertan_get_hw_magic)"
+
+       [ "$fw_magic" != "$magic" ] && {
+               echo "Invalid image, ID mismatch, got:$magic, but need:$fw_magic"
+               return 1
+       }
+
+       return 0
+}
+
 platform_check_image() {
        local board=$(ar71xx_board_name)
        local magic="$(get_magic_word "$1")"
@@ -155,6 +171,12 @@ platform_check_image() {
                dir825b_check_image "$1" && return 0
                ;;
 
+       mynet-rext|\
+       wrt160nl)
+               cybertan_check_image "$1" && return 0
+               return 1
+               ;;
+
        mynet-n600)
                [ "$magic_long" != "5ea3a417" ] && {
                        echo "Invalid image, bad magic: $magic_long"
@@ -192,6 +214,7 @@ platform_check_image() {
        tl-wa7510n | \
        tl-wa750re | \
        tl-wa850re | \
+       tl-wa801nd-v2 | \
        tl-wa901nd | \
        tl-wa901nd-v2 | \
        tl-wdr3500 | \
@@ -204,9 +227,11 @@ platform_check_image() {
        tl-wr841n-v1 | \
        tl-wr841n-v7 | \
        tl-wr841n-v8 | \
+       tl-wr842n-v2 | \
        tl-wr941nd | \
        tl-wr1041n-v2 | \
        tl-wr1043nd | \
+       tl-wr1043nd-v2 | \
        tl-wr2543n)
                [ "$magic" != "0100" ] && {
                        echo "Invalid image type."
@@ -252,13 +277,6 @@ platform_check_image() {
                }
                return 0
                ;;
-       wrt160nl)
-               [ "$magic" != "4e4c" ] && {
-                       echo "Invalid image type."
-                       return 1
-               }
-               return 0
-               ;;
        routerstation | \
        routerstation-pro | \
        ls-sr71 | \
@@ -327,6 +345,10 @@ platform_do_upgrade() {
        om2p-lc)
                platform_do_upgrade_openmesh "$ARGV"
                ;;
+       uap-pro)
+               MTD_CONFIG_ARGS="-s 0x180000"
+               default_do_upgrade "$ARGV"
+               ;;
        *)
                default_do_upgrade "$ARGV"
                ;;