From: Mike Frysinger <vapier@gentoo.org>
To: linux-mmc@vger.kernel.org,
Adrian Hunter <adrian.hunter@nokia.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
uclinux-dist-devel@blackfin.uclinux.org,
Cliff Cai <cliff.cai@analog.com>
Subject: [PATCH 3/3] mmc: bfin_sdh: set timeout based on actual card data
Date: Tue, 19 Jan 2010 03:02:11 -0500 [thread overview]
Message-ID: <1263888131-25656-3-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1263888131-25656-1-git-send-email-vapier@gentoo.org>
From: Cliff Cai <cliff.cai@analog.com>
The hardcoded value doesn't really work for all cards.
Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
drivers/mmc/host/bfin_sdh.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c
index f218a99..56f7b44 100644
--- a/drivers/mmc/host/bfin_sdh.c
+++ b/drivers/mmc/host/bfin_sdh.c
@@ -115,6 +115,7 @@ static int sdh_setup_data(struct sdh_host *host, struct mmc_data *data)
unsigned int length;
unsigned int data_ctl;
unsigned int dma_cfg;
+ unsigned int cycle_ns, timeout;
dev_dbg(mmc_dev(host->mmc), "%s enter flags: 0x%x\n", __func__, data->flags);
host->data = data;
@@ -135,8 +136,11 @@ static int sdh_setup_data(struct sdh_host *host, struct mmc_data *data)
data_ctl |= ((ffs(data->blksz) - 1) << 4);
bfin_write_SDH_DATA_CTL(data_ctl);
-
- bfin_write_SDH_DATA_TIMER(0xFFFF);
+ /* the time of a host clock period in ns */
+ cycle_ns = 1000000000 / (get_sclk() / (2 * (host->clk_div + 1)));
+ timeout = data->timeout_ns / cycle_ns;
+ timeout += data->timeout_clks;
+ bfin_write_SDH_DATA_TIMER(timeout);
SSYNC();
if (data->flags & MMC_DATA_READ) {
--
1.6.6
next prev parent reply other threads:[~2010-01-19 8:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-19 8:02 [PATCH 1/3] mmc: bfin_sdh: fix unused sg warning on BF51x/BF52x systems Mike Frysinger
2010-01-19 8:02 ` [PATCH 2/3] mmc: bfin_sdh: drop redundant MMC depend string Mike Frysinger
2010-01-19 8:02 ` Mike Frysinger [this message]
2010-01-26 0:07 ` [PATCH 3/3] mmc: bfin_sdh: set timeout based on actual card data Andrew Morton
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=1263888131-25656-3-git-send-email-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=adrian.hunter@nokia.com \
--cc=akpm@linux-foundation.org \
--cc=cliff.cai@analog.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
/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
all inboxes | Powered by JetHome®