All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 17/27] Blackfin: use 8/16/32 bit transfer widths in dma_memcpy()
Date: Wed, 28 Jan 2009 19:03:26 -0500	[thread overview]
Message-ID: <1233187416-22378-18-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1233187416-22378-1-git-send-email-vapier@gentoo.org>

Rather than using 8bit transfers for everything, use 8/16/32 bit transfers
as usable with the source/destination addresses and the count size.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 lib_blackfin/string.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/lib_blackfin/string.c b/lib_blackfin/string.c
index e458718..12b6d24 100644
--- a/lib_blackfin/string.c
+++ b/lib_blackfin/string.c
@@ -136,6 +136,8 @@ int strncmp(const char *cs, const char *ct, size_t count)
  */
 void dma_memcpy_nocache(void *dst, const void *src, size_t count)
 {
+	uint16_t wdsize, mod;
+
 	/* Disable DMA in case it's still running (older u-boot's did not
 	 * always turn them off).  Do it before the if statement below so
 	 * we can be cheap and not do a SSYNC() due to the forced abort.
@@ -151,24 +153,37 @@ void dma_memcpy_nocache(void *dst, const void *src, size_t count)
 	     (unsigned long)dst < L1_SRAM_SCRATCH_END))
 		hang();
 
+	if (((unsigned long)dst | (unsigned long)src | count) & 0x1) {
+		wdsize = WDSIZE_8;
+		mod = 1;
+	} else if (((unsigned long)dst | (unsigned long)src | count) & 0x2) {
+		wdsize = WDSIZE_16;
+		count >>= 1;
+		mod = 2;
+	} else {
+		wdsize = WDSIZE_32;
+		count >>= 2;
+		mod = 4;
+	}
+
 	/* Copy sram functions from sdram to sram */
 	/* Setup destination start address */
 	bfin_write_MDMA_D0_START_ADDR(dst);
 	/* Setup destination xcount */
 	bfin_write_MDMA_D0_X_COUNT(count);
 	/* Setup destination xmodify */
-	bfin_write_MDMA_D0_X_MODIFY(1);
+	bfin_write_MDMA_D0_X_MODIFY(mod);
 
 	/* Setup Source start address */
 	bfin_write_MDMA_S0_START_ADDR(src);
 	/* Setup Source xcount */
 	bfin_write_MDMA_S0_X_COUNT(count);
 	/* Setup Source xmodify */
-	bfin_write_MDMA_S0_X_MODIFY(1);
+	bfin_write_MDMA_S0_X_MODIFY(mod);
 
 	/* Enable source DMA */
-	bfin_write_MDMA_S0_CONFIG(DMAEN);
-	bfin_write_MDMA_D0_CONFIG(WNR | DMAEN | DI_EN);
+	bfin_write_MDMA_S0_CONFIG(wdsize | DMAEN);
+	bfin_write_MDMA_D0_CONFIG(wdsize | DMAEN | WNR | DI_EN);
 	SSYNC();
 
 	while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE))
-- 
1.6.1.1

  parent reply	other threads:[~2009-01-29  0:03 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-29  0:03 [U-Boot] [PATCH 00/27] Blackfin updates for 2009.03 (part 2) Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 01/27] Blackfin: bfin_mac: force board_get_enetaddr() usage Mike Frysinger
