10-rt2x00-eeprom 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #!/bin/sh
  2. rt2x00_eeprom_die() {
  3. echo "rt2x00 eeprom: " "$*"
  4. exit 1
  5. }
  6. rt2x00_eeprom_extract() {
  7. local part=$1
  8. local offset=$2
  9. local count=$3
  10. local mtd
  11. . /lib/functions.sh
  12. mtd=$(find_mtd_part $part)
  13. [ -n "$mtd" ] || \
  14. rt2x00_eeprom_die "no mtd device found for partition $part"
  15. dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
  16. rt2x00_eeprom_die "failed to extract from $mtd"
  17. }
  18. [ -e /lib/firmware/$FIRMWARE ] && exit 0
  19. . /lib/ramips.sh
  20. board=$(ramips_board_name)
  21. case "$FIRMWARE" in
  22. "soc_wmac.eeprom")
  23. case $board in
  24. asl26555 | \
  25. dir-300-b1 | \
  26. dir-600-b1 | \
  27. dir-600-b2 | \
  28. dir-615-d)
  29. rt2x00_eeprom_extract "devdata" 16384 512
  30. ;;
  31. dap-1350)
  32. rt2x00_eeprom_extract "devdata" 0 512
  33. ;;
  34. rt-n10-plus | \
  35. rt-g32-b1)
  36. rt2x00_eeprom_extract "devconf" 0 512
  37. ;;
  38. f5d8235-v1 | \
  39. f5d8235-v2)
  40. rt2x00_eeprom_extract "u-boot" 262144 512
  41. ;;
  42. 3g-6200n | \
  43. 3g-6200nl | \
  44. 3g300m | \
  45. air3gii | \
  46. all0239-3g | \
  47. all0256n | \
  48. all5002 | \
  49. all5003 | \
  50. argus-atp52b | \
  51. awm002-evb | \
  52. bc2 | \
  53. br6425 | \
  54. broadway | \
  55. br6524n | \
  56. carambola | \
  57. d105 | \
  58. dir-615-h1 | \
  59. dir-620-a1 | \
  60. dir-620-d1 | \
  61. esr-9753 | \
  62. f7c027 | \
  63. fonera20n | \
  64. rt-n13u | \
  65. freestation5 | \
  66. hw550-3g | \
  67. mofi3500-3gn | \
  68. mpr-a1 | \
  69. mpr-a2 | \
  70. pwh2004 | \
  71. nbg-419n | \
  72. nw718 | \
  73. omni-emb | \
  74. omni-emb-hpm | \
  75. psr-680w | \
  76. rt-n15 | \
  77. rt-n56u | \
  78. sl-r7205 | \
  79. v11st-fe | \
  80. v22rw-2x2 | \
  81. w306r-v20 | \
  82. w150m | \
  83. w502u | \
  84. wcr-150gn | \
  85. whr-g300n | \
  86. wl-330n | \
  87. wl-330n3g | \
  88. wl-351 | \
  89. wli-tx4-ag300n | \
  90. wnce2001 | \
  91. wr512-3gn | \
  92. wr6202 | \
  93. mzk-w300nh2 | \
  94. ur-326n4g | \
  95. ur-336un | \
  96. xdxrn502j | \
  97. hg255d)
  98. rt2x00_eeprom_extract "factory" 0 512
  99. ;;
  100. wl341v3)
  101. rt2x00_eeprom_extract "board-nvram" 64880 512
  102. ;;
  103. *)
  104. rt2x00_eeprom_die "board $board is not supported yet"
  105. ;;
  106. esac
  107. ;;
  108. "rt2x00pci_1_0.eeprom")
  109. case $board in
  110. rt-n56u)
  111. rt2x00_eeprom_extract "factory" 32768 512
  112. ;;
  113. esac
  114. ;;
  115. esac