Skip to content

Commit c9a9497

Browse files
Wolfram Sangstorulf
authored andcommitted
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: 5603731 ("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>
1 parent 5ea4769 commit c9a9497

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/mmc/host/renesas_sdhi_core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
641641
struct renesas_sdhi *priv;
642642
struct resource *res;
643643
int irq, ret, i;
644+
u16 ver;
644645

645646
of_data = of_device_get_match_data(&pdev->dev);
646647

@@ -773,12 +774,17 @@ int renesas_sdhi_probe(struct platform_device *pdev,
773774
if (ret)
774775
goto efree;
775776

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+
776782
ret = tmio_mmc_host_probe(host);
777783
if (ret < 0)
778784
goto edisclk;
779785

780786
/* 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)
782788
mmc_data->flags &= ~TMIO_MMC_HAVE_CBSY;
783789

784790
/* Enable tuning iff we have an SCC and a supported mode */

0 commit comments

Comments
 (0)