]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.6.1/mmc-mmc-fix-partition-switch-timeout-for-some-emmcs.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.1 / mmc-mmc-fix-partition-switch-timeout-for-some-emmcs.patch
1 From 1c447116d017a98c90f8f71c8c5a611e0aa42178 Mon Sep 17 00:00:00 2001
2 From: Adrian Hunter <adrian.hunter@intel.com>
3 Date: Thu, 5 May 2016 08:12:28 +0300
4 Subject: mmc: mmc: Fix partition switch timeout for some eMMCs
5
6 From: Adrian Hunter <adrian.hunter@intel.com>
7
8 commit 1c447116d017a98c90f8f71c8c5a611e0aa42178 upstream.
9
10 Some eMMCs set the partition switch timeout too low.
11
12 Now typically eMMCs are considered a critical component (e.g. because
13 they store the root file system) and consequently are expected to be
14 reliable. Thus we can neglect the use case where eMMCs can't switch
15 reliably and we might want a lower timeout to facilitate speedy
16 recovery.
17
18 Although we could employ a quirk for the cards that are affected (if
19 we could identify them all), as described above, there is little
20 benefit to having a low timeout, so instead simply set a minimum
21 timeout.
22
23 The minimum is set to 300ms somewhat arbitrarily - the examples that
24 have been seen had a timeout of 10ms but were sometimes taking 60-70ms.
25
26 Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
27 Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
28 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29
30 ---
31 drivers/mmc/core/mmc.c | 7 +++++++
32 1 file changed, 7 insertions(+)
33
34 --- a/drivers/mmc/core/mmc.c
35 +++ b/drivers/mmc/core/mmc.c
36 @@ -333,6 +333,9 @@ static void mmc_manage_gp_partitions(str
37 }
38 }
39
40 +/* Minimum partition switch timeout in milliseconds */
41 +#define MMC_MIN_PART_SWITCH_TIME 300
42 +
43 /*
44 * Decode extended CSD.
45 */
46 @@ -397,6 +400,10 @@ static int mmc_decode_ext_csd(struct mmc
47
48 /* EXT_CSD value is in units of 10ms, but we store in ms */
49 card->ext_csd.part_time = 10 * ext_csd[EXT_CSD_PART_SWITCH_TIME];
50 + /* Some eMMC set the value too low so set a minimum */
51 + if (card->ext_csd.part_time &&
52 + card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME)
53 + card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME;
54
55 /* Sleep / awake timeout in 100ns units */
56 if (sa_shift > 0 && sa_shift <= 0x17)