10-rt2x00-eeprom 820 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. hg622 |\
  29. hg655b)
  30. rt2x00_eeprom_extract "cal_data" 0 512
  31. ;;
  32. *)
  33. rt2x00_eeprom_die "board $board is not supported yet"
  34. ;;
  35. esac
  36. ;;
  37. esac