diff options
| author | Tom Rini <[email protected]> | 2026-08-29 09:56:00 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-08-29 09:56:00 -0600 |
| commit | 856a00aeb61c1d4e7825257e54219599f8e34a6c (patch) | |
| tree | 0b02f08085d5db33af937a34e861e86c7d60fa84 /test | |
| parent | 043b4280138d45c50340c0f899935b83be4375b7 (diff) | |
| parent | ed58bafd0b24e15b734c624bdaf00b876e5d32e6 (diff) | |
Merge tag 'u-boot-rockchip-2027.01-20260828' of https://git.u-boot-project.org/u-boot/custodians/u-boot-rockchip into nextnext
- Fixed possible SPI hangs when only PICO is routed (TX-only),
- Added support for ROC-RK3399-PC-PLUS (via roc-pc-rk3399_defconfig)
Diffstat (limited to 'test')
| -rw-r--r-- | test/dm/spi.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/dm/spi.c b/test/dm/spi.c index a89ba06274f..a0da12ab6bc 100644 --- a/test/dm/spi.c +++ b/test/dm/spi.c @@ -216,3 +216,42 @@ static int dm_test_spi_xfer(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_spi_xfer, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* Test that a transfer is rejected when the device has no wire for it */ +static int dm_test_spi_xfer_no_rx_tx(struct unit_test_state *uts) +{ + struct dm_spi_slave_plat *plat; + struct spi_slave *slave; + struct udevice *bus; + const int busnum = 0, cs = 0; + const char dout[5] = {0x9f}; + unsigned char din[5]; + uint saved_mode; + + ut_assertok(spi_get_bus_and_cs(busnum, cs, &bus, &slave)); + ut_assertok(spi_claim_bus(slave)); + plat = dev_get_parent_plat(slave->dev); + saved_mode = plat->mode; + + plat->mode |= SPI_NO_RX; + ut_asserteq(-EINVAL, spi_xfer(slave, 40, dout, din, + SPI_XFER_BEGIN | SPI_XFER_END)); + + plat->mode = saved_mode | SPI_NO_TX; + ut_asserteq(-EINVAL, spi_xfer(slave, 40, dout, din, + SPI_XFER_BEGIN | SPI_XFER_END)); + + plat->mode = saved_mode; + spi_release_bus(slave); + + /* + * Since we are about to destroy all devices, we must tell sandbox + * to forget the emulation device + */ +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) + sandbox_sf_unbind_emul(state_get_current(), busnum, cs); +#endif + + return 0; +} +DM_TEST(dm_test_spi_xfer_no_rx_tx, UTF_SCAN_PDATA | UTF_SCAN_FDT); |
