1e7aa7e7d79f4ae3eddc93ac94dc220140c9aa55
[openwrt/openwrt.git] / target / linux / mediatek / patches-4.14 / 0155-mmc-mediatek-add-busy_check-support.patch
1 From 788d269aee4c612d5cd97b896ea5d22f19137097 Mon Sep 17 00:00:00 2001
2 From: Chaotian Jing <chaotian.jing@mediatek.com>
3 Date: Mon, 16 Oct 2017 09:46:34 +0800
4 Subject: [PATCH 155/224] mmc: mediatek: add busy_check support
5
6 bit7 of PATCH_BIT1 has different meaning in new design, to
7 compatible with previous platform, clear this bit in new
8 platform.
9
10 Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
11 Tested-by: Sean Wang <sean.wang@mediatek.com>
12 Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
13 ---
14 drivers/mmc/host/mtk-sd.c | 7 +++++++
15 1 file changed, 7 insertions(+)
16
17 diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
18 index 8113bacc1540..eceaee86ba4d 100644
19 --- a/drivers/mmc/host/mtk-sd.c
20 +++ b/drivers/mmc/host/mtk-sd.c
21 @@ -316,6 +316,7 @@ struct mtk_mmc_compatible {
22 u32 pad_tune_reg;
23 bool async_fifo;
24 bool data_tune;
25 + bool busy_check;
26 };
27
28 struct msdc_tune_para {
29 @@ -380,6 +381,7 @@ static const struct mtk_mmc_compatible mt8135_compat = {
30 .pad_tune_reg = MSDC_PAD_TUNE,
31 .async_fifo = false,
32 .data_tune = false,
33 + .busy_check = false,
34 };
35
36 static const struct mtk_mmc_compatible mt8173_compat = {
37 @@ -388,6 +390,7 @@ static const struct mtk_mmc_compatible mt8173_compat = {
38 .pad_tune_reg = MSDC_PAD_TUNE,
39 .async_fifo = false,
40 .data_tune = false,
41 + .busy_check = false,
42 };
43
44 static const struct mtk_mmc_compatible mt2701_compat = {
45 @@ -396,6 +399,7 @@ static const struct mtk_mmc_compatible mt2701_compat = {
46 .pad_tune_reg = MSDC_PAD_TUNE0,
47 .async_fifo = true,
48 .data_tune = true,
49 + .busy_check = false,
50 };
51
52 static const struct mtk_mmc_compatible mt2712_compat = {
53 @@ -404,6 +408,7 @@ static const struct mtk_mmc_compatible mt2712_compat = {
54 .pad_tune_reg = MSDC_PAD_TUNE0,
55 .async_fifo = true,
56 .data_tune = true,
57 + .busy_check = true,
58 };
59
60 static const struct of_device_id msdc_of_ids[] = {
61 @@ -1275,6 +1280,8 @@ static void msdc_init_hw(struct msdc_host *host)
62 sdr_set_field(host->base + MSDC_PATCH_BIT, MSDC_CKGEN_MSDC_DLY_SEL, 1);
63 writel(0xffff4089, host->base + MSDC_PATCH_BIT1);
64 sdr_set_bits(host->base + EMMC50_CFG0, EMMC50_CFG_CFCSTS_SEL);
65 + if (host->dev_comp->busy_check)
66 + sdr_clr_bits(host->base + MSDC_PATCH_BIT1, (1 << 7));
67 if (host->dev_comp->async_fifo) {
68 sdr_set_field(host->base + MSDC_PATCH_BIT2,
69 MSDC_PB2_RESPWAIT, 3);
70 --
71 2.11.0
72