The driver currently ignores the word length configuration. Implement
the set_wordlen operation to store and track the current word length.

Signed-off-by: Dario Binacchi <[email protected]>
---

(no changes since v1)

 drivers/spi/sandbox_spi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/spi/sandbox_spi.c b/drivers/spi/sandbox_spi.c
index 4cc016138b11..8eed56140f6a 100644
--- a/drivers/spi/sandbox_spi.c
+++ b/drivers/spi/sandbox_spi.c
@@ -34,10 +34,12 @@
  *
  * @speed:     Current bus speed.
  * @mode:      Current bus mode.
+ * @wordlen:   Current wordlen.
  */
 struct sandbox_spi_priv {
        uint speed;
        uint mode;
+       uint wordlen;
 };
 
 __weak int sandbox_spi_get_emul(struct sandbox_state *state,
@@ -61,6 +63,16 @@ uint sandbox_spi_get_mode(struct udevice *dev)
        return priv->mode;
 }
 
+static int sandbox_spi_set_wordlen(struct udevice *slave, unsigned int wordlen)
+{
+       struct udevice *bus = slave->parent;
+       struct sandbox_spi_priv *priv = dev_get_priv(bus);
+
+       priv->wordlen = wordlen;
+
+       return 0;
+}
+
 static int sandbox_spi_xfer(struct udevice *slave, unsigned int bitlen,
                            const void *dout, void *din, unsigned long flags)
 {
@@ -158,6 +170,7 @@ static const struct dm_spi_ops sandbox_spi_ops = {
        .set_mode       = sandbox_spi_set_mode,
        .cs_info        = sandbox_cs_info,
        .get_mmap       = sandbox_spi_get_mmap,
+       .set_wordlen    = sandbox_spi_set_wordlen,
 };
 
 static const struct udevice_id sandbox_spi_ids[] = {
-- 
2.43.0

Reply via email to