From: mingming lee <mingming.lee@mediatek.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/5] mmc: mtk-sd: add HS200 support
Date: Wed, 11 Sep 2019 19:14:57 +0800 [thread overview]
Message-ID: <20190911111459.4536-4-mingming.lee@mediatek.com> (raw)
In-Reply-To: <20190911111459.4536-1-mingming.lee@mediatek.com>
add HS200 mode and tune support
Signed-off-by: mingming lee <mingming.lee@mediatek.com>
---
drivers/mmc/mtk-sd.c | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/drivers/mmc/mtk-sd.c b/drivers/mmc/mtk-sd.c
index f555357af2..bede4153b3 100644
--- a/drivers/mmc/mtk-sd.c
+++ b/drivers/mmc/mtk-sd.c
@@ -362,6 +362,8 @@ static u32 msdc_cmd_prepare_raw_cmd(struct msdc_host *host,
case MMC_CMD_WRITE_SINGLE_BLOCK:
case MMC_CMD_READ_SINGLE_BLOCK:
case SD_CMD_APP_SEND_SCR:
+ case MMC_CMD_SEND_TUNING_BLOCK:
+ case MMC_CMD_SEND_TUNING_BLOCK_HS200:
dtype = 1;
break;
case SD_CMD_SWITCH_FUNC: /* same as MMC_CMD_SWITCH */
@@ -467,6 +469,14 @@ static int msdc_start_command(struct msdc_host *host, struct mmc_cmd *cmd,
if (!msdc_cmd_is_ready(host))
return -EIO;
+ if ((readl(&host->base->msdc_fifocs) &
+ MSDC_FIFOCS_TXCNT_M) >> MSDC_FIFOCS_TXCNT_S ||
+ (readl(&host->base->msdc_fifocs) &
+ MSDC_FIFOCS_RXCNT_M) >> MSDC_FIFOCS_RXCNT_S) {
+ pr_err("TX/RX FIFO non-empty before start of IO. Reset\n");
+ msdc_reset_hw(host);
+ }
+
msdc_fifo_clr(host);
host->last_resp_type = cmd->resp_type;
@@ -650,14 +660,22 @@ static int msdc_ops_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
struct mmc_data *data)
{
struct msdc_host *host = dev_get_priv(dev);
- int ret;
+ int cmd_ret, data_ret;
- ret = msdc_start_command(host, cmd, data);
- if (ret)
- return ret;
+ cmd_ret = msdc_start_command(host, cmd, data);
+ if (cmd_ret &&
+ !(cmd_ret == -EIO &&
+ (cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK ||
+ cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK_HS200)))
+ return cmd_ret;
- if (data)
- return msdc_start_data(host, data);
+ if (data) {
+ data_ret = msdc_start_data(host, data);
+ if (cmd_ret)
+ return cmd_ret;
+ else
+ return data_ret;
+ }
return 0;
}
--
2.18.0
next prev parent reply other threads:[~2019-09-11 11:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-11 11:14 [U-Boot] [PATCH 0/5] Add support for MediaTek MT8518 Soc mingming lee
2019-09-11 11:14 ` [U-Boot] [PATCH 1/5] ARM: MediaTek: Add support for MediaTek MT8518 SoC mingming lee
2019-10-13 10:55 ` Matthias Brugger
2019-10-15 6:25 ` Mingming Lee
2019-10-15 6:42 ` Mingming Lee
2019-10-15 6:56 ` Mingming Lee
2019-09-11 11:14 ` [U-Boot] [PATCH 2/5] clk: mediatek: add driver for MT8518 mingming lee
2019-09-11 11:14 ` mingming lee [this message]
2019-09-11 11:14 ` [U-Boot] [PATCH 4/5] pinctrl: " mingming lee
2019-09-11 11:14 ` [U-Boot] [PATCH 5/5] ARM: MediaTek: add basic support for MT8518 boards mingming lee
2019-10-11 17:28 ` Tom Rini
2019-10-15 9:38 ` Mingming Lee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190911111459.4536-4-mingming.lee@mediatek.com \
--to=mingming.lee@mediatek.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox