]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
test: spi: add sandbox_spi_get_wordlen interface
authorDario Binacchi <dario.binacchi@amarulasolutions.com>
Wed, 25 Feb 2026 16:16:54 +0000 (17:16 +0100)
committerPatrice Chotard <patrice.chotard@foss.st.com>
Thu, 30 Apr 2026 06:01:11 +0000 (08:01 +0200)
Add the sandbox_spi_get_wordlen() public interface to retrieve the
internal word length state of the sandbox SPI device.

This is intended for use in sandbox SPI test cases to verify that
the word length is correctly propagated from the SPI uclass to
the driver.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Simon Glass <simon.glass@canonical.com>
arch/sandbox/include/asm/test.h
drivers/spi/sandbox_spi.c

index 0e8d19ce23253939862b1c7e3ba787c8288f1ed8..0438790028b9a63b944015022b25a768b71f76c6 100644 (file)
@@ -243,6 +243,14 @@ uint sandbox_spi_get_speed(struct udevice *dev);
  */
 uint sandbox_spi_get_mode(struct udevice *dev);
 
+/**
+ * sandbox_spi_get_wordlen() - Get current wordlen setting of a sandbox spi slave
+ *
+ * @dev: Device to check
+ * Return: current wordlen
+ */
+uint sandbox_spi_get_wordlen(struct udevice *dev);
+
 /**
  * sandbox_get_pch_spi_protect() - Get the PCI SPI protection status
  *
index 7c237ac8d371ddf6f9f8f127bb3f0d720203bf91..3ee97d67f4a0cf9c5e5f51ac39fa31d6ec6b2cbd 100644 (file)
@@ -61,6 +61,13 @@ uint sandbox_spi_get_mode(struct udevice *dev)
        return priv->mode;
 }
 
+uint sandbox_spi_get_wordlen(struct udevice *dev)
+{
+       struct spi_slave *slave = dev_get_parent_priv(dev);
+
+       return slave->wordlen;
+}
+
 static int sandbox_spi_set_wordlen(struct udevice *dev, unsigned int wordlen)
 {
        struct spi_slave *slave = dev_get_parent_priv(dev);