ipq806x: add support for Nokia Airscale AC400i
authorKristjan Krušič <kristjan.krusic@krusic22.com>
Sat, 4 Feb 2023 16:00:57 +0000 (17:00 +0100)
committerKristjan Krušič <kristjan.krusic@krusic22.com>
Sun, 19 Mar 2023 17:02:34 +0000 (18:02 +0100)
Hardware
--------

SoC:    Qualcomm IPQ8065
RAM:    512 MB DDR3
Flash:  256 MB NAND (Macronix MX30UF2G18AC) (split into 2x128MB)
        4 MB SPI-NOR (Macronix MX25U3235F)
WLAN:   Qualcomm Atheros QCA9984 - 2.4Ghz
        Qualcomm Atheros QCA9984 - 5Ghz
ETH:    eth0 - POE (100Mbps in U-Boot, 1000Mbps in OpenWrt)
        eth1 - (1000Mbps in both)
        Auto-negotiation broken on both.
USB:    USB 2.0
LED:    5G, 2.4G, ETH1, ETH2, CTRL, PWR (All support green and red)
BTN:    Reset
Other:  SD card slot (non-functional)
Serial: 115200bps, near the Ethernet transformers, labeled 9X.
        Connections from the arrow to the 9X text:
[NC] - [TXD] - [GND] - [RXD] - [NC]

Installation
------------

0. Connect to the device
Plug your computer into LAN2 (1000Mbps connection required).
If you use the LAN1/POE port, set your computer to force a 100Mbps link.

Connect to the device via TTL (Serial) 115200n8.
Locate the header (or solder pads) labeled 9X,
near the Ethernet jacks/transformers.
There should be an arrow on the other side of the header marking.
The connections should go like this:
(from the arrow to the 9X text): NC - TXD - GND - RXD - NC

1. Prepare for installation
While the AP is powering up, interrupt the startup process.
MAKE SURE TO CHECK YOUR CURRENT PARTITION!

If you see: "Current Partition is : partB" or
"Need to switch partition from partA to partB",
you have to force the device into partA mode, before continuing.
This can be done by changing the PKRstCnt to 5 and resetting the device.

setenv PKRstCnt 5
saveenv
reset

After you interrupt the startup process again,
you should see: Need to switch partition from partB to partA

You can now continue to the next step.

If you see: "Current Partition is : partA",
you can continue to the next step.

2. Prevent partition switching.
To prevent the device from switching partitions,
we are going to modify the startup command.
set bootcmd "setenv PKRstCnt 0; saveenv; bootipq"
setenv

3. First boot
Now, we have to boot the OpenWrt intifs.
The easiest way to do this is by using Tiny PXE.
You can also use the normal U-Boot tftp method.

Run "bootp" this will get an IP from the DHCP server
and possibly the firmware image.
If it doesn't download the firmware image, run "tftpboot".

Now run "bootm" to run the image.

You might see:
"ERROR: new format image overwritten - must RESET the board to recover"
this means that the image you are trying to load is too big.
Use a smaller image for the initial boot.

4. Install OpenWrt from initfs
Once you are booted into OpenWrt,
transfer the OpenWrt upgrade image and
use sysupgrade to install OpenWrt to the device.

Signed-off-by: Kristjan Krušič <kristjan.krusic@krusic22.com>
package/boot/uboot-envtools/files/ipq806x
package/firmware/ipq-wifi/Makefile
target/linux/ipq806x/base-files/etc/board.d/01_leds
target/linux/ipq806x/base-files/etc/board.d/02_network
target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
target/linux/ipq806x/base-files/lib/upgrade/platform.sh
target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8065-ac400i.dts [new file with mode: 0644]
target/linux/ipq806x/image/generic.mk

index 77dfefbcd8196bf2a6edd55fb6936c60890cf70d..01a86c7b19fcae59360d1996152fe6e71e3b3224 100644 (file)
@@ -45,6 +45,9 @@ linksys,ea8500)
 netgear,r7800)
        ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x040000" "0x20000"
        ;;
+nokia,ac400i)
+       ubootenv_add_uci_config "/dev/mtd20" "0x0" "0x040000" "0x20000"
+       ;;
 qcom,ipq8064-ap148|\
 qcom,ipq8064-db149)
        ubootenv_add_uci_config $(ubootenv_mtdinfo)
index 992ecba839a4b29f384846f055560a0fd2306ee8..b3fbc36d33dbacea134b6df2fcb5ded2c5a389ea 100644 (file)
@@ -44,6 +44,7 @@ ALLWIFIBOARDS:= \
        glinet_gl-s1300 \
        linksys_ea8300 \
        linksys_whw03v2 \
