esrev.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/sh
  2. # Debug script to determine proper ES revision for the current board. The
  3. # pvrsrvkm module must be insmoded before attempting to get the es rev.
  4. machine_id() { # return the machine ID
  5. awk 'BEGIN { FS=": " } /Hardware/ \
  6. { gsub(" ", "_", $2); print tolower($2) } ' </proc/cpuinfo
  7. }
  8. if [ "$(machine_id)" = "ti8168evm" ] ; then
  9. CPUTYPE=TI816x
  10. elif [ "$(machine_id)" = "am335xevm" ] ; then
  11. CPUTYPE=TI33XX
  12. else
  13. CPUTYPE=$(devmem 0x4800244c | sed -e 's/0x00005C00/OMAP3503/' \
  14. -e 's/0x00001C00/OMAP3515/' \
  15. -e 's/0x00004C00/OMAP3525/' \
  16. -e 's/0x00000C00/OMAP3530/' \
  17. -e 's/0x00005E00/OMAP3503/' \
  18. -e 's/0x00001E00/OMAP3515/' \
  19. -e 's/0x00004E00/OMAP3525/' \
  20. -e 's/0x00000E00/OMAP3530/' \
  21. -e 's/0x00000CC0/OMAP3530/' )
  22. if [[ "$(echo $CPUTYPE | grep OMAP)" == "" ]]; then
  23. echo "Unable to determine CPU type"
  24. exit 1
  25. fi
  26. fi
  27. case $CPUTYPE in
  28. "OMAP3530")
  29. devmem 0x48004B48 w 0x2
  30. devmem 0x48004B10 w 0x1
  31. devmem 0x48004B00 w 0x2
  32. ES_REVISION="$(devmem 0x50000014 | sed -e s:0x00010205:5: \
  33. -e s:0x00010201:3: -e s:0x00010003:2:)"
  34. ;;
  35. "TI33XX")
  36. devmem 0x44e01104 w 0x0
  37. devmem 0x44e00904 w 0x2
  38. ES_REVISION="$(devmem 0x56000014 | sed -e s:0x00010205:8:)"
  39. ;;
  40. "TI816x")
  41. devmem 0x48180F04 w 0x0
  42. devmem 0x48180900 w 0x2
  43. devmem 0x48180920 w 0x2
  44. ES_REVISION="$(devmem 0x56000014 | sed -e s:0x00010205:6: \
  45. -e s:0x00010201:3: -e s:0x00010003:2:)"
  46. ;;
  47. *)
  48. echo Unable to determine SGX hardware
  49. exit 2
  50. ;;
  51. esac
  52. echo $ES_REVISION