diff options
author | Pratyush Yadav <p.yadav@ti.com> | 2021-06-25 22:17:15 +0300 |
---|---|---|
committer | Jagan Teki <jagan@amarulasolutions.com> | 2021-06-28 09:29:47 +0300 |
commit | 6182d15b3e4a40929df22e403601fd24abd3f918 (patch) | |
tree | 925882760bcf92cd731662c09dd75704199c7128 /drivers | |
parent | 71025f013ccb2da5a39e60cec319f1fdef031d3d (diff) | |
download | u-boot-6182d15b3e4a40929df22e403601fd24abd3f918.tar.xz |
mtd: spi-nor-core: Do not set data direction when there is no data
Even when spi_nor_write_reg() has no data to write, like when executing
a write enable operation, it sets the data direction to
SPI_MEM_DATA_OUT. This trips up spi_mem_check_buswidth() because it
expects a data phase when there is none. Make sure the data direction is
set to SPI_MEM_NO_DATA when there is no data to write.
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/spi/spi-nor-core.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 24c6b8c4a3..d795ecbc9f 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -209,6 +209,9 @@ static int spi_nor_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len) SPI_MEM_OP_NO_DUMMY, SPI_MEM_OP_DATA_OUT(len, NULL, 1)); + if (len == 0) + op.data.dir = SPI_MEM_NO_DATA; + return spi_nor_read_write_reg(nor, &op, buf); } |