From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 2/9] mmc: sdhci.c: Add config option to use a fixed buffer for transfers
Date: Mon, 29 Jun 2015 14:58:09 +0200 [thread overview]
Message-ID: <1435582696-30068-3-git-send-email-sr@denx.de> (raw)
In-Reply-To: <1435582696-30068-1-git-send-email-sr@denx.de>
While implementing SDIO/MMC SPL booting for the Marvell Armada 38x, the
following problem occured. The SPL runs in internal SRAM which is
the L2 cache locked to memory. When the MMC buffers now are located
on the stack (or bss), the SDIO controller (SDHCI) can't write into
this L2 cache memory.
This patch introduces a method to use a fixed buffer that will be
used for all transfers by defining CONFIG_FIXED_SDHCI_ALIGNED_BUFFER.
This way, the board can use this buffer address located in SDRAM
for all transfers. This solves this SPL problem on the A38x and
should only be used in the SPL U-Boot version.
Tested for SPL booting on Marvell Armada 38x DB-88F6820-GP board.
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Cc: Luka Perkov <luka.perkov@sartura.hr>
---
drivers/mmc/sdhci.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index f72536b..d89e302 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -13,7 +13,11 @@
#include <mmc.h>
#include <sdhci.h>
+#if defined(CONFIG_FIXED_SDHCI_ALIGNED_BUFFER)
+void *aligned_buffer = (void *)CONFIG_FIXED_SDHCI_ALIGNED_BUFFER;
+#else
void *aligned_buffer;
+#endif
static void sdhci_reset(struct sdhci_host *host, u8 mask)
{
@@ -205,6 +209,17 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
memcpy(aligned_buffer, data->src, trans_bytes);
}
+#if defined(CONFIG_FIXED_SDHCI_ALIGNED_BUFFER)
+ /*
+ * Always use this bounce-buffer when
+ * CONFIG_FIXED_SDHCI_ALIGNED_BUFFER is defined
+ */
+ is_aligned = 0;
+ start_addr = (unsigned long)aligned_buffer;
+ if (data->flags != MMC_DATA_READ)
+ memcpy(aligned_buffer, data->src, trans_bytes);
+#endif
+
sdhci_writel(host, start_addr, SDHCI_DMA_ADDRESS);
mode |= SDHCI_TRNS_DMA;
#endif
--
2.4.5
next prev parent reply other threads:[~2015-06-29 12:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-29 12:58 [U-Boot] [PATCH v1 0/9] mvebu/a38x: Add MMC/SDIO, SATA/AHCI and USB/EHCI support Stefan Roese
2015-06-29 12:58 ` [U-Boot] [PATCH v1 1/9] mmc: sdhci: Use timer based timeout detection in sdhci_send_command() Stefan Roese
2015-06-29 12:58 ` Stefan Roese [this message]
2015-06-29 12:58 ` [U-Boot] [PATCH v1 3/9] arm: mvebu: Add SDIO/SDHCI support for Armada A38x Stefan Roese
2015-06-29 12:58 ` [U-Boot] [PATCH v1 4/9] arm: mvebu: db-88f6820-gp: Add MMC/SDIO support Stefan Roese
2015-06-29 12:58 ` [U-Boot] [PATCH v1 5/9] block: ahci: Don't enable port interrupts Stefan Roese
2015-06-29 16:03 ` Simon Glass
2015-06-29 12:58 ` [U-Boot] [PATCH v1 6/9] arm: mvebu: Add SATA/SCSI (AHCI) support for Armada A38x Stefan Roese
2015-06-29 12:58 ` [U-Boot] [PATCH v1 7/9] arm: mvebu: db-88f6820-gp.h: Add SATA/SCSI (AHCI) support Stefan Roese
2015-06-29 12:58 ` [U-Boot] [PATCH v1 8/9] usb: Add EHCI support for Armada 38x (mvebu) Stefan Roese
2015-06-29 15:22 ` Marek Vasut
2015-07-02 11:03 ` Stefan Roese
2015-07-02 11:13 ` Marek Vasut
2015-06-29 12:58 ` [U-Boot] [PATCH v1 9/9] arm: mvebu: db-88f6820-gp: Add USB/EHCI support Stefan Roese
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=1435582696-30068-3-git-send-email-sr@denx.de \
--to=sr@denx.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.