Skip to content

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

Closed

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!

Activity

  1. pelwell commented on Jul 20, 2015

    @pelwell
    Contributor

    I'm happy to add it, provided it works. Which card are you using? None of mine (SanDisk class 10, Lexar class 10, no-name class 6) have the required capabilities. In fact there's a discussion in #431 where Gordon says that SD cards don't really support (and in fact don't need) trimming.

  2. pelwell commented on Jul 21, 2015

    @pelwell
    Contributor

    I've added the ERASE capability to the sdhost driver - it will be in the next release.

  3. ghost closed this as completedon Jul 22, 2015
  4. added a commit that references this issue on Jul 29, 2015
  5. 273 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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