Skip to content

radxa-zero2: fancy u-boot v2026.01 // minimal+full fusb302 enablement#9253

Merged
rpardini merged 2 commits intoarmbian:mainfrom
rpardini:pr/radxa-zero2-fancy-u-boot-v202601--minimalfull-fusb302-enablement
Jan 16, 2026
Merged

radxa-zero2: fancy u-boot v2026.01 // minimal+full fusb302 enablement#9253
rpardini merged 2 commits intoarmbian:mainfrom
rpardini:pr/radxa-zero2-fancy-u-boot-v202601--minimalfull-fusb302-enablement

Conversation

@rpardini
Copy link
Member

@rpardini rpardini commented Jan 15, 2026

radxa-zero2: fancy u-boot v2026.01 // minimal+full fusb302 enablement

Summary by CodeRabbit

Release Notes

  • New Features

    • Added FUSB302 Type-C controller support for Radxa Zero 2
    • Introduced GPIO-based USB Type-C SuperSpeed switch functionality
    • Enhanced u-boot with LED support, EFI debugging, extended filesystem support, and improved USB gadget capabilities
  • Improvements

    • Optimized boot sequence to prioritize USB and NVMe devices
    • Added kernel support for GPIO-controlled Type-C multiplexing
  • Chores

    • Updated boot configuration to latest version (v2026.01)

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 15, 2026

📝 Walkthrough

Walkthrough

The pull request updates Radxa Zero 2 u-boot to version v2026.01 with enhanced features including preboot LED sequences, EFI debugging, compression algorithms, GPIO LED and USB Ethernet support. It introduces USB Type-C controller support via FUSB302 and a new GPIO-based SuperSpeed switch kernel driver. The kernel configuration is updated to enable the Type-C multiplexer, and the boot target sequence is reordered to prioritize USB and NVMe over MMC.

Changes

Cohort / File(s) Summary
U-Boot Configuration
config/boards/radxa-zero2.csc
Bumped boot patch version from v2024.07 to v2026.01; added new post_config_uboot_target__radxa-zero2_fancy_uboot() function that enables preboot with LED blink, EFI debugging (EFIDEBUG, NVEDIT_EFI), filesystem support (BTRFS), compression (LZO, BZIP2, ZSTD), GPIO LEDs, USB Ethernet drivers (ASIX variants, RTL8152, SMSC95XX), networking commands (NFS, WGET, DNS, TCP), LWIP stack, and UMS/RockUSB gadget support with FASTBOOT disabled.
USB Type-C Kernel Support
config/kernel/linux-meson64-edge.config
Added CONFIG_TYPEC_MUX_GPIO_SWITCH kernel config option set to module.
USB Type-C Driver Implementation
drivers/usb/typec/mux/gpio-superspeed-switch.c, drivers/usb/typec/mux/Kconfig, drivers/usb/typec/mux/Makefile
New GPIO-based SuperSpeed switch driver for USB Type-C; includes probe/remove paths, GPIO control for enable and orientation, and platform driver wiring. Updated Kconfig with TYPEC_MUX_GPIO_SWITCH symbol. Extended Makefile to build driver when config is enabled.
Device Tree and Bindings
arch/arm64/boot/dts/amlogic/meson-g12b-radxa-zero2.dts, Documentation/devicetree/bindings/usb/gpio-superspeed-switch.yaml, Documentation/devicetree/bindings/vendor-prefixes.yaml
Added FUSB302 Type-C controller (i2c3 node with interrupt and VBUS) and GPIO-based SuperSpeed switch to Radxa Zero 2 DTS with associated port configuration. New dt-binding YAML defines GPIO switch schema with enable-gpios, select-gpios, vcc-supply, orientation-switch, and ports properties. Added WCH vendor prefix for Nanjing Qinheng Microelectronics.
Boot Target Sequence
include/configs/meson64.h (via patch)
Reordered BOOT_TARGET_DEVICES macros to prioritize USB and NVMe/SCSI over MMC; reorganized MMC indices and integrated PXE/DHCP into revised macro structure.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • igorpecovnik
  • pyavitz
  • Tonymac32
  • NicoD-SBC
  • paolosabatino

Poem

