Repository navigation
Conversation
Our ext flash has a rather peculiar 'feature' in that SPI sometimes locks up when first accessing the ext flash. Resetting the flash chip prior alleviates this problem. This is highly specific and I don't expect this to make it into wolfboot as is, but I'm hopeful we can come to some sort of solution where we don't need to patch every new wolfboot version.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved SPI flash transaction and reset-sequencing defects can hang boot, prevent reset recovery, and produce incorrect JEDEC IDs.
4 open issues
What changed in this PR
This PR adds an optional software reset during external SPI flash probing to address reported first-access lockups without requiring downstream patches.
Changes:
- Defines reset-enable (
0x66) and reset (0x99) commands. - Adds a
RESET_EXT_FLASH-guarded reset sequence and delay loops. - Changes the device-identification transaction around the reset option.
| File | Description |
|---|---|
src/spi_flash.c |
Adds optional flash reset handling and modifies probe sequencing. |
Review effort: Balanced
| @@ -186,9 +188,28 @@ uint16_t spi_flash_probe(void) | |||
| int i; | |||
| spi_init(0,0); | |||
| wait_busy(); | |||
| spi_cs_on(SPI_CS_PIO_BASE, SPI_CS_FLASH); | ||
| spi_write(MDID); | ||
| notused = spi_read(); | ||
| write_address(0); |
| notused = spi_read(); | ||
| write_address(0); | ||
| #else | ||
| notused = spi_read(); |
| spi_write(RST); | ||
| notused = spi_read(); | ||
| spi_cs_off(SPI_CS_PIO_BASE, SPI_CS_FLASH); | ||
| for (i = 0; i < 18000; i++); |
Member
|
Okay to test. Company contributor agreement on file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Our ext flash has a rather peculiar 'feature' in that we sometimes get an invalid response when first accessing the ext flash. Resetting the flash chip prior alleviates this problem.
This is highly specific and I don't expect this to make it into wolfboot as is, but I'm hopeful we can come to some sort of solution where we don't need to patch every new wolfboot version.
I'm also curious what function this particular line has: 3444c47#diff-315ae084c53140288a75552950c9b0dab78db6e39b69173980741b4687a7633bL181
To be honest, we don't actually know the whole reason for this bit any more. The original author is no longer working with us.