drivers: flash: stm32 qspi flash driver valid read or write operations
Like the stm32 flash driver, in case of QSPI nor flash controller the read or write or erase returns '0' if data is of null size. This avoids useless QPSI low level access to the controller. Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
parent
81d2768016
commit
2f4cfca6fd
1 changed files with 15 additions and 0 deletions
|
@ -311,6 +311,11 @@ static int flash_stm32_qspi_read(const struct device *dev, off_t addr,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* read non-zero size */
|
||||
if (!size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
QSPI_CommandTypeDef cmd = {
|
||||
.Instruction = SPI_NOR_CMD_READ,
|
||||
.Address = addr,
|
||||
|
@ -359,6 +364,11 @@ static int flash_stm32_qspi_write(const struct device *dev, off_t addr,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* write non-zero size */
|
||||
if (!size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
QSPI_CommandTypeDef cmd_write_en = {
|
||||
.Instruction = SPI_NOR_CMD_WREN,
|
||||
.InstructionMode = QSPI_INSTRUCTION_1_LINE,
|
||||
|
@ -429,6 +439,11 @@ static int flash_stm32_qspi_erase(const struct device *dev, off_t addr,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* erase non-zero size */
|
||||
if (!size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
QSPI_CommandTypeDef cmd_write_en = {
|
||||
.Instruction = SPI_NOR_CMD_WREN,
|
||||
.InstructionMode = QSPI_INSTRUCTION_1_LINE,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue