brcm63xx: add device tree based board detection
authorJonas Gorski <jogo@openwrt.org>
Mon, 16 Mar 2015 11:52:26 +0000 (11:52 +0000)
committerJonas Gorski <jogo@openwrt.org>
Mon, 16 Mar 2015 11:52:26 +0000 (11:52 +0000)
Use the device tree model property for detecting the board instead
of board id from nvram if present.

Since we can now directly detect the DVA-G3810BN, we can remove the
extra check for it.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
SVN-Revision: 44834

target/linux/brcm63xx/base-files/lib/brcm63xx.sh

index d16d52bec5ca3c0801125088fa7e004a69c15beb..4b603a1730dbdc2f098212191740c8ad3216a3a0 100755 (executable)
@@ -11,113 +11,208 @@ sys_mtd_part=""
 brcm63xx_has_reset_button=""
 ifname=""
 
-brcm63xx_legacy_detect() {
+brcm63xx_dt_detect() {
        local board_name
 
        case "$1" in
-       963281TAN)
-               board_name="bcm963281tan"
+       "ADB P.DG A4001N")
+               board_name="a4001n"
                ;;
-       963281T_TEF)
+       "ADB P.DG A4001N1")
                board_name="a4001n1"
                ;;
-       96328avng)
-               board_name="bcm96328avng"
+       "Alcatel RG100A")
+               board_name="rg100a"
                ;;
-       96328dg2x2)
-               board_name="a4401n"
+       "ASMAX AR 1004g")
+               board_name="ar100g"
                ;;
-       96328A-1241N)
-               board_name="ar-5381u"
+       "Belkin F5D7633")
+               board_name="f5d7633"
                ;;
-       96328A-1441N1)
-               board_name="ar-5387un"
+       "Broadcom 96348R reference board")
+               board_name="bcm96348r"
                ;;
-       96348GW)
-               board_name="bcm96348gw"
+       "Broadcom bcm963281TAN reference board")
+               board_name="bcm963281tan"
                ;;
-       96348GW-11)
+       "Broadcom BCM96328avng reference board")
+               board_name="bcm6328avng"
+               ;;
+       "Broadcom BCM96345GW2 reference board")
+               board_name="bcm96345gw2"
+               ;;
+       "Broadcom BCM96348GW-10 reference board")
+               board_name="bcm96348gw-10"
+               ;;
+       "Broadcom BCM96348GW-11 reference board")
                board_name="bcm96348gw-11"
                ;;
-       96358-502V)
-               board_name="spw303v"
+       "Broadcom BCM96348GW reference board")
+               board_name="bcm96358gw"
                ;;
-       96368M-1341N)
-               board_name="vr-3025un"
+       "Broadcom BCM96358VW reference board")
+               board_name="bcm96358vw"
+               ;;
+       "Broadcom BCM96358VW2 reference board")
+               board_name="bcm96358vw2"
+               ;;
+       "Broadcom BCM96368MVNgr reference board")
+               board_name="bcm96368mvngr"
+               ;;
+       "Broadcom BCM96368MVWG reference board")
+               board_name="bcm96368mvwg"
+               ;;
+       "BT Voyager V2500V")
+               board_name="v2500v"
+               ;;
+       "Comtrend AR-5381u")
+               board_name="ar-5381u"
+               ;;
+       "Comtrend AR-5387un")
+               board_name="ar-5387un"
                ;;
-       96368M-1541N)
+       "Comtrend CT-5365")
+               board_name="ct-5365"
+               ;;
+       "Comtrend CT-536+/CT-5621T")
+               board_name="ct-536p_5621t"
+               ;;
+       "Comtrend CT-6373")
+               board_name="ct-6373"
+               ;;
+       "Comtrend VR-3025u")
                board_name="vr-3025u"
                ;;
-       96369R-1231N)
+       "Comtrend VR-3025un")
+               board_name="vr-3025un"
+               ;;
+       "Comtrend WAP-5813n")
                board_name="wap-5813n"
                ;;
-       AR1004G)
-               board_name="ar1004g"
+       "Davolink DV-201AMR")
+               board_name="dv-201amr"
                ;;
-       AW4139 |\
-       AW4339U)
+       "D-Link DSL-2640B rev B2")
+               board_name="dsl-2640b-b"
+               ;;
+       "D-Link DSL-2650U")
+               board_name="dsl-2650u"
+               ;;
+       "D-Link DSL-2740B/DSL-2741B rev C2/3")
                board_name="dsl-274xb-c"
                ;;
-       AW5200B)
-               board_name="dsl-275xb-d"
+       "D-Link DSL-2740B/DSL-2741B rev F1")
+               board_name="dsl-274xb-f"
                ;;
