Skip to content

Commit d33da4d

Browse files
shifteekartben
authored andcommitted
drivers: flash_stm32_qspi: add st,read-id-dummy-cycles
Add new device tree property specifying the number of dummy-cycles required when reading the JEDEC ID. The Arduino Opta has an at25sf128a with JEDEC ID 1F 89 01. The PR below adds support for this, but the id read is 01 1F 89. Changing DummyCycles to 16 causes the correct value to be read. zephyrproject-rtos#89539 Signed-off-by: Mark O'Donovan <[email protected]>
1 parent 369f15d commit d33da4d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

drivers/flash/flash_stm32_qspi.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,12 @@ static int qspi_read_jedec_id(const struct device *dev, uint8_t *id)
317317
{
318318
struct flash_stm32_qspi_data *dev_data = dev->data;
319319
uint8_t data[JESD216_READ_ID_LEN];
320+
uint32_t dummy_cycles = DT_INST_PROP(0, st_read_id_dummy_cycles);
320321

321322
QSPI_CommandTypeDef cmd = {
322323
.Instruction = JESD216_CMD_READ_ID,
323324
.AddressSize = QSPI_ADDRESS_NONE,
324-
.DummyCycles = 8,
325+
.DummyCycles = dummy_cycles,
325326
.InstructionMode = QSPI_INSTRUCTION_1_LINE,
326327
.AddressMode = QSPI_ADDRESS_1_LINE,
327328
.DataMode = QSPI_DATA_1_LINE,
@@ -333,7 +334,7 @@ static int qspi_read_jedec_id(const struct device *dev, uint8_t *id)
333334
hal_ret = HAL_QSPI_Command_IT(&dev_data->hqspi, &cmd);
334335

335336
if (hal_ret != HAL_OK) {
336-
LOG_ERR("%d: Failed to send OSPI instruction", hal_ret);
337+
LOG_ERR("%d: Failed to send QSPI instruction", hal_ret);
337338
return -EIO;
338339
}
339340

dts/bindings/flash_controller/st,stm32-qspi-nor.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,8 @@ properties:
7171
protection register that initializes to write-protected. Use this
7272
property to indicate that the BPR must be unlocked before write
7373
operations can proceed.
74+
75+
st,read-id-dummy-cycles:
76+
type: int
77+
default: 8
78+
description: The number of dummy-cycles required when reading jedec id

0 commit comments

Comments
 (0)