Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8dce5c62 authored by Stephen Boyd's avatar Stephen Boyd Committed by Xiaonian Wang
Browse files

mmc: sdhci-msm: Read version register properly



The version register is only 16 bits wide but we use a readl to
read it. Normally this wouldn't be a problem, but the register
offset is 0xfe, something that is not word aligned. This causes
crashes on THUMB2 kernels. Use readw instead to read the register
properly and avoid any alignment issues.

Change-Id: I3b8b14ce2f741631ef7554e3763d1d7f145077a8
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 7c9780dc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1811,7 +1811,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
	struct sdhci_msm_host *msm_host;
	struct resource *core_memres = NULL;
	int ret = 0, pwr_irq = 0, dead = 0;
	u32 host_version;
	u16 host_version;

	pr_debug("%s: Enter %s\n", dev_name(&pdev->dev), __func__);
	msm_host = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_msm_host),
@@ -1937,7 +1937,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
	host->quirks2 |= SDHCI_QUIRK2_BROKEN_PRESET_VALUE;
	host->quirks2 |= SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT;

	host_version = readl_relaxed((host->ioaddr + SDHCI_HOST_VERSION));
	host_version = readw_relaxed((host->ioaddr + SDHCI_HOST_VERSION));
	dev_dbg(&pdev->dev, "Host Version: 0x%x Vendor Version 0x%x\n",
		host_version, ((host_version & SDHCI_VENDOR_VER_MASK) >>
		  SDHCI_VENDOR_VER_SHIFT));