-
Notifications
You must be signed in to change notification settings - Fork 2k
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_sdmmc: always enable the erase function #20180
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.
|
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.
This makes
RIOT/drivers/mtd_sdmmc/Kconfig
Line 26 in bee6c17
config MTD_SDMMC_ERASE |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
Please remove the
RIOT/drivers/mtd_sdmmc/Kconfig
Line 26 in bee6c17
config MTD_SDMMC_ERASE |
RIOT/drivers/include/mtd_sdmmc.h Lines 48 to 68 in a4fcf21
should be removed too. |
af0080f
to
1dd3c5c
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.
Please squash.
1dd3c5c
to
5e30c0e
Compare
Contribution description
For some reason the
.erase_sector
is 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_raw
onsame54-xpro
master
this PR
Issues/PRs references