]> git.baikalelectronics.ru Git - uboot.git/commit
spi: spi-mem: allow specifying a command's extension
authorPratyush Yadav <p.yadav@ti.com>
Fri, 25 Jun 2021 19:17:04 +0000 (00:47 +0530)
committerJagan Teki <jagan@amarulasolutions.com>
Mon, 28 Jun 2021 06:25:11 +0000 (11:55 +0530)
commit34018427e606e98f75494f535b8699adcf10df99
tree8413453cbbbd9d558babedda18ec1afc2c5014ac
parentd45cb3b77b3c89bbfdb17c980df8a6436e2ce6bf
spi: spi-mem: allow specifying a command's extension

In xSPI mode, flashes expect 2-byte opcodes. The second byte is called
the "command extension". There can be 3 types of extensions in xSPI:
repeat, invert, and hex. When the extension type is "repeat", the same
opcode is sent twice. When it is "invert", the second byte is the
inverse of the opcode. When it is "hex" an additional opcode byte based
is sent with the command whose value can be anything.

So, make opcode a 16-bit value and add a 'nbytes', similar to how
multiple address widths are handled.

All usages of sizeof(op->cmd.opcode) also need to be changed to be
op->cmd.nbytes because that is the actual indicator of opcode size.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
drivers/spi/mtk_snfi_spi.c
drivers/spi/spi-mem-nodm.c
drivers/spi/spi-mem.c
include/spi-mem.h