drivers/mtd_sdmmc: always enable the erase function#20180
drivers/mtd_sdmmc: always enable the erase function#20180benpicco merged 5 commits intoRIOT-OS:masterfrom
Conversation
|
SD memory cards and MMC/eMMCs should handle sector erase internally when writing, so it should not be necessary to explicitly erase sectors before writing to them here: Line 233 in bee6c17 MTD_SDMMC_ERASE was defined in Kconfig and disabled by default.
|
gschorcht
left a comment
There was a problem hiding this comment.
This makes
RIOT/drivers/mtd_sdmmc/Kconfig
Line 26 in bee6c17
|
Ah but I think we should just set |
| memset(dev->work_area, 0, SDMMC_SDHC_BLOCK_SIZE); | ||
| while (count) { | ||
| if (sdmmc_write_blocks(mtd_sd->sdmmc, sector, SDMMC_SDHC_BLOCK_SIZE, | ||
| 1, dev->work_area, NULL)) { | ||
| return -EIO; | ||
| } | ||
| --count; | ||
| ++sector; | ||
| } |
There was a problem hiding this comment.
What I don't understand is why you added this fallback implementation when you have a proper sdmmc_erase_blocks().
This was only needed for sdcard_spi because it does not implement the erase command at all.
There was a problem hiding this comment.
What I don't understand is why you added this fallback implementation when you have a proper
sdmmc_erase_blocks().
To be honest, I don't remember. Probably, I just used mtd_sdcard_spi as a template to implement mtd_sdmmc so that it is just a copy of it. I didn't know the MTD_DRIVER_FLAG_DIRECT_WRITE flag.
gschorcht
left a comment
There was a problem hiding this comment.
Please remove the
RIOT/drivers/mtd_sdmmc/Kconfig
Line 26 in bee6c17
RIOT/drivers/include/mtd_sdmmc.h Lines 48 to 68 in a4fcf21 should be removed too. |
af0080f to
1dd3c5c
Compare
1dd3c5c to
5e30c0e
Compare
Contribution description
For some reason the
.erase_sectoris a no-op by default when there is a perfectly cromulent implementation available.Always enable it to comply with the MTD API.
Testing procedure
I run
tests/drivers/mtd_rawonsame54-xpromaster
this PR
Issues/PRs references