mtd: refactor mtd struct for better erase support
Contribution description
As said in #8400, erase in mtd spi nor is not working correctly as on some flash, the erase size might be smaller than the sector size.
Thie PR adds min_erase_size and sector_size fields in the mtd_dev_t to fix that.
On spi flashes supporting different erase size, the config can be (for instance a flash with 64KB blocks and 4KB erasable sectors):
sector_size = 65536
min_erase_size = 4096
Issues/PRs references
This is based on #8399 and #8400
Rebased since #8399 and #8400 have been merged
Rebased
Rebased.
Could someone take a look at this one?
@gebart can you review or shall we look for someone new?
@gebart can you review or shall we look for a new reviewer?
It seems we are not that far from merging this PR. Maybe @smlng can help reviewing and testing this PR since he reviewed #8239 (littlefs). For FatFS, let's also ping @MichelRottleuthner and again @smlng: they were both involved in #7104 and #6072.
Maybe also @x3ro can easily help here?
Interesting, I'll see if I can find time to look at this during the next week.
Hmm, I understand the need for min_erase_size but can't seem to figure out why it was necessary to replace pages_per_sector with sector_size. I feel like I'm missing something obvious. Can you help out, @vincent-d?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.
@vincent-d Could you give this a rebase? I can give this a review one of these days.
Since this PR has been stale for several years, I'll convert it to a draft.
Please feel free to remove the draft state if anyone wants to pick this up again.