History

Merge tag 'mmc-v5.6-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC fixes from Ulf Hansson: "MMC core: - Fix HW busy detection support for host controllers requiring the MMC_RSP_BUSY response flag (R1B) to be set for the command. In particular for CMD6 (eMMC), erase/trim/discard (SD/eMMC) and CMD5 (eMMC sleep). MMC host: - sdhci-omap|tegra: Fix support for HW busy detection" * tag 'mmc-v5.6-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for eMMC sleep command mmc: sdhci-tegra: Fix busy detection by enabling MMC_CAP_NEED_RSP_BUSY mmc: sdhci-omap: Fix busy detection by enabling MMC_CAP_NEED_RSP_BUSY mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for erase/trim/discard mmc: core: Allow host controllers to require R1B for CMD6

Linus Torvalds committed 6 years ago

Commit d3656122 parents ddd2b85 18d20046 files · +20 −5Browse files

Unified · Split

6 files
  1. drivers/mmc/core/core.c +4 −1
  2. drivers/mmc/core/mmc.c +5 −2
  3. drivers/mmc/core/mmc_ops.c +4 −2
  4. drivers/mmc/host/sdhci-omap.c +3 −0
  5. drivers/mmc/host/sdhci-tegra.c +3 −0
  6. include/linux/mmc/host.h +1 −0
drivers/mmc/core/core.c+4−1
@@ -1732,8 +1732,11 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from, · 1731 unmodified lines
1732 * the erase operation does not exceed the max_busy_timeout, we should1732 * the erase operation does not exceed the max_busy_timeout, we should
1733 * use R1B response. Or we need to prevent the host from doing hw busy1733 * use R1B response. Or we need to prevent the host from doing hw busy
1734 * detection, which is done by converting to a R1 response instead.1734 * detection, which is done by converting to a R1 response instead.
1735 * Note, some hosts requires R1B, which also means they are on their own
1736 * when it comes to deal with the busy timeout.
1735 */1737 */
1736 if (card->host->max_busy_timeout &&1738 if (!(card->host->caps & MMC_CAP_NEED_RSP_BUSY) &&
1739 card->host->max_busy_timeout &&
1737 busy_timeout > card->host->max_busy_timeout) {1740 busy_timeout > card->host->max_busy_timeout) {
1738 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;1741 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
1739 } else {1742 } else {
drivers/mmc/core/mmc.c+5−2
@@ -1910,9 +1910,12 @@ static int mmc_sleep(struct mmc_host *host) · 1909 unmodified lines
1910 * If the max_busy_timeout of the host is specified, validate it against1910 * If the max_busy_timeout of the host is specified, validate it against
1911 * the sleep cmd timeout. A failure means we need to prevent the host1911 * the sleep cmd timeout. A failure means we need to prevent the host
1912 * from doing hw busy detection, which is done by converting to a R11912 * from doing hw busy detection, which is done by converting to a R1
1913 * response instead of a R1B.1913 * response instead of a R1B. Note, some hosts requires R1B, which also
1914 * means they are on their own when it comes to deal with the busy
1915 * timeout.
1914 */1916 */
1915 if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) {1917 if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && host->max_busy_timeout &&
1918 (timeout_ms > host->max_busy_timeout)) {
1916 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;1919 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
1917 } else {1920 } else {
1918 cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;1921 cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
drivers/mmc/core/mmc_ops.c+4−2
@@ -542,9 +542,11 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, · 541 unmodified lines
542 * If the max_busy_timeout of the host is specified, make sure it's542 * If the max_busy_timeout of the host is specified, make sure it's
543 * enough to fit the used timeout_ms. In case it's not, let's instruct543 * enough to fit the used timeout_ms. In case it's not, let's instruct
544 * the host to avoid HW busy detection, by converting to a R1 response544 * the host to avoid HW busy detection, by converting to a R1 response
545 * instead of a R1B.545 * instead of a R1B. Note, some hosts requires R1B, which also means
546 * they are on their own when it comes to deal with the busy timeout.
546 */547 */
547 if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout))548 if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && host->max_busy_timeout &&
549 (timeout_ms > host->max_busy_timeout))
548 use_r1b_resp = false;550 use_r1b_resp = false;
549 551
550 cmd.opcode = MMC_SWITCH;552 cmd.opcode = MMC_SWITCH;
drivers/mmc/host/sdhci-omap.c+3−0
@@ -1192,6 +1192,9 @@ static int sdhci_omap_probe(struct platform_device *pdev) · 1191 unmodified lines
1192 if (of_find_property(dev->of_node, "dmas", NULL))1192 if (of_find_property(dev->of_node, "dmas", NULL))
1193 sdhci_switch_external_dma(host, true);1193 sdhci_switch_external_dma(host, true);
1194 1194
1195 /* R1B responses is required to properly manage HW busy detection. */
1196 mmc->caps |= MMC_CAP_NEED_RSP_BUSY;
1197
1195 ret = sdhci_setup_host(host);1198 ret = sdhci_setup_host(host);
1196 if (ret)1199 if (ret)
1197 goto err_put_sync;1200 goto err_put_sync;
drivers/mmc/host/sdhci-tegra.c+3−0
@@ -1552,6 +1552,9 @@ static int sdhci_tegra_probe(struct platform_device *pdev) · 1551 unmodified lines
1552 if (tegra_host->soc_data->nvquirks & NVQUIRK_ENABLE_DDR50)1552 if (tegra_host->soc_data->nvquirks & NVQUIRK_ENABLE_DDR50)
1553 host->mmc->caps |= MMC_CAP_1_8V_DDR;1553 host->mmc->caps |= MMC_CAP_1_8V_DDR;
1554 1554
1555 /* R1B responses is required to properly manage HW busy detection. */
1556 host->mmc->caps |= MMC_CAP_NEED_RSP_BUSY;
1557
1555 tegra_sdhci_parse_dt(host);1558 tegra_sdhci_parse_dt(host);
1556 1559
1557 tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power",1560 tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power",
include/linux/mmc/host.h+1−0
@@ -333,6 +333,7 @@ struct mmc_host { · 332 unmodified lines
333 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \333 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \
334 MMC_CAP_UHS_DDR50)334 MMC_CAP_UHS_DDR50)
335#define MMC_CAP_SYNC_RUNTIME_PM (1 << 21) /* Synced runtime PM suspends. */335#define MMC_CAP_SYNC_RUNTIME_PM (1 << 21) /* Synced runtime PM suspends. */
336#define MMC_CAP_NEED_RSP_BUSY (1 << 22) /* Commands with R1B can't use R1. */
336#define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */337#define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */
337#define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */338#define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */
338#define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */339#define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */