ar71xx: add Abicom SC450 support
[openwrt/openwrt.git] / target / linux / ar71xx / base-files / lib / ar71xx.sh
index 1e7427d..6c3396b 100755 (executable)
@@ -64,6 +64,40 @@ wndr3700_board_detect() {
        AR71XX_MODEL="$machine"
 }
 
+ubnt_get_mtd_part_magic() {
+       ar71xx_get_mtd_offset_size_format EEPROM 4118 2 %02x
+}
+
+ubnt_xm_board_detect() {
+       local model
+       local magic
+
+       magic="$(ubnt_get_mtd_part_magic)"
+       case ${magic:0:3} in
+               "e00"|\
+               "e01"|\
+               "e80")
+                       model="Ubiquiti NanoStation M"
+                       ;;
+               "e0a")
+                       model="Ubiquiti NanoStation loco M"
+                       ;;
+               "e1b"|\
+               "e1d")
+                       model="Ubiquiti Rocket M"
+                       ;;
+               "e20"|\
+               "e2d")
+                       model="Ubiquiti Bullet M"
+                       ;;
+               "e30")
+                       model="Ubiquiti PicoStation M"
+                       ;;
+       esac
+
+       [ -z "$model" ] || AR71XX_MODEL="${model}${magic:3:1}"
+}
+
 cybertan_get_hw_magic() {
        local part
 
@@ -184,6 +218,9 @@ tplink_board_detect() {
        "080100"*)
                model="TP-Link TL-WA801N/ND"
                ;;
+       "080200"*)
+               model="TP-Link TL-WR802N"
+               ;;
        "083000"*)
                model="TP-Link TL-WA830RE"
 
@@ -213,6 +250,9 @@ tplink_board_detect() {
        "090100"*)
                model="TP-Link TL-WA901N/ND"
                ;;
+       "094000"*)
+               model="TP-Link TL-WR940N"
+               ;;
        "094100"*)
                if [ "$hwid" = "09410002" -a "$mid" = "00420001" ]; then
                        model="Rosewill RNX-N360RT"
@@ -313,24 +353,10 @@ tplink_pharos_get_model_string() {
 tplink_pharos_board_detect() {
        local model_string="$(tplink_pharos_get_model_string | tr -d '\r')"
        local oIFS="$IFS"; IFS=":"; set -- $model_string; IFS="$oIFS"
-       local model
 
-       case "$1" in
-       'CPE210(TP-LINK|UN|N300-2)')
-               model='TP-Link CPE210'
-               ;;
-       'CPE220(TP-LINK|UN|N300-2)')
-               model='TP-Link CPE220'
-               ;;
-       'CPE510(TP-LINK|UN|N300-5)')
-               model='TP-Link CPE510'
-               ;;
-       'CPE520(TP-LINK|UN|N300-5)')
-               model='TP-Link CPE520'
-               ;;
-       esac
+       local model="${1%%\(*}"
 
-       [ -n "$model" ] && AR71XX_MODEL="$model v$2"
+       AR71XX_MODEL="TP-Link $model v$2"
 }
 
 gl_inet_board_detect() {
@@ -395,9 +421,6 @@ ar71xx_board_detect() {
        *"Arduino Yun")
                name="arduino-yun"
                ;;
-       *AP113)
-               name="ap113"
-               ;;
        *"AP121 reference board")
                name="ap121"
                ;;
@@ -425,11 +448,8 @@ ar71xx_board_detect() {
        *"AP152 reference board")
                name="ap152"
                ;;
-       *AP81)
-               name="ap81"
-               ;;
-       *AP83)
-               name="ap83"
+       *AP90Q)
+               name="ap90q"
                ;;
        *"Archer C5")
                name="archer-c5"
@@ -443,18 +463,39 @@ ar71xx_board_detect() {
        *AW-NR580)
                name="aw-nr580"
                ;;
+       *BHR-4GRV2)
+               name="bhr-4grv2"
+               ;;
        *CAP324)
                name="cap324"
                ;;
        *C-55)
                name="c-55"
                ;;
+       *C-60)
+               name="c-60"
+               ;;
        *CAP4200AG)
                name="cap4200ag"
                ;;
-       *"COMFAST CF-E316N v2")
+       *"CF-E316N v2")
                name="cf-e316n-v2"
                ;;
+       *"CF-E320N v2")
+               name="cf-e320n-v2"
+               ;;
+       *"CF-E380AC v1")
+               name="cf-e380ac-v1"
+               ;;
+       *"CF-E380AC v2")
+               name="cf-e380ac-v2"
+               ;;
+       *CF-E520N)
+               name="cf-e520n"
+               ;;
+       *CF-E530N)
+               name="cf-e530n"
+               ;;
        *"CPE210/220")
                name="cpe210"
                tplink_pharos_board_detect