🐰 A Zero hops with Type-C flair,
FUSB302 dancing in the air,
GPIO switches, LEDs that glow,
Boot targets shuffled, USB first to go!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: bumping u-boot to v2026.01 with fancy features and adding FUSB302 support for Radxa Zero 2.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added 02 Milestone: First quarter release size/large PR with 250 lines or more Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Jan 15, 2026
…/Christian)

- I submitted the basic enablement, got feedback on ML, reworked it to the minimal, valid, description
- Picked and rebased Neil/Christian's original full implementation from 2024 on top of it
  - See https://gitlab.com/superna9999/linux/-/tree/topic/amlogic/radxa-zero2/fusb302
  - This includes a driver for the CH482D chip (under `CONFIG_TYPEC_MUX_GPIO_SWITCH`, enabled here)
  - Quick search revealed two CH482D's are also present `rockchip/rk3566-radxa-cm3-io.dts` but thus far undescribed
    - see https://dl.radxa.com/cm3/io_board/radxa_cm3_io_board_v1.32_schematic.pdf pages 7 and 13
    - maybe we can work with them to help test driver and bindings?
- See https://lore.kernel.org/linux-amlogic/20260114-arm64-dts-amlogic-radxa-zero2-additions-v1-0-8b5cdf328fde@pardini.net/
- See https://lore.kernel.org/linux-amlogic/20260115-arm64-dts-amlogic-radxa-zero2-additions-v2-1-948bb0479a45@pardini.net/
@rpardini rpardini force-pushed the pr/radxa-zero2-fancy-u-boot-v202601--minimalfull-fusb302-enablement branch from ad34a4c to f9b883c Compare January 15, 2026 20:06
@rpardini rpardini marked this pull request as ready for review January 15, 2026 20:07
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@patch/kernel/archive/meson64-6.19/board-radxa-zero2-dts-amlogic-describe-the-FUSB302-on-Radxa-Zero-2.patch`:
- Around line 136-140: Fix the typo in the device tree compatible strings:
replace the incorrect "wcn,ch482d" value with "wch,ch482d" wherever it appears
(the enum entry under the compatible node, the example instance, and the DTS
instance) so the vendor prefix matches the earlier "wch" (WinChipHead) usage and
the devicetree validation passes; ensure all occurrences are updated
consistently alongside the existing "const: gpio-superspeed-switch" compatible
entry.
🧹 Nitpick comments (2)
patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch (1)

4-4: Subject line doesn't fully match the implementation.

The subject says "SD -> USB -> eMMC -> PXE" but the actual boot order is: MMC1 (SD) → NVMe → USB → SCSI → MMC2 → MMC0 (eMMC) → PXE → DHCP. Consider updating the subject to reflect the NVMe/SCSI placement for accuracy.

config/boards/radxa-zero2.csc (1)

59-64: Inconsistent CONFIG_ prefix usage in config names.

Some config names include the CONFIG_ prefix while others don't:

  • USB_GADGET_DOWNLOAD (line 59) - missing prefix
  • USB_FUNCTION_FASTBOOT (line 64) - missing prefix

While scripts/config handles both forms, using consistent naming improves readability.

Suggested fix for consistency
-	declare -a enable_configs=("CONFIG_CMD_USB_MASS_STORAGE" "CONFIG_USB_GADGET" "USB_GADGET_DOWNLOAD" "CONFIG_USB_FUNCTION_ACM")
+	declare -a enable_configs=("CONFIG_CMD_USB_MASS_STORAGE" "CONFIG_USB_GADGET" "CONFIG_USB_GADGET_DOWNLOAD" "CONFIG_USB_FUNCTION_ACM")
 	for config in "${enable_configs[@]}"; do
 		run_host_command_logged scripts/config --enable "${config}"
 	done
 	# Auto-enabled by the above, force off...
-	run_host_command_logged scripts/config --disable USB_FUNCTION_FASTBOOT
+	run_host_command_logged scripts/config --disable CONFIG_USB_FUNCTION_FASTBOOT
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bc871ca and f9b883c.

📒 Files selected for processing (4)
  • config/boards/radxa-zero2.csc
  • config/kernel/linux-meson64-edge.config
  • patch/kernel/archive/meson64-6.19/board-radxa-zero2-dts-amlogic-describe-the-FUSB302-on-Radxa-Zero-2.patch
  • patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch
🧰 Additional context used
🧠 Learnings (24)
📓 Common learnings
Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-19T13:56:45.124Z
Learning: When reviewing kernel or u-boot version bump PRs in the Armbian build system, check if patches existed in previous kernel version directories (e.g., sunxi-6.12, sunxi-6.13) before describing them as new features. If a patch and the majority of its contents existed previously with no major functionality changes, focus the review on the actual changes: the version bump itself and patch compatibility adjustments. Don't describe existing patches being ported/maintained across versions as new features or drivers—this is misleading. The patches are existing code being re-aligned to work with the new upstream version.
Learnt from: rpardini
Repo: armbian/build PR: 9159
File: patch/u-boot/u-boot-genio/0026-dts-configs-add-Grinn-GenioSBC-510.patch:161-161
Timestamp: 2026-01-03T20:46:29.189Z
Learning: For the Armbian genio family (config/sources/families/genio.conf and patch/u-boot/u-boot-genio/), when reviewing PRs that include vendor U-Boot patches from Collabora, avoid flagging potential issues in board configurations that are out of scope for the PR's primary focus (e.g., don't flag Genio 510/700 board issues when the PR is focused on radxa-nio-12l/Genio 1200). The maintainer prioritizes keeping vendor patches close to upstream for easier re-copying and maintenance, even if secondary board configs have potential mismatches.
<!-- </add_learning>
Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:76-86
Timestamp: 2025-03-31T22:20:48.475Z
Learning: For the Armbian build project, maintaining consistency with existing patches across U-Boot versions (such as between 2025.01 and 2025.04) is prioritized over refactoring individual patches for code improvements.
Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:73-75
Timestamp: 2025-03-31T22:20:41.849Z
Learning: When porting patches between U-Boot versions (like from 2025.01 to 2025.04), rpardini prefers to maintain patches as-is rather than introducing refactoring changes, even when potential improvements are identified. This approach prioritizes consistency and reduces the risk of introducing new issues.
Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub or the PR API to get the complete picture of what files are being added or modified.
Learnt from: amazingfate
Repo: armbian/build PR: 8619
File: config/sources/families/rockchip.conf:222-230
Timestamp: 2025-09-14T06:32:29.806Z
Learning: In the Armbian build system, the write_uboot_platform() function implementations follow different patterns across Rockchip family files. The newer standard (used in rockchip64_common.inc and rk3506) includes 'status=none' parameter in dd commands, while older implementations (rk3288, rk322x) use an older pattern without this parameter. The rk3506 implementation correctly follows the current Rockchip family standard.
Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub API (https://api.github.com/repos/armbian/build/pulls/{pr_number}/files) to get the complete picture of what files are being added or modified, especially for U-Boot patches that will be applied during the build process.
Learnt from: rpardini
Repo: armbian/build PR: 8879
File: config/sources/families/uefi-x86.conf:0-0
Timestamp: 2025-11-06T15:36:04.682Z
Learning: As of PR `#8879`, the uefi-x86 family in the Armbian build system now includes kernel patches for the first time. The current and edge branches for uefi-x86 are specifically configured for Apple T2-based x86 machines, including T2-specific patches from the linux-t2 project and custom kernel configuration options for Apple hardware drivers.
Learnt from: EvilOlaf
Repo: armbian/build PR: 8968
File: patch/u-boot/u-boot-sunxi/arm64-dts-sun50i-h6-orangepi.dtsi-Rollback-r_rsb-to-r_i2c.patch:36-36
Timestamp: 2025-11-20T18:20:11.985Z
Learning: The rewrite-patches tool (REWRITE_PATCHES=yes) in the Armbian build system can inadvertently introduce semantic changes when the u-boot/kernel git base revision differs from expected state. The tool applies patches, commits them, and re-exports them using git format-patch, which can cause the re-exported patch to reflect the base revision's state rather than preserving the original patch intent. This is particularly problematic for device tree changes like interrupt specifications. The tool currently lacks validation mechanisms to detect such semantic drift, and affected patches must be manually corrected after rewriting.
Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:28-67
Timestamp: 2025-12-13T11:39:08.046Z
Learning: In the Armbian build system for SpacemiT U-Boot patches (patch/u-boot/legacy/u-boot-spacemit-k1/), alignment with mainline U-Boot behavior is prioritized. For example, in boot mode handling, leaving devnum unchanged in the default case (when devtype is cleared) follows mainline conventions rather than explicitly clearing it to handle edge cases.
Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:17-25
Timestamp: 2025-12-13T11:45:02.422Z
Learning: In the SpacemiT U-Boot patches for Armbian (patch/u-boot/legacy/u-boot-spacemit-k1/), the environment variable `devnum` is set to the device name string (e.g., "mmc", "nvme") rather than a numeric index, and `distro_bootpart` holds the partition number. This implementation aligns with mainline U-Boot conventions for the SpacemiT platform and has been verified to work correctly by the maintainer.
📚 Learning: 2026-01-03T07:27:45.955Z
Learnt from: iav
Repo: armbian/build PR: 9158
File: patch/kernel/archive/rockchip64-6.18/add-board-helios64.patch:598-600
Timestamp: 2026-01-03T07:27:45.955Z
Learning: In Rockchip vendor kernel branches (e.g., rockchip64-6.18), the FUSB302 device tree binding accepts usb-role-switch as a phandle reference to a USB role switch provider (e.g., typec_extcon_bridge), not just as a boolean flag as in mainline kernel bindings. The vendor implementation allows usb-role-switch = <&typec_extcon_bridge>; to work correctly.

