From: Sasha Levin Date: Thu, 26 Mar 2020 04:48:14 +0000 (-0400) Subject: Fixes for 5.5 X-Git-Tag: v5.6.1~90 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5cb9f9bc6d4eafb0f9b29874d00ab55ea85bd91c;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.5 Signed-off-by: Sasha Levin --- diff --git a/queue-5.5/mmc-core-allow-host-controllers-to-require-r1b-for-c.patch b/queue-5.5/mmc-core-allow-host-controllers-to-require-r1b-for-c.patch new file mode 100644 index 00000000000..28c9a3c270e --- /dev/null +++ b/queue-5.5/mmc-core-allow-host-controllers-to-require-r1b-for-c.patch @@ -0,0 +1,65 @@ +From 5e650d1fd85b41f2be7e8f93f2a42fc1994ba31a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Mar 2020 19:06:46 +0100 +Subject: mmc: core: Allow host controllers to require R1B for CMD6 + +From: Ulf Hansson + +[ Upstream commit 1292e3efb149ee21d8d33d725eeed4e6b1ade963 ] + +It has turned out that some host controllers can't use R1B for CMD6 and +other commands that have R1B associated with them. Therefore invent a new +host cap, MMC_CAP_NEED_RSP_BUSY to let them specify this. + +In __mmc_switch(), let's check the flag and use it to prevent R1B responses +from being converted into R1. Note that, this also means that the host are +on its own, when it comes to manage the busy timeout. + +Suggested-by: Sowjanya Komatineni +Cc: +Tested-by: Anders Roxell +Tested-by: Sowjanya Komatineni +Tested-by: Faiz Abbas +Tested-By: Peter Geis +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/mmc/core/mmc_ops.c | 8 +++++--- + include/linux/mmc/host.h | 1 + + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c +index 09113b9ad6790..18a7afb2a5b23 100644 +--- a/drivers/mmc/core/mmc_ops.c ++++ b/drivers/mmc/core/mmc_ops.c +@@ -538,10 +538,12 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, + * If the cmd timeout and the max_busy_timeout of the host are both + * specified, let's validate them. A failure means we need to prevent + * the host from doing hw busy detection, which is done by converting +- * to a R1 response instead of a R1B. ++ * to a R1 response instead of a R1B. Note, some hosts requires R1B, ++ * which also means they are on their own when it comes to deal with the ++ * busy timeout. + */ +- if (timeout_ms && host->max_busy_timeout && +- (timeout_ms > host->max_busy_timeout)) ++ if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && timeout_ms && ++ host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) + use_r1b_resp = false; + + cmd.opcode = MMC_SWITCH; +diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h +index ba703384bea0c..4c5eb3aa8e723 100644 +--- a/include/linux/mmc/host.h ++++ b/include/linux/mmc/host.h +@@ -333,6 +333,7 @@ struct mmc_host { + MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \ + MMC_CAP_UHS_DDR50) + #define MMC_CAP_SYNC_RUNTIME_PM (1 << 21) /* Synced runtime PM suspends. */ ++#define MMC_CAP_NEED_RSP_BUSY (1 << 22) /* Commands with R1B can't use R1. */ + #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ + #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ + #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */ +-- +2.20.1 + diff --git a/queue-5.5/mmc-core-respect-mmc_cap_need_rsp_busy-for-emmc-slee.patch b/queue-5.5/mmc-core-respect-mmc_cap_need_rsp_busy-for-emmc-slee.patch new file mode 100644 index 00000000000..153a74292dd --- /dev/null +++ b/queue-5.5/mmc-core-respect-mmc_cap_need_rsp_busy-for-emmc-slee.patch @@ -0,0 +1,50 @@ +From f3a0117d663ed77a56c12ca778af76328e33bfe1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Mar 2020 19:06:48 +0100 +Subject: mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for eMMC sleep command + +From: Ulf Hansson + +[ Upstream commit 18d200460cd73636d4f20674085c39e32b4e0097 ] + +The busy timeout for the CMD5 to put the eMMC into sleep state, is specific +to the card. Potentially the timeout may exceed the host->max_busy_timeout. +If that becomes the case, mmc_sleep() converts from using an R1B response +to an R1 response, as to prevent the host from doing HW busy detection. + +However, it has turned out that some hosts requires an R1B response no +matter what, so let's respect that via checking MMC_CAP_NEED_RSP_BUSY. Note +that, if the R1B gets enforced, the host becomes fully responsible of +managing the needed busy timeout, in one way or the other. + +Suggested-by: Sowjanya Komatineni +Cc: +Link: https://lore.kernel.org/r/20200311092036.16084-1-ulf.hansson@linaro.org +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/mmc/core/mmc.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c +index f6912ded652dc..de14b5845f525 100644 +--- a/drivers/mmc/core/mmc.c ++++ b/drivers/mmc/core/mmc.c +@@ -1910,9 +1910,12 @@ static int mmc_sleep(struct mmc_host *host) + * If the max_busy_timeout of the host is specified, validate it against + * the sleep cmd timeout. A failure means we need to prevent the host + * from doing hw busy detection, which is done by converting to a R1 +- * response instead of a R1B. ++ * response instead of a R1B. Note, some hosts requires R1B, which also ++ * means they are on their own when it comes to deal with the busy ++ * timeout. + */ +- if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) { ++ if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && host->max_busy_timeout && ++ (timeout_ms > host->max_busy_timeout)) { + cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; + } else { + cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; +-- +2.20.1 + diff --git a/queue-5.5/mmc-core-respect-mmc_cap_need_rsp_busy-for-erase-tri.patch b/queue-5.5/mmc-core-respect-mmc_cap_need_rsp_busy-for-erase-tri.patch new file mode 100644 index 00000000000..9c5444d89a6 --- /dev/null +++ b/queue-5.5/mmc-core-respect-mmc_cap_need_rsp_busy-for-erase-tri.patch @@ -0,0 +1,51 @@ +From 21061f53155eb9bfcdbaa0cd89e8524278ef735b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Mar 2020 19:06:47 +0100 +Subject: mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for erase/trim/discard + +From: Ulf Hansson + +[ Upstream commit 43cc64e5221cc6741252b64bc4531dd1eefb733d ] + +The busy timeout that is computed for each erase/trim/discard operation, +can become quite long and may thus exceed the host->max_busy_timeout. If +that becomes the case, mmc_do_erase() converts from using an R1B response +to an R1 response, as to prevent the host from doing HW busy detection. + +However, it has turned out that some hosts requires an R1B response no +matter what, so let's respect that via checking MMC_CAP_NEED_RSP_BUSY. Note +that, if the R1B gets enforced, the host becomes fully responsible of +managing the needed busy timeout, in one way or the other. + +Suggested-by: Sowjanya Komatineni +Cc: +Tested-by: Anders Roxell +Tested-by: Sowjanya Komatineni +Tested-by: Faiz Abbas +Tested-By: Peter Geis +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/mmc/core/core.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index abf8f5eb0a1c8..26644b7ec13e3 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -1732,8 +1732,11 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from, + * the erase operation does not exceed the max_busy_timeout, we should + * use R1B response. Or we need to prevent the host from doing hw busy + * detection, which is done by converting to a R1 response instead. ++ * Note, some hosts requires R1B, which also means they are on their own ++ * when it comes to deal with the busy timeout. + */ +- if (card->host->max_busy_timeout && ++ if (!(card->host->caps & MMC_CAP_NEED_RSP_BUSY) && ++ card->host->max_busy_timeout && + busy_timeout > card->host->max_busy_timeout) { + cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; + } else { +-- +2.20.1 + diff --git a/queue-5.5/mmc-sdhci-omap-fix-busy-detection-by-enabling-mmc_ca.patch b/queue-5.5/mmc-sdhci-omap-fix-busy-detection-by-enabling-mmc_ca.patch new file mode 100644 index 00000000000..57a66ec4d64 --- /dev/null +++ b/queue-5.5/mmc-sdhci-omap-fix-busy-detection-by-enabling-mmc_ca.patch @@ -0,0 +1,46 @@ +From 406052fde8fe47327b503fb5ddf447ad2157cb3f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Mar 2020 19:06:49 +0100 +Subject: mmc: sdhci-omap: Fix busy detection by enabling MMC_CAP_NEED_RSP_BUSY + +From: Ulf Hansson + +[ Upstream commit 055e04830d4544c57f2a5192a26c9e25915c29c0 ] + +It has turned out that the sdhci-omap controller requires the R1B response, +for commands that has this response associated with them. So, converting +from an R1B to an R1 response for a CMD6 for example, leads to problems +with the HW busy detection support. + +Fix this by informing the mmc core about the requirement, via setting the +host cap, MMC_CAP_NEED_RSP_BUSY. + +Reported-by: Naresh Kamboju +Reported-by: Anders Roxell +Reported-by: Faiz Abbas +Cc: +Tested-by: Anders Roxell +Tested-by: Faiz Abbas +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/mmc/host/sdhci-omap.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c +index 083e7e053c954..d3135249b2e40 100644 +--- a/drivers/mmc/host/sdhci-omap.c ++++ b/drivers/mmc/host/sdhci-omap.c +@@ -1134,6 +1134,9 @@ static int sdhci_omap_probe(struct platform_device *pdev) + host->mmc_host_ops.execute_tuning = sdhci_omap_execute_tuning; + host->mmc_host_ops.enable_sdio_irq = sdhci_omap_enable_sdio_irq; + ++ /* R1B responses is required to properly manage HW busy detection. */ ++ mmc->caps |= MMC_CAP_NEED_RSP_BUSY; ++ + ret = sdhci_setup_host(host); + if (ret) + goto err_put_sync; +-- +2.20.1 + diff --git a/queue-5.5/mmc-sdhci-tegra-fix-busy-detection-by-enabling-mmc_c.patch b/queue-5.5/mmc-sdhci-tegra-fix-busy-detection-by-enabling-mmc_c.patch new file mode 100644 index 00000000000..03700155b5b --- /dev/null +++ b/queue-5.5/mmc-sdhci-tegra-fix-busy-detection-by-enabling-mmc_c.patch @@ -0,0 +1,47 @@ +From 32aa0c2f5a181aa49ea84e6c4baec5845f5a0ec8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Mar 2020 19:06:50 +0100 +Subject: mmc: sdhci-tegra: Fix busy detection by enabling + MMC_CAP_NEED_RSP_BUSY + +From: Ulf Hansson + +[ Upstream commit d2f8bfa4bff5028bc40ed56b4497c32e05b0178f ] + +It has turned out that the sdhci-tegra controller requires the R1B response, +for commands that has this response associated with them. So, converting +from an R1B to an R1 response for a CMD6 for example, leads to problems +with the HW busy detection support. + +Fix this by informing the mmc core about the requirement, via setting the +host cap, MMC_CAP_NEED_RSP_BUSY. + +Reported-by: Bitan Biswas +Reported-by: Peter Geis +Suggested-by: Sowjanya Komatineni +Cc: +Tested-by: Sowjanya Komatineni +Tested-By: Peter Geis +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/mmc/host/sdhci-tegra.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c +index 403ac44a73782..a25c3a4d3f6cb 100644 +--- a/drivers/mmc/host/sdhci-tegra.c ++++ b/drivers/mmc/host/sdhci-tegra.c +@@ -1552,6 +1552,9 @@ static int sdhci_tegra_probe(struct platform_device *pdev) + if (tegra_host->soc_data->nvquirks & NVQUIRK_ENABLE_DDR50) + host->mmc->caps |= MMC_CAP_1_8V_DDR; + ++ /* R1B responses is required to properly manage HW busy detection. */ ++ host->mmc->caps |= MMC_CAP_NEED_RSP_BUSY; ++ + tegra_sdhci_parse_dt(host); + + tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power", +-- +2.20.1 + diff --git a/queue-5.5/series b/queue-5.5/series new file mode 100644 index 00000000000..92f2a7dff40 --- /dev/null +++ b/queue-5.5/series @@ -0,0 +1,5 @@ +mmc-core-allow-host-controllers-to-require-r1b-for-c.patch +mmc-core-respect-mmc_cap_need_rsp_busy-for-erase-tri.patch +mmc-core-respect-mmc_cap_need_rsp_busy-for-emmc-slee.patch +mmc-sdhci-omap-fix-busy-detection-by-enabling-mmc_ca.patch +mmc-sdhci-tegra-fix-busy-detection-by-enabling-mmc_c.patch