Files
openwrt/target/linux/airoha/image
Zhenpeng Zhou 0d7bfcb7e3 airoha: add support for Quantum Fiber Q1000K
Add the Q1000K optical network terminal using the UBI layout prepared
by its U-Boot chainloader and installer.

Hardware:
- Airoha AN7581SIT with four Cortex-A53 cores
- 512 MiB RAM and 512 MiB SPI-NAND
- One 1 GbE port on internal switch port 1 / PHY 9
- One 10 GbE port using RTL8261N at MDIO address 8
- Reset button and GPIO status/Ethernet LEDs; no Wi-Fi
- Power input: 12 V DC, 1.5 A
- UART: internal five-pin header, accessible by opening the case;
  115200 baud, 8N1, 1.8 V logic. With Ethernet ports pointing away,
  left to right: TX - GND - VCC - N/A - RX

Configure both copper ports as LAN members. Keep GDM2 and the PON PCS
explicitly disabled until the optical data path and provisioning are
supported. The chainloader reads the factory DSD and supplies Ethernet
MAC addresses through the device tree; both LAN ports use lan_mac.

Drive the 1 GbE jack LEDs from lan1. Invert both RTL8261N SerDes
TX and RX polarity to match the OEM PHY initialization.

MAC address layout on the inspected unit (unit-specific bytes masked):
- lan1 (1 GbE): 00:58:28:xx:xx:xx, DSD lan_mac via GDM1/DSA
- lan2 (10 GbE): 00:58:28:xx:xx:xx, DSD lan_mac via GDM4
- PON (disabled): 00:58:28:xx:xx:xx, DSD wan_mac via GDM2

The chainloader reads lan_mac/wan_mac from the first 16 KiB of factory
DSD at NAND offset 0x00400000 and sets mac-address/local-mac-address in
the Linux DT. Both LAN ports share lan_mac without a per-port increment.
OpenWrt does not read the MACs from the copied factory UBI volume.

Generate an initramfs recovery FIT and a sysupgrade FIT containing the
kernel, device tree and SquashFS. Use fit_check_image()/fit_do_upgrade()
for upgrades, and limit uploads to the chainloader's 256 MiB buffer.
Reserve the vendor bootloader/DSD, chainloader, ART and BMT regions;
place writable UBI between 0x00700000 and 0x1bd00000. UBI manages bad
blocks for OpenWrt without enabling the vendor BMT mapping layer.

Install with the Q1000K chainloader and installer at:
https://github.com/lightingghost/http-uboot-q1000k/commit/4b34476f2e76

Build and installation guide: doc/board/airoha/q1000k.rst

1. Build q1000k-chainload-uboot.itb with an AArch64 cross compiler:

     CROSS_COMPILE=aarch64-linux-gnu- JOBS=8 \
       ./scripts/build-chainloader-fit.sh

2. Open the case and connect a 1.8 V serial adapter to the UART header
   described above: adapter RX to board TX, adapter TX to board RX,
   and GND to GND. Leave VCC and N/A unconnected. Power the unit from
   its own supply, use 115200 8N1, and interrupt vendor autoboot.
   Connect a PC to the 1 GbE port, set 192.168.255.3/24, and serve the
   chainloader FIT over TFTP. At the vendor console, run:

     setenv serverip 192.168.255.3
     setenv ipaddr 192.168.255.1
     tftpboot 0x89000000 q1000k-chainload-uboot.itb

     iminfo 0x89000000
     bootm 0x89000000

3. Connect a PC to the 1 GbE port, set its address to 192.168.255.2/24,
   and open http://192.168.255.1. Select NAND Backup, then Download NAND
   Backup. Save the 512 MiB data-area backup before installation; it
   does not contain per-page OOB bytes.

4. Open Update U-Boot. Set U-Boot operation to "Install U-Boot and
   prepare UBI", select the same chainloader FIT, and click
   "Install U-Boot and Prepare UBI". Confirm the erase notice and wait
   for verification and reboot. The default "Update U-Boot only
   (keep UBI)" operation does not perform initial installation.

   Installation erases existing UBI firmware and settings. It writes
   the chainloader, prepares UBI, copies factory records and selects
   the new vendor boot command. The vendor first-stage bootloader,
   original DSD, ART and BMT/BBT regions are preserved.

5. Return to the HTTP interface after reboot. Optionally upload the
   quantum_q1000k-ubi initramfs-recovery.itb through Recovery Image first.
   If Linux recovery boots, hold Reset during the next chainloader
   startup to re-enter HTTP, or interrupt autoboot and run
   http_recovery at the chainloader prompt.

6. Upload the quantum_q1000k-ubi squashfs-sysupgrade.itb through Firmware
   Recovery. Both images must use the Q1000K UBI layout. Each HTTP
   upload recreates rootfs_data, so upload recovery before firmware.

7. Once OpenWrt boots, return the PC to DHCP. OpenWrt defaults to
   192.168.1.1; use SSH, or LuCI if included in the firmware build.
   Use normal OpenWrt sysupgrade for configuration-preserving updates.

Hold Reset during chainloader startup to force HTTP recovery later.
If installation fails, inspect its serial diagnostics and RAM-boot the
corrected chainloader before retrying. Uploading a new FIT to an old
running HTTP session still uses that session's installer code.

Compile-checked the DTS and verified image profile naming/compatibility,
shell syntax and patch style.

Observed on hardware: installed FIT boot, writable UBIFS overlay and
1 Gb/s full-duplex link/bridge forwarding on lan1. Traffic through the
10 GbE port, GPIO Ethernet LEDs and factory MAC handoff still require
hardware verification. PON service is not implemented by this port.

Prepared with assistance from Codex (OpenAI).

Signed-off-by: Zhenpeng Zhou <zhenp3ngzhou@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25146
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-09-14 13:11:49 +02:00
..