Skip to content

Commit

Permalink
ath79: add Netgear WNDAP360
Browse files Browse the repository at this point in the history
SoC: Atheros AR7161
RAM: DDR 128 MiB (hynix h5dU5162ETR-E3C)
Flash: SPI-NOR 8 MiB (mx25l6406em2i-12g)
WLAN: 2.4/5 GHz
2.4 GHz: Atheros AR9220
5 GHz: Atheros AR9223
Ethernet: 4x 10/100/1000 Mbps (Atheros AR8021)
LEDs/Keys: 2/2 (Internet + System LED, Mesh button + Reset pin)
UART: RJ45 9600,8N1
Power: 12 VDC, 1.0 A

Installation instruction:
0. Make sure you have latest original firmware (3.7.11.4)
1. Connect to the Serial Port with a Serial Cable RJ45 to DB9/RS232
   (9600,8N1)
   screen  /dev/ttyUSB0 9600,cs8,-parenb,-cstopb,-hupcl,-crtscts,clocal
2. Configure your IP-Address to 192.168.1.42
3. When device boots hit spacebar
3. Configure the device for tftpboot
   setenv ipaddr 192.168.1.1
   setenv serverip 192.168.1.42
   saveenv
4. Reset the device
   reset
5. Hit again the spacebar
6. Now load the image via tftp:
   tftpboot 0x81000000 INITRAMFS.bin
7. Boot the image:
   bootm 0x81000000
8. Copy the squashfs-image to the device.
9. Do a sysupgrade.

https://openwrt.org/toh/netgear/wndap360

The device should be converted from kmod-owl-loader to nvmem-cells in the
future. Nvmem cells were not working. Maybe ATH9K_PCI_NO_EEPROM is missing.
That is why this commit is still using kmod-owl-loader. In the future
the device tree may look like this:

&ath9k0 {
       nvmem-cells = <&macaddr_art_120c>, <&cal_art_1000>;
       nvmem-cell-names = "mac-address", "calibration";
};

&ath9k1 {
       nvmem-cells = <&macaddr_art_520c>, <&cal_art_5000>;
       nvmem-cell-names = "mac-address", "calibration";
};

&art {
	...
	cal_art_1000: cal@1000 {
		reg = <0x1000 0xeb8>;
	};

	cal_art_5000: cal@5000 {
		reg = <0x5000 0xeb8>;
	};
};

Signed-off-by: Nick Hainke <vincent@systemli.org>
  • Loading branch information
PolynomialDivision authored and hauke committed Apr 30, 2022
1 parent 6e9c814 commit 8852729
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 2 deletions.
169 changes: 169 additions & 0 deletions target/linux/ath79/dts/ar7161_netgear_wndap360.dts
@@ -0,0 +1,169 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

#include "ar7100.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
compatible = "netgear,wndap360", "qca,ar7161";
model = "Netgear WNDAP360";

aliases {
led-boot = &led_power_orange;
led-failsafe = &led_power_orange;
led-running = &led_power_orange;
led-upgrade = &led_power_orange;
};

extosc: ref {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-output-names = "ref";
clock-frequency = <40000000>;
};

leds {
compatible = "gpio-leds";

led_power_orange: power_orange {
label = "orange:power";
gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
};
};

ath9k-leds {
compatible = "gpio-leds";

wifi_2g_green {
label = "green:wlan2g";
gpios = <&ath9k0 5 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};

wifi_5g_green {
label = "green:wlan5g";
gpios = <&ath9k1 5 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy1tpt";
};
};

keys {
compatible = "gpio-keys";

reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
};
};
};

&mdio0 {
status = "okay";

phy-mask = <0x0f>;
phy1: ethernet-phy@1 {
reg = <0x1>;
};
};

&eth0 {
status = "okay";

phy-mode = "rgmii";
phy-handle = <&phy1>;

nvmem-cells = <&macaddr_art_0>;
nvmem-cell-names = "mac-address";
};

