diff options
author | Marcin Wojtas <mw@semihalf.com> | 2015-01-29 06:36:25 -0500 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2015-01-29 07:08:02 -0500 |
commit | a39128bcd6f1e56c6514abf489b40b67d226093b (patch) | |
tree | 377e736a1df15c133faf21045040a6fef6dd554a /drivers/mmc/host/sdhci-pxav3.c | |
parent | d4b803c559843e3774736e5108cf6331cf75f64c (diff) |
mmc: sdhci-pxav3: Fix Armada 38x controller's caps according to erratum ERR-7878951
According to erratum 'ERR-7878951' Armada 38x SDHCI controller has
different capabilities than the ones shown in its registers:
- it doesn't support the voltage switching: it can work either with
3.3V or 1.8V supply
- it doesn't support the SDR104 mode
- SDR50 mode doesn't need tuning
The SDHCI_QUIRK_MISSING_CAPS quirk is used for updating the
capabilities accordingly.
[gregory.clement@free-electrons.com: port from 3.10]
Fixes: 5491ce3f79ee ("mmc: sdhci-pxav3: add support for the Armada 38x SDHCI controller")
Cc: <stable@vger.kernel.org> # v3.15+
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/sdhci-pxav3.c')
-rw-r--r-- | drivers/mmc/host/sdhci-pxav3.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c index 1529efcbb733..90cbf016894e 100644 --- a/drivers/mmc/host/sdhci-pxav3.c +++ b/drivers/mmc/host/sdhci-pxav3.c | |||
@@ -118,8 +118,11 @@ static int mv_conf_mbus_windows(struct platform_device *pdev, | |||
118 | return 0; | 118 | return 0; |
119 | } | 119 | } |
120 | 120 | ||
121 | static int armada_38x_quirks(struct sdhci_host *host) | 121 | static int armada_38x_quirks(struct platform_device *pdev, |
122 | struct sdhci_host *host) | ||
122 | { | 123 | { |
124 | struct device_node *np = pdev->dev.of_node; | ||
125 | |||
123 | host->quirks |= SDHCI_QUIRK_MISSING_CAPS; | 126 | host->quirks |= SDHCI_QUIRK_MISSING_CAPS; |
124 | /* | 127 | /* |
125 | * According to erratum 'FE-2946959' both SDR50 and DDR50 | 128 | * According to erratum 'FE-2946959' both SDR50 and DDR50 |
@@ -129,6 +132,21 @@ static int armada_38x_quirks(struct sdhci_host *host) | |||
129 | */ | 132 | */ |
130 | host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1); | 133 | host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1); |
131 | host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_DDR50); | 134 | host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_DDR50); |
135 | |||
136 | /* | ||
137 | * According to erratum 'ERR-7878951' Armada 38x SDHCI | ||
138 | * controller has different capabilities than the ones shown | ||
139 | * in its registers | ||
140 | */ | ||
141 | host->caps = sdhci_readl(host, SDHCI_CAPABILITIES); | ||
142 | if (of_property_read_bool(np, "no-1-8-v")) { | ||
143 | host->caps &= ~SDHCI_CAN_VDD_180; | ||
144 | host->mmc->caps &= ~MMC_CAP_1_8V_DDR; | ||
145 | } else { | ||
146 | host->caps &= ~SDHCI_CAN_VDD_330; | ||
147 | } | ||
148 | host->caps1 &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_USE_SDR50_TUNING); | ||
149 | |||
132 | return 0; | 150 | return 0; |
133 | } | 151 | } |
134 | 152 | ||
@@ -332,8 +350,11 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) | |||
332 | if (!IS_ERR(pxa->clk_core)) | 350 | if (!IS_ERR(pxa->clk_core)) |
333 | clk_prepare_enable(pxa->clk_core); | 351 | clk_prepare_enable(pxa->clk_core); |
334 | 352 | ||
353 | /* enable 1/8V DDR capable */ | ||
354 | host->mmc->caps |= MMC_CAP_1_8V_DDR; | ||
355 | |||
335 | if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) { | 356 | if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) { |
336 | ret = armada_38x_quirks(host); | 357 | ret = armada_38x_quirks(pdev, host); |
337 | if (ret < 0) | 358 | if (ret < 0) |
338 | goto err_clk_get; | 359 | goto err_clk_get; |
339 | ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info()); | 360 | ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info()); |
@@ -341,9 +362,6 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) | |||
341 | goto err_mbus_win; | 362 | goto err_mbus_win; |
342 | } | 363 | } |
343 | 364 | ||
344 | /* enable 1/8V DDR capable */ | ||
345 | host->mmc->caps |= MMC_CAP_1_8V_DDR; | ||
346 | |||
347 | match = of_match_device(of_match_ptr(sdhci_pxav3_of_match), &pdev->dev); | 365 | match = of_match_device(of_match_ptr(sdhci_pxav3_of_match), &pdev->dev); |
348 | if (match) { | 366 | if (match) { |
349 | ret = mmc_of_parse(host->mmc); | 367 | ret = mmc_of_parse(host->mmc); |