-
Notifications
You must be signed in to change notification settings - Fork 8.3k
drivers: flash: mcux-flexspi-nor: Support octal mode #99518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -743,6 +743,86 @@ static int flash_flexspi_nor_octal_enable(struct flash_flexspi_nor_data *data, | |||||||
| /* Wait for QE bit to complete programming */ | ||||||||
| return flash_flexspi_nor_wait_bus_busy(data); | ||||||||
| } | ||||||||
|
|
||||||||
| static int flash_flexspi_nor_octal_enable_s2b3(struct flash_flexspi_nor_data *data, | ||||||||
| uint32_t (*flexspi_lut)[MEMC_FLEXSPI_CMD_PER_SEQ]) | ||||||||
| { | ||||||||
| int ret; | ||||||||
| uint32_t buffer = 0; | ||||||||
| flexspi_transfer_t transfer = { | ||||||||
| .deviceAddress = 0x02, | ||||||||
| .port = data->port, | ||||||||
| .SeqNumber = 1, | ||||||||
| .data = &buffer, | ||||||||
| }; | ||||||||
| const flexspi_device_config_t config = { | ||||||||
| .flexspiRootClk = MHZ(50), | ||||||||
| .flashSize = FLEXSPI_FLSHCR0_FLSHSZ_MASK, | ||||||||
| .ARDSeqNumber = 1, | ||||||||
| .ARDSeqIndex = READ, | ||||||||
| }; | ||||||||
|
|
||||||||
| flexspi_lut[SCRATCH_CMD][0] = | ||||||||
| FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x65, | ||||||||
| kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 0x08); | ||||||||
|
Comment on lines
+765
to
+767
|
||||||||
| flexspi_lut[SCRATCH_CMD][1] = | ||||||||
| FLEXSPI_LUT_SEQ(kFLEXSPI_Command_DUMMY_SDR, kFLEXSPI_1PAD, 0x08, | ||||||||
| kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x01); | ||||||||
|
Comment on lines
+769
to
+770
|
||||||||
| flexspi_lut[SCRATCH_CMD2][0] = | ||||||||
| FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_WRSR2, | ||||||||
| kFLEXSPI_Command_WRITE_SDR, kFLEXSPI_1PAD, 0x01); | ||||||||
|
|
||||||||
| ret = memc_flexspi_set_device_config(&data->controller, &config, (uint32_t *)flexspi_lut, | ||||||||
| FLEXSPI_INSTR_END * MEMC_FLEXSPI_CMD_PER_SEQ, | ||||||||
| data->port); | ||||||||
| if (ret < 0) { | ||||||||
| return ret; | ||||||||
| } | ||||||||
|
|
||||||||
| transfer.dataSize = 1; | ||||||||
| transfer.seqIndex = SCRATCH_CMD; | ||||||||
| transfer.cmdType = kFLEXSPI_Read; | ||||||||
| ret = memc_flexspi_transfer(&data->controller, &transfer); | ||||||||
| if (ret < 0) { | ||||||||
| return ret; | ||||||||
| } | ||||||||
|
|
||||||||
|
||||||||
| /* Check if octal mode is already enabled (SR2 bit 3) */ |
Copilot
AI
Nov 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line sets bit 3 to enable octal mode but lacks a comment explaining the purpose. Consider adding a comment like '/* Set bit 3 to enable octal mode */' to improve code clarity.
| /* Set bit 3 to enable octal mode */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 0x02 as deviceAddress appears to be a register address for reading Status Register 2, but lacks explanation. Consider adding a comment or defining this as a named constant like SR2_ADDRESS or STATUS_REG2_ADDR to clarify its purpose.