[PATCH] spi: rockchip: restore bus_num alias lookup via dev->id

Stephano Cetola stephano at cetola.net
Sat Aug 22 07:07:45 PDT 2026


ctlr->bus_num = pdev->id was commented out when this driver was
ported from Linux (pdev doesn't exist in barebox's device model here,
only dev - the port left this line unresolved rather than translating
it). With bus_num left at its kzalloc default of 0,
spi_register_controller() only runs the alias lookup when bus_num < 0,
so it's skipped and every Rockchip SPI controller ends up on bus 0.

On RK3588S, spi at feb20000 returns the PMIC controller instead of
the intended gpio-spi RP2040 bus. The barebox spi command then does
a write+read through the Rockchip SPI driver, which programmes the
hardware in XFM_RO (RX-only) mode for the read phase. In that mode
dummy TXDR writes don't generate clock pulses, the RX FIFO never
fills, and rockchip_spi_pio's while(1) loop never exits -> boot hang.

Fixes: 1efba64ba04 ("spi: add rockchip spi controller support")
Signed-off-by: Stephano Cetola <stephano at cetola.net>
---
 drivers/spi/spi-rockchip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 1e81e9393f..b9f43fa4d6 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -514,7 +514,7 @@ static int rockchip_spi_probe(struct device *dev)
 		goto err_put_ctlr;
 	}
 
-//	ctlr->bus_num = pdev->id;
+	ctlr->bus_num = dev->id;
 //	ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP | SPI_LSB_FIRST;
 
 	/*

---
base-commit: 9bc1a26592a59919d2ee8c60c273d87d3d9f2e81
change-id: 20260821-send-spi-rockchip-busnum-a9b1116e14a5




More information about the barebox mailing list