[v2,2/2] spi: sun6i: Add dual read support for the H616

Message ID 20261116-spi-sun6i-h616-dual-read-v2-2-e0c66eb71e20@gmail.com (mailing list archive)
State New
Headers
Series spi: sun6i: Add dual read support for the H616 |

Commit Message

Arun Iyengar via B4 Relay Nov. 16, 2026, 5:55 a.m. UTC
From: Arun Iyengar <aiyengar1990@gmail.com>

The H616 SPI controllers bind through the "allwinner,sun8i-h3-spi"
fallback, which advertises no dual or quad modes, although the H616
manual documents the dual read (DRM, SPI_BCC bit 28) and quad (Quad_EN,
bit 29) controls that the driver already programs for the R329.

Match "allwinner,sun50i-h616-spi" with the H3 clock control and dual
reads. Dual writes and quad mode are left out: untested on the H616.

Tested on an Orange Pi Zero2 (2 MiB Macronix SPI NOR, flash node with
spi-rx-bus-width = <2>): 1-1-2 reads (opcode 0x3b), the whole flash in
0.30 s instead of 0.52 s, repeated reads identical.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/spi/spi-sun6i.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Patch

diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c
index 6b7a05dd0de8..3a77ade87fbe 100644
--- a/drivers/spi/spi-sun6i.c
+++ b/drivers/spi/spi-sun6i.c
@@ -778,6 +778,12 @@  static const struct sun6i_spi_cfg sun8i_h3_spi_cfg = {
 	.has_clk_ctl	= true,
 };
 
+static const struct sun6i_spi_cfg sun50i_h616_spi_cfg = {
+	.fifo_depth	= SUN8I_FIFO_DEPTH,
+	.has_clk_ctl	= true,
+	.mode_bits	= SPI_RX_DUAL,
+};
+
 static const struct sun6i_spi_cfg sun50i_r329_spi_cfg = {
 	.fifo_depth	= SUN8I_FIFO_DEPTH,
 	.mode_bits	= SPI_RX_DUAL | SPI_TX_DUAL | SPI_RX_QUAD | SPI_TX_QUAD,
@@ -786,6 +792,7 @@  static const struct sun6i_spi_cfg sun50i_r329_spi_cfg = {
 static const struct of_device_id sun6i_spi_match[] = {
 	{ .compatible = "allwinner,sun6i-a31-spi", .data = &sun6i_a31_spi_cfg },
 	{ .compatible = "allwinner,sun8i-h3-spi",  .data = &sun8i_h3_spi_cfg },
+	{ .compatible = "allwinner,sun50i-h616-spi", .data = &sun50i_h616_spi_cfg },
 	{ .compatible = "allwinner,sun50i-r329-spi", .data = &sun50i_r329_spi_cfg },
 	/*
 	 * A523's SPI controller has a combined RX buffer + FIFO counter