summaryrefslogtreecommitdiffstats
path: root/target/linux/apm821xx/base-files
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@googlemail.com>2016-07-20 15:44:57 +0200
committerFelix Fietkau <nbd@nbd.name>2016-07-22 09:48:12 +0200
commit9e0fd1b52ad1f805a308bf6a5a13236f352fd962 (patch)
treec01eaf08bb04ea37b07070469e8077c402a5d111 /target/linux/apm821xx/base-files
parent47eeb9f857044de6e79c79577a1a7d6a57ac5046 (diff)
downloadmaster-31e0f0ae-9e0fd1b52ad1f805a308bf6a5a13236f352fd962.tar.gz
master-31e0f0ae-9e0fd1b52ad1f805a308bf6a5a13236f352fd962.tar.bz2
master-31e0f0ae-9e0fd1b52ad1f805a308bf6a5a13236f352fd962.zip
apm821xx: add support for the Netgear Centria N900 WNDR4700/WNDR4720
This patch adds support for Netgear Centria N900 WNDR4700/WNDR4720 hardware highlights: CPU: AMCC PowerPC APM82181 Rev. E at 1000 MHz (PLB=166, OPB=83, EBC=83 MHz) Security support, Boot ROM Location NAND wo/ECC 2k page (8 bits) 32 kB I-Cache 32 kB D-Cache, 256 kB L2-Cache, 32 kB OnChip Memory Board: AMCC APM82181 Evaluation Board, PCIE0/SATA1, 1*USB OTG DRAM: 256 MB (ECC not enabled, 500 Mb/s, 32-bit, CL3) NAND: 128 MiB (SLC, erase size: 128 KiB, page size: 2048, OOB size: 64) ETH: Atheros AR8327N Gigabit Switch (4 x LAN, 1 x WAN) USB: 2 x 3.0 (Renesas uPD720202K8-711-BAA-A, firmware not included) SATA: 1 x SATA-II 3.5" Hard Drive Bay for HDDs (DesignWare SATA). WLAN1: Atheros AR9380 5GHz 802.11an 3:3x3 WLAN2: Atheros AR9581 2.4GHz 802.11bgn 3:3x3 SDCARD: GL827L SD/MMC/MS Flash Card Reader (on internal dwc2 USB 2.0 host) I2C: GMT G781 (i2c-0 @ 0x4d - lm90 compatible temperature sensor) TC654 (i2c-0 @ 0x1b - Dual PWM fan Speed controller) WARNING: The serial port needs a TTL/RS-232 v3.3 level converter! INFO: Since this device only has a NAND chip. I opted for going with root.squashfs in a UBI volume. There's no squashfs/jffs2 image. This target produces three images. a. netgear factory image This image can be used to flash the Netgear WNDR4700 via the firmware recovery mechanism and the web admin site. The bootloader can be instructed to do a firmware recovery via the # fw_recovery command. It will start a tftp server and listen on 192.168.1.1 (the ipaddr variable in u-boot) for incoming, binary tftp clients. The firmware recovery mechanism is also started if any of the flash content which contains the kernel, device-tree definitions or the (fake)rootfs fails to verify or load. b. sysupgrade.tar image for sysupgrade An sysupgrade will replace the entire current LEDE installation with a newer version. This does include the kernel and the ubi rootfs partition. The configuration can be carried over automatically as well if desired. simply copy the sysupgrade.tar to a the WNDR4700 running LEDE and run: root@lede:~# sysupgrade sysupgrade.tar and let it reboot. Note: The devicetree flash area is NOT updated. Until the devicetree definition is stable, this can lead to all sorts of hardware detection problems! So make sure, if you experience issues: try the fw_recovery. If you are unsure whenever this affects you: test if you can reproduce your issue with the initramfs method. As it will always have up-to-date device-tree definitions. c. initramfs image for TFTP (for development and testing) To use the initramfs method, follow the following steps: 1) Move the "lede-apm821xx-netgear-WNDR4700-initramfs-kernel.bin" file to to the root directory of your TFTP server. 2) rename it to wndr4700.bin 3) On the WNDR4700 - Hit Enter during u-boot and insert: # tftp 400000 wndr4700.bin; run addtty; bootm 400000 - This will boot the LEDE image. Note: The default tftp server is 192.168.1.7, if you want to change it: # setenv serverip 192.168.8.7; Note2: The default address for the WNDR4700 is 192.168.1.1: # setenv ipaddr 192.168.8.8; Note: Connect you tftp server on the last LAN port (not the WAN) Note: The firmware for the USB 3.0 Host chip is not included anymore. Therefore the two USB 3.0 ports will not work without the uPD7070x-firmware package installed. Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Diffstat (limited to 'target/linux/apm821xx/base-files')
-rwxr-xr-xtarget/linux/apm821xx/base-files/etc/board.d/01_leds8
-rwxr-xr-xtarget/linux/apm821xx/base-files/etc/board.d/02_network6
-rwxr-xr-xtarget/linux/apm821xx/base-files/etc/diag.sh4
-rw-r--r--target/linux/apm821xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom89
-rwxr-xr-xtarget/linux/apm821xx/base-files/lib/apm821xx.sh4
-rwxr-xr-xtarget/linux/apm821xx/base-files/lib/upgrade/platform.sh9
6 files changed, 120 insertions, 0 deletions
diff --git a/target/linux/apm821xx/base-files/etc/board.d/01_leds b/target/linux/apm821xx/base-files/etc/board.d/01_leds
index bcc7a9f101..48fe139ce9 100755
--- a/target/linux/apm821xx/base-files/etc/board.d/01_leds
+++ b/target/linux/apm821xx/base-files/etc/board.d/01_leds
@@ -19,6 +19,14 @@ mr24)
mbl)
;;
+wndr4700)
+ ucidef_set_led_netdev "wan" "WAN (green)" "wndr4700:green:wan" "eth0.2"
+ ucidef_set_led_usbdev "usb3-1" "USB3-1" "wndr4700:blue:usb" "2-1"
+ ucidef_set_led_usbdev "usb3-2" "USB3-2" "wndr4700:blue:usb" "3-1"
+ ucidef_set_led_wlan "wlan2g" "WLAN2G" "wndr4700:blue:wlan" "phy0tpt"
+ ucidef_set_led_wlan "wlan5g" "WLAN5G" "wndr4700:blue:wlan" "phy1tpt"
+ ;;
+
*)
;;
esac
diff --git a/target/linux/apm821xx/base-files/etc/board.d/02_network b/target/linux/apm821xx/base-files/etc/board.d/02_network
index 9525d8c5f2..3a25709a2a 100755
--- a/target/linux/apm821xx/base-files/etc/board.d/02_network
+++ b/target/linux/apm821xx/base-files/etc/board.d/02_network
@@ -13,6 +13,12 @@ mbl | \
mr24)
ucidef_set_interface_lan "eth0"
;;
+
+wndr4700)
+ ucidef_add_switch "switch0" \
+ "0@eth0" "4:lan" "3:lan" "2:lan" "1:lan" "5:wan"
+ ;;
+
*)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
;;
diff --git a/target/linux/apm821xx/base-files/etc/diag.sh b/target/linux/apm821xx/base-files/etc/diag.sh
index bea66eb14d..3ddd21d844 100755
--- a/target/linux/apm821xx/base-files/etc/diag.sh
+++ b/target/linux/apm821xx/base-files/etc/diag.sh
@@ -13,6 +13,10 @@ get_status_led() {
status_led="mr24:green:power"
;;
+ wndr4700)
+ status_led="wndr4700:green:power"
+ ;;
+
*)
;;
esac
diff --git a/target/linux/apm821xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/apm821xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
new file mode 100644
index 0000000000..dfdc548d63
--- /dev/null
+++ b/target/linux/apm821xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+[ -e /lib/firmware/$FIRMWARE ] && exit 0
+
+. /lib/apm821xx.sh
+. /lib/functions.sh
+. /lib/functions/system.sh
+
+ath9k_eeprom_die() {
+ echo "ath9k eeprom: " "$*"
+ exit 1
+}
+
+ath9k_eeprom_extract() {
+ local part=$1
+ local offset=$2
+ local count=$3
+ local mtd
+
+ mtd=$(find_mtd_chardev $part)
+ [ -n "$mtd" ] || \
+ ath9k_eeprom_die "no mtd device found for partition $part"
+
+ dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
+ ath9k_eeprom_die "failed to extract from $mtd"
+}
+
+ath9k_ubi_eeprom_extract() {
+ local part=$1
+ local offset=$2
+ local count=$3
+ local ubidev=$(nand_find_ubi $CI_UBIPART)
+ local ubi
+
+ ubi=$(nand_find_volume $ubidev $part)
+ [ -n "$ubi" ] || \
+ ath9k_eeprom_die "no UBI volume found for $part"
+
+ dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
+ ath9k_eeprom_die "failed to extract from $ubi"
+}
+
+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
+}
+
+board=$(apm821xx_board_name)
+
+case "$FIRMWARE" in
+"pci_wmac0.eeprom")
+ case $board in
+ wndr4700)
+ . /lib/upgrade/nand.sh
+
+ if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
+ ath9k_ubi_eeprom_extract "caldata" 20480 4096
+ else
+ ath9k_eeprom_extract "wifi_data" 20480 4096
+ ath9k_patch_firmware_mac $(mtd_get_mac_binary wifi_data 12)
+ fi
+ ;;
+ *)
+ ath9k_eeprom_die "board $board is not supported yet"
+ ;;
+ esac
+ ;;
+
+"pci_wmac1.eeprom")
+ case $board in
+ wndr4700)
+ . /lib/upgrade/nand.sh
+
+ if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
+ ath9k_ubi_eeprom_extract "caldata" 4096 4096
+ else
+ ath9k_eeprom_extract "wifi_data" 4096 4096
+ ath9k_patch_firmware_mac $(mtd_get_mac_binary wifi_data 0)
+ fi
+ ;;
+ *)
+ ath9k_eeprom_die "board $board is not supported yet"
+ ;;
+ esac
+ ;;
+esac
diff --git a/target/linux/apm821xx/base-files/lib/apm821xx.sh b/target/linux/apm821xx/base-files/lib/apm821xx.sh
index 98e88cff6e..78fe452184 100755
--- a/target/linux/apm821xx/base-files/lib/apm821xx.sh
+++ b/target/linux/apm821xx/base-files/lib/apm821xx.sh
@@ -18,6 +18,10 @@ apm821xx_board_detect() {
name="mbl"
;;
+ *"Netgear WNDR4700/WNDR4720 Series")
+ name="wndr4700"
+ ;;
+
*)
name="unknown"
;;
diff --git a/target/linux/apm821xx/base-files/lib/upgrade/platform.sh b/target/linux/apm821xx/base-files/lib/upgrade/platform.sh
index d5b0986dd5..5559767a26 100755
--- a/target/linux/apm821xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/apm821xx/base-files/lib/upgrade/platform.sh
@@ -21,6 +21,11 @@ platform_check_image() {
return $?;
;;
+ wndr4700)
+ nand_do_platform_check $board "$1"
+ return $?;
+ ;;
+
*)
;;
esac
@@ -37,6 +42,10 @@ platform_pre_upgrade() {
merakinand_do_upgrade "$1"
;;
+ wndr4700)
+ nand_do_upgrade "$1"
+ ;;
+
*)
;;
esac