]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.10.7/mmc-sdhci-do-not-disable-interrupts-while-waiting-for-clock.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.10.7 / mmc-sdhci-do-not-disable-interrupts-while-waiting-for-clock.patch
1 From e2ebfb2142acefecc2496e71360f50d25726040b Mon Sep 17 00:00:00 2001
2 From: Adrian Hunter <adrian.hunter@intel.com>
3 Date: Mon, 20 Mar 2017 19:50:29 +0200
4 Subject: mmc: sdhci: Do not disable interrupts while waiting for clock
5
6 From: Adrian Hunter <adrian.hunter@intel.com>
7
8 commit e2ebfb2142acefecc2496e71360f50d25726040b upstream.
9
10 Disabling interrupts for even a millisecond can cause problems for some
11 devices. That can happen when sdhci changes clock frequency because it
12 waits for the clock to become stable under a spin lock.
13
14 The spin lock is not necessary here. Anything that is racing with changes
15 to the I/O state is already broken. The mmc core already provides
16 synchronization via "claiming" the host.
17
18 Although the spin lock probably should be removed from the code paths that
19 lead to this point, such a patch would touch too much code to be suitable
20 for stable trees. Consequently, for this patch, just drop the spin lock
21 while waiting.
22
23 Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
24 Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
25 Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27
28 ---
29 drivers/mmc/host/sdhci.c | 4 +++-
30 1 file changed, 3 insertions(+), 1 deletion(-)
31
32 --- a/drivers/mmc/host/sdhci.c
33 +++ b/drivers/mmc/host/sdhci.c
34 @@ -1362,7 +1362,9 @@ void sdhci_enable_clk(struct sdhci_host
35 return;
36 }
37 timeout--;
38 - mdelay(1);
39 + spin_unlock_irq(&host->lock);
40 + usleep_range(900, 1100);
41 + spin_lock_irq(&host->lock);
42 }
43
44 clk |= SDHCI_CLOCK_CARD_EN;