+       nokia_ac400i \
        p2w_r619ac \
        pakedge_wr-1 \
        qnap_301w \
@@ -146,6 +147,7 @@ $(eval $(call generate-ipq-wifi-package,glinet_gl-ap1300,GL.iNet GL-AP1300))
 $(eval $(call generate-ipq-wifi-package,glinet_gl-s1300,GL.iNet GL-S1300))
 $(eval $(call generate-ipq-wifi-package,linksys_ea8300,Linksys EA8300))
 $(eval $(call generate-ipq-wifi-package,linksys_whw03v2,Linksys WHW03 V2))
+$(eval $(call generate-ipq-wifi-package,nokia_ac400i,Nokia AC400i))
 $(eval $(call generate-ipq-wifi-package,p2w_r619ac,P&W R619AC))
 $(eval $(call generate-ipq-wifi-package,pakedge_wr-1,Pakedge WR-1))
 $(eval $(call generate-ipq-wifi-package,qnap_301w,QNAP 301w))
index 2b259b90361465d1d021e5ee2e740bbf3f7be4b6..82ca270dd6b1159f2df512548148fda0a3ad5705 100644 (file)
@@ -43,6 +43,14 @@ netgear,xr500)
        ucidef_set_led_switch "wan" "WAN" "white:wan" "switch0" "0x20"
        ucidef_set_led_ide "esata" "eSATA" "white:esata"
        ;;
+nokia,ac400i)
+       ucidef_set_led_wlan "wlan5g" "5G" "green:wlan5g" "wlan0"
+       ucidef_set_led_wlan "wlan2g" "2.4G" "green:wlan2g" "wlan1"
+       ucidef_set_led_netdev "eth1" "ETH1" "green:eth1" "eth0"
+       ucidef_set_led_netdev "eth2" "ETH2" "green:eth2" "eth1"
+       ucidef_set_led_default "ctrl" "CTRL" "green:ctrl" "0"
+       ucidef_set_led_default "pwr" "PWR" "green:power" "1"
+       ;;
 tplink,ad7200)
        ucidef_set_led_usbport "usb1" "USB 1" "blue:usb1" "usb1-port1" "usb2-port1"
        ucidef_set_led_usbport "usb2" "USB 2" "blue:usb3" "usb3-port1" "usb4-port1"
index f38876b69f08df307e36d7853e97975f84b32e63..8dd52452b17395d02b6c3e4b207acba4ebea2a57 100644 (file)
@@ -85,6 +85,7 @@ tplink,onhub)
        ucidef_add_switch "switch0" \
                "1:lan" "6@eth1" "2:wan" "0@eth0"
        ;;
+nokia,ac400i |\
 ubnt,unifi-ac-hd)
        ucidef_set_interface_lan "eth0 eth1"
        ;;
index a0e2e9d1237bdfaa5d00e7a07aa7d98cacf8efe7..4c5019cf5bd247d0e9f1f5a546c0e5b02b39e8ae 100644 (file)
@@ -52,6 +52,10 @@ case "$FIRMWARE" in
                CI_UBIPART=art
                caldata_extract_ubi "ART" 0x1000 0x2f20
                ;;
+       nokia,ac400i)
+               caldata_extract "0:art" 0x1000 0x2f20
+               ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:appsblenv ethaddr) +2)
+               ;;
        zyxel,nbg6817)
                caldata_extract "0:art" 0x1000 0x2f20
                ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:appsblenv ethaddr) 1)
@@ -84,6 +88,10 @@ case "$FIRMWARE" in
                CI_UBIPART=art
                caldata_extract_ubi "ART" 0x5000 0x2f20
                ;;
+       nokia,ac400i)
+               caldata_extract "0:art" 0x5000 0x2f20
+               ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:appsblenv ethaddr) +3)
+               ;;
        zyxel,nbg6817)
                caldata_extract "0:art" 0x5000 0x2f20
                ath10k_patch_mac $(mtd_get_mac_ascii 0:appsblenv ethaddr)
index 67ceaab24fb5b65253592668c345c407b229ae67..5ec4f513bd33db2a43bab264ae4855123bb2358d 100644 (file)
@@ -18,6 +18,7 @@ platform_do_upgrade() {
        netgear,r7500v2 |\
        netgear,r7800 |\
        netgear,xr500 |\
+       nokia,ac400i |\
        qcom,ipq8064-ap148 |\
        qcom,ipq8064-ap161)
                nand_do_upgrade "$1"
