On Sat, 21 Feb 2026 at 02:43, Dario Binacchi <[email protected]> wrote: > > 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 <[email protected]> > --- > > (no changes since v1) > > arch/sandbox/include/asm/test.h | 8 ++++++++ > drivers/spi/sandbox_spi.c | 8 ++++++++ > 2 files changed, 16 insertions(+) >
Reviewed-by: Simon Glass <[email protected]> But I think it is better to store this in the uclass-plat data rather than in each individual SPI driver. > diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h > index 0e8d19ce2325..0438790028b9 100644 > --- a/arch/sandbox/include/asm/test.h > +++ b/arch/sandbox/include/asm/test.h > @@ -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 > * > diff --git a/drivers/spi/sandbox_spi.c b/drivers/spi/sandbox_spi.c > index 8eed56140f6a..b035a60ef43a 100644 > --- a/drivers/spi/sandbox_spi.c > +++ b/drivers/spi/sandbox_spi.c > @@ -63,6 +63,14 @@ uint sandbox_spi_get_mode(struct udevice *dev) > return priv->mode; > } > > +uint sandbox_spi_get_wordlen(struct udevice *slave) > +{ > + struct udevice *bus = slave->parent; > + struct sandbox_spi_priv *priv = dev_get_priv(bus); > + > + return priv->wordlen; > +} > + > static int sandbox_spi_set_wordlen(struct udevice *slave, unsigned int > wordlen) > { > struct udevice *bus = slave->parent; > -- > 2.43.0 >

