ar71xx: wndr4300: set official mac addresses

Get the factory assigned mac addresses stored in the caldata
partition and asign them to lan and wan interfaces. Also put
the correct mac addresses into the WiFi eeprom files to ensure
that the ath9k driver will use the correct ones.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Patchwork: http://patchwork.openwrt.org/patch/4350/
[juhosg:
  - move WiFi MAC address setup to the firmware hotplug file,
  - use the official MAC address for the 2.4GHz as well,
  - remove uci-defaults.sh modifications,
  - update commit message]
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@38812 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Gabor Juhos 2013-11-15 08:21:59 +00:00
parent 448a6b8d51
commit 2681696e2f
2 changed files with 15 additions and 2 deletions

View File

@ -11,8 +11,6 @@ ath9k_eeprom_extract() {
local count=$3 local count=$3
local mtd local mtd
. /lib/functions.sh
mtd=$(find_mtd_chardev $part) mtd=$(find_mtd_chardev $part)
[ -n "$mtd" ] || \ [ -n "$mtd" ] || \
ath9k_eeprom_die "no mtd device found for partition $part" ath9k_eeprom_die "no mtd device found for partition $part"
@ -21,9 +19,18 @@ ath9k_eeprom_extract() {
ath9k_eeprom_die "failed to extract from $mtd" ath9k_eeprom_die "failed to extract from $mtd"
} }
ath9k_patch_firmware_mac() {
local mac=$1
[ -z "$mac" ] && return
macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=2 count=6
}
[ -e /lib/firmware/$FIRMWARE ] && exit 0 [ -e /lib/firmware/$FIRMWARE ] && exit 0
. /lib/ar71xx.sh . /lib/ar71xx.sh
. /lib/functions.sh
board=$(ar71xx_board_name) board=$(ar71xx_board_name)
@ -32,6 +39,7 @@ case "$FIRMWARE" in
case $board in case $board in
wndr4300) wndr4300)
ath9k_eeprom_extract "caldata" 4096 2048 ath9k_eeprom_extract "caldata" 4096 2048
ath9k_patch_firmware_mac $(mtd_get_mac_binary caldata 0)
;; ;;
*) *)
ath9k_eeprom_die "board $board is not supported yet" ath9k_eeprom_die "board $board is not supported yet"
@ -43,6 +51,7 @@ case "$FIRMWARE" in
case $board in case $board in
wndr4300) wndr4300)
ath9k_eeprom_extract "caldata" 20480 2048 ath9k_eeprom_extract "caldata" 20480 2048
ath9k_patch_firmware_mac $(mtd_get_mac_binary caldata 12)
;; ;;
*) *)
ath9k_eeprom_die "board $board is not supported yet" ath9k_eeprom_die "board $board is not supported yet"

View File

@ -211,6 +211,10 @@ wndr4300)
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" "1" "1"
ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4" ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
ucidef_add_switch_vlan "switch0" "2" "0t 5" ucidef_add_switch_vlan "switch0" "2" "0t 5"
mac_lan=$(mtd_get_mac_binary caldata 0)
[ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
mac_wan=$(mtd_get_mac_binary caldata 6)
[ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
;; ;;
all0305 |\ all0305 |\