]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
airoha: an7581: add Nokia Valyrian support 21761/head
authorChristian Marangi <ansuelsmth@gmail.com>
Wed, 28 Jan 2026 19:56:53 +0000 (20:56 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Tue, 17 Mar 2026 13:44:44 +0000 (14:44 +0100)
Add support for Nokia Valyrian based on Airoha AN7581 SoC.

Device specification
--------------------
SoC Type: Airoha AN7581
RAM: 2x DDR4 Nanya NT5AD256M16E4-JR (1GB)
Flash: eMMC Macronix MX52LM08A11XVW (1GB)
Ethernet: 3x gigabit via AN7581, 1x 10g via AS21x1x, 1x SFP cage
Wi-Fi: MT7996 - BE19000
LEDs: 11 LED via 2x 74HC595 shift register
Button: Reset, WPS, WiFi
USB ports: 1x 2.0
Miscellaneous:  1x Power Monitor via RTQ6059, 2x FXS port

Device is unfused and is originally flashed with Airoha SDK bootloader
that require signed images.

Bootloader is username/password protected and use the leaked auth combo
that can be found online.

From the bootloadet instruction on how to flash custom bootloader are:
1. mmc erase 0 0x800
2. tftpboot 192.168.1.10:airoha/an7581/openwrt-airoha-an7581-nokia_valyrian-preloader.bin
3. mmc write $loadaddr 0x4 0xfc
4. tftpboot 192.168.1.10:airoha/an7581/openwrt-airoha-an7581-nokia_valyrian-bl31-uboot.fip
5. mmc write $loadaddr 0x100 0x700

It's also possible to use the Emergency Recovery procedure:
From powered OFF device:
1. Keep the reset button pressed (middle button)
2. Power on the device
3. Notice the "Press x" prompt
4. Press x
5. Notice the "C" char waiting for XMODEM load
6. Load the preloader binary with XMODEM protocol
7. Notice the "Press x to load BL31 + U-Boot FIP"
8. Press x
9. Notice the "C" char waiting for XMODEM load
10. Load the fip binary with XMODEM protocol
11. You are now in U-Boot loaded from serial
12. Follow normal procedure to flash bootloader

Due to BOOTROM limitation. the device can't have a standard GPT table
implementation. Because of this fixed-partitions are used to handle this.

U-Boot still doesn't have support for this (it's planned) and currently to flash
and load and image it's needed to write and read from static address in eMMC.

The GPT partition table follow Prpl guidelines with dual partition table with
kernel and rootfs split.

The address for kernel is 0xb00000 and the address for rootfs is 0x1b00000.

Link: https://github.com/openwrt/openwrt/pull/21761
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
target/linux/airoha/an7581/base-files/etc/board.d/02_network
target/linux/airoha/dts/an7581-nokia-valyrian.dts [new file with mode: 0644]
target/linux/airoha/image/an7581.mk

index 734808cb3db942aff5050432fa6c8409ffd0f8eb..b6293658d9fc52c303008900513efabb0c0d003f 100644 (file)
@@ -17,6 +17,8 @@ an7581_setup_interfaces()
        gemtek,w1700k-ubi)
                ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" "wan"
                ;;
+       nokia,valyrian)
+               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 10g" "wan"
        *)
                echo "Unsupported hardware. Network interfaces not initialized"
                ;;
