Skip to content

could you add "MMC_CAP_ERASE" to the bcm2835-sdhost driver mmc->caps initialization? #1076

Closed
@ghost

Description

I've been using the new "sdhost" driver, and it's overclocking abilities are amazing. E.g., I can now run my card at 40MB/s read speeds (as compared to 18MB/s under the "mmc" driver).

However the current implementation of this new driver in the "rpi-4.0.y" tree is missing the "MMC_CAP_ERASE" capability for the host controller configuration, and as such this prevents "fstrim" from working ("fstrim" gives an "FITRIM ioctl failed: Operation not supported" error). Adding the MMC_CAP_ERASE capability fixes this issue, and the "sdhost" driver will then support the TRIM feature like the current "bcm2835-mmc" driver does.

I've enabled this capability in my own kernel build, but it'd be great to get this in upstream so that I don't need to keep building my own kernel just for this simple change...

The patch to bcm2835-sdhost.c is really simple:

diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c
index d65870a..57a6ad3 100644
--- a/drivers/mmc/host/bcm2835-sdhost.c
+++ b/drivers/mmc/host/bcm2835-sdhost.c
@@ -1675,7 +1675,7 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host)
        /* host controller capabilities */
        mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA |
                MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED |
-               MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET |
+               MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE |
                (ALLOW_CMD23 * MMC_CAP_CMD23);

        spin_lock_init(&host->lock);

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions