From ff32c4b41f30f0b4609ef5898a00569ab1862939 Mon Sep 17 00:00:00 2001 From: "Bao D. Nguyen" Date: Wed, 3 Jun 2020 15:21:22 -0700 Subject: [PATCH] mmc: sdhci_msm: keep a reference to the sdhc host instance Keep a reference to the sdhc host instance to retrieve all the necessary data structures in case of a crash for debugging. Change-Id: I151b160ffbd6a02edea022ae7b970241dedce031 Signed-off-by: Bao D. Nguyen --- drivers/mmc/host/sdhci-msm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 8f29d6d15a94..f616058377f5 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -405,6 +405,8 @@ struct sdhci_msm_host { struct sdhci_msm_regs_restore regs_restore; }; +static struct sdhci_msm_host *sdhci_slot[2]; + static void sdhci_msm_bus_voting(struct sdhci_host *host, bool enable); static int sdhci_msm_dt_get_array(struct device *dev, const char *prop_name, @@ -3019,6 +3021,14 @@ static int sdhci_msm_probe(struct platform_device *pdev) if (ret) goto pltfm_free; + if (pdev->dev.of_node) { + ret = of_alias_get_id(pdev->dev.of_node, "sdhc"); + if (ret <= 0) + dev_err(&pdev->dev, "get slot index failed %d\n", ret); + else if (ret <= 2) + sdhci_slot[ret-1] = msm_host; + } + /* * Based on the compatible string, load the required msm host info from * the data associated with the version info.