Applied to files:

  • config/kernel/linux-meson64-edge.config
  • patch/kernel/archive/meson64-6.19/board-radxa-zero2-dts-amlogic-describe-the-FUSB302-on-Radxa-Zero-2.patch
📚 Learning: 2025-09-22T21:52:01.225Z
Learnt from: tabrisnet
Repo: armbian/build PR: 8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.

Applied to files:

  • config/kernel/linux-meson64-edge.config
📚 Learning: 2025-08-02T05:46:10.664Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-08-02T05:46:10.664Z
Learning: In the Armbian build system, the KERNEL_CONFIGURE=yes switch is deprecated. The recommended approach for kernel configuration is now to use the `kernel-config` build command, which provides a more structured way to configure kernel options.

Applied to files:

  • config/kernel/linux-meson64-edge.config
📚 Learning: 2025-10-23T19:48:42.980Z
Learnt from: igorpecovnik
Repo: armbian/build PR: 8812
File: config/kernel/linux-sm8250-edge.config:498-501
Timestamp: 2025-10-23T19:48:42.980Z
Learning: For Armbian EDGE kernel configs, CONFIG_ATH12K=m alone is sufficient for PCI-based Wi-Fi 7 devices (e.g., WCN785x/QCN9274). A separate CONFIG_ATH12K_PCI option is not required, as confirmed by maintainer testing.

