From: Bob Liu <lliubbo@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 10/16] Blackfin: Bf60x: Check card ready for each RSI command
Date: Tue, 7 Aug 2012 16:07:49 +0800 [thread overview]
Message-ID: <1344326875-348-10-git-send-email-lliubbo@gmail.com> (raw)
In-Reply-To: <1344326875-348-1-git-send-email-lliubbo@gmail.com>
From: Sonic Zhang <sonic.zhang@analog.com>
Set up RSI data before sending RSI command if data is applicable.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
---
drivers/mmc/bfin_sdh.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/bfin_sdh.c b/drivers/mmc/bfin_sdh.c
index 4dd9b78..f22429a 100644
--- a/drivers/mmc/bfin_sdh.c
+++ b/drivers/mmc/bfin_sdh.c
@@ -79,6 +79,9 @@ sdh_send_cmd(struct mmc *mmc, struct mmc_cmd *mmc_cmd)
sdh_cmd |= CMD_RSP;
if (flags & MMC_RSP_136)
sdh_cmd |= CMD_L_RSP;
+#ifdef RSI_BLKSZ
+ sdh_cmd |= CMD_DATA0_BUSY;
+#endif
bfin_write_SDH_ARGUMENT(arg);
bfin_write_SDH_COMMAND(sdh_cmd);
@@ -113,6 +116,12 @@ sdh_send_cmd(struct mmc *mmc, struct mmc_cmd *mmc_cmd)
bfin_write_SDH_STATUS_CLR(CMD_SENT_STAT | CMD_RESP_END_STAT |
CMD_TIMEOUT_STAT | CMD_CRC_FAIL_STAT);
+#ifdef RSI_BLKSZ
+ /* wait till card ready */
+ while (!(bfin_read_RSI_ESTAT() & SD_CARD_READY))
+ ;
+ bfin_write_RSI_ESTAT(SD_CARD_READY);
+#endif
return ret;
}
@@ -122,7 +131,6 @@ static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data)
{
u16 data_ctl = 0;
u16 dma_cfg = 0;
- int ret = 0;
unsigned long data_size = data->blocksize * data->blocks;
/* Don't support write yet. */
@@ -150,7 +158,7 @@ static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data)
/* kick off transfer */
bfin_write_SDH_DATA_CTL(bfin_read_SDH_DATA_CTL() | DTX_DMA_E | DTX_E);
- return ret;
+ return 0;
}
@@ -160,15 +168,23 @@ static int bfin_sdh_request(struct mmc *mmc, struct mmc_cmd *cmd,
u32 status;
int ret = 0;
+ if (data) {
+ ret = sdh_setup_data(mmc, data);
+ if (ret)
+ return ret;
+ }
+
ret = sdh_send_cmd(mmc, cmd);
if (ret) {
bfin_write_SDH_COMMAND(0);
+ bfin_write_DMA_CONFIG(0);
+ bfin_write_SDH_DATA_CTL(0);
SSYNC();
printf("sending CMD%d failed\n", cmd->cmdidx);
return ret;
}
+
if (data) {
- ret = sdh_setup_data(mmc, data);
do {
udelay(1);
status = bfin_read_SDH_STATUS();
@@ -253,6 +269,7 @@ static int bfin_sdh_init(struct mmc *mmc)
bfin_write_SDH_PWR_CTL(PWR_ON | ROD_CTL);
#else
bfin_write_SDH_CFG(bfin_read_SDH_CFG() | PWR_ON);
+#endif
return 0;
}
--
1.7.9.5
next prev parent reply other threads:[~2012-08-07 8:07 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-07 8:07 [U-Boot] [PATCH 01/16] Blackfin: BF60x: new processor port Bob Liu
2012-08-07 8:07 ` [U-Boot] [PATCH 02/16] Blackfin: bf609-ezkit: new board port Bob Liu
2012-08-08 4:41 ` Mike Frysinger
2012-08-20 7:55 ` Bob Liu
2012-08-07 8:07 ` [U-Boot] [PATCH 03/16] Blackfin: Bf60x: support big cplb page Bob Liu
2012-08-08 4:48 ` Mike Frysinger
2012-08-20 8:00 ` Bob Liu
2012-08-23 3:49 ` Mike Frysinger
2012-08-07 8:07 ` [U-Boot] [PATCH 04/16] Blackfin: Rsi: add support for bf609-ezkit Bob Liu
2012-08-08 4:52 ` Mike Frysinger
2012-08-20 8:01 ` Bob Liu
2012-08-07 8:07 ` [U-Boot] [PATCH 05/16] Blackfin: Paraflash: " Bob Liu
2012-08-08 4:55 ` Mike Frysinger
2012-08-20 8:01 ` Bob Liu
2012-08-07 8:07 ` [U-Boot] [PATCH 06/16] Blackfin: Bf609-ezkit: implement soft switch Bob Liu
2012-08-08 4:59 ` Mike Frysinger
2012-08-20 8:11 ` Bob Liu
2012-08-23 3:53 ` Mike Frysinger
2012-08-07 8:07 ` [U-Boot] [PATCH 07/16] Blackfin: Spi: add bf6xx spi driver Bob Liu
2012-08-08 5:02 ` Mike Frysinger
2012-08-20 8:11 ` Bob Liu
2012-08-07 8:07 ` [U-Boot] [PATCH 08/16] Blackfin: add more print info for Bf60x Bob Liu
2012-08-08 5:04 ` Mike Frysinger
2012-08-20 8:12 ` Bob Liu
2012-08-07 8:07 ` [U-Boot] [PATCH 09/16] Blackfin: Bf60x: add reset support Bob Liu
2012-08-08 5:05 ` Mike Frysinger
2012-08-20 8:13 ` Bob Liu
2012-08-07 8:07 ` Bob Liu [this message]
2012-08-08 5:05 ` [U-Boot] [PATCH 10/16] Blackfin: Bf60x: Check card ready for each RSI command Mike Frysinger
2012-08-20 8:13 ` Bob Liu
2012-08-07 8:07 ` [U-Boot] [PATCH 11/16] Blackfin: Bf60x: support clock init Bob Liu
2012-08-08 5:06 ` Mike Frysinger
2012-08-07 8:07 ` [U-Boot] [PATCH 12/16] Blackfin: Bf60x: initcode: set up uart baud properly Bob Liu
2012-08-08 5:06 ` Mike Frysinger
2012-08-07 8:07 ` [U-Boot] [PATCH 13/16] Blackfin: Bf60x: add hw watchdog support Bob Liu
2012-08-08 5:11 ` Mike Frysinger
2012-08-20 8:25 ` Bob Liu
2012-08-07 8:07 ` [U-Boot] [PATCH 14/16] Blackfin: setup SMC if user desires it Bob Liu
2012-08-07 8:07 ` [U-Boot] [PATCH 15/16] Blackfin: Bf60x: add resume from hibernate Bob Liu
2012-08-07 8:07 ` [U-Boot] [PATCH 16/16] Blackfin: update license to Clear BSD license Bob Liu
2012-08-08 5:12 ` Mike Frysinger
2012-08-20 8:25 ` Bob Liu
2012-08-08 4:39 ` [U-Boot] [PATCH 01/16] Blackfin: BF60x: new processor port Mike Frysinger
2012-08-20 7:54 ` Bob Liu
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=1344326875-348-10-git-send-email-lliubbo@gmail.com \
--to=lliubbo@gmail.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