public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alex Deymo <deymo@google.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] mmc: bcm2835_sdhci: Speed up mmc writes.
Date: Sun,  2 Apr 2017 01:24:33 -0700	[thread overview]
Message-ID: <20170402082434.32078-2-deymo@google.com> (raw)
In-Reply-To: <20170402082434.32078-1-deymo@google.com>

From: Jocelyn Bohr <bohr@google.com>

The linux kernel driver for this module does not use a delay when
writing to the SDHCI_BUFFER register. This patch mimics that behavior
in order to speed up the mmc writes on the Raspberry Pi.

Signed-off-by: Alex Deymo <deymo@google.com>
---
 drivers/mmc/bcm2835_sdhci.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/bcm2835_sdhci.c b/drivers/mmc/bcm2835_sdhci.c
index 29c2a85812..20079bce48 100644
--- a/drivers/mmc/bcm2835_sdhci.c
+++ b/drivers/mmc/bcm2835_sdhci.c
@@ -44,6 +44,7 @@
 
 /* 400KHz is max freq for card ID etc. Use that as min */
 #define MIN_FREQ 400000
+#define SDHCI_BUFFER 0x20
 
 struct bcm2835_sdhci_host {
 	struct sdhci_host host;
@@ -69,8 +70,11 @@ static inline void bcm2835_sdhci_raw_writel(struct sdhci_host *host, u32 val,
 	 * (Which is just as well - otherwise we'd have to nobble the DMA engine
 	 * too)
 	 */
-	while (timer_get_us() - bcm_host->last_write < bcm_host->twoticks_delay)
-		;
+	if (reg != SDHCI_BUFFER) {
+		while (timer_get_us() - bcm_host->last_write <
+		       bcm_host->twoticks_delay)
+			;
+	}
 
 	writel(val, host->ioaddr + reg);
 	bcm_host->last_write = timer_get_us();
-- 
2.12.2.564.g063fe858b8-goog

  reply	other threads:[~2017-04-02  8:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <b45d36cb8f3ff07a9de93a9a0acc48c017410b0c>
2017-04-02  8:24 ` [U-Boot] [PATCH 0/2] Improve Raspberry Pi mmc writes Alex Deymo
2017-04-02  8:24   ` Alex Deymo [this message]
2017-04-02  8:24     ` [U-Boot] [PATCH 2/2] mmc: sdhci: Wait for SDHCI_INT_DATA_END when transferring Alex Deymo
2017-04-06 22:42       ` Simon Glass
2017-04-06 22:42     ` [U-Boot] [PATCH 1/2] mmc: bcm2835_sdhci: Speed up mmc writes Simon Glass

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=20170402082434.32078-2-deymo@google.com \
    --to=deymo@google.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