Applied to files:

  • config/kernel/linux-meson64-edge.config
📚 Learning: 2025-03-31T22:20:41.849Z
Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:73-75
Timestamp: 2025-03-31T22:20:41.849Z
Learning: When porting patches between U-Boot versions (like from 2025.01 to 2025.04), rpardini prefers to maintain patches as-is rather than introducing refactoring changes, even when potential improvements are identified. This approach prioritizes consistency and reduces the risk of introducing new issues.

Applied to files:

  • config/boards/radxa-zero2.csc
  • patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch
📚 Learning: 2025-09-14T06:32:29.806Z
Learnt from: amazingfate
Repo: armbian/build PR: 8619
File: config/sources/families/rockchip.conf:222-230
Timestamp: 2025-09-14T06:32:29.806Z
Learning: In the Armbian build system, the write_uboot_platform() function implementations follow different patterns across Rockchip family files. The newer standard (used in rockchip64_common.inc and rk3506) includes 'status=none' parameter in dd commands, while older implementations (rk3288, rk322x) use an older pattern without this parameter. The rk3506 implementation correctly follows the current Rockchip family standard.

Applied to files:

  • config/boards/radxa-zero2.csc
  • patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch
📚 Learning: 2026-01-03T20:46:29.189Z
Learnt from: rpardini
Repo: armbian/build PR: 9159
File: patch/u-boot/u-boot-genio/0026-dts-configs-add-Grinn-GenioSBC-510.patch:161-161
Timestamp: 2026-01-03T20:46:29.189Z
Learning: For the Armbian genio family (config/sources/families/genio.conf and patch/u-boot/u-boot-genio/), when reviewing PRs that include vendor U-Boot patches from Collabora, avoid flagging potential issues in board configurations that are out of scope for the PR's primary focus (e.g., don't flag Genio 510/700 board issues when the PR is focused on radxa-nio-12l/Genio 1200). The maintainer prioritizes keeping vendor patches close to upstream for easier re-copying and maintenance, even if secondary board configs have potential mismatches.
<!-- </add_learning>

Applied to files:

  • config/boards/radxa-zero2.csc
  • patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch
📚 Learning: 2025-11-02T20:49:56.719Z
Learnt from: igorpecovnik
Repo: armbian/build PR: 8849
File: config/boards/radxa-e54c.csc:14-28
Timestamp: 2025-11-02T20:49:56.719Z
Learning: In Armbian board configuration files (config/boards/*.conf, *.csc, etc.), do not use kernel_config_set, kernel_config_set_m, kernel_config_set_y, or custom_kernel_config__* functions to modify kernel configuration. Kernel configuration is associated with LINUXFAMILY/BOARDFAMILY, not individual BOARD. Board-specific kernel modifications cause inconsistency in kernel packages published to the apt repository because boards within a family share the same kernel packages. Kernel configuration changes must be made in the appropriate kernel config file (e.g., config/kernel/linux-*-*.config) or in family configuration files (config/sources/families/*.conf, *.inc) instead.

Applied to files:

  • config/boards/radxa-zero2.csc
📚 Learning: 2025-03-31T22:20:48.475Z
Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:76-86
Timestamp: 2025-03-31T22:20:48.475Z
Learning: For the Armbian build project, maintaining consistency with existing patches across U-Boot versions (such as between 2025.01 and 2025.04) is prioritized over refactoring individual patches for code improvements.

Applied to files:

  • config/boards/radxa-zero2.csc
  • patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch
📚 Learning: 2025-12-13T11:39:08.046Z
Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:28-67
Timestamp: 2025-12-13T11:39:08.046Z
Learning: In the Armbian build system for SpacemiT U-Boot patches (patch/u-boot/legacy/u-boot-spacemit-k1/), alignment with mainline U-Boot behavior is prioritized. For example, in boot mode handling, leaving devnum unchanged in the default case (when devtype is cleared) follows mainline conventions rather than explicitly clearing it to handle edge cases.

Applied to files:

  • config/boards/radxa-zero2.csc
  • patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch
📚 Learning: 2025-12-19T13:56:45.124Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-19T13:56:45.124Z
Learning: When reviewing kernel or u-boot version bump PRs in the Armbian build system, check if patches existed in previous kernel version directories (e.g., sunxi-6.12, sunxi-6.13) before describing them as new features. If a patch and the majority of its contents existed previously with no major functionality changes, focus the review on the actual changes: the version bump itself and patch compatibility adjustments. Don't describe existing patches being ported/maintained across versions as new features or drivers—this is misleading. The patches are existing code being re-aligned to work with the new upstream version.

Applied to files:

  • config/boards/radxa-zero2.csc
  • patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch
  • patch/kernel/archive/meson64-6.19/board-radxa-zero2-dts-amlogic-describe-the-FUSB302-on-Radxa-Zero-2.patch
📚 Learning: 2025-12-13T11:45:02.422Z
Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:17-25
Timestamp: 2025-12-13T11:45:02.422Z
Learning: In the SpacemiT U-Boot patches for Armbian (patch/u-boot/legacy/u-boot-spacemit-k1/), the environment variable `devnum` is set to the device name string (e.g., "mmc", "nvme") rather than a numeric index, and `distro_bootpart` holds the partition number. This implementation aligns with mainline U-Boot conventions for the SpacemiT platform and has been verified to work correctly by the maintainer.

Applied to files:

  • config/boards/radxa-zero2.csc
  • patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch
📚 Learning: 2025-10-05T19:31:16.930Z
Learnt from: rpardini
Repo: armbian/build PR: 8718
File: config/boards/thinkpad-x13s.conf:185-185
Timestamp: 2025-10-05T19:31:16.930Z
Learning: In config/boards/thinkpad-x13s.conf, the x13s_obtain_firmware() function is reference-only utility code that never runs. It is kept for documentation purposes. Updates to firmware must be done at the armbian/firmware repository. TODO comments in this function are intentional reminders and should not be flagged.

Applied to files:

  • config/boards/radxa-zero2.csc
📚 Learning: 2025-10-14T05:08:11.785Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8754
File: config/boards/bestv-r3300-l.csc:14-16
Timestamp: 2025-10-14T05:08:11.785Z
Learning: In the Armbian build system, BOOTBRANCH_BOARD is a valid framework variable used as a fallback when BOOTBRANCH is unset. The framework checks BOOTBRANCH_BOARD before applying the default bootloader branch value (see config/sources/common.conf). Board configuration files can use BOOTBRANCH_BOARD to specify the bootloader branch.

Applied to files:

  • config/boards/radxa-zero2.csc
📚 Learning: 2026-01-12T17:21:32.630Z
Learnt from: rpardini
Repo: armbian/build PR: 9233
File: patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch:86-94
Timestamp: 2026-01-12T17:21:32.630Z
Learning: For U-Boot patches that implement custom MAC address injection into device tree nodes (such as for Rockchip RK3588 gmac interfaces), consider using U-Boot's standard fdt_fixup_ethernet() function instead. This function automatically walks /aliases looking for ethernet, ethernet0, ethernet1, etc., resolves each to a device node, and writes the corresponding environment MAC (ethaddr, eth1addr) into the mac-address or local-mac-address property. The standard approach requires: 1) adding ethernet aliases to board device trees (e.g., ethernet0 = &gmac0), 2) calling fdt_fixup_ethernet(blob) in ft_board_setup() or ft_system_setup(), and 3) ensuring ethaddr/eth1addr are set in the environment. This is simpler, well-tested, and easier to upstream than custom implementations.

Applied to files:

  • config/boards/radxa-zero2.csc
📚 Learning: 2025-07-23T07:30:52.265Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8417
File: config/boards/orangepi5pro.csc:57-58
Timestamp: 2025-07-23T07:30:52.265Z
Learning: In the Armbian build system, BOOTPATCHDIR can contain board-specific subdirectories (e.g., board_orangepi5pro) for applying patches to specific boards only. The framework automatically checks if such board-specific subdirectories exist for the board being built and applies those patches accordingly.

Applied to files:

  • config/boards/radxa-zero2.csc
  • patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch
📚 Learning: 2025-12-28T15:39:55.793Z
Learnt from: rpardini
Repo: armbian/build PR: 9119
File: config/boards/mixtile-core3588e.csc:1-1
Timestamp: 2025-12-28T15:39:55.793Z
Learning: In board configuration comments, e.g., a reference to Jetson SoM, treat it as indicating compatibility with the form factor/pin layout rather than implying the board uses an NVIDIA Jetson product. This helps reviewers avoid misclassifying boards as Jetson-based. Apply this understanding broadly to all .csc files under config/boards to ensure consistent interpretation of form-factor references.

Applied to files:

  • config/boards/radxa-zero2.csc
📚 Learning: 2025-11-20T18:20:11.985Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8968
File: patch/u-boot/u-boot-sunxi/arm64-dts-sun50i-h6-orangepi.dtsi-Rollback-r_rsb-to-r_i2c.patch:36-36
Timestamp: 2025-11-20T18:20:11.985Z
Learning: The rewrite-patches tool (REWRITE_PATCHES=yes) in the Armbian build system can inadvertently introduce semantic changes when the u-boot/kernel git base revision differs from expected state. The tool applies patches, commits them, and re-exports them using git format-patch, which can cause the re-exported patch to reflect the base revision's state rather than preserving the original patch intent. This is particularly problematic for device tree changes like interrupt specifications. The tool currently lacks validation mechanisms to detect such semantic drift, and affected patches must be manually corrected after rewriting.

Applied to files:

  • patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch
📚 Learning: 2026-01-12T17:21:32.630Z
Learnt from: rpardini
Repo: armbian/build PR: 9233
File: patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch:86-94
Timestamp: 2026-01-12T17:21:32.630Z
Learning: When creating U-Boot patches that inject MAC addresses into device-tree nodes (e.g., for RK3588 GMAC), prefer using U-Boot's fdt_fixup_ethernet() instead of custom patch logic. This function scans /aliases (ethernet, ethernet0, ethernet1, ...), resolves each to a device node, and writes ethaddr/eth1addr into the mac-address or local-mac-address properties. Ensure the patch: 1) adds ethernet aliases to the board DT (e.g., ethernet0 = &gmac0), 2) calls fdt_fixup_ethernet(blob) in ft_board_setup() or ft_system_setup(), and 3) guarantees ethaddr/eth1addr are set in the environment. This approach is simpler, well-tested, and easier to upstream than bespoke code.

Applied to files:

  • patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch
📚 Learning: 2025-12-17T15:46:22.709Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 9096
File: patch/kernel/archive/sunxi-6.18/patches.armbian/arm64-dts-sun50i-h616-add-overlays.patch:4-5
Timestamp: 2025-12-17T15:46:22.709Z
Learning: In Armbian kernel patches, when patches are renamed or reorganized, the old Subject line may be intentionally preserved in the patch header (as a second Subject line) for archival/historical purposes to document the previous patch name. This is an Armbian-specific practice for tracking patch evolution and should not be flagged as an error when the maintainer has intentionally included it for documentation.

Applied to files:

  • patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch
  • patch/kernel/archive/meson64-6.19/board-radxa-zero2-dts-amlogic-describe-the-FUSB302-on-Radxa-Zero-2.patch
📚 Learning: 2025-07-21T04:12:02.439Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-07-21T04:12:02.439Z
Learning: In the Armbian build system, for recurring maintenance tasks like kernel version bumping, TODO comments should use generic version formats (e.g., "MAJOR.MINOR-rc1") rather than specific version numbers (e.g., "6.17-rc1") to avoid the need for frequent comment updates that would create unnecessary maintenance overhead.

Applied to files:

  • patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch
📚 Learning: 2026-01-10T04:28:58.758Z
Learnt from: kasimling
Repo: armbian/build PR: 9177
File: patch/kernel/archive/rockchip64-6.18/rk3588-1212-arm64-dts-Automatic-fan-speed-and-USB-3.0-Type-A-por.patch:37-41
Timestamp: 2026-01-10T04:28:58.758Z
Learning: When reviewing Linux kernel device-tree bindings involving thermal cooling devices, THERMAL_NO_LIMIT can be used for both min_state (lower) and max_state (upper). If used as lower/min_state, the framework converts it to 0; if used as upper/max_state, it converts to the cooling device's max_state. Verify patch entries like: cooling-device = <&fan THERMAL_NO_LIMIT 1> are valid and correctly reflect the intended bounds. Ensure consistent interpretation of NO_LIMIT in both min and max contexts and that the resulting values align with the device's actual limits.

Applied to files:

  • patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch
  • patch/kernel/archive/meson64-6.19/board-radxa-zero2-dts-amlogic-describe-the-FUSB302-on-Radxa-Zero-2.patch
📚 Learning: 2025-12-17T05:09:02.306Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-17T05:09:02.306Z
Learning: In the Armbian build system, kernel patches (e.g., in patch/kernel/archive/sunxi-6.18/patches.armbian/) contain device tree overlays and other code that have existed for years and are maintained/ported across kernel versions. When reviewing PRs that modify these patch files, focus on the actual changes being made (e.g., Makefile fixes, new additions) rather than reviewing the entire existing content within the patch as if it were new code. The patch file contents are existing, stable code unless explicitly modified in the PR diff.

Applied to files:

  • patch/kernel/archive/meson64-6.19/board-radxa-zero2-dts-amlogic-describe-the-FUSB302-on-Radxa-Zero-2.patch
🔇 Additional comments (12)
patch/u-boot/v2026.01/board_radxa-zero2/zero2-boot-sd-usb-nvme.patch (1)

14-27: Boot order logic looks correct.

The reordering prioritizes SD card boot, followed by NVMe and USB before falling back to eMMC. This is a sensible sequence for development boards where removable media should take precedence over onboard storage.

patch/kernel/archive/meson64-6.19/board-radxa-zero2-dts-amlogic-describe-the-FUSB302-on-Radxa-Zero-2.patch (6)

22-60: FUSB302 minimal DTS integration looks correct.

The i2c3 configuration with FUSB302 at address 0x22, interrupt wiring to GPIOA_13 (interrupt 74), and pinctrl configuration follows standard binding patterns for this Type-C controller.


89-90: Vendor prefix addition is correctly placed.

The WCH vendor prefix for Nanjing Qinheng Microelectronics is alphabetically ordered and required for the CH482D superspeed switch binding.


311-343: Potential race condition in gpio_ss_switch_set.

The function reads and writes gpio_ss_switch->enabled and gpio_ss_switch->swapped without any locking. If gpio_ss_switch_set is called concurrently from multiple contexts, this could lead to inconsistent state. Consider adding a mutex if concurrent access is possible.

This may be a non-issue if the Type-C framework serializes calls to the switch set callback. Please verify whether locking is needed.


444-462: Superspeed switch and Type-C connector wiring looks correct.

The GPIO-based superspeed switch configuration with GPIOC_7 and the bidirectional port linkage between the USB-C connector and the switch are properly wired. The same "wcn" typo noted earlier appears at line 445.


482-503: USB-C connector configuration is reasonable for this board.

Setting data-role="host" and power-role="source" with PDO_FIXED(5000, 2000, ...) makes sense for a development board that primarily acts as a USB host. The port wiring to the superspeed switch is correct.


510-513: USB3 PCIe PHY enablement looks correct.

Enabling usb3_pcie_phy with the typec2_vbus supply completes the USB3 path for Type-C functionality.

config/kernel/linux-meson64-edge.config (1)

3105-3105: Kernel config addition is correct.

Enabling CONFIG_TYPEC_MUX_GPIO_SWITCH=m as a module aligns with the new driver added in the kernel patch and follows the pattern of other Type-C mux options in this config.

config/boards/radxa-zero2.csc (4)

15-16: U-Boot version bump to v2026.01 is consistent.

Boot branch and patch directory references are aligned.


18-21: Preboot LED sequence configuration looks good.

The function follows Armbian's hook naming convention. The LED blink sequence provides visual boot feedback.


23-37: Extended U-Boot features are well-chosen.

EFI debugging, Btrfs support, compression algorithms, and LED support are all useful additions. The LED configs are required for the preboot LED sequence to work.


39-55: USB Ethernet and networking configuration is comprehensive.

The USB Ethernet drivers cover common adapters (ASIX, Realtek, SMSC), and the networking commands plus LWIP stack enable advanced network boot scenarios.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@github-actions github-actions bot added the Ready to merge Reviewed, tested and ready for merge label Jan 15, 2026
@github-actions
Copy link
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions bot removed the Needs review Seeking for review label Jan 15, 2026
@rpardini rpardini merged commit 1606887 into armbian:main Jan 16, 2026
1 check passed
@CodeChenL
Copy link
Collaborator

CodeChenL commented Feb 2, 2026

radxa-zero2: fancy u-boot v2026.01 // minimal+full fusb302 enablement

Summary by CodeRabbit

Release Notes

  • New Features

    • Added FUSB302 Type-C controller support for Radxa Zero 2
    • Introduced GPIO-based USB Type-C SuperSpeed switch functionality
    • Enhanced u-boot with LED support, EFI debugging, extended filesystem support, and improved USB gadget capabilities
  • Improvements

    • Optimized boot sequence to prioritize USB and NVMe devices
    • Added kernel support for GPIO-controlled Type-C multiplexing
  • Chores

    • Updated boot configuration to latest version (v2026.01)

✏️ Tip: You can customize this high-level summary in your review settings.

Hi @rpardini
Maybe here is a cleaner implementation without adding any new drivers:
radxa/kernel@27cc28a
The upstream kernel has already implemented a generic gpio-sbu-mux switch.

@rpardini
Copy link
Member Author

rpardini commented Feb 3, 2026

Hi @rpardini
Maybe here is a cleaner implementation without adding any new drivers:
radxa/kernel@27cc28a
The upstream kernel has already implemented a generic gpio-sbu-mux switch.

Nice, maybe you can follow-up to https://lore.kernel.org/linux-amlogic/20260115-arm64-dts-amlogic-radxa-zero2-additions-v2-1-948bb0479a45@pardini.net/ ?

I suppose same generic is or can be used for CM3/CM3-IO?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

02 Milestone: First quarter release Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... Ready to merge Reviewed, tested and ready for merge size/large PR with 250 lines or more

Development

Successfully merging this pull request may close these issues.

3 participants