]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/mmc-renesas_sdhi-limit-block-count-to-16-bit-for-old-revisions.patch
Linux 4.14.109
[thirdparty/kernel/stable-queue.git] / queue-4.19 / mmc-renesas_sdhi-limit-block-count-to-16-bit-for-old-revisions.patch
1 From c9a9497ccef205ed4ed2e247011382627876d831 Mon Sep 17 00:00:00 2001
2 From: Wolfram Sang <wsa+renesas@sang-engineering.com>
3 Date: Tue, 19 Mar 2019 11:12:59 +0100
4 Subject: mmc: renesas_sdhi: limit block count to 16 bit for old revisions
5
6 From: Wolfram Sang <wsa+renesas@sang-engineering.com>
7
8 commit c9a9497ccef205ed4ed2e247011382627876d831 upstream.
9
10 R-Car Gen2 has two different SDHI incarnations in the same chip. The
11 older one does not support the recently introduced 32 bit register
12 access to the block count register. Make sure we use this feature only
13 after the first known version.
14
15 Thanks to the Renesas Testing team for this bug report!
16
17 Fixes: 5603731a15ef ("mmc: tmio: fix access width of Block Count Register")
18 Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
19 Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
20 Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
21 Tested-by: Phong Hoang <phong.hoang.wz@renesas.com>
22 Cc: stable@vger.kernel.org
23 Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26 ---
27 drivers/mmc/host/renesas_sdhi_core.c | 8 +++++++-
28 1 file changed, 7 insertions(+), 1 deletion(-)
29
30 --- a/drivers/mmc/host/renesas_sdhi_core.c
31 +++ b/drivers/mmc/host/renesas_sdhi_core.c
32 @@ -557,6 +557,7 @@ int renesas_sdhi_probe(struct platform_d
33 struct renesas_sdhi *priv;
34 struct resource *res;
35 int irq, ret, i;
36 + u16 ver;
37
38 of_data = of_device_get_match_data(&pdev->dev);
39
40 @@ -671,12 +672,17 @@ int renesas_sdhi_probe(struct platform_d
41 if (ret)
42 goto efree;
43
44 + ver = sd_ctrl_read16(host, CTL_VERSION);
45 + /* GEN2_SDR104 is first known SDHI to use 32bit block count */
46 + if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX)
47 + mmc_data->max_blk_count = U16_MAX;
48 +
49 ret = tmio_mmc_host_probe(host);
50 if (ret < 0)
51 goto edisclk;
52
53 /* One Gen2 SDHI incarnation does NOT have a CBSY bit */
54 - if (sd_ctrl_read16(host, CTL_VERSION) == SDHI_VER_GEN2_SDR50)
55 + if (ver == SDHI_VER_GEN2_SDR50)
56 mmc_data->flags &= ~TMIO_MMC_HAVE_CBSY;
57
58 /* Enable tuning iff we have an SCC and a supported mode */