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
drivers/mtd_mapper: inherit physical properties #18113
Conversation
Might this have been assert-only so far to allow the maps to be static const? It's currently not tested for that this is allowed, but it might have been the original intention. [edit] I looked around a bit more in the code -- the |
|
Lets summon @bergzand then :) |
7892f30
to
a962be8
Compare
@benpicco are all these properties really physical properties? The write_size and sector_size are, the page_size and pages_per_sector can be changed as long as the sector size is kept. Allowing changing the page_size allows easier subsystem definition (e.g. Littlefs that IIRC uses the page_size as the block_size). |
Huh? It could be changed to a lower fraction, but to what gain? LittleFS does fs->config.block_size = fs->dev->page_size * fs->dev->pages_per_sector;
fs->config.prog_size = fs->dev->page_size;
fs->config.read_size = fs->dev->page_size; where they use block instead of sector to name the erase unit. |
I indeed missed in the definition, I meant the |
If people find a reason not to inherit the physical properties, we could only inherit them in |
But we already have assert(backing_mtd->page_size == region->mtd.page_size);
assert(backing_mtd->pages_per_sector == region->mtd.pages_per_sector); so setting this to anything else would currently fail in master. |
Maybe this was too limiting from the start ? If the page_size would be defined as the largest block that can be written at once (needs to be documented) the checks should be: |
fbafc4f
to
ec5da5f
Compare
There might have been some intention to make it const at some point. But that's not going to happen at this point. I'm fine with this PR as it is. |
ec5da5f
to
8ebfe9f
Compare
8ebfe9f
to
53f891e
Compare
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.
I am also happy with this. I would also add some kind of initializer macro but that´s not the topic here.
Contribution description
A MTD mapper region must adhere to the same physical constraints as the underlying MTD device, so inherit it's physical properties instead of relying on the user to set them correctly.
Testing procedure
tests/mtd_mapper
still works without the redundant informationIssues/PRs references