&spi {
status = "okay";

flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;

partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

partition@0 {
label = "u-boot";
reg = <0x0 0x040000>;
read-only;
};

partition@40000 {
label = "u-boot-env";
reg = <0x40000 0x010000>;
read-only;
};

partition@50000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0x50000 0x790000>;
};

partition@7e0000 {
label = "nvram";
reg = <0x7e0000 0x010000>;
read-only;
};

art: partition@7f0000 {
label = "art";
reg = <0x7f0000 0x010000>;
read-only;
};
};
};
};

&pcie0 {
status = "okay";

ath9k0: wifi@0,11 {
compatible = "pci168c,0029";
reg = <0x8800 0 0 0 0>;
qca,no-eeprom;
nvmem-cells = <&macaddr_art_120c>;
nvmem-cell-names = "mac-address";
#gpio-cells = <2>;
gpio-controller;
};

ath9k1: wifi@0,12 {
compatible = "pci168c,0029";
reg = <0x9000 0 0 0 0>;
qca,no-eeprom;
nvmem-cells = <&macaddr_art_520c>;
nvmem-cell-names = "mac-address";
mac-address-increment = <1>;
#gpio-cells = <2>;
gpio-controller;
};
};


&art {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;

macaddr_art_0: macaddr@0 {
reg = <0x0 0x6>;
};

macaddr_art_120c: macaddr@120c {
reg = <0x120c 0x6>;
};

macaddr_art_520c: macaddr@520c {
reg = <0x520c 0x6>;
};
};
Expand Up @@ -49,6 +49,7 @@ ath79_setup_interfaces()
netgear,ex6400|\
netgear,ex7300|\
netgear,ex7300-v2|\
netgear,wndap360|\
ocedo,koala|\
ocedo,raccoon|\
onion,omega|\
Expand Down
Expand Up @@ -152,7 +152,8 @@ case "$FIRMWARE" in
"ath9k-eeprom-pci-0000:00:11.0.bin")
case $board in
buffalo,wzr-600dhp|\
buffalo,wzr-hp-ag300h)
buffalo,wzr-hp-ag300h|\
netgear,wndap360)
caldata_extract "art" 0x1000 0xeb8
;;
dlink,dir-825-b1)
Expand All @@ -170,7 +171,8 @@ case "$FIRMWARE" in
"ath9k-eeprom-pci-0000:00:12.0.bin")
case $board in
buffalo,wzr-600dhp|\
buffalo,wzr-hp-ag300h)
buffalo,wzr-hp-ag300h|\
netgear,wndap360)
caldata_extract "art" 0x5000 0xeb8
;;
dlink,dir-825-b1)
Expand Down
15 changes: 15 additions & 0 deletions target/linux/ath79/image/generic.mk
Expand Up @@ -1654,6 +1654,21 @@ define Device/netgear_ex7300-v2
endef
TARGET_DEVICES += netgear_ex7300-v2

define Device/netgear_wndap360
$(Device/netgear_generic)
SOC := ar7161
DEVICE_MODEL := WNDAP360
DEVICE_PACKAGES := kmod-leds-reset kmod-owl-loader
IMAGE_SIZE := 7744k
BLOCKSIZE := 256k
KERNEL := kernel-bin | append-dtb | gzip | uImage gzip
KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none
IMAGES := sysupgrade.bin
IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | \
check-size | append-metadata
endef
TARGET_DEVICES += netgear_wndap360

define Device/netgear_wndr3x00
$(Device/netgear_generic)
SOC := ar7161
Expand Down

1 comment on commit 8852729

@chunkeey
Copy link
Member

@chunkeey chunkeey commented on 8852729 May 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PolynomialDivision

The device should be converted from kmod-owl-loader to nvmem-cells in the future. Nvmem cells were not working. Maybe ATH9K_PCI_NO_EEPROM is missing. That is why this commit is still using kmod-owl-loader.

Hm, I think there's a misunderstanding here. The WiFi driver ath9k(-pci) alone won't initialize the EEPROM-less AR92xx chips. it depends on the (ath9k-pci-)owl-loader for that.
When you were testing with the nvmem dtb, did you include the kmod-owl-loader in the image as well? (and had the "qca,no-eeprom;" property removed?)

Yes, the owl-loader has nvmem support as well, it depends on the same properties.

The Netgear WNDR3700v1v2+3800+MACv1v2 use them in a similiar setup with the nvmem in dts and the owl-loader.
it should look like this during boot:

[    0.437418] PCI host bridge /ahb/apb/pcie-controller@17010000 ranges:
[    0.443884]  MEM 0x0000000010000000..0x0000000016ffffff
[    0.449107]   IO 0x0000000000000000..0x0000000000000000
[    0.486417] PCI host bridge to bus 0000:00
[    0.490574] pci_bus 0000:00: root bus resource [mem 0x10000000-0x16ffffff]
[    0.497436] pci_bus 0000:00: root bus resource [io  0x0000]
[    0.503020] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.509791] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.518210] pci 0000:00:11.0: [168c:ff1d] type 00 class 0x020000                                      <<--- enumerated with the owl emulation PCIID: 168c:ff1d 
[    0.524222] pci 0000:00:11.0: reg 0x10: [mem 0x00000000-0x0000ffff]
[    0.531721] pci 0000:00:12.0: [168c:ff1d] type 00 class 0x020000
[    0.537740] pci 0000:00:12.0: reg 0x10: [mem 0x00000000-0x0000ffff]
[    0.545590] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00
[    0.552213] pci 0000:00:11.0: BAR 0: assigned [mem 0x10000000-0x1000ffff]
[    0.559021] pci 0000:00:12.0: BAR 0: assigned [mem 0x10010000-0x1001ffff]
...

[   29.471683] ath9k_pci_owl_loader 0000:00:11.0: enabling device (0000 -> 0002)
[   29.479026] ath9k_pci_owl_loader 0000:00:12.0: enabling device (0000 -> 0002)
[   29.565343] ath9k_pci_owl_loader 0000:00:11.0: fixup device configuration
[   29.577280] ath9k_pci_owl_loader 0000:00:12.0: fixup device configuration
[   29.602339] pci 0000:00:11.0: [168c:0029] type 00 class 0x028000                                          <<--- enumerated with the ath9k supported PCIID for the AR9220-ish
[   29.608369] pci 0000:00:11.0: reg 0x10: [mem 0x10000000-0x1000ffff]
[   29.614708] pci 0000:00:11.0: PME# supported from D0 D3hot
[   29.621685] pci 0000:00:11.0: BAR 0: assigned [mem 0x10000000-0x1000ffff]
[   29.630344] pci 0000:00:12.0: [168c:0029] type 00 class 0x028000                          
[   29.636371] pci 0000:00:12.0: reg 0x10: [mem 0x10010000-0x1001ffff]
[   29.642689] pci 0000:00:12.0: PME# supported from D0 D3hot
[   29.649635] pci 0000:00:12.0: BAR 0: assigned [mem 0x10010000-0x1001ffff]
[   30.180891] ath9k 0000:00:11.0: enabling device (0000 -> 0002)                                           <<--- ath9k(-pci) picks it up from here
[   30.220221] ath: phy0: Ignoring endianness difference in EEPROM magic bytes.
[   30.228825] ath: EEPROM regdomain sanitized
[   30.228832] ath: EEPROM regdomain: 0x64
[   30.228837] ath: EEPROM indicates we should expect a direct regpair map
[   30.228855] ath: Country alpha2 being used: 00
[   30.228859] ath: Regpair used: 0x64
[   30.242588] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   30.244444] gpio-508 (fixed antenna group 1): hogged as output/high
[   30.250776] gpio-509 (fixed antenna group 1): hogged as output/high

Please sign in to comment.