diff --git a/target/linux/airoha/dts/an7581-nokia-valyrian.dts b/target/linux/airoha/dts/an7581-nokia-valyrian.dts
new file mode 100644 (file)
index 0000000..ae24d07
--- /dev/null
@@ -0,0 +1,539 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/dts-v1/;
+
+#include <dt-bindings/leds/common.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include "an7581.dtsi"
+
+/ {
+       model = "Nokia Valyrian";
+       compatible = "nokia,valyrian", "airoha,an7581", "airoha,en7581";
+
+       aliases {
+               serial0 = &uart1;
+               led-boot = &led_status_white;
+               led-failsafe = &led_status_red;
+               led-running = &led_status_green;
+               led-upgrade = &led_status_blue;
+       };
+
+       chosen {
+               bootargs = "earlycon";
+               stdout-path = "serial0:115200n8";
+       };
+
+       memory@80000000 {
+               device_type = "memory";
+               reg = <0x0 0x80000000 0x2 0x00000000>;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               btn-0 {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&en7581_pinctrl 0 GPIO_ACTIVE_LOW>;
+               };
+
+               btn-1 {
+                       label = "wps";
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&en7581_pinctrl 13 GPIO_ACTIVE_LOW>;
+               };
+
+               btn-2 {
+                       label = "wifi";
+                       linux,code = <KEY_RFKILL>;
+                       gpios = <&en7581_pinctrl 16 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_status_red: led-0 {
+                       function = LED_FUNCTION_STATUS;
+                       color = <LED_COLOR_ID_RED>;
+                       gpios = <&leds_shift_reg 0 GPIO_ACTIVE_LOW>;
+               };
+
+               led_status_green: led-1 {
+                       function = LED_FUNCTION_STATUS;
+                       color = <LED_COLOR_ID_GREEN>;
+                       gpios = <&leds_shift_reg 1 GPIO_ACTIVE_LOW>;
+               };
+
+               led_status_blue: led-2 {
+                       function = LED_FUNCTION_STATUS;
+                       color = <LED_COLOR_ID_BLUE>;
+                       gpios = <&leds_shift_reg 2 GPIO_ACTIVE_LOW>;
+               };
+
+               led_status_white: led-3 {
+                       function = LED_FUNCTION_STATUS;
+                       color = <LED_COLOR_ID_WHITE>;
+                       gpios = <&leds_shift_reg 3 GPIO_ACTIVE_LOW>;
+               };
+
+               led-4 {
+                       function = LED_FUNCTION_POWER;
+                       color = <LED_COLOR_ID_AMBER>;
+                       gpios = <&leds_shift_reg 4 GPIO_ACTIVE_LOW>;
+               };
+
+               led-5 {
+                       function = LED_FUNCTION_POWER;
+                       color = <LED_COLOR_ID_GREEN>;
+                       gpios = <&leds_shift_reg 5 GPIO_ACTIVE_LOW>;
+                       default-state = "on";
+               };
+
+               led-6 {
+                       function = LED_FUNCTION_POWER;
+                       color = <LED_COLOR_ID_RED>;
+                       gpios = <&leds_shift_reg 6 GPIO_ACTIVE_LOW>;
+               };
+
+               led-7 {
+                       function = LED_FUNCTION_MOBILE;
+                       color = <LED_COLOR_ID_GREEN>;
+                       gpios = <&leds_shift_reg 7 GPIO_ACTIVE_LOW>;
+               };
+
+               led-8 {
+                       function = LED_FUNCTION_WAN;
+                       color = <LED_COLOR_ID_GREEN>;
+                       gpios = <&leds_shift_reg 8 GPIO_ACTIVE_LOW>;
+               };
+
+               led-9 {
+                       function = LED_FUNCTION_WAN;
+                       color = <LED_COLOR_ID_RED>;
+                       gpios = <&leds_shift_reg 9 GPIO_ACTIVE_LOW>;
+               };
+
+               led-10 {
+                       function = LED_FUNCTION_USB;
+                       color = <LED_COLOR_ID_GREEN>;
+                       gpios = <&leds_shift_reg 10 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       sfp: sfp {
+               compatible = "sff,sfp";
+
+               i2c-bus = <&i2c0>;
+
+               mod-def0-gpios = <&en7581_pinctrl 33 GPIO_ACTIVE_LOW>;
+               los-gpios = <&en7581_pinctrl 36 GPIO_ACTIVE_HIGH>;
+               tx-disable-gpios = <&en7581_pinctrl 41 GPIO_ACTIVE_HIGH>;
+               tx-fault-gpios = <&en7581_pinctrl 40 GPIO_ACTIVE_HIGH>;
+               maximum-power-milliwatt = <3000>;
+       };
+
+       i2c-1 {
+               compatible = "i2c-gpio";
+
+               sda-gpios = <&en7581_pinctrl 2 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+               scl-gpios = <&en7581_pinctrl 1 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+               i2c-gpio,delay-us = <2>;        /* ~100 kHz */
+
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               adc@40 {
+                       compatible = "richtek,rtq6059";
+                       reg = <0x40>;
+
+                       #io-channel-cells = <1>;
+               };
+       };
+
+       spi-0 {
+                compatible = "spi-gpio";
+
+                sck-gpios = <&en7581_pinctrl 4 GPIO_ACTIVE_HIGH>;
+                mosi-gpios = <&en7581_pinctrl 3 GPIO_ACTIVE_HIGH>;
+                cs-gpios = <&en7581_pinctrl 30 GPIO_ACTIVE_LOW>;
+
+                num-chipselects = <1>;
+
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                leds_shift_reg: gpio-expander@0 {
+                        compatible = "fairchild,74hc595";
+                        reg = <0>;
+
+                       enable-gpios = <&en7581_pinctrl 14 GPIO_ACTIVE_LOW>;
+
+                        gpio-controller;
+
+                        registers-number = <2>;
+                        spi-max-frequency = <100000>;
+
+                        #gpio-cells = <2>;
+                };
+        };
+};
+
+&en7581_pinctrl {
+       gpio-ranges = <&en7581_pinctrl 0 13 47>;
+
+       pcie1_rst_pins: pcie1-rst-pins {
+               conf {
+                       pins = "pcie_reset1";
+                       drive-open-drain = <1>;
+               };
+       };
+
+       pcie2_rst_pins: pcie2-rst-pins {
+               conf {
+                       pins = "pcie_reset2";
+                       drive-open-drain = <1>;
+               };
+       };
+
+       gswp1_led0_pins: gswp1-led1-pins {
+               mux {
+                       function = "phy1_led0";
+                       pins = "gpio43";
+               };
+       };
+
+       gswp2_led0_pins: gswp2-led1-pins {
+               mux {
+                       function = "phy2_led0";
+                       pins = "gpio44";
+               };
+       };
+
+       gswp3_led0_pins: gswp3-led1-pins {
+               mux {
+                       function = "phy3_led0";
+                       pins = "gpio45";
+               };
+       };
+
+       mmc_pins: mmc-pins {
+               mux {
+                       function = "emmc";
+                       groups = "emmc";
+               };
+       };
+};
+
+&mmc0 {
+       pinctrl-names = "default", "state_uhs";
+       pinctrl-0 = <&mmc_pins>;
+       pinctrl-1 = <&mmc_pins>;
+       status = "okay";
+
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       card@0 {
+               compatible = "mmc-card";
+               reg = <0>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       bl@800 {
+                               label = "bl2";
+                               reg = <0x00000800 0x0001f800>;
+                       };
+
+                       bootloader@20000 {
+                               label = "bootloader";
+                               reg = <0x00020000 0x000e0000>;
+                       };
+
+                       bootloader-inactive@100000 {
+                               label = "bootloader-inactive";
+                               reg = <0x00100000 0x000e0000>;
+                       };
+
+                       u-boot-env@1e0000 {
+                               label = "u-boot-env";
+                               reg = <0x001e0000 0x00020000>;
+
+                               nvmem-layout {
+                                       compatible = "u-boot,env-layout";
+                               };
+                       };
+
+                       factory@200000 {
+                               label = "factory";
+                               reg = <0x00200000 0x00800000>;
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       eeprom_factory_0: eeprom@0 {
+                                               reg = <0x40000 0x1e00>;
+                                       };
+
+                                       mac_factory_2c0000: mac@2c0000 {
+                                               compatible = "mac-base";
+                                               reg = <0x2c0000 0x6>;
+
+                                               #nvmem-cell-cells = <1>;
+                                       };
+
+                                       onu_type_factory_2e0000: onu_type@2e0000 {
+                                               reg = <0x2e0000 0x10>;
+                                       };
+
+                                       board_config_factory_2e0010: board_config@2e0010 {
+                                               reg = <0x2e0010 0x8>;
+                                       };
+                               };
+                       };
+
+                       mfgdata@a00000 {
+                               label = "mfgdata";
+                               reg = <0x00a00000 0x00100000>;
+                       };
+
+                       kernel-active@b00000 {
+                               label = "kernel-active";
+                               reg = <0x00b00000 0x00800000>;
+                       };
+
+                       kernel-inactive@1300000 {
+                               label = "kernel-inactive";
+                               reg = <0x01300000 0x00800000>;
+                       };
+
+                       rootfs-active@1b00000 {
+                               label = "rootfs-active";
+                               reg = <0x01b00000 0x06400000>;
+                       };
+
+                       rootfs-inactive@7f00000 {
+                               label = "rootfs-inactive";
+                               reg = <0x07f00000 0x06400000>;
+                       };
+
+                       rootfs-data@e300000 {
+                               label = "rootfs_data";
+                               reg = <0x0e300000 0x02000000>;
+                       };
+
+                       securestore@10300000 {
+                               label = "securestore";
+                               reg = <0x10300000 0x1000000>;
+                       };
+
+                       lcm-data@11300000 {
+                               label = "lcm_data";
+                               reg = <0x11300000 0x40000000>;
+                       };
+               };
+       };
+};
+
+&usb0 {
+       status = "okay";
+
+       mediatek,u3p-dis-msk = <0x1>;
+       phys = <&usb0_phy PHY_TYPE_USB2>;
+};
+
+&i2c0 {
+       status = "okay";
+};
+
+&pciephy {
+       status = "okay";
+};
+
+&pcie0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pcie1_rst_pins>;
+       status = "okay";
+
+       pcie@0,0 {
+               reg = <0x0000 0 0 0 0>;
+
+               wifi@0,0 {
+                       compatible = "mediatek,mt76";
+                       reg = <0x0000 0 0 0 0>;
+
+                       nvmem-cells = <&eeprom_factory_0>;
+                       nvmem-cell-names = "eeprom";
+
+                       airoha,npu = <&npu>;
+                       airoha,eth = <&eth>;
+
+                       band@0 {
+                               /* 2.4 GHz */
+                               reg = <0>;
+                               nvmem-cells = <&mac_factory_2c0000 6>;
+                               nvmem-cell-names = "mac-address";
+                       };
+
+                       band@1 {
+                               /* 5 GHz */
+                               reg = <1>;
+                               nvmem-cells = <&mac_factory_2c0000 7>;
+                               nvmem-cell-names = "mac-address";
+                       };
+
+                       band@2 {
+                               /* 6 GHz */
+                               reg = <2>;
+                               nvmem-cells =<&mac_factory_2c0000 8>;
+                               nvmem-cell-names = "mac-address";
+                       };
+               };
+       };
+};
+
+&pcie2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pcie2_rst_pins>;
+       status = "okay";
+};
+
+&eth {
+       status = "okay";
+};
+
+&gdm1 {
+       status = "okay";
+
+       nvmem-cells = <&mac_factory_2c0000 3>;
+       nvmem-cell-names = "mac-address";
+};
+
+&mdio {
+       as21xx: ethernet-phy@1c {
+               compatible = "ethernet-phy-ieee802.3-c45";
+               reg = <0x1c>;
+
+               firmware-name = "as21x1x_fw.bin";
+
+               reset-deassert-us = <1000000>;
+               reset-assert-us = <1000000>;
+               reset-gpios = <&en7581_pinctrl 31 GPIO_ACTIVE_LOW>;
+
+               leds {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       led@0 {
+                               reg = <0>;
+                               color = <LED_COLOR_ID_GREEN>;
+                               function = LED_FUNCTION_LAN;
+                               default-state = "keep";
+                       };
+               };
+       };
+};
+
+&switch {
+       status = "okay";
+};
+
+&pon_pcs {
+       status = "okay";
+};
+
+&gdm2 {
+       status = "okay";
+
+       sfp = <&sfp>;
+
+       managed = "in-band-status";
+       phy-mode = "usxgmii";
+
+       nvmem-cells = <&mac_factory_2c0000 4>;
+       nvmem-cell-names = "mac-address";
+
+       openwrt,netdev-name = "wan";
+};
+
+&eth_pcs {
+       status = "okay";
+};
+
+&gdm4 {
+       status = "okay";
+
+       managed = "in-band-status";
+       phy-handle = <&as21xx>;
+       phy-mode = "usxgmii";
+
+       nvmem-cells = <&mac_factory_2c0000 5>;
+       nvmem-cell-names = "mac-address";
+
+       openwrt,netdev-name = "10g";
+};
+
+&gsw_port1 {
+       label = "lan1";
+
+       status = "okay";
+};
+
+&gsw_phy1 {
+       pinctrl-names = "gbe-led";
+       pinctrl-0 = <&gswp1_led0_pins>;
+
+       status = "okay";
+};
+
+&gsw_phy1_led0 {
+       function = LED_FUNCTION_LAN;
+       active-low;
+
+       status = "okay";
+};
+
+&gsw_port2 {
+       label = "lan2";
+
+       status = "okay";
+};
+
+&gsw_phy2 {
+       pinctrl-names = "gbe-led";
+       pinctrl-0 = <&gswp2_led0_pins>;
+
+       status = "okay";
+};
+
+&gsw_phy2_led0 {
+       function = LED_FUNCTION_LAN;
+       active-low;
+
+       status = "okay";
+};
+
+&gsw_port3 {
+       label = "lan3";
+
+       status = "okay";
+};
+
+&gsw_phy3 {
+       pinctrl-names = "gbe-led";
+       pinctrl-0 = <&gswp3_led0_pins>;
+
+       status = "okay";
+};
+
+&gsw_phy3_led0 {
+       function = LED_FUNCTION_LAN;
+       active-low;
+
+       status = "okay";
+};
index e52eff03a94e79098fe76cb2dbae1058e0547797..5e001cb8163d43963d9e16cd9a44e804010008ba 100644 (file)
@@ -104,3 +104,17 @@ define Device/gemtek_w1700k-ubi
   SOC := an7581
 endef
 TARGET_DEVICES += gemtek_w1700k-ubi
+
+define Device/nokia_valyrian
+  DEVICE_VENDOR := Nokia
+  DEVICE_MODEL := Valyrian
+  DEVICE_DTS := an7581-nokia-valyrian
+  DEVICE_PACKAGES := kmod-spi-gpio kmod-gpio-nxp-74hc164 kmod-leds-gpio \
+    kmod-i2c-an7581 kmod-i2c-gpio kmod-iio-richtek-rtq6056 \
+    kmod-sfp kmod-phy-aeonsemi-as21xxx \
+    kmod-mt7996-firmware
+  ARTIFACT/preloader.bin := an7581-preloader nokia_valyrian
+  ARTIFACT/bl31-uboot.fip := an7581-bl31-uboot nokia_valyrian
+  ARTIFACTS := preloader.bin bl31-uboot.fip
+endef
+TARGET_DEVICES += nokia_valyrian