summaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2019-03-19 06:12:59 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2019-03-21 06:41:46 -0400
commitc9a9497ccef205ed4ed2e247011382627876d831 (patch)
tree52064d064e2e427b2f22439dfd953516d39ec4df /drivers/mmc
parent5ea47691bd99e1100707ec63364aff72324e2af4 (diff)
mmc: renesas_sdhi: limit block count to 16 bit for old revisions
R-Car Gen2 has two different SDHI incarnations in the same chip. The older one does not support the recently introduced 32 bit register access to the block count register. Make sure we use this feature only after the first known version. Thanks to the Renesas Testing team for this bug report! Fixes: 5603731a15ef ("mmc: tmio: fix access width of Block Count Register") Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Tested-by: Phong Hoang <phong.hoang.wz@renesas.com> Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/renesas_sdhi_core.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 71e13844df6c..8742e27e4e8b 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -641,6 +641,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
641 struct renesas_sdhi *priv; 641 struct renesas_sdhi *priv;
642 struct resource *res; 642 struct resource *res;
643 int irq, ret, i; 643 int irq, ret, i;
644 u16 ver;
644 645
645 of_data = of_device_get_match_data(&pdev->dev); 646 of_data = of_device_get_match_data(&pdev->dev);
646 647
@@ -773,12 +774,17 @@ int renesas_sdhi_probe(struct platform_device *pdev,
773 if (ret) 774 if (ret)
774 goto efree; 775 goto efree;
775 776
777 ver = sd_ctrl_read16(host, CTL_VERSION);
778 /* GEN2_SDR104 is first known SDHI to use 32bit block count */
779 if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX)
780 mmc_data->max_blk_count = U16_MAX;
781
776 ret = tmio_mmc_host_probe(host); 782 ret = tmio_mmc_host_probe(host);
777 if (ret < 0) 783 if (ret < 0)
778 goto edisclk; 784 goto edisclk;
779 785
780 /* One Gen2 SDHI incarnation does NOT have a CBSY bit */ 786 /* One Gen2 SDHI incarnation does NOT have a CBSY bit */
781 if (sd_ctrl_read16(host, CTL_VERSION) == SDHI_VER_GEN2_SDR50) 787 if (ver == SDHI_VER_GEN2_SDR50)
782 mmc_data->flags &= ~TMIO_MMC_HAVE_CBSY; 788 mmc_data->flags &= ~TMIO_MMC_HAVE_CBSY;
783 789
784 /* Enable tuning iff we have an SCC and a supported mode */ 790 /* Enable tuning iff we have an SCC and a supported mode */