]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.68/mmc-sdhci-msm-fix-issue-with-power-irq.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.9.68 / mmc-sdhci-msm-fix-issue-with-power-irq.patch
CommitLineData
95244f99
GKH
1From foo@baz Wed Dec 6 17:39:55 CET 2017
2From: Subhash Jadavani <subhashj@codeaurora.org>
3Date: Wed, 27 Sep 2017 11:04:40 +0530
4Subject: mmc: sdhci-msm: fix issue with power irq
5
6From: Subhash Jadavani <subhashj@codeaurora.org>
7
8
9[ Upstream commit c7ccee224d2d551f712752c4a16947f6529d6506 ]
10
11SDCC controller reset (SW_RST) during probe may trigger power irq if
12previous status of PWRCTL was either BUS_ON or IO_HIGH_V. So before we
13enable the power irq interrupt in GIC (by registering the interrupt
14handler), we need to ensure that any pending power irq interrupt status
15is acknowledged otherwise power irq interrupt handler would be fired
16prematurely.
17
18Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
19Signed-off-by: Vijay Viswanath <vviswana@codeaurora.org>
20Acked-by: Adrian Hunter <adrian.hunter@intel.com>
21Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
22Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
23Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24---
25 drivers/mmc/host/sdhci-msm.c | 18 ++++++++++++++++++
26 1 file changed, 18 insertions(+)
27
28--- a/drivers/mmc/host/sdhci-msm.c
29+++ b/drivers/mmc/host/sdhci-msm.c
30@@ -642,6 +642,21 @@ static int sdhci_msm_probe(struct platfo
31 CORE_VENDOR_SPEC_CAPABILITIES0);
32 }
33
34+ /*
35+ * Power on reset state may trigger power irq if previous status of
36+ * PWRCTL was either BUS_ON or IO_HIGH_V. So before enabling pwr irq
37+ * interrupt in GIC, any pending power irq interrupt should be
38+ * acknowledged. Otherwise power irq interrupt handler would be
39+ * fired prematurely.
40+ */
41+ sdhci_msm_voltage_switch(host);
42+
43+ /*
44+ * Ensure that above writes are propogated before interrupt enablement
45+ * in GIC.
46+ */
47+ mb();
48+
49 /* Setup IRQ for handling power/voltage tasks with PMIC */
50 msm_host->pwr_irq = platform_get_irq_byname(pdev, "pwr_irq");
51 if (msm_host->pwr_irq < 0) {
52@@ -651,6 +666,9 @@ static int sdhci_msm_probe(struct platfo
53 goto clk_disable;
54 }
55
56+ /* Enable pwr irq interrupts */
57+ writel_relaxed(INT_MASK, msm_host->core_mem + CORE_PWRCTL_MASK);
58+
59 ret = devm_request_threaded_irq(&pdev->dev, msm_host->pwr_irq, NULL,
60 sdhci_msm_pwr_irq, IRQF_ONESHOT,
61 dev_name(&pdev->dev), host);