MMC core:

- Fix partition switch time for eMMC
 
 MMC host:
  - mmci: Enforce R1B response to fix busy detection for the stm32 variants
  - cqhci: Fix crash when removing mmc module/card
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmBLSbQXHHVsZi5oYW5z
 c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjCnxHxAAh6lGUoQyHp/wxUE/jZfOLyI4
 nQVnRlKYIx3K+wR2qNYWzf9L74iJ05LkvONdPIZjJIMiJ+XdvhUjsOREB7AQhb/1
 PRm9mwrXA1TnghLjJAYuMguVEhCRKZC9vwTd0IMcE0gxmMLuE1UVj8GXCOWj3Rgz
 XPGMh8sqAJttlkifff4PUSI+4o5ojLz4t9sNjK/Q/ShtFJW2ojktb2U/mAe67KLA
 GVj22t3//0Rh5n+sA/pmL/yVQgCZ3OzTLHEDwJwxTOr6/aQCIz6AzFGsXIQ/Kz83
 wRwjuTGZp0q9+mrKRcXFJqS27nid/Y9mDt3/xL+SfkRXoS8VHRfrUhAeqfEn28aF
 xtRVT+B8bD7+Lz39K8naN8aRsgPPh09Eir+dWZtNbkzo2sdfYY+J9URFjkorUyj3
 D/vIHLLZOQp5GOdEwEkcSk1eRoUDYMNeIfgVFv92nqUQYOMNm5TNO/6GToY1HBI2
 xChzDZFU1eFI+jE6WgRISpOI5vMSYbtllhK2ajoDODDduoY2BlWNzEcJ5IF+cneE
 f1OUO8gC5mb6k66TP3t/R+mcfv0UA6KbaeZdB7p93sYBZYNtCF3FWjebSEaAfaDN
 uzQVdA/Nugi99QTAIXqvZS/tDzJGggP9/z1eYeH1JR3zSGS2EvNynZ1HXkOokfTX
 6wAVa2csDB+PPJFXk/Y=
 =idaH
 -----END PGP SIGNATURE-----

Merge tag 'mmc-v5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC fixes from Ulf Hansson:
 "MMC core:

   - Fix partition switch time for eMMC

  MMC host:

   - mmci: Enforce R1B response to fix busy detection for
     the stm32 variants

   - cqhci: Fix crash when removing mmc module/card"

* tag 'mmc-v5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  mmc: cqhci: Fix random crash when remove mmc module/card
  mmc: core: Fix partition switch time for eMMC
  mmc: mmci: Add MMC_CAP_NEED_RSP_BUSY for the stm32 variants
This commit is contained in:
Linus Torvalds 2021-03-12 11:58:33 -08:00
commit 568099a703
3 changed files with 25 additions and 11 deletions

View File

@ -399,11 +399,6 @@ void mmc_remove_card(struct mmc_card *card)
mmc_remove_card_debugfs(card);
#endif
if (host->cqe_enabled) {
host->cqe_ops->cqe_disable(host);
host->cqe_enabled = false;
}
if (mmc_card_present(card)) {
if (mmc_host_is_spi(card->host)) {
pr_info("%s: SPI card removed\n",
@ -416,6 +411,10 @@ void mmc_remove_card(struct mmc_card *card)
of_node_put(card->dev.of_node);
}
if (host->cqe_enabled) {
host->cqe_ops->cqe_disable(host);
host->cqe_enabled = false;
}
put_device(&card->dev);
}

View File

@ -423,10 +423,6 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
/* EXT_CSD value is in units of 10ms, but we store in ms */
card->ext_csd.part_time = 10 * ext_csd[EXT_CSD_PART_SWITCH_TIME];
/* Some eMMC set the value too low so set a minimum */
if (card->ext_csd.part_time &&
card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME)
card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME;
/* Sleep / awake timeout in 100ns units */
if (sa_shift > 0 && sa_shift <= 0x17)
@ -616,6 +612,17 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
card->ext_csd.data_sector_size = 512;
}
/*
* GENERIC_CMD6_TIME is to be used "unless a specific timeout is defined
* when accessing a specific field", so use it here if there is no
* PARTITION_SWITCH_TIME.
*/
if (!card->ext_csd.part_time)
card->ext_csd.part_time = card->ext_csd.generic_cmd6_time;
/* Some eMMC set the value too low so set a minimum */
if (card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME)
card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME;
/* eMMC v5 or later */
if (card->ext_csd.rev >= 7) {
memcpy(card->ext_csd.fwrev, &ext_csd[EXT_CSD_FIRMWARE_VERSION],

View File

@ -1242,7 +1242,11 @@ mmci_start_command(struct mmci_host *host, struct mmc_command *cmd, u32 c)
if (!cmd->busy_timeout)
cmd->busy_timeout = 10 * MSEC_PER_SEC;
clks = (unsigned long long)cmd->busy_timeout * host->cclk;
if (cmd->busy_timeout > host->mmc->max_busy_timeout)
clks = (unsigned long long)host->mmc->max_busy_timeout * host->cclk;
else
clks = (unsigned long long)cmd->busy_timeout * host->cclk;
do_div(clks, MSEC_PER_SEC);
writel_relaxed(clks, host->base + MMCIDATATIMER);
}
@ -2151,6 +2155,10 @@ static int mmci_probe(struct amba_device *dev,
mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY;
}
/* Variants with mandatory busy timeout in HW needs R1B responses. */
if (variant->busy_timeout)
mmc->caps |= MMC_CAP_NEED_RSP_BUSY;
/* Prepare a CMD12 - needed to clear the DPSM on some variants. */
host->stop_abort.opcode = MMC_STOP_TRANSMISSION;
host->stop_abort.arg = 0;