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

spiFlashdb: add MX25R6435F and fix SPIFlash::bp_to_len #447

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

pu-cc
Copy link
Contributor

@pu-cc pu-cc commented Mar 14, 2024

This device was missing in spiFlashdb and is installed on the GateMate evaluation board.

MX25R6435F's status register contains a quad-enable bit.
image

If it is set, SPIFlash::bp_to_len incorrectly masks all sectors, even if no bp-bit is set. This fix seems obvious to me, but I don't have many boards to test this.

.tb_offset = (1 << 3),
.tb_register = CONFR,
.bp_len = 4,
.bp_offset = {(1 << 2), (1 << 3), (1 << 4), 0}}
Copy link
Owner

Choose a reason for hiding this comment

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

bp_len is 4 but you only provides 3 positions. Maybe the issue is related to that. I will investigate too.

Comment on lines +898 to +900
/* 0 -> no block protected */
if (tmp == 0)
return protect_area;
Copy link
Owner

Choose a reason for hiding this comment

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

it's true! Its wrong to substract something to 0!

@trabucayre trabucayre merged commit 41ecac5 into trabucayre:master Mar 15, 2024
14 checks passed
@trabucayre
Copy link
Owner

Applied. Thanks @pu-cc.

I have to check too but maybe the issue is related to the quad mode with a bad read and an flash's answer containing 0xff ?

@pu-cc
Copy link
Contributor Author

pu-cc commented Mar 15, 2024

Thank you, @trabucayre!

I does not seem that the status register is misread. 0x40 is QE bit:

write to flash
Jtag frequency : requested 10.00MHz  -> real 10.00MHz 
found 1 devices
index 0:
        idcode 0x20000001
        manufacturer colognechip
        family GateMate Series
        model  GM1Ax
        irlength 6
File type : cfg
c2 28 17 c2 read c22817c2
Detected: Macronix MX25R6435F 128 sectors size: 64Mb
RDSR : 40  <- here
WIP  : 0
WEL  : 0
BP   : 0
TB   : 0
SRWD : 0
00000000 00000000 00000000 40

We just did not return from SPIFlash::bp_to_len if bp != 0, and later subtract to 0:

if (bp == 0)

The fix mentioned in #447 (comment) solves the issues and with the current status everything is perfect for me. Thanks again!

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