Skip to content

Conversation

@EvilOlaf
Copy link
Member

@EvilOlaf EvilOlaf commented Dec 23, 2025

Description

Add this series as a single patch: https://patchwork.kernel.org/project/linux-arm-kernel/cover/20251221110513.1850535-1-wens@kernel.org/

This series adds support for the SPI controllers found in the Allwinner
A523 SoC family. The SPI controller is almost the same as the ones in
previous generations, except that it moved the "RX buffer count"
register field to a separate register, and that register now reports
the total count for RX buffer and FIFO.

How Has This Been Tested?

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • New Features
    • Added full SPI (Serial Peripheral Interface) controller support for Allwinner A523 devices, enabling communication with external SPI peripherals and flash memory storage.
    • Extended hardware compatibility for compatible A523-based boards and devices.
    • Updated system drivers and bindings to recognize new SPI controller variants.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 23, 2025

Walkthrough

This pull request adds support for Allwinner A523 SPI controllers by introducing a new kernel patch. The changes extend device-tree bindings, modify the SPI driver to recognize new A523 SoC variants, and add device-tree nodes for three SPI controllers with corresponding pinctrl configurations and flash storage support.

Changes

Cohort / File(s) Summary
Patch series configuration
patch/kernel/archive/sunxi-6.18/series.conf
Added new backports patch entry for A523 SPI controller support after the UART1 patch.
SPI driver update
drivers/spi/spi-sun6i.c
Added new OF device ID entry mapping allwinner,sun55i-a523-spi compatible to existing sun50i_r329_spi_cfg data structure.
Device-tree bindings documentation
Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml
Extended compatible lists to include allwinner,sun55i-a523-spi and allwinner,sun55i-a523-spi-dbi variants.
SoC device-tree definitions
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
Added three SPI controller nodes (spi0, spi1, spi2) with appropriate register addresses, clocks, resets, DMAs, and pinctrl configurations; introduced r_spi0 controller and spi0 flash node.
Board device-tree overlay
arch/arm64/boot/dts/allwinner/sun55i-t527-orangepi-4a.dts
Added spi0 node with pinctrl and flash@0 storage device configuration.
Reference files
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi.orig
Updated baseline reference reflecting A523 SPI binding changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • igorpecovnik
  • AGM1968
  • JohnTheCoolingFan
  • PanderMusubi
  • TheSnowfield
  • janprunk
  • chraac

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately and specifically summarizes the main change: adding support for Allwinner A523 SPI controllers through a patch series.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 Dec 23, 2025
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

📜 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 60e869c and 2a6de6b.

📒 Files selected for processing (2)
  • patch/kernel/archive/sunxi-6.18/patches.backports/30-allwinner-a523-support-spi-controllers.patch
  • patch/kernel/archive/sunxi-6.18/series.conf
🧰 Additional context used
🧠 Learnings (15)
📓 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: 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.
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.
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.
📚 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/sunxi-6.18/series.conf
  • patch/kernel/archive/sunxi-6.18/patches.backports/30-allwinner-a523-support-spi-controllers.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:

  • patch/kernel/archive/sunxi-6.18/series.conf
  • patch/kernel/archive/sunxi-6.18/patches.backports/30-allwinner-a523-support-spi-controllers.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/kernel/archive/sunxi-6.18/series.conf
  • patch/kernel/archive/sunxi-6.18/patches.backports/30-allwinner-a523-support-spi-controllers.patch
📚 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/kernel/archive/sunxi-6.18/series.conf
  • patch/kernel/archive/sunxi-6.18/patches.backports/30-allwinner-a523-support-spi-controllers.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:

  • patch/kernel/archive/sunxi-6.18/series.conf
  • patch/kernel/archive/sunxi-6.18/patches.backports/30-allwinner-a523-support-spi-controllers.patch
📚 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:

  • patch/kernel/archive/sunxi-6.18/series.conf
📚 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:

  • patch/kernel/archive/sunxi-6.18/series.conf
📚 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:

  • patch/kernel/archive/sunxi-6.18/series.conf
📚 Learning: 2025-09-14T11:37:35.089Z
Learnt from: amazingfate
Repo: armbian/build PR: 8619
File: config/sources/families/rockchip.conf:65-72
Timestamp: 2025-09-14T11:37:35.089Z
Learning: In the Armbian build system, patch directories referenced in BOOTPATCHDIR and KERNELPATCHDIR configurations can be non-existent without causing build failures. Empty patch directories are also ignored by git, so missing patch directories should not be flagged as errors during code review.

Applied to files:

  • patch/kernel/archive/sunxi-6.18/series.conf
📚 Learning: 2025-09-11T06:06:52.328Z
Learnt from: SuperKali
Repo: armbian/build PR: 8608
File: lib/functions/compilation/patch/drivers_network.sh:361-363
Timestamp: 2025-09-11T06:06:52.328Z
Learning: For the RTW88 SDIO RF path detection fix patch (004-rtw88-sdio-rf-path-detection-fix.patch), SuperKali prefers using exact version matching (eq 6.1 || eq 6.16) rather than range checks, as the patch has only been tested on those specific kernel versions and may be mainstreamed soon.

Applied to files:

  • patch/kernel/archive/sunxi-6.18/series.conf
📚 Learning: 2025-08-02T14:59:28.145Z
Learnt from: amazingfate
Repo: armbian/build PR: 8453
File: lib/functions/compilation/patch/drivers_network.sh:213-216
Timestamp: 2025-08-02T14:59:28.145Z
Learning: The wireless driver patches wireless-rtl8812au-Fix-6.16.patch, wireless-rtl8811cu-Fix-6.16.patch, and wireless-rtl88x2bu-Fix-6.16.patch in the Armbian build system are backward compatible and can be applied unconditionally without version checks, even though they're named for 6.16+ fixes.

Applied to files:

  • patch/kernel/archive/sunxi-6.18/series.conf
📚 Learning: 2025-06-14T05:53:10.627Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8298
File: extensions/https_proxy.sh:1-9
Timestamp: 2025-06-14T05:53:10.627Z
Learning: Armbian build framework extensions are NOT designed to run standalone but are called by the supervisor. The framework provides environment variables like USERPATCHES_PATH and SDCARD, and commands are executed with protection via run_host_command_logged and chroot_sdcard functions that use bash -e -o pipefail.

Applied to files:

  • patch/kernel/archive/sunxi-6.18/series.conf
📚 Learning: 2025-10-22T07:51:53.015Z
Learnt from: igorpecovnik
Repo: armbian/build PR: 8789
File: config/kernel/linux-sunxi64-edge.config:839-839
Timestamp: 2025-10-22T07:51:53.015Z
Learning: In Armbian's wireless driver configuration, CONFIG_RK_WIFI_DEVICE_* options are Rockchip-specific device registration settings, while CONFIG_WLAN_UWE* are the actual cross-platform driver modules for UWE5622 wireless chips. The UWE5622 chip (manufactured by Unisoc/Spreadtrum) is used on multiple Allwinner boards including Orange Pi Zero 2/2W/3 and Orange Pi 3 LTS, so CONFIG_WLAN_UWE5621/5622 along with Unisoc infrastructure options (CONFIG_SPARD_WLAN_SUPPORT, CONFIG_SC23XX, CONFIG_UNISOC_WIFI_PS, CONFIG_WCN_BSP_DRIVER_BUILDIN) are correct in sunxi64 kernel configs.

Applied to files:

  • patch/kernel/archive/sunxi-6.18/series.conf
  • patch/kernel/archive/sunxi-6.18/patches.backports/30-allwinner-a523-support-spi-controllers.patch
📚 Learning: 2025-09-14T05:23:42.991Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8632
File: config/sources/families/include/rockchip64_common.inc:327-334
Timestamp: 2025-09-14T05:23:42.991Z
Learning: In the Armbian build system for Rockchip boards, SPI flash consistently maps to /dev/mtd0, so hard-coding this device path in flashcp commands is acceptable and based on hardware conventions rather than being a bug.

Applied to files:

  • patch/kernel/archive/sunxi-6.18/patches.backports/30-allwinner-a523-support-spi-controllers.patch
🔇 Additional comments (6)
patch/kernel/archive/sunxi-6.18/series.conf (1)

410-411: LGTM!

The new backport patch entry is correctly placed in the backports section and follows the existing naming convention with numeric prefix.

patch/kernel/archive/sunxi-6.18/patches.backports/30-allwinner-a523-support-spi-controllers.patch (5)

24-53: DT binding additions look correct.

The binding updates for allwinner,sun55i-a523-spi and the -dbi variant follow the existing patterns in the yaml file.


64-99: Pinctrl definitions are well-structured.

The SPI0 pin configurations properly use /omit-if-no-ref/ and include helpful comments about eMMC conflicts for hold and wp pins.


112-178: SPI controller nodes are properly defined.

The four SPI controllers (spi0, spi1, spi2, r_spi0) follow correct device tree conventions with sequential register addresses, IRQs, and DMA channels. All are disabled by default, following best practices for board-specific enablement.


448-461: SPI flash configuration for Orange Pi 4A looks reasonable.

The SPI NOR flash is configured with a conservative 20MHz frequency and appropriate pinctrl. The vcc-supply = <&reg_cldo1> reference should exist in the board's PMIC configuration.


490-515: Driver changes are correct with good documentation.

The A523 SPI controller reuses the R329 configuration, and the inline comment (lines 505-509) clearly explains the hardware difference regarding the combined RX buffer + FIFO counter. This aligns with the PR description about the A523's register changes.

