diff --git a/package/boot/uboot-envtools/files/apm821xx b/package/boot/uboot-envtools/files/apm821xx index bf61e972de..6bcc3ad62f 100644 --- a/package/boot/uboot-envtools/files/apm821xx +++ b/package/boot/uboot-envtools/files/apm821xx @@ -17,6 +17,10 @@ meraki,mr24) meraki,mx60) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" "4" ;; +netgear,wndap620|\ +netgear,wndap660) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x4000" "4" + ;; esac config_load ubootenv 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 632d22a470..dd529b528d 100755 --- a/target/linux/apm821xx/base-files/etc/board.d/01_leds +++ b/target/linux/apm821xx/base-files/etc/board.d/01_leds @@ -23,6 +23,22 @@ meraki,mx60) ucidef_set_led_switch "lan4" "LAN4" "mx60:green:lan4" "switch0" "0x02" ;; +netgear,wndap620) + ucidef_set_led_switch "lan_act" "LAN (Activity)" "wndap6x0:green:activity" "switch0" "0x04" "0x0f" "rx tx" + ucidef_set_led_switch "lan_100" "LAN 100Mbps" "wndap620:amber:link100" "switch0" "0x04" "0x04" "link" + ucidef_set_led_switch "lan_1000" "LAN 1000Mbps" "wndap620:green:link1000" "switch0" "0x04" "0x08" "link" + ;; + +netgear,wndap660) + ucidef_set_led_netdev "lan_act" "LAN (Activity)" "wndap6x0:green:activity" "eth0" + ucidef_set_led_switch "lan1_100" "LAN 100Mbps" "wndap660:amber:lan1-link100" "switch0" "0x04" "0x04" "link" + ucidef_set_led_switch "lan1_1000" "LAN 1000Mbps" "wndap660:green:lan1-link1000" "switch0" "0x04" "0x08" "link" + ucidef_set_led_switch "lan2_100" "LAN 100Mbps" "wndap660:amber:lan2-link100" "switch0" "0x02" "0x04" "link" + ucidef_set_led_switch "lan2_1000" "LAN 1000Mbps" "wndap660:green:lan2-link1000" "switch0" "0x02" "0x08" "link" + ucidef_set_led_wlan "wlan2g" "WLAN2G" "wndap6x0:green:wlan2g" "phy0tpt" + ucidef_set_led_wlan "wlan5g" "WLAN5G" "wndap6x0:green:wlan5g" "phy1tpt" + ;; + netgear,wndr4700) ucidef_set_led_switch "wan_green" "WAN (green)" "wndr4700:green:wan" "switch0" "0x20" ucidef_set_led_netdev "wan_yellow" "WAN (yellow)" "wndr4700:yellow:wan" "eth0.2" "tx rx" 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 6f4456e8a1..69bc038bd4 100755 --- a/target/linux/apm821xx/base-files/etc/board.d/02_network +++ b/target/linux/apm821xx/base-files/etc/board.d/02_network @@ -13,7 +13,12 @@ wd,mybooklive|\ wd,mybooklive-duo) ucidef_set_interface_lan "eth0" ;; - +netgear,wndap620) + ucidef_add_switch "switch0" "2:lan" "5@eth0" + ;; +netgear,wndap660) + ucidef_add_switch "switch0" "1:lan:2" "2:lan:1" "5@eth0" + ;; meraki,mx60|\ netgear,wndr4700) ucidef_add_switch "switch0" \ diff --git a/target/linux/apm821xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/apm821xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac new file mode 100644 index 0000000000..597b5dcca6 --- /dev/null +++ b/target/linux/apm821xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -0,0 +1,21 @@ +#!/bin/ash + +[ "$ACTION" == "add" ] || exit 0 + +PHYNBR=${DEVPATH##*/phy} + +[ -n $PHYNBR ] || exit 0 + +. /lib/functions.sh +. /lib/functions/system.sh + +board=$(board_name) + +case "$board" in +netgear,wndap620|\ +netgear,wndap660) + echo $(macaddr_add $(mtd_get_mac_ascii u-boot-env baseMAC) $(($PHYNBR + 1)) ) > /sys${DEVPATH}/macaddress + ;; +*) + ;; +esac diff --git a/target/linux/apm821xx/base-files/lib/upgrade/platform.sh b/target/linux/apm821xx/base-files/lib/upgrade/platform.sh index fa0aa38014..02c750130c 100755 --- a/target/linux/apm821xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/apm821xx/base-files/lib/upgrade/platform.sh @@ -26,6 +26,8 @@ platform_do_upgrade() { ;; meraki,mr24|\ meraki,mx60|\ + netgear,wndap620|\ + netgear,wndap660|\ netgear,wndr4700) nand_do_upgrade "$1" ;; diff --git a/target/linux/apm821xx/dts/netgear-wndap620.dts b/target/linux/apm821xx/dts/netgear-wndap620.dts new file mode 100644 index 0000000000..afaf0616ba --- /dev/null +++ b/target/linux/apm821xx/dts/netgear-wndap620.dts @@ -0,0 +1,28 @@ +/* + * Device Tree Source for Netgear WNDAP620 + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without + * any warranty of any kind, whether express or implied. + */ + +/dts-v1/; + +#include "netgear-wndap6x0.dtsi"; + +/ { + model = "Netgear WNDAP620"; + compatible = "netgear,wndap620", "apm,bluestone"; +}; + +&LEDS { + link1000 { + label = "wndap620:green:link1000"; + gpios = <&GPIO0 9 GPIO_ACTIVE_HIGH>; + }; + + link100 { + label = "wndap620:amber:link100"; + gpios = <&GPIO0 10 GPIO_ACTIVE_HIGH>; + }; +}; diff --git a/target/linux/apm821xx/dts/netgear-wndap660.dts b/target/linux/apm821xx/dts/netgear-wndap660.dts new file mode 100644 index 0000000000..3e5daac835 --- /dev/null +++ b/target/linux/apm821xx/dts/netgear-wndap660.dts @@ -0,0 +1,38 @@ +/* + * Device Tree Source for Netgear WNDAP660 + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without + * any warranty of any kind, whether express or implied. + */ + +/dts-v1/; + +#include "netgear-wndap6x0.dtsi" + +/ { + model = "Netgear WNDAP660"; + compatible = "netgear,wndap660", "apm,bluestone"; +}; + +&LEDS { + lan1-link1000 { + label = "wndap660:green:lan1-link1000"; + gpios = <&GPIO0 22 GPIO_ACTIVE_HIGH>; + }; + + lan1-link100 { + label = "wndap660:amber:lan1-link100"; + gpios = <&GPIO0 23 GPIO_ACTIVE_HIGH>; + }; + + lan2-link1000 { + label = "wndap660:green:lan2-link1000"; + gpios = <&GPIO0 9 GPIO_ACTIVE_HIGH>; + }; + + lan2-link100 { + label = "wndap660:amber:lan2-link100"; + gpios = <&GPIO0 10 GPIO_ACTIVE_HIGH>; + }; +}; diff --git a/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi b/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi new file mode 100644 index 0000000000..a163b1d82d --- /dev/null +++ b/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi @@ -0,0 +1,227 @@ +/* + * Device Tree Source for Netgear WNDAP620 and WNDAP660 + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without + * any warranty of any kind, whether express or implied. + */ + +#include "apm82181.dtsi" + +/ { + aliases { + serial0 = &UART0; + led-boot = &status; + led-failsafe = &failsafe; + led-running = &status; + led-upgrade = &status; + }; + + chosen { + stdout-path = "/plb/opb/serial@ef600300"; + }; +}; + +&CRYPTO { + status = "okay"; +}; + +&PKA { + status = "okay"; +}; + +&TRNG { + status = "okay"; +}; + +&EBC0 { + ndfc@1,0 { + status = "okay"; + /* 32 MiB SLC NAND Flash */ + nand { + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x00000000 0x00100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x00100000 0x00010000>; + read-only; + }; + + partition@110000,0 { + label = "firmware"; + reg = <0x00110000 0x01ac0000>; + }; + + partition@110000,1 { + /* + * The u-boot bootloader will look at this + * offset (0x110000) for an uImage binary. + */ + label = "kernel"; + reg = <0x00110000 0x003f0000>; + }; + + partition@500000 { + label = "ubi"; + reg = <0x00500000 0x016d0000>; + }; + + partition@1bd0000 { + /* + * original vendor device-tree - do not use or + * overwrite. The original u-boot also supports + * the gzipped legacy monolithic/Multi-File Image + * format, which is a better choice. + */ + label = "device-tree"; + reg = <0x01bd0000 0x0010000>; + read-only; + }; + + partition@1be0000 { + label = "var"; + reg = <0x01be0000 0x0400000>; + read-only; + }; + + partition@1fe0000 { + label = "manudata"; + reg = <0x01fe0000 0x20000 >; + read-only; + }; + }; + }; +}; + +&UART0 { + status = "okay"; +}; + +&GPIO0 { + status = "okay"; +}; + +&EMAC0 { + status = "okay"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + asym-pause; + }; + + mdio0: mdio { + #address-cells = <1>; + #size-cells = <0>; + }; +}; + +&POB0 { + gpio_keys_polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <2>; + poll-interval = <60>; /* 3 * 20 = 60ms */ + autorepeat; + + reset { + label = "Reset Button"; + gpios = <&GPIO0 16 GPIO_ACTIVE_HIGH>; + linux,code = ; + interrupt-parent = <&UIC1>; + interrupts = <0x15 IRQ_TYPE_EDGE_FALLING>; + }; + }; + + LEDS: gpio-leds { + compatible = "gpio-leds"; + + status: power { + label = "wndap6x0:green:power"; + gpios = <&GPIO0 18 GPIO_ACTIVE_HIGH>; + }; + + failsafe: test { + label = "wndap6x0:amber:test"; + gpios = <&GPIO0 17 GPIO_ACTIVE_HIGH>; + panic-indicator; + }; + + activity { + label = "wndap6x0:green:activity"; + gpios = <&GPIO0 21 GPIO_ACTIVE_HIGH>; + }; + + wlan2g { + label = "wndap6x0:green:wlan2g"; + gpios = <&GPIO0 19 GPIO_ACTIVE_HIGH>; + }; + + wlan5g { + label = "wndap6x0:green:wlan5g"; + gpios = <&GPIO0 20 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + internal-antenna { + gpio-export,name = "wndap6x0:internal-antenna"; + gpio-export,output = <1>; + gpios = <&GPIO0 11 GPIO_ACTIVE_HIGH>; + }; + + external-antenna { + gpio-export,name = "wndap6x0:external-antenna"; + gpio-export,output = <0>; + gpios = <&GPIO0 14 GPIO_ACTIVE_HIGH>; + }; + + mains-powered { + /* + * Input pin describing what powers the AP + * 0/Low = PoE + * 1/High = 12v mains powered + */ + gpio-export,name = "wndap620:mains-powered"; + gpios = <&GPIO0 3 GPIO_ACTIVE_HIGH>; + }; + }; + + rtl8367b { + compatible = "realtek,rtl8367b"; + cpu_port = <5>; + realtek,extif0 = <1 2 1 1 1 1 1 1 2>; + mii-bus = <&mdio0>; + }; +}; + +&PCIE0 { + status = "okay"; +}; + +&MSI { + status = "okay"; +}; + +&IIC0 { + status = "okay"; + + at24@52 { + compatible = "atmel,24c04"; + reg = <0x52>; + pagesize = <16>; + read-only; + }; +}; + diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile index 4a6ca9b633..4dec5fdf3c 100644 --- a/target/linux/apm821xx/image/Makefile +++ b/target/linux/apm821xx/image/Makefile @@ -152,6 +152,35 @@ define Build/MuImage-initramfs rm -rf $@.fakerd endef +define Device/netgear_wndap6x0 + DEVICE_PACKAGES := kmod-eeprom-at24 + SUBPAGESIZE := 256 + PAGESIZE := 512 + BLOCKSIZE := 16k + DTB_SIZE := 32768 + IMAGE_SIZE := 27392k + IMAGES := sysupgrade.tar factory.img + KERNEL_SIZE := 4032k + KERNEL := dtb | kernel-bin | gzip | MuImage-initramfs gzip + IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata + IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi + UBINIZE_OPTS := -E 5 +endef + +define Device/netgear_wndap620 + $(Device/netgear_wndap6x0) + DEVICE_TITLE := Netgear WNDAP620 - Premium Wireless-N + DEVICE_DTS := netgear-wndap620 +endef +TARGET_DEVICES += netgear_wndap620 + +define Device/netgear_wndap660 + $(Device/netgear_wndap6x0) + DEVICE_TITLE := Netgear WNDAP660 - Dual Radio Dual Band Wireless-N + DEVICE_DTS := netgear-wndap660 +endef +TARGET_DEVICES += netgear_wndap660 + define Device/netgear_wndr4700 DEVICE_TITLE := Netgear Centria N900 WNDR4700/WNDR4720 DEVICE_PACKAGES := badblocks block-mount e2fsprogs \ diff --git a/target/linux/apm821xx/nand/config-default b/target/linux/apm821xx/nand/config-default index 7b66f27d30..1c05a83fb1 100644 --- a/target/linux/apm821xx/nand/config-default +++ b/target/linux/apm821xx/nand/config-default @@ -39,8 +39,11 @@ CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_UBIFS_FS=y # CONFIG_UBIFS_FS_ADVANCED_COMPR is not set +CONFIG_RTL8366_SMI=y +CONFIG_RTL8367B_PHY=y CONFIG_SENSORS_LM90=y CONFIG_SENSORS_TC654=y CONFIG_SWCONFIG=y CONFIG_SWCONFIG_LEDS=y CONFIG_WNDR4700=y +