Skip to content

Commit 61fadd5

Browse files
ahunter6gregkh
authored andcommitted
mmc: core: Fix partition switch time for eMMC
commit 66fbacc upstream. Avoid the following warning by always defining partition switch time: [ 3.209874] mmc1: unspecified timeout for CMD6 - use generic [ 3.222780] ------------[ cut here ]------------ [ 3.233363] WARNING: CPU: 1 PID: 111 at drivers/mmc/core/mmc_ops.c:575 __mmc_switch+0x200/0x204 Reported-by: Paul Fertser <[email protected]> Fixes: 1c44711 ("mmc: mmc: Fix partition switch timeout for some eMMCs") Signed-off-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: [email protected] Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1cb73c8 commit 61fadd5

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

drivers/mmc/core/mmc.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,6 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
423423

424424
/* EXT_CSD value is in units of 10ms, but we store in ms */
425425
card->ext_csd.part_time = 10 * ext_csd[EXT_CSD_PART_SWITCH_TIME];
426-
/* Some eMMC set the value too low so set a minimum */
427-
if (card->ext_csd.part_time &&
428-
card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME)
429-
card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME;
430426

431427
/* Sleep / awake timeout in 100ns units */
432428
if (sa_shift > 0 && sa_shift <= 0x17)
@@ -616,6 +612,17 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
616612
card->ext_csd.data_sector_size = 512;
617613
}
618614

615+
/*
616+
* GENERIC_CMD6_TIME is to be used "unless a specific timeout is defined
617+
* when accessing a specific field", so use it here if there is no
618+
* PARTITION_SWITCH_TIME.
619+
*/
620+
if (!card->ext_csd.part_time)
621+
card->ext_csd.part_time = card->ext_csd.generic_cmd6_time;
622+
/* Some eMMC set the value too low so set a minimum */
623+
if (card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME)
624+
card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME;
625+
619626
/* eMMC v5 or later */
620627
if (card->ext_csd.rev >= 7) {
621628
memcpy(card->ext_csd.fwrev, &ext_csd[EXT_CSD_FIRMWARE_VERSION],

0 commit comments

Comments
 (0)