-       CPVA642)
-               board_name="cpva642"
+       "D-Link DVA-G3810BN/TL")
+               board_name="dva-g3810bn"
+               ;;
+       "Dynalink RTA1025W")
+               board_name="rta1025w"
+               ;;
+       "Dynalink RTA1320")
+               board_name="rta1320"
+               ;;
+       "Huawei EchoLife HG520v")
+               board_name="hg520v"
+               ;;
+       "Huawei EchoLife HG553")
+               board_name="hg553"
+               ;;
+       "Huawei EchoLife HG556a (version A)")
+               board_name="hg556a_a"
+               ;;
+       "Huawei EchoLife HG556a (version B)")
+               board_name="hg556a_b"
                ;;
-       CT536_CT5621)
-               board_name="ct536_ct5621"
+       "Huawei EchoLife HG556a (version C)")
+               board_name="hg556a_c"
+               ;;
+       "Inventel Livebox 1")
+               board_name="livebox1"
                ;;
-       CVG834G_E15R3921)
+       "Netgear CVG834G")
                board_name="cvg834g"
                ;;
-       D-4P-W)
-               board_name="dsl-2640b-b"
+       "Netgear DG834GT/PN")
+               board_name="dg834gt"
                ;;
-       DGND3700v1_3800B)
+       "Netgear DGND3700v1/DGND3800B")
                board_name="dgnd3700v1_dgnd3800b"
                ;;
-       "F@ST2504n")
+       "Pirelli A226G")
+               board_name="a226g"
+               ;;
+       "Pirelli A226M")
+               board_name="a226m"
+               ;;
+       "Pirelli A226M-FWB")
+               board_name="a226m-fwb"
+               ;;
+       "Pirelli Alice Gate AGPF-S0")
+               board_name="agpf-s0"
+               ;;
+       "Sagem F@ST2404")
+               board_name="fast2404"
+               ;;
+       "Sagem F@ST2504n")
                board_name="fast2504n"
                ;;
-       'F@ST2704V2')
+       "Sagem F@ST2604")
+               board_name="fast2604"
+               ;;
+       "Sagem F@ST2704V2")
                board_name="fast2704v2"
                ;;
-       GW6000)
-               board_name="gw6000"
+       "SFR Neuf Box 4"*)
+               board_name="neufbox4"
                ;;
-       GW6200)
-               board_name="gw6200"
+       "SFR neufbox 6 (Sercomm)")
+               board_name="neufbox6"
                ;;
-       HW553)
-               board_name="hg553"
+       "T-Com Speedport W303 V")
+               board_name="spw303v"
                ;;
-       HW556_A)
-               board_name="hg556a_a"
+       "T-Com Speedport W500 V")
+               board_name="spw500v"
                ;;
-       HW556_B)
-               board_name="hg556a_b"
+       "TECOM GW6000")
+               board_name="g6000"
                ;;
-       HW556_C)
-               board_name="hg556a_c"
+       "TECOM GW6200")
+               board_name="g6200"
                ;;
-       HW6358GW_B)
-               board_name="hg620"
+       "Telsey CPVA642-type (CPA-ZNTE60T)")
+               board_name="cpva642"
                ;;
-       NB6)
-               board_name="neufbox6"
+       "TP-Link TD-W8900GB")
+               board_name="td-w8900gb"
                ;;
-       P870HW-51a_v2)
+       "USRobotics 9108")
+               board_name="usr9108"
+               ;;
+       "Zyxel P870HW-51a v2")
                board_name="p870hw-51a_v2"
                ;;
+       *)
+               board_name="unknown"
+               ;;
+       esac
+
+       echo "$board_name"
+}
+
+brcm63xx_legacy_detect() {
+       local board_name
+
+       case "$1" in
        RTA770BW)
                board_name="rta770bw"
                ;;
        RTA770W)
                board_name="rta770w"
                ;;
-       SPW500V)
-               board_name="spw500v"
-               ;;
        V2110)
                board_name="v2110"
                ;;
@@ -134,18 +229,14 @@ brcm63xx_detect() {
 
        board_id=$(awk 'BEGIN{FS="[ \t:/]+"} /system type/ {print $4}' /proc/cpuinfo)
 
-       if [ "$board_id" = "96358VW" ] && [ -n "$(swconfig dev eth1 help 2>/dev/null)" ]; then
-               board_id="DVAG3810BN"
-       fi
-
        if [ -e /proc/device-tree ]; then
                model=$(cat /proc/device-tree/model)
+               board_name=$(brcm63xx_dt_detect "$model")
        else
                model="Unknown bcm63xx board"
+               board_name=$(brcm63xx_legacy_detect "$board_id")
        fi
 
-       board_name=$(brcm63xx_legacy_detect "$board_id")
-
        case "$board_name" in
        bcm963281tan)
                status_led="963281TAN::power"