diff --git a/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8065-ac400i.dts b/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8065-ac400i.dts
new file mode 100644 (file)
index 0000000..7151f8d
--- /dev/null
@@ -0,0 +1,318 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qcom-ipq8065-smb208.dtsi"
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "Nokia AC400i";
+       compatible = "nokia,ac400i", "qcom,ipq8065", "qcom,ipq8064";
+
+       aliases {
+               mdio-gpio0 = &mdio0;
+               ethernet0 = &gmac0;
+               ethernet1 = &gmac1;
+
+               led-boot = &pwr_red;
+               led-failsafe = &pwr_red;
+               led-running = &pwr_green;
+               led-upgrade = &pwr_green;
+       };
+
+       chosen {
+               bootargs-override = " console=ttyMSM0,115200n8 ubi.mtd=ubi root=/dev/ubiblock0_2";
+       };
+
+       keys {
+               compatible = "gpio-keys";
+               pinctrl-0 = <&button_pins>;
+               pinctrl-names = "default";
+
+               reset {
+                       label = "reset";
+                       gpios = <&qcom_pinmux 15 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESTART>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-0 = <&led_pins>;
+               pinctrl-names = "default";
+
+               5g_red {
+                       label = "red:5g";
+                       gpios = <&qcom_pinmux 65 GPIO_ACTIVE_HIGH>;
+               };
+
+               5g_green {
+                       label = "green:5g";
+                       gpios = <&qcom_pinmux 64 GPIO_ACTIVE_HIGH>;
+               };
+
+               2g_red {
+                       label = "red:2g";
+                       gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>;
+               };
+
+               2g_green {
+                       label = "green:2g";
+                       gpios = <&qcom_pinmux 54 GPIO_ACTIVE_HIGH>;
+               };
+
+               eth1_red {
+                       label = "red:eth1";
+                       gpios = <&qcom_pinmux 68 GPIO_ACTIVE_HIGH>;
+               };
+
+               eth1_green {
+                       label = "green:eth1";
+                       gpios = <&qcom_pinmux 22 GPIO_ACTIVE_LOW>;
+               };
+
+               eth2_red {
+                       label = "red:eth2";
+                       gpios = <&qcom_pinmux 67 GPIO_ACTIVE_HIGH>;
+               };
+
+               eth2_green {
+                       label = "green:eth2";
+                       gpios = <&qcom_pinmux 23 GPIO_ACTIVE_LOW>;
+               };
+
+               ctrl_red {
+                       label = "red:ctrl";
+                       gpios = <&qcom_pinmux 55 GPIO_ACTIVE_HIGH>;
+               };
+
+               ctrl_green {
+                       label = "green:ctrl";
+                       gpios = <&qcom_pinmux 56 GPIO_ACTIVE_HIGH>;
+               };
+
+               pwr_red: pwr_red {
+                       label = "red:pwr";
+                       gpios = <&qcom_pinmux 2 GPIO_ACTIVE_LOW>;
+               };
+
+               pwr_green: pwr_green {
+                       label = "green:pwr";
+                       gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&qcom_pinmux {
+       spi_pins: spi_pins {
+               mux {
+                       pins = "gpio18", "gpio19";
+                       function = "gsbi5";
+                       drive-strength = <10>;
+                       bias-pull-down;
+               };
+
+               clk {
+                       pins = "gpio21";
+                       function = "gsbi5";
+                       drive-strength = <12>;
+                       bias-pull-down;
+               };
+
+               cs {
+                       pins = "gpio20";
+                       function = "gpio";
+                       drive-strength = <10>;
+                       bias-pull-up;
+               };
+       };
+
+       led_pins: led_pins {
+               mux {
+                       pins = "gpio65", "gpio64",
+                                  "gpio53", "gpio54",
+                                  "gpio68", "gpio22",
+                                  "gpio67", "gpio23",
+                                  "gpio55", "gpio56",
+                                  "gpio2", "gpio26";
+                       function = "gpio";
+                       drive-strength = <2>;
+                       bias-pull-up;
+               };
+       };
+
+       button_pins: button_pins {
+               mux {
+                       pins = "gpio15";
+                       function = "gpio";
+                       drive-strength = <2>;
+                       bias-pull-up;
+               };
+       };
+
+};
+
+&gsbi5 {
+       qcom,mode = <GSBI_PROT_SPI>;
+       status = "okay";
+
+       spi4: spi@1a280000 {
+               status = "okay";
+               spi-max-frequency = <50000000>;
+
+               pinctrl-0 = <&spi_pins>;
+               pinctrl-names = "default";
+
+               cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>;
+
+               m25p80@0 {
+                       compatible = "jedec,spi-nor";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       spi-max-frequency = <50000000>;
+                       reg = <0>;
+
+                       partitions {
+                               compatible = "qcom,smem-part";
+                       };
+               };
+       };
+};
+
+&usb3_0 {
+       status = "okay";
+};
+
+&usb3_1 {
+       status = "okay";
+};
+
+&pcie0 {
+       status = "okay";
+
+       /delete-property/ pinctrl-0;
+       /delete-property/ pinctrl-names;
+       /delete-property/ perst-gpios;
+
+       bridge@0,0 {
+                       reg = <0x00000000 0 0 0 0>;
+                       #address-cells = <3>;
+                       #size-cells = <2>;
+                       ranges;
+
+                       wifi@1,0 {
+                                       compatible = "qcom,ath10k";
+                                       status = "okay";
+                                       reg = <0x00010000 0 0 0 0>;
+                                       qcom,ath10k-calibration-variant = "Nokia-AC400i";
+                       };
+       };
+};
+
+&pcie1 {
+       status = "okay";
+
+       /delete-property/ pinctrl-0;
+       /delete-property/ pinctrl-names;
+       /delete-property/ perst-gpios;
+
+       bridge@0,0 {
+                       reg = <0x00000000 0 0 0 0>;
+                       #address-cells = <3>;
+                       #size-cells = <2>;
+                       ranges;
+
+                       wifi@1,0 {
+                                       compatible = "qcom,ath10k";
+                                       status = "okay";
+                                       reg = <0x00010000 0 0 0 0>;
+                                       qcom,ath10k-calibration-variant = "Nokia-AC400i";
+                       };
+       };
+};
+
+&mdio0 {
+       status = "okay";
+       pinctrl-0 = <&mdio0_pins>;
+       pinctrl-names = "default";
+
+       phy0: ethernet-phy@0 {
+               reg = <0>;
+       };
+
+       phy1: ethernet-phy@1 {
+               reg = <1>;
+       };
+
+};
+
+//POE
+&gmac0 {
+       status = "okay";
+       qcom,id = <0>;
+
+       pinctrl-0 = <&rgmii2_pins>;
+       pinctrl-names = "default";
+
+       mdiobus = <&mdio0>;
+       phy-handle = <&phy0>;
+       phy-mode = "rgmii";
+
+       fixed-link {
+               speed = <1000>;
+               full-duplex;
+       };
+};
+
+//LAN1
+&gmac1 {
+       status = "okay";
+       qcom,id = <1>;
+
+       mdiobus = <&mdio0>;
+       phy-handle = <&phy1>;
+       phy-mode = "rgmii";
+
+       fixed-link {
+               speed = <1000>;
+               full-duplex;
+       };
+};
+
+&nand {
+       status = "okay";
+       pinctrl-0 = <&nand_pins>;
+       pinctrl-names = "default";
+
+       nand@0 {
+               reg = <0>;
+               compatible = "qcom,nandcs";
+
+               nand-ecc-strength = <4>;
+               nand-bus-width = <8>;
+               nand-ecc-step-size = <512>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       rootfs@0 {
+                               label = "rootfs";
+                               reg = <0x0000000 0x4000000>;
+                       };
+
+                       rootfs_1@4000000 {
+                               label = "rootfs_1";
+                               reg = <0x4000000 0x4000000>;
+                       };
+
+                       cfg@8000000 {
+                               label = "cfg";
+                               reg = <0x8000000 0x8000000>;
+                       };
+               };
+       };
+};
+
+&adm_dma {
+       status = "okay";
+};
index 91739bc858700b69276870967337fb734be68ff4..3e9b366c396235fe83a00ccd5ed8ba0d40e4ff99 100644 (file)
@@ -335,6 +335,20 @@ define Device/netgear_xr500
 endef
 TARGET_DEVICES += netgear_xr500
 
+define Device/nokia_ac400i
+       $(call Device/FitImage)
+       $(call Device/UbiFit)
+       DEVICE_VENDOR := Nokia
+       DEVICE_MODEL := AC400i
+       SOC := qcom-ipq8065
+       DEVICE_DTS := qcom-ipq8065-ac400i
+       BLOCKSIZE := 128k
+       PAGESIZE := 2048
+       BOARD_NAME := ac400i
+       DEVICE_PACKAGES := ath10k-firmware-qca9984-ct ipq-wifi-nokia-ac400i
+endef
+TARGET_DEVICES += nokia_ac400i
+
 define Device/qcom_ipq8064-ap148
        $(call Device/FitImage)
        $(call Device/UbiFit)