stm32/qspi: Allow qspi_write_cmd_data to write cmd with 1 data byte.
The existing qspi for stm32 implementation can only send a spi command with exactly 0 or 2 data bytes. Certain spiflash chips (e.g. AT25SF321B) have commands that only take a single data byte, and will ignore the command if more than that is sent. This commit allows sending a command with a single data byte. Signed-off-by: Victor Rajewski <victor@allumeenergy.com.au>
This commit is contained in:
parent
409978a1fb
commit
730525cec9
@ -232,9 +232,13 @@ STATIC int qspi_write_cmd_data(void *self_in, uint8_t cmd, size_t len, uint32_t
|
||||
while (!(QUADSPI->SR & QUADSPI_SR_FTF)) {
|
||||
}
|
||||
|
||||
if (len == 1) {
|
||||
*(uint8_t *)&QUADSPI->DR = data;
|
||||
} else {
|
||||
// This assumes len==2
|
||||
*(uint16_t *)&QUADSPI->DR = data;
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for write to finish
|
||||
while (!(QUADSPI->SR & QUADSPI_SR_TCF)) {
|
||||
|
Loading…
Reference in New Issue
Block a user