# Comprehensive auto-detection mechanisms for all boards
#
# The strategy for autodetection is to look for the most likely
# identifiers first, then resort to more sketchy means.
# Boards that define $soc are very reliable to detect, followed
# by the value of $ethact, followed by less reliable fingerprints.

cat << EOF

if test -n \$soc; then
  if test \$soc = tegra2; then
    setenv soc tegra20
  fi

  if test \$soc = tegra20 || test \$soc = tegra30 || test \$soc = tegra114 ; then
    run config_tegra
  elif test \$soc = am33xx; then
    run config_am33xx
  elif test \$soc = omap4; then
    run config_omap4
  elif test \$soc = omap5; then
    run config_omap5
  fi
elif test -n \$board; then
  if test \$board = cubox-i; then
    run config_cubox
  fi
elif test -n \$fdt_file; then
  if test \$fdt_file = imx6q-wandboard.dtb; then
    run config_wandboard
  fi
elif test -n \$ethact; then
  if test \$ethact = asx0; then
    run config_arndale
  elif test \$ethact = FEC0; then
    run config_utilite
  elif test \$ethact = egiga0; then
    if test -n \$mvNetConfig || test -n \$disaMvPnp; then
      run config_xp_gp
    fi
  elif test \$ethact = xgmac0; then
    fdt addr 1000
    fdt get value board / compatible
    if test \$board = calxeda,highbank; then
      run config_highbank
    elif test \$board = calxeda,ecx-2000; then
      run config_midway
    else
      run config_calxeda
    fi
  fi
elif test -n \$beaglerev; then
  run config_omap3
  setenv findfdt 'setenv fdtfile omap3-beagle-xm.dtb; if test \$beaglerev = C4; then setenv fdtfile omap3-beagle.dtb; elif test \$beaglerev = Cx; then setenv fdtfile omap3-beagle.dtb; fi'
elif test -n \$panicarg; then
  if test -n \$preboot; then
    test 1 = 1
  else
    run config_cubie
  fi
fi

EOF