@@ -463,12 +504,29 @@ ar71xx_board_detect() {
                name="cpe510"
                tplink_pharos_board_detect
                ;;
+       *CPE830)
+               name="cpe830"
+               ;;
+       *CPE870)
+               name="cpe870"
+               ;;
+       *WBS210)
+               name="wbs210"
+               tplink_pharos_board_detect
+               ;;
+       *WBS510)
+               name="wbs510"
+               tplink_pharos_board_detect
+               ;;
        *CR3000)
                name="cr3000"
                ;;
        *CR5000)
                name="cr5000"
                ;;
+       *"DAP-2695 rev. A1")
+               name="dap-2695-a1"
+               ;;
        *"DB120 reference board")
                name="db120"
                ;;
@@ -503,6 +561,9 @@ ar71xx_board_detect() {
        *"DIR-835 rev. A1")
                name="dir-835-a1"
                ;;
+       *"DIR-869 rev. A1")
+               name="dir-869-a1"
+               ;;
        *"dLAN Hotspot")
                name="dlan-hotspot"
                ;;
@@ -524,6 +585,16 @@ ar71xx_board_detect() {
        *"Domino Pi")
                name="gl-domino"
                ;;
+       *"DW33D")
+               name="dw33d"
+               ;;
+       *E2100L)
+               name="e2100l"
+               ;;
+       *"EAP120")
+               name="eap120"
+               tplink_pharos_board_detect
+               ;;
        *"EAP300 v2")
                name="eap300v2"
                ;;
@@ -569,12 +640,14 @@ ar71xx_board_detect() {
                ;;
        *"Bullet M")
                name="bullet-m"
+               ubnt_xm_board_detect
                ;;
        *"Loco M XW")
                name="loco-m-xw"
                ;;
        *"Nanostation M")
                name="nanostation-m"
+               ubnt_xm_board_detect
                ;;
        *"Nanostation M XW")
                name="nanostation-m-xw"
@@ -702,12 +775,12 @@ ar71xx_board_detect() {
        *"PB44 reference board")
                name="pb44"
                ;;
-       *PB92)
-               name="pb92"
-               ;;
        *"Qihoo 360 C301")
                name="qihoo-c301"
                ;;
+       *"RE450")
+               name="re450"
+               ;;
        *"RouterBOARD 411/A/AH")
                name="rb-411"
                ;;
@@ -762,6 +835,9 @@ ar71xx_board_detect() {
        *"RouterBOARD 912UAG-5HPnD")
                name="rb-912uag-5hpnd"
                ;;
+       *"RouterBOARD 941-2nD")
+               name="rb-941-2nd"
+               ;;
        *"RouterBOARD 951G-2HnD")
                name="rb-951g-2hnd"
                ;;
@@ -791,6 +867,7 @@ ar71xx_board_detect() {
                ;;
        *"Rocket M")
                name="rocket-m"
+               ubnt_xm_board_detect
                ;;
        *"Rocket M TI")
                name="rocket-m-ti"
@@ -807,6 +884,12 @@ ar71xx_board_detect() {
        *RW2458N)
                name="rw2458n"
                ;;
+       *SC300M)
+               name="sc300m"
+               ;;
+       *SC450)
+               name="sc450"
+               ;;
        *"SMART-300")
                name="smart-300"
                ;;
@@ -819,6 +902,9 @@ ar71xx_board_detect() {
        *SOM9331)
                name="som9331"
                ;;
+       *SR3200)
+               name="sr3200"
+               ;;
        *TEW-632BRP)
                name="tew-632brp"
                ;;
@@ -843,6 +929,9 @@ ar71xx_board_detect() {
        *"TL-WR1043ND v2")
                name="tl-wr1043nd-v2"
                ;;
+       *"TL-WR1043ND v4")
+               name="tl-wr1043nd-v4"
+               ;;
        *TL-WR2543N*)
                name="tl-wr2543n"
                ;;
@@ -897,6 +986,9 @@ ar71xx_board_detect() {
        *"TL-WA801ND v3")
                name="tl-wa801nd-v3"
                ;;
+       *"TL-WR802N v1")
+               name="tl-wr802n-v1"
+               ;;
        *TL-WA901ND)
                name="tl-wa901nd"
                ;;
@@ -924,6 +1016,9 @@ ar71xx_board_detect() {
        *"TL-WDR6500 v2")
                name="tl-wdr6500-v2"
                ;;
+       *TL-WPA8630)
+               name="tl-wpa8630"
+               ;;
        *TL-WR741ND)
                name="tl-wr741nd"
                ;;
@@ -960,6 +1055,9 @@ ar71xx_board_detect() {
        *"TL-WR941N/ND v6")
                name="tl-wr941nd-v6"
                ;;
+       *"TL-WR940N v4")
+               name="tl-wr940n-v4"
+               ;;
        *"TL-WR703N v1")
                name="tl-wr703n"
                ;;
@@ -1098,6 +1196,15 @@ ar71xx_board_detect() {
        *WHR-HP-G300N)
                name="whr-hp-g300n"
                ;;
+       *XD3200)
+               name="xd3200"
+               ;;
+       *Z1)
+               name="z1"
+               ;;
+       *ZBT-WE1526)
+               name="zbt-we1526"
+               ;;
        *ZCN-1523H-2)
                name="zcn-1523h-2"
                ;;