2009-01-29  5:43   ` Ben Warren
2009-01-29  5:53     ` Mike Frysinger
2009-01-29  6:01       ` Ben Warren
2009-01-29  6:16         ` Mike Frysinger
2009-01-29  6:20           ` Ben Warren
2009-01-29 10:43           ` Wolfgang Denk
2009-01-29  6:59     ` [U-Boot] [PATCH 01/27 v2] " Mike Frysinger
2009-01-29  7:53       ` Ben Warren
2009-01-29 10:45       ` Wolfgang Denk
2009-01-29 16:35         ` Mike Frysinger
2009-01-29 19:03           ` Wolfgang Denk
2009-01-29 20:25             ` Mike Frysinger
2009-01-29 20:41               ` Wolfgang Denk
2009-01-29 21:05                 ` Mike Frysinger
2009-01-29 21:17                   ` Wolfgang Denk
2009-01-29 21:48                     ` Mike Frysinger
2009-01-29 22:18                       ` Wolfgang Denk
2009-01-30  1:23                         ` Mike Frysinger
2009-02-02 20:05                           ` Mike Frysinger
2009-02-02 21:04                             ` Wolfgang Denk
2009-02-03  0:37                               ` Mike Frysinger
2009-02-03  8:16                                 ` Wolfgang Denk
2009-02-03 19:40                                   ` Mike Frysinger
2009-02-10 20:36                                     ` Mike Frysinger
2009-02-11  5:45                                       ` Ben Warren
2009-02-11  5:57                                         ` Mike Frysinger
2009-02-11 12:17                                         ` Wolfgang Denk
2009-02-11 19:25                                           ` Mike Frysinger
2009-02-11 20:15                                             ` Ben Warren
2009-02-12  1:29                                               ` Mike Frysinger
2009-02-12  6:24                                                 ` Ben Warren
2009-02-12  6:30                                                   ` Mike Frysinger
2009-02-12  7:33                                                 ` Wolfgang Denk
2009-02-12  7:57                                                   ` Mike Frysinger
2009-01-30  0:59                 ` [U-Boot] [PATCH] net: new utility functions eth_{parse, {get, set}env}_enetaddr() Mike Frysinger
2009-01-30  1:09                 ` [U-Boot] [PATCH 01/27 v3] Blackfin: bfin_mac: force boards to setup the MAC themselves Mike Frysinger
2009-01-30  1:09                 ` [U-Boot] [PATCH] Blackfin: bf537-stamp: rewrite MAC-in-flash handling Mike Frysinger
2009-01-29 17:49     ` [U-Boot] [PATCH 01/27] Blackfin: bfin_mac: force board_get_enetaddr() usage Scott Wood
2009-01-29 10:30   ` Wolfgang Denk
2009-01-29  0:03 ` [U-Boot] [PATCH 02/27] Blackfin: bfin_mac: set MDCDIV based on SCLK Mike Frysinger
2009-01-29  5:46   ` Ben Warren
2009-01-29  0:03 ` [U-Boot] [PATCH 03/27] Blackfin: bfin_mac: cleanup MII/PHY functions Mike Frysinger
2009-01-29  5:48   ` Ben Warren
2009-01-29  0:03 ` [U-Boot] [PATCH 04/27] Blackfin: bfin_mac: respect CONFIG_PHY_{ADDR, CLOCK_FREQ} Mike Frysinger
2009-01-29  5:50   ` Ben Warren
2009-01-29  0:03 ` [U-Boot] [PATCH 05/27] Blackfin: bfin_mac: use common debug() Mike Frysinger
2009-01-29  5:51   ` Ben Warren
2009-01-29  0:03 ` [U-Boot] [PATCH 06/27] Blackfin: bfin_mac: convert CONFIG_BFIN_MAC_RMII to CONFIG_RMII Mike Frysinger
2009-01-29  6:03   ` Ben Warren
2009-01-29  0:03 ` [U-Boot] [PATCH 07/27] Blackfin: bfin_mac: cleanup pointer/casts for aliasing issues Mike Frysinger
2009-01-29  6:05   ` Ben Warren
2009-01-29  0:03 ` [U-Boot] [PATCH 08/27] Blackfin: only build post code when CONFIG_POST Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 09/27] Blackfin: add driver for on-chip SPI controller Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 10/27] Blackfin: dont check baud if it wont actually get used Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 11/27] Blackfin: enable --gc-sections Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 12/27] Blackfin: cache core/system clock values Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 13/27] Blackfin: setup bi_enetaddr for single nets Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 14/27] Blackfin: rewrite cache handling functions Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 15/27] Blackfin: dma_memcpy(): fix random failures Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 16/27] Blackfin: only flag L1 instruction for DMA memcpy Mike Frysinger
2009-01-29  0:03 ` Mike Frysinger [this message]
2009-01-29  0:03 ` [U-Boot] [PATCH 18/27] Blackfin: fix up EBIU defines Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 19/27] Blackfin: build with -mno-fdpic Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 20/27] Blackfin: add driver for on-chip NAND controller Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 21/27] Blackfin: add driver for on-chip ATAPI controller Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 22/27] Blackfin: add port I bits Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 23/27] Blackfin: update asm-blackfin/posix_types.h to latest Linux version Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 24/27] Blackfin: set default CONFIG_ENV_SPI_CS based on bootrom Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 25/27] Blackfin: output booting source when booting Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 26/27] Blackfin: add port muxing for BF51x SPI Mike Frysinger
2009-01-29  0:03 ` [U-Boot] [PATCH 27/27] Blackfin: add driver for on-chip MMC/SD controller Mike Frysinger

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=1233187416-22378-18-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --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.