Skip to content
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

rework to use smart SPI flash detection #2670

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ANTodorov
Copy link
Contributor

Check JEDEC ID is in range between 0x0001 ... 0xFFFE, Compare the output from 0x90 and 0x9F,
Then the size from the JEDEC ID

Otherwise fall-back to 256 kB

Extend the spi_flash_decode.py to handle more (known) SPI flash ICs

Check JEDEC ID is in range between 0x0001 ... 0xFFFE,
Compare the output from 0x90 and 0x9F,
Then the size from the JEDEC ID

Otherwise fall-back to 256 kB

Extend the spi_flash_decode.py to handle more (known) SPI flash ICs
// default device is 'unknown'
spi_flash_data.device = SpiFlashTable[0].device;

// Check JEDEC datais valid, compare the reported device types and then calcualte the number of pages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typos: Missing space and inverted letters

}
if (spi_flash_data.jedec_id > 0 && spi_flash_data.jedec_id < 0xFFFF) {
uint8_t jedec_p64k = (1 << (spi_flash_data.jedec_id & 0x000F)) & 0xFF;
uint8_t deviceid_p64k = (1 << ((spi_flash_data.device_id & 0x0F) + 1)) & 0xFF;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to compute this shift.
Checking that (spi_flash_data.device_id + 1) & 0x0f == (spi_flash_data.jedec_id & 0x0f) should be enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants