mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: barebox@lists.infradead.org
Subject: [PATCH] drivers/mci: pxa fix clockrate
Date: Mon, 19 Dec 2011 22:03:05 +0100	[thread overview]
Message-ID: <1324328585-30806-1-git-send-email-robert.jarzmik@free.fr> (raw)
In-Reply-To: <20111219111424.GM27267@pengutronix.de>

The clock rate was incorrectly calculated, leading to a
frequency of 19.5MHz / 64 instead of 19.5Mz for the host
controller.

with the fix applied, a copy of a file of 230 kB shrinks
from 6000ms to 123ms.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/mci/pxamci.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/mci/pxamci.c b/drivers/mci/pxamci.c
index 1634a1d..75b61f0 100644
--- a/drivers/mci/pxamci.c
+++ b/drivers/mci/pxamci.c
@@ -161,7 +161,8 @@ static int pxamci_transfer_data(struct pxamci_host *host,
 static void pxamci_start_cmd(struct pxamci_host *host, struct mci_cmd *cmd,
 			     unsigned int cmdat)
 {
-	mci_dbg("cmd=(idx=%d,type=%d)\n", cmd->cmdidx, cmd->resp_type);
+	mci_dbg("cmd=(idx=%d,type=%d,clkrt=%d)\n", cmd->cmdidx, cmd->resp_type,
+		host->clkrt);
 	if (cmd->resp_type & MMC_RSP_BUSY)
 		cmdat |= CMDAT_BUSY;
 
@@ -277,11 +278,14 @@ static void pxamci_set_ios(struct mci_host *mci, struct device_d *dev,
 {
 	struct pxamci_host *host = to_pxamci(mci);
 	unsigned int clk_in = pxa_get_mmcclk();
-	unsigned long fact;
+	int fact;
 
-	mci_dbg("bus_width=%d, clock=%ud\n", bus_width, clock);
-	fact = min_t(int, clock / clk_in, 1);
-	fact = max_t(int, fact, 1 << 6);
+	mci_dbg("bus_width=%d, clock=%u\n", bus_width, clock);
+	if (clock)
+		fact = min_t(int, clk_in / clock, 1 << 6);
+	else
+		fact = 1 << 6;
+	fact = max_t(int, fact, 1);
 
 	/*
 	 * We calculate clkrt here, and will write it on the next command
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2011-12-19 21:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-05 17:51 FAT filesystem write and long names stability Robert Jarzmik
2011-12-05 20:03 ` Franck JULLIEN
2011-12-05 20:40   ` Robert Jarzmik
2011-12-05 20:43     ` Franck JULLIEN
2011-12-06 10:01       ` Robert Jarzmik
2011-12-07  8:37         ` Sascha Hauer
2011-12-13 15:33           ` Robert Jarzmik
2011-12-15  9:28             ` Robert Jarzmik
2011-12-19 11:01               ` Sascha Hauer
2011-12-19 11:14                 ` Sascha Hauer
2011-12-19 21:03                   ` Robert Jarzmik [this message]

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=1324328585-30806-1-git-send-email-robert.jarzmik@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=barebox@lists.infradead.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