Comment on lines +5 to +10
Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi.orig
arch/arm64/boot/dts/allwinner/sun55i-t527-orangepi-4a.dts
arch/arm64/boot/dts/allwinner/sun55i-t527-orangepi-4a.dts.orig
drivers/spi/spi-sun6i.c
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

# First, verify the patch file exists and check for .orig file modifications
echo "=== Checking patch content for .orig file modifications ==="
patch_file="patch/kernel/archive/sunxi-6.18/patches.backports/30-allwinner-a523-support-spi-controllers.patch"

if [ -f "$patch_file" ]; then
  echo "Patch file found. Checking for .orig file hunks..."
  grep -c "^+++ .*\.orig" "$patch_file" || echo "No .orig file modifications found"
  
  echo ""
  echo "=== Listing all modified files in this patch ==="
  grep "^+++ b/" "$patch_file" | sed 's/^+++ b\///' | sort | uniq
  
  echo ""
  echo "=== Checking for .orig pattern in file list ==="
  grep "^+++ b/.*\.orig" "$patch_file" | sed 's/^+++ b\///'
else
  echo "Patch file not found!"
fi

echo ""
echo "=== Checking if other patches in the same directory modify .orig files ==="
patches_dir="patch/kernel/archive/sunxi-6.18/patches.backports"
if [ -d "$patches_dir" ]; then
  count=0
  for f in "$patches_dir"/*.patch; do
    if [ -f "$f" ] && grep -q "^+++ .*\.orig" "$f" 2>/dev/null; then
      echo "$(basename "$f")"
      ((count++))
    fi
  done
  echo "Total patches with .orig modifications: $count"
else
  echo "Directory not found: $patches_dir"
fi

Repository: armbian/build

Length of output: 860


🏁 Script executed:

#!/bin/bash

patch_file="patch/kernel/archive/sunxi-6.18/patches.backports/30-allwinner-a523-support-spi-controllers.patch"

echo "=== Examining .orig file modification hunks ==="
# Extract hunks for .orig files
awk '/^--- a.*\.orig/{flag=1; section=$0} /^--- a/ && !/\.orig/{if(flag) flag=0} flag' "$patch_file" | head -200

echo ""
echo "=== Comparing size of changes to .orig vs non-.orig files ==="
echo "Lines added to sun55i-a523.dtsi:"
grep -c "^++" "$patch_file" | head -1
echo "Lines added to sun55i-a523.dtsi.orig:"
awk '/^--- a.*sun55i-a523\.dtsi\.orig/{flag=1} /^--- a/ && !/sun55i-a523\.dtsi\.orig/{flag=0} flag' "$patch_file" | grep "^++" | wc -l

echo ""
echo "Lines added to sun55i-t527-orangepi-4a.dts:"
awk '/^--- a.*sun55i-t527-orangepi-4a\.dts$/{flag=1} /^--- a/ && !/sun55i-t527-orangepi-4a\.dts$/{flag=0} flag' "$patch_file" | grep "^++" | wc -l

echo "Lines added to sun55i-t527-orangepi-4a.dts.orig:"
awk '/^--- a.*sun55i-t527-orangepi-4a\.dts\.orig/{flag=1} /^--- a/ && !/sun55i-t527-orangepi-4a\.dts\.orig/{flag=0} flag' "$patch_file" | grep "^++" | wc -l

echo ""
echo "=== First 50 lines of sun55i-a523.dtsi.orig hunk ==="
awk '/^--- a.*sun55i-a523\.dtsi\.orig/{flag=1; next} /^--- a/{if(flag) exit} flag' "$patch_file" | head -50

Repository: armbian/build

Length of output: 6513


The patch includes modifications to .orig files which should be excluded.

The patch modifies sun55i-a523.dtsi.orig and sun55i-t527-orangepi-4a.dts.orig. These are backup/artifact files that should not be committed to the kernel tree. The .orig file for sun55i-a523.dtsi includes ~120+ lines of unrelated thermal configuration (thermal sensor nodes, cooling-cells, thermal-zones) that appear to be artifacts from the patch generation process. These files will cause issues when applying the patch to a clean kernel tree.

Regenerate the patch to exclude the .orig file modifications.

🤖 Prompt for AI Agents
In
patch/kernel/archive/sunxi-6.18/patches.backports/30-allwinner-a523-support-spi-controllers.patch
around lines 5 to 10, the patch incorrectly includes .orig backup files
(sun55i-a523.dtsi.orig and sun55i-t527-orangepi-4a.dts.orig) which are unrelated
artifacts; regenerate the patch without these files by removing the .orig
entries from the commit/diff and re-creating the patch from a clean working tree
(use git add only the intended files, git commit, then git format-patch or git
diff --staged), confirm the regenerated patch contains only the target files,
and validate with git apply --check before submitting.

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, ... Needs review Seeking for review Patches Patches related to kernel, U-Boot, ... size/large PR with 250 lines or more

Development

Successfully merging this pull request may close these issues.

1 participant