10-rt2x00-eeprom 810 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh
  2. # Based on gabors ralink wisoc implementation.
  3. rt2x00_eeprom_die() {
  4. echo "rt2x00 eeprom: " "$*"
  5. exit 1
  6. }
  7. rt2x00_eeprom_extract() {
  8. local part=$1
  9. local offset=$2
  10. local count=$3
  11. local mtd
  12. . /lib/functions.sh
  13. mtd=$(find_mtd_part $part)
  14. [ -n "$mtd" ] || \
  15. rt2x00_eeprom_die "no mtd device found for partition $part"
  16. dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count || \
  17. rt2x00_eeprom_die "failed to extract from $mtd"
  18. }
  19. [ -e /lib/firmware/$FIRMWARE ] && exit 0
  20. . /lib/brcm63xx.sh
  21. board=$(brcm63xx_board_name)
  22. case "$FIRMWARE" in
  23. "rt2x00.eeprom" )
  24. case $board in
  25. hg556a_c)
  26. rt2x00_eeprom_extract "cal_data" 130560 512
  27. ;;
  28. hg655b)
  29. rt2x00_eeprom_extract "cal_data" 0 512
  30. ;;
  31. *)
  32. rt2x00_eeprom_die "board $board is not supported yet"
  33. ;;
  34. esac
  35. ;;
  36. esac