Skip to contentSkip to conversation

8xxx dma updates

PATCH New Peter Tyser 5 participants 33 messages Jun 30, 2009 – Jul 8, 2009 dmaengine

lore
Share & tools
lore
#0 lore raw

v2 cover 8xxx dma updates

This patch series attempts to clean up the DMA implementation for the 83xx, 85xx, and 86xx architectures. The changes include:
- consolidate 83xx, 85xx, and 86xx structures and code
- add defines for bitfields
- use proper IO accessors
- add support for arbitrarily large transfer sizes
- rename dma_xfer() to dmacpy() and make dmacpy's prototype similar to memcpy()

Changes since v1:
- Add 83xx patches, these were previously submitted as an RFC
- Add a CONFIG_FSL_DMA check to include/asm-ppc/config.h
- Use phys_addr_t and phys_size_t arguments to dmacpy()

I've tested the code on MPC8572 and MPC8640-based boards. Ira Snyder tested on an 83xx-based board. I compile-tested all 8xxx boards.

Peter Tyser (12):
85xx, 86xx: Break out DMA code to a common file
fsl_dma: Add bitfield definitions for common registers
fsl_dma: Use proper I/O access functions
fsl_dma: Add support for arbitrarily large transfers
fsl_dma: Fix Channel Start bug in dma_check() 8xxx: Rename dma_xfer() to dmacpy()
fsl_dma: Move dma function prototypes to common header file 85xx, 86xx: Move dma_init() call to common code
fsl_dma: Break out common memory initialization function
fsl_dma: Make DMA transactions snoopable
83xx: Replace CONFIG_ECC_INIT_VIA_DDRC references 83xx: Add support for fsl_dma driver

 board/freescale/mpc8360emds/mpc8360emds.c |    4 +-
 board/freescale/mpc8360erdk/mpc8360erdk.c |    4 +-
 board/freescale/mpc837xemds/mpc837xemds.c |    4 +-
 board/freescale/mpc837xerdb/mpc837xerdb.c |    4 +-
 board/keymile/kmeter1/kmeter1.c           |    4 +-
 board/mpc8540eval/mpc8540eval.c           |   35 +------
 board/sbc8560/sbc8560.c                   |   33 +-----
 cpu/mpc83xx/cpu.c                         |   85 --------------
 cpu/mpc83xx/spd_sdram.c                   |   43 +------
 cpu/mpc85xx/cpu.c                         |   47 --------
 cpu/mpc85xx/cpu_init.c                    |    4 +-
 cpu/mpc85xx/ddr-gen1.c                    |   33 +-----
 cpu/mpc86xx/cpu.c                         |   55 ---------
 cpu/mpc86xx/cpu_init.c                    |    3 +
 drivers/dma/Makefile                      |    1 +
 drivers/dma/fsl_dma.c                     |  178 +++++++++++++++++++++++++++++
 include/asm-ppc/config.h                  |    8 ++
 include/asm-ppc/fsl_dma.h                 |   90 +++++++++++++++
 include/asm-ppc/immap_83xx.h              |   49 +-------
 include/configs/PM854.h                   |    1 +
 include/configs/PM856.h                   |    1 +
 include/mpc83xx.h                         |   16 ---
 22 files changed, 308 insertions(+), 394 deletions(-)
 create mode 100644 drivers/dma/fsl_dma.c
#1 lore raw

PATCH v2 1/12 85xx, 86xx: Break out DMA code to a common file

DMA support is now enabled via the CONFIG_FSL_DMA define instead of the previous CONFIG_DDR_ECC

---
 cpu/mpc85xx/cpu.c        |   47 -----------------------
 cpu/mpc86xx/cpu.c        |   55 ---------------------------
 drivers/dma/Makefile     |    1 +
 drivers/dma/fsl_dma.c    |   92 ++++++++++++++++++++++++++++++++++++++++++++++
 include/asm-ppc/config.h |    7 +++
 include/configs/PM854.h  |    1 +
 include/configs/PM856.h  |    1 +
 7 files changed, 102 insertions(+), 102 deletions(-)
 create mode 100644 drivers/dma/fsl_dma.c
cpu/mpc85xx/cpu.c +0 -47
index d88c564..28c6119 100644
@@ -264,53 +264,6 @@ reset_85xx_watchdog(void)
 }
 #endif	/* CONFIG_WATCHDOG */
 
-#if defined(CONFIG_DDR_ECC)
-void dma_init(void) {
-	volatile ccsr_dma_t *dma_base = (void *)(CONFIG_SYS_MPC85xx_DMA_ADDR);
-	volatile fsl_dma_t *dma = &dma_base->dma[0];
-
-	dma->satr = 0x00040000;
-	dma->datr = 0x00040000;
-	dma->sr = 0xffffffff; /* clear any errors */
-	asm("sync; isync; msync");
-	return;
-}
-
-uint dma_check(void) {
-	volatile ccsr_dma_t *dma_base = (void *)(CONFIG_SYS_MPC85xx_DMA_ADDR);
-	volatile fsl_dma_t *dma = &dma_base->dma[0];
-	volatile uint status = dma->sr;
-
-	/* While the channel is busy, spin */
-	while((status & 4) == 4) {
-		status = dma->sr;
-	}
-
-	/* clear MR[CS] channel start bit */
-	dma->mr &= 0x00000001;
-	asm("sync;isync;msync");
-
-	if (status != 0) {
-		printf ("DMA Error: status = %x\n", status);
-	}
-	return status;
-}
-
-int dma_xfer(void *dest, uint count, void *src) {
-	volatile ccsr_dma_t *dma_base = (void *)(CONFIG_SYS_MPC85xx_DMA_ADDR);
-	volatile fsl_dma_t *dma = &dma_base->dma[0];
-
-	dma->dar = (uint) dest;
-	dma->sar = (uint) src;
-	dma->bcr = count;
-	dma->mr = 0xf000004;
-	asm("sync;isync;msync");
-	dma->mr = 0xf000005;
-	asm("sync;isync;msync");
-	return dma_check();
-}
-#endif
-
 /*
  * Configures a UPM. The function requires the respective MxMR to be set
  * before calling this function. "size" is the number or entries, not a sizeof.
cpu/mpc86xx/cpu.c +0 -55

61 lines not on this page · raw message

drivers/dma/Makefile +1 -0
index cf29efa..36d99f9 100644
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
 LIB	:= $(obj)libdma.a
 
 COBJS-$(CONFIG_FSLDMAFEC) += MCD_tasksInit.o MCD_dmaApi.o MCD_tasks.o
+COBJS-$(CONFIG_FSL_DMA) += fsl_dma.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/dma/fsl_dma.c new file +92 -0

92 lines not on this page · raw message

include/asm-ppc/config.h +7 -0
index 0900f65..9c358aa 100644
@@ -29,4 +29,11 @@
 #endif
 #endif
 
+#ifndef CONFIG_FSL_DMA
+#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER) && \
+	(defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx))
+#define CONFIG_FSL_DMA
 #endif
+#endif
+
+#endif /* _ASM_CONFIG_H_ */
include/configs/PM854.h +1 -0
index 3f943aa..4b9bcca 100644
@@ -96,6 +96,7 @@
 #undef CONFIG_DDR_SPD
 #define CONFIG_DDR_DLL                      /* possible DLL fix needed */
 #define CONFIG_DDR_ECC			    /* only for ECC DDR module */
+#define CONFIG_FSL_DMA			    /* use DMA to init DDR ECC  */
 
 #define CONFIG_MEM_INIT_VALUE	0xDeadBeef
 
include/configs/PM856.h +1 -0
index 43c2873..1db20bc 100644
@@ -98,6 +98,7 @@
 #undef CONFIG_DDR_SPD
 #define CONFIG_DDR_DLL                      /* possible DLL fix needed */
 #define CONFIG_DDR_ECC			    /* only for ECC DDR module */
+#define CONFIG_FSL_DMA			    /* use DMA to init DDR ECC  */
 
 #define CONFIG_MEM_INIT_VALUE	0xDeadBeef
 
Signature · 1 line
1.6.2.1
#3 lore raw

PATCH v2 2/12 fsl_dma: Add bitfield definitions for common registers

In reply to Peter Tyser
---
 drivers/dma/fsl_dma.c     |   12 +++++-----
 include/asm-ppc/fsl_dma.h |   46 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 6 deletions(-)
drivers/dma/fsl_dma.c +6 -6
index a9989ee..baf2942 100644
@@ -51,11 +51,11 @@ static uint dma_check(void) {
 	volatile uint status = dma->sr;
 
 	/* While the channel is busy, spin */
-	while (status & 4)
+	while (status & FSL_DMA_SR_CB)
 		status = dma->sr;
 
 	/* clear MR[CS] channel start bit */
-	dma->mr &= 1;
+	dma->mr &= FSL_DMA_MR_CS;
 	dma_sync();
 
 	if (status != 0)
@@ -67,8 +67,8 @@ static uint dma_check(void) {
 void dma_init(void) {
 	volatile fsl_dma_t *dma = &dma_base->dma[0];
 
-	dma->satr = 0x00040000;
-	dma->datr = 0x00040000;
+	dma->satr = FSL_DMA_SATR_SREAD_NO_SNOOP;
+	dma->datr = FSL_DMA_DATR_DWRITE_NO_SNOOP;
 	dma->sr = 0xffffffff; /* clear any errors */
 	dma_sync();
 }
@@ -81,11 +81,11 @@ int dma_xfer(void *dest, uint count, void *src) {
 	dma->bcr = count;
 
 	/* Disable bandwidth control, use direct transfer mode */
-	dma->mr = 0xf000004;
+	dma->mr = FSL_DMA_MR_BWC_DIS | FSL_DMA_MR_CTM_DIRECT;
 	dma_sync();
 
 	/* Start the transfer */
-	dma->mr = 0xf000005;
+	dma->mr = FSL_DMA_MR_BWC_DIS | FSL_DMA_MR_CTM_DIRECT | FSL_DMA_MR_CS;
 	dma_sync();
 
 	return dma_check();
include/asm-ppc/fsl_dma.h +46 -0

58 lines not on this page · raw message

Signature · 1 line
1.6.2.1
#5 lore raw

PATCH v2 3/12 fsl_dma: Use proper I/O access functions

In reply to Peter Tyser
---
 drivers/dma/fsl_dma.c |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)
drivers/dma/fsl_dma.c +18 -14
index baf2942..33ea828 100644
@@ -27,12 +27,13 @@
 
 #include <config.h>
 #include <common.h>
+#include <asm/io.h>
 #include <asm/fsl_dma.h>
 
 #if defined(CONFIG_MPC85xx)
-volatile ccsr_dma_t *dma_base = (void *)(CONFIG_SYS_MPC85xx_DMA_ADDR);
+ccsr_dma_t *dma_base = (void *)(CONFIG_SYS_MPC85xx_DMA_ADDR);
 #elif defined(CONFIG_MPC86xx)
-volatile ccsr_dma_t *dma_base = (void *)(CONFIG_SYS_MPC86xx_DMA_ADDR);
+ccsr_dma_t *dma_base = (void *)(CONFIG_SYS_MPC86xx_DMA_ADDR);
 #else
 #error "Freescale DMA engine not supported on your processor"
 #endif
@@ -48,14 +49,15 @@ static void dma_sync(void)
 
 static uint dma_check(void) {
 	volatile fsl_dma_t *dma = &dma_base->dma[0];
-	volatile uint status = dma->sr;
+	uint status;
 
 	/* While the channel is busy, spin */
-	while (status & FSL_DMA_SR_CB)
-		status = dma->sr;
+	do {
+		status = in_be32(&dma->sr);
+	} while (status & FSL_DMA_SR_CB);
 
 	/* clear MR[CS] channel start bit */
-	dma->mr &= FSL_DMA_MR_CS;
+	out_be32(&dma->mr, in_be32(&dma->mr) & FSL_DMA_MR_CS);
 	dma_sync();
 
 	if (status != 0)
@@ -67,25 +69,27 @@ static uint dma_check(void) {
 void dma_init(void) {
 	volatile fsl_dma_t *dma = &dma_base->dma[0];
 
-	dma->satr = FSL_DMA_SATR_SREAD_NO_SNOOP;
-	dma->datr = FSL_DMA_DATR_DWRITE_NO_SNOOP;
-	dma->sr = 0xffffffff; /* clear any errors */
+	out_be32(&dma->satr, FSL_DMA_SATR_SREAD_NO_SNOOP);
+	out_be32(&dma->datr, FSL_DMA_DATR_DWRITE_NO_SNOOP);
+	out_be32(&dma->sr, 0xffffffff); /* clear any errors */
 	dma_sync();
 }
 
 int dma_xfer(void *dest, uint count, void *src) {
 	volatile fsl_dma_t *dma = &dma_base->dma[0];
 
-	dma->dar = (uint) dest;
-	dma->sar = (uint) src;
-	dma->bcr = count;
+	out_be32(&dma->dar, (uint) dest);
+	out_be32(&dma->sar, (uint) src);
+	out_be32(&dma->bcr, count);
 
 	/* Disable bandwidth control, use direct transfer mode */
-	dma->mr = FSL_DMA_MR_BWC_DIS | FSL_DMA_MR_CTM_DIRECT;
+	out_be32(&dma->mr, FSL_DMA_MR_BWC_DIS | FSL_DMA_MR_CTM_DIRECT);
 	dma_sync();
 
 	/* Start the transfer */
-	dma->mr = FSL_DMA_MR_BWC_DIS | FSL_DMA_MR_CTM_DIRECT | FSL_DMA_MR_CS;
+	out_be32(&dma->mr, FSL_DMA_MR_BWC_DIS |
+			FSL_DMA_MR_CTM_DIRECT |
+			FSL_DMA_MR_CS);
 	dma_sync();
 
 	return dma_check();
Signature · 1 line
1.6.2.1
#7 lore raw

PATCH v2 4/12 fsl_dma: Add support for arbitrarily large transfers

In reply to Peter Tyser

Support DMA transfers larger than the DMA controller's limit of (2 ^ 26 - 1) bytes

---
 drivers/dma/fsl_dma.c |   40 ++++++++++++++++++++++++++++------------
 1 files changed, 28 insertions(+), 12 deletions(-)
drivers/dma/fsl_dma.c +28 -12
index 33ea828..f3575af 100644
@@ -30,6 +30,9 @@
 #include <asm/io.h>
 #include <asm/fsl_dma.h>
 
+/* Controller can only transfer 2^26 - 1 bytes at a time */
+#define FSL_DMA_MAX_SIZE	(0x3ffffff)
+
 #if defined(CONFIG_MPC85xx)
 ccsr_dma_t *dma_base = (void *)(CONFIG_SYS_MPC85xx_DMA_ADDR);
 #elif defined(CONFIG_MPC86xx)
@@ -77,20 +80,33 @@ void dma_init(void) {
 
 int dma_xfer(void *dest, uint count, void *src) {
 	volatile fsl_dma_t *dma = &dma_base->dma[0];
+	uint xfer_size;
 
-	out_be32(&dma->dar, (uint) dest);
-	out_be32(&dma->sar, (uint) src);
-	out_be32(&dma->bcr, count);
+	while (count) {
+		xfer_size = MIN(FSL_DMA_MAX_SIZE, count);
 
-	/* Disable bandwidth control, use direct transfer mode */
-	out_be32(&dma->mr, FSL_DMA_MR_BWC_DIS | FSL_DMA_MR_CTM_DIRECT);
-	dma_sync();
+		out_be32(&dma->dar, (uint) dest);
+		out_be32(&dma->sar, (uint) src);
+		out_be32(&dma->bcr, xfer_size);
 
-	/* Start the transfer */
-	out_be32(&dma->mr, FSL_DMA_MR_BWC_DIS |
-			FSL_DMA_MR_CTM_DIRECT |
-			FSL_DMA_MR_CS);
-	dma_sync();
+		/* Disable bandwidth control, use direct transfer mode */
+		out_be32(&dma->mr, FSL_DMA_MR_BWC_DIS | FSL_DMA_MR_CTM_DIRECT);
+		dma_sync();
+
+		/* Start the transfer */
+		out_be32(&dma->mr, FSL_DMA_MR_BWC_DIS |
+				FSL_DMA_MR_CTM_DIRECT |
+				FSL_DMA_MR_CS);
+
+		count -= xfer_size;
+		src += xfer_size;
+		dest += xfer_size;
+
+		dma_sync();
+
+		if (dma_check())
+			return -1;
+	}
 
-	return dma_check();
+	return 0;
 }
Signature · 1 line
1.6.2.1
#9 lore raw

PATCH v2 5/12 fsl_dma: Fix Channel Start bug in dma_check()

In reply to Peter Tyser

The Channel Start (CS) bit in the Mode Register (MR) should actually be cleared as the comment in the code suggests. Previously, CS was being set, not cleared.

Assuming normal operation of the DMA engine, this change shouldn't have any real affect.

---
 drivers/dma/fsl_dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/fsl_dma.c +1 -1
index f3575af..f058802 100644
@@ -60,7 +60,7 @@ static uint dma_check(void) {
 	} while (status & FSL_DMA_SR_CB);
 
 	/* clear MR[CS] channel start bit */
-	out_be32(&dma->mr, in_be32(&dma->mr) & FSL_DMA_MR_CS);
+	out_be32(&dma->mr, in_be32(&dma->mr) & ~FSL_DMA_MR_CS);
 	dma_sync();
 
 	if (status != 0)
Signature · 1 line
1.6.2.1
#11 lore raw

PATCH v2 6/12 8xxx: Rename dma_xfer() to dmacpy()

In reply to Peter Tyser

Also update dmacpy()'s argument order to match memcpy's and use phys_addr_t/phy_size_t for address/size arguments

---
 board/mpc8540eval/mpc8540eval.c |   25 ++++++++++++-------------
 board/sbc8560/sbc8560.c         |   25 ++++++++++++-------------
 cpu/mpc83xx/cpu.c               |    4 ++--
 cpu/mpc83xx/spd_sdram.c         |   29 ++++++++++++++---------------
 cpu/mpc85xx/ddr-gen1.c          |   29 ++++++++++++++---------------
 drivers/dma/fsl_dma.c           |    2 +-
 6 files changed, 55 insertions(+), 59 deletions(-)
board/mpc8540eval/mpc8540eval.c +12 -13
index 72a1ad3..ed6bbb4 100644
@@ -148,29 +148,28 @@ phys_size_t initdram (int board_type)
 		}
 
 		/* 8K */
-		dma_xfer((uint *)0x2000,0x2000,(uint *)0);
+		dmacpy(0x2000, 0, 0x2000);
 		/* 16K */
-		dma_xfer((uint *)0x4000,0x4000,(uint *)0);
+		dmacpy(0x4000, 0, 0x4000);
 		/* 32K */
-		dma_xfer((uint *)0x8000,0x8000,(uint *)0);
+		dmacpy(0x8000, 0, 0x8000);
 		/* 64K */
-		dma_xfer((uint *)0x10000,0x10000,(uint *)0);
+		dmacpy(0x10000, 0, 0x10000);
 		/* 128k */
-		dma_xfer((uint *)0x20000,0x20000,(uint *)0);
+		dmacpy(0x20000, 0, 0x20000);
 		/* 256k */
-		dma_xfer((uint *)0x40000,0x40000,(uint *)0);
+		dmacpy(0x40000, 0, 0x40000);
 		/* 512k */
-		dma_xfer((uint *)0x80000,0x80000,(uint *)0);
+		dmacpy(0x80000, 0, 0x80000);
 		/* 1M */
-		dma_xfer((uint *)0x100000,0x100000,(uint *)0);
+		dmacpy(0x100000, 0, 0x100000);
 		/* 2M */
-		dma_xfer((uint *)0x200000,0x200000,(uint *)0);
+		dmacpy(0x200000, 0, 0x200000);
 		/* 4M */
-		dma_xfer((uint *)0x400000,0x400000,(uint *)0);
+		dmacpy(0x400000, 0, 0x400000);
 
-		for (i = 1; i < dram_size / 0x800000; i++) {
-			dma_xfer((uint *)(0x800000*i),0x800000,(uint *)0);
-		}
+		for (i = 1; i < dram_size / 0x800000; i++)
+			dmacpy(0x800000 * i, 0, 0x800000);
 
 		/* Enable errors for ECC */
 		ddr->err_disable = 0x00000000;
board/sbc8560/sbc8560.c +12 -13
index 7f032c8..f8527f9 100644
@@ -349,29 +349,28 @@ phys_size_t initdram (int board_type)
 		}
 
 		/* 8K */
-		dma_xfer((uint *)0x2000,0x2000,(uint *)0);
+		dmacpy(0x2000, 0, 0x2000);
 		/* 16K */
-		dma_xfer((uint *)0x4000,0x4000,(uint *)0);
+		dmacpy(0x4000, 0, 0x4000);
 		/* 32K */
-		dma_xfer((uint *)0x8000,0x8000,(uint *)0);
+		dmacpy(0x8000, 0, 0x8000);
 		/* 64K */
-		dma_xfer((uint *)0x10000,0x10000,(uint *)0);
+		dmacpy(0x10000, 0, 0x10000);
 		/* 128k */
-		dma_xfer((uint *)0x20000,0x20000,(uint *)0);
+		dmacpy(0x20000, 0, 0x20000);
 		/* 256k */
-		dma_xfer((uint *)0x40000,0x40000,(uint *)0);
+		dmacpy(0x40000, 0, 0x40000);
 		/* 512k */
-		dma_xfer((uint *)0x80000,0x80000,(uint *)0);
+		dmacpy(0x80000, 0, 0x80000);
 		/* 1M */
-		dma_xfer((uint *)0x100000,0x100000,(uint *)0);
+		dmacpy(0x100000, 0, 0x100000);
 		/* 2M */
-		dma_xfer((uint *)0x200000,0x200000,(uint *)0);
+		dmacpy(0x200000, 0, 0x200000);
 		/* 4M */
-		dma_xfer((uint *)0x400000,0x400000,(uint *)0);
+		dmacpy(0x400000, 0, 0x400000);
 
-		for (i = 1; i < dram_size / 0x800000; i++) {
-			dma_xfer((uint *)(0x800000*i),0x800000,(uint *)0);
-		}
+		for (i = 1; i < dram_size / 0x800000; i++)
+			dmacpy(0x800000 * i, 0, 0x800000);
 
 		/* Enable errors for ECC */
 		ddr->err_disable = 0x00000000;
cpu/mpc83xx/cpu.c +2 -2
index c4331ae..a5c1f00 100644
@@ -327,7 +327,7 @@ uint dma_check(void)
 	return status;
 }
 
-int dma_xfer(void *dest, u32 count, void *src)
+int dmacpy(phys_addr_t dest, phys_addr_t src, phys_size_t count)
 {
 	volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
 	volatile dma83xx_t *dma = &immap->dma;
@@ -336,7 +336,7 @@ int dma_xfer(void *dest, u32 count, void *src)
 	/* initialize DMASARn, DMADAR and DMAABCRn */
 	dma->dmadar0 = swab32((u32)dest);
 	dma->dmasar0 = swab32((u32)src);
-	dma->dmabcr0 = swab32(count);
+	dma->dmabcr0 = swab32((u32)count);
 
 	__asm__ __volatile__ ("sync");
 	__asm__ __volatile__ ("isync");
cpu/mpc83xx/spd_sdram.c +14 -15
index 4704d20..97ca700 100644
@@ -68,7 +68,7 @@ void board_add_ram_info(int use_default)
 #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
 extern void dma_init(void);
 extern uint dma_check(void);
-extern int dma_xfer(void *dest, uint count, void *src);
+extern int dmacpy(phys_addr_t dest, phys_addr_t src, phys_size_t n);
 #endif
 
 #ifndef	CONFIG_SYS_READ_SPD
@@ -898,20 +898,19 @@ void ddr_enable_ecc(unsigned int dram_size)
 	/* Initialise DMA for direct transfer */
 	dma_init();
 	/* Start DMA to transfer */
-	dma_xfer((uint *)0x2000, 0x2000, (uint *)0); /* 8K */
-	dma_xfer((uint *)0x4000, 0x4000, (uint *)0); /* 16K */
-	dma_xfer((uint *)0x8000, 0x8000, (uint *)0); /* 32K */
-	dma_xfer((uint *)0x10000, 0x10000, (uint *)0); /* 64K */
-	dma_xfer((uint *)0x20000, 0x20000, (uint *)0); /* 128K */
-	dma_xfer((uint *)0x40000, 0x40000, (uint *)0); /* 256K */
-	dma_xfer((uint *)0x80000, 0x80000, (uint *)0); /* 512K */
-	dma_xfer((uint *)0x100000, 0x100000, (uint *)0); /* 1M */
-	dma_xfer((uint *)0x200000, 0x200000, (uint *)0); /* 2M */
-	dma_xfer((uint *)0x400000, 0x400000, (uint *)0); /* 4M */
-
-	for (i = 1; i < dram_size / 0x800000; i++) {
-		dma_xfer((uint *)(0x800000*i), 0x800000, (uint *)0);
-	}
+	dmacpy(0x2000, 0, 0x2000); /* 8K */
+	dmacpy(0x4000, 0, 0x4000); /* 16K */
+	dmacpy(0x8000, 0, 0x8000); /* 32K */
+	dmacpy(0x10000, 0, 0x10000); /* 64K */
+	dmacpy(0x20000, 0, 0x20000); /* 128K */
+	dmacpy(0x40000, 0, 0x40000); /* 256K */
+	dmacpy(0x80000, 0, 0x80000); /* 512K */
+	dmacpy(0x100000, 0, 0x100000); /* 1M */
+	dmacpy(0x200000, 0, 0x200000); /* 2M */
+	dmacpy(0x400000, 0, 0x400000); /* 4M */
+
+	for (i = 1; i < dram_size / 0x800000; i++)
+		dmacpy(0x800000 * i, 0, 0x800000);
 #endif
 
 	t_end = get_tbms();
cpu/mpc85xx/ddr-gen1.c +14 -15
index e24c9af..b188906 100644
@@ -68,7 +68,7 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 extern void dma_init(void);
 extern uint dma_check(void);
-extern int dma_xfer(void *dest, uint count, void *src);
+extern int dmacpy(phys_addr_t dest, phys_addr_t src, phys_size_t n);
 
 /*
  * Initialize all of memory for ECC, then enable errors.
@@ -93,20 +93,19 @@ ddr_enable_ecc(unsigned int dram_size)
 		}
 	}
 
-	dma_xfer((uint *)0x002000, 0x002000, (uint *)0); /* 8K */
-	dma_xfer((uint *)0x004000, 0x004000, (uint *)0); /* 16K */
-	dma_xfer((uint *)0x008000, 0x008000, (uint *)0); /* 32K */
-	dma_xfer((uint *)0x010000, 0x010000, (uint *)0); /* 64K */
-	dma_xfer((uint *)0x020000, 0x020000, (uint *)0); /* 128k */
-	dma_xfer((uint *)0x040000, 0x040000, (uint *)0); /* 256k */
-	dma_xfer((uint *)0x080000, 0x080000, (uint *)0); /* 512k */
-	dma_xfer((uint *)0x100000, 0x100000, (uint *)0); /* 1M */
-	dma_xfer((uint *)0x200000, 0x200000, (uint *)0); /* 2M */
-	dma_xfer((uint *)0x400000, 0x400000, (uint *)0); /* 4M */
-
-	for (i = 1; i < dram_size / 0x800000; i++) {
-		dma_xfer((uint *)(0x800000*i), 0x800000, (uint *)0);
-	}
+	dmacpy(0x002000, 0, 0x2000); /* 8K */
+	dmacpy(0x004000, 0, 0x4000); /* 16K */
+	dmacpy(0x008000, 0, 0x8000); /* 32K */
+	dmacpy(0x010000, 0, 0x10000); /* 64K */
+	dmacpy(0x020000, 0, 0x20000); /* 128K */
+	dmacpy(0x040000, 0, 0x40000); /* 256K */
+	dmacpy(0x080000, 0, 0x80000); /* 512K */
+	dmacpy(0x100000, 0, 0x100000); /* 1M */
+	dmacpy(0x200000, 0, 0x200000); /* 2M */
+	dmacpy(0x400000, 0, 0x400000); /* 4M */
+
+	for (i = 1; i < dram_size / 0x800000; i++)
+		dmacpy(0x800000 *i, 0, 0x800000);
 
 	/*
 	 * Enable errors for ECC.
drivers/dma/fsl_dma.c +1 -1
index f058802..49ea8f1 100644
@@ -78,7 +78,7 @@ void dma_init(void) {
 	dma_sync();
 }
 
-int dma_xfer(void *dest, uint count, void *src) {
+int dmacpy(phys_addr_t dest, phys_addr_t src, phys_size_t count) {
 	volatile fsl_dma_t *dma = &dma_base->dma[0];
 	uint xfer_size;
 
Signature · 1 line
1.6.2.1
#13 lore raw

PATCH v2 7/12 fsl_dma: Move dma function prototypes to common header file

In reply to Peter Tyser
---
 cpu/mpc85xx/ddr-gen1.c    |    4 ----
 include/asm-ppc/fsl_dma.h |    5 +++++
 2 files changed, 5 insertions(+), 4 deletions(-)
cpu/mpc85xx/ddr-gen1.c +0 -4
index b188906..9fc498e 100644
@@ -66,10 +66,6 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 }
 
 #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
-extern void dma_init(void);
-extern uint dma_check(void);
-extern int dmacpy(phys_addr_t dest, phys_addr_t src, phys_size_t n);
-
 /*
  * Initialize all of memory for ECC, then enable errors.
  */
include/asm-ppc/fsl_dma.h +5 -0
index c9ec6b5..978283a 100644
@@ -94,4 +94,9 @@ typedef struct fsl_dma {
 	char	res4[56];
 } fsl_dma_t;
 
+#ifdef CONFIG_FSL_DMA
+void dma_init(void);
+int dmacpy(phys_addr_t dest, phys_addr_t src, phys_size_t n);
+#endif
+
 #endif	/* _ASM_DMA_H_ */
Signature · 1 line
1.6.2.1
#15 lore raw

PATCH v2 8/12 85xx, 86xx: Move dma_init() call to common code

In reply to Peter Tyser
---
 board/mpc8540eval/mpc8540eval.c |    2 +-
 board/sbc8560/sbc8560.c         |    2 +-
 cpu/mpc85xx/cpu_init.c          |    4 +++-
 cpu/mpc85xx/ddr-gen1.c          |    2 --
 cpu/mpc86xx/cpu_init.c          |    3 +++
 5 files changed, 8 insertions(+), 5 deletions(-)
board/mpc8540eval/mpc8540eval.c +1 -1
index ed6bbb4..04a7470 100644
@@ -140,7 +140,7 @@ phys_size_t initdram (int board_type)
 		uint *p = 0;
 		uint i = 0;
 		volatile ccsr_ddr_t *ddr= (void *)(CONFIG_SYS_MPC85xx_DDR_ADDR);
-		dma_init();
+
 		for (*p = 0; p < (uint *)(8 * 1024); p++) {
 			if (((unsigned int)p & 0x1f) == 0) { dcbz(p); }
 			*p = (unsigned int)0xdeadbeef;
board/sbc8560/sbc8560.c +1 -1
index f8527f9..17f900b 100644
@@ -341,7 +341,7 @@ phys_size_t initdram (int board_type)
 		uint *p = 0;
 		uint i = 0;
 		volatile ccsr_ddr_t *ddr= (void *)(CONFIG_SYS_MPC85xx_DDR_ADDR);
-		dma_init();
+
 		for (*p = 0; p < (uint *)(8 * 1024); p++) {
 			if (((unsigned int)p & 0x1f) == 0) { dcbz(p); }
 			*p = (unsigned int)0xdeadbeef;
cpu/mpc85xx/cpu_init.c +3 -1
index c98dd8d..41de694 100644
@@ -261,7 +261,9 @@ void cpu_init_f (void)
 #if defined(CONFIG_MPC8536)
 	fsl_serdes_init();
 #endif
-
+#if defined(CONFIG_FSL_DMA)
+	dma_init();
+#endif
 }
 
 
cpu/mpc85xx/ddr-gen1.c +0 -2
index 9fc498e..3bf872b 100644
@@ -77,8 +77,6 @@ ddr_enable_ecc(unsigned int dram_size)
 	uint i = 0;
 	volatile ccsr_ddr_t *ddr= (void *)(CONFIG_SYS_MPC85xx_DDR_ADDR);
 
-	dma_init();
-
 	for (*p = 0; p < (uint *)(8 * 1024); p++) {
 		if (((unsigned int)p & 0x1f) == 0) {
 			ppcDcbz((unsigned long) p);
cpu/mpc86xx/cpu_init.c +3 -0
index 49528aa..341e815 100644
@@ -113,6 +113,9 @@ void cpu_init_f(void)
 	memctl->or7 = CONFIG_SYS_OR7_PRELIM;
 	memctl->br7 = CONFIG_SYS_BR7_PRELIM;
 #endif
+#if defined(CONFIG_FSL_DMA)
+	dma_init();
+#endif
 
 	/* enable the timebase bit in HID0 */
 	set_hid0(get_hid0() | 0x4000000);
Signature · 1 line
1.6.2.1
#17 lore raw

PATCH v2 9/12 fsl_dma: Break out common memory initialization function

In reply to Peter Tyser
---
 board/mpc8540eval/mpc8540eval.c |   32 +-------------------------------
 board/sbc8560/sbc8560.c         |   32 +-------------------------------
 cpu/mpc85xx/ddr-gen1.c          |   26 +-------------------------
 drivers/dma/fsl_dma.c           |   32 ++++++++++++++++++++++++++++++++
 include/asm-ppc/fsl_dma.h       |    3 +++
 5 files changed, 38 insertions(+), 87 deletions(-)
board/mpc8540eval/mpc8540eval.c +1 -31
index 04a7470..7c27233 100644
@@ -137,39 +137,9 @@ phys_size_t initdram (int board_type)
 	{
 		/* Initialize all of memory for ECC, then
 		 * enable errors */
-		uint *p = 0;
-		uint i = 0;
 		volatile ccsr_ddr_t *ddr= (void *)(CONFIG_SYS_MPC85xx_DDR_ADDR);
 
-		for (*p = 0; p < (uint *)(8 * 1024); p++) {
-			if (((unsigned int)p & 0x1f) == 0) { dcbz(p); }
-			*p = (unsigned int)0xdeadbeef;
-			if (((unsigned int)p & 0x1c) == 0x1c) { dcbf(p); }
-		}
-
-		/* 8K */
-		dmacpy(0x2000, 0, 0x2000);
-		/* 16K */
-		dmacpy(0x4000, 0, 0x4000);
-		/* 32K */
-		dmacpy(0x8000, 0, 0x8000);
-		/* 64K */
-		dmacpy(0x10000, 0, 0x10000);
-		/* 128k */
-		dmacpy(0x20000, 0, 0x20000);
-		/* 256k */
-		dmacpy(0x40000, 0, 0x40000);
-		/* 512k */
-		dmacpy(0x80000, 0, 0x80000);
-		/* 1M */
-		dmacpy(0x100000, 0, 0x100000);
-		/* 2M */
-		dmacpy(0x200000, 0, 0x200000);
-		/* 4M */
-		dmacpy(0x400000, 0, 0x400000);
-
-		for (i = 1; i < dram_size / 0x800000; i++)
-			dmacpy(0x800000 * i, 0, 0x800000);
+		dma_meminit(CONFIG_MEM_INIT_VALUE, dram_size);
 
 		/* Enable errors for ECC */
 		ddr->err_disable = 0x00000000;
board/sbc8560/sbc8560.c +1 -31
index 17f900b..c40b5e3 100644
@@ -338,39 +338,9 @@ phys_size_t initdram (int board_type)
 	{
 		/* Initialize all of memory for ECC, then
 		 * enable errors */
-		uint *p = 0;
-		uint i = 0;
 		volatile ccsr_ddr_t *ddr= (void *)(CONFIG_SYS_MPC85xx_DDR_ADDR);
 
-		for (*p = 0; p < (uint *)(8 * 1024); p++) {
-			if (((unsigned int)p & 0x1f) == 0) { dcbz(p); }
-			*p = (unsigned int)0xdeadbeef;
-			if (((unsigned int)p & 0x1c) == 0x1c) { dcbf(p); }
-		}
-
-		/* 8K */
-		dmacpy(0x2000, 0, 0x2000);
-		/* 16K */
-		dmacpy(0x4000, 0, 0x4000);
-		/* 32K */
-		dmacpy(0x8000, 0, 0x8000);
-		/* 64K */
-		dmacpy(0x10000, 0, 0x10000);
-		/* 128k */
-		dmacpy(0x20000, 0, 0x20000);
-		/* 256k */
-		dmacpy(0x40000, 0, 0x40000);
-		/* 512k */
-		dmacpy(0x80000, 0, 0x80000);
-		/* 1M */
-		dmacpy(0x100000, 0, 0x100000);
-		/* 2M */
-		dmacpy(0x200000, 0, 0x200000);
-		/* 4M */
-		dmacpy(0x400000, 0, 0x400000);
-
-		for (i = 1; i < dram_size / 0x800000; i++)
-			dmacpy(0x800000 * i, 0, 0x800000);
+		dma_meminit(CONFIG_MEM_INIT_VALUE, dram_size);
 
 		/* Enable errors for ECC */
 		ddr->err_disable = 0x00000000;
cpu/mpc85xx/ddr-gen1.c +1 -25
index 3bf872b..54437dd 100644
@@ -73,33 +73,9 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
 void
 ddr_enable_ecc(unsigned int dram_size)
 {
-	uint *p = 0;
-	uint i = 0;
 	volatile ccsr_ddr_t *ddr= (void *)(CONFIG_SYS_MPC85xx_DDR_ADDR);
 
-	for (*p = 0; p < (uint *)(8 * 1024); p++) {
-		if (((unsigned int)p & 0x1f) == 0) {
-			ppcDcbz((unsigned long) p);
-		}
-		*p = (unsigned int)CONFIG_MEM_INIT_VALUE;
-		if (((unsigned int)p & 0x1c) == 0x1c) {
-			ppcDcbf((unsigned long) p);
-		}
-	}
-
-	dmacpy(0x002000, 0, 0x2000); /* 8K */
-	dmacpy(0x004000, 0, 0x4000); /* 16K */
-	dmacpy(0x008000, 0, 0x8000); /* 32K */
-	dmacpy(0x010000, 0, 0x10000); /* 64K */
-	dmacpy(0x020000, 0, 0x20000); /* 128K */
-	dmacpy(0x040000, 0, 0x40000); /* 256K */
-	dmacpy(0x080000, 0, 0x80000); /* 512K */
-	dmacpy(0x100000, 0, 0x100000); /* 1M */
-	dmacpy(0x200000, 0, 0x200000); /* 2M */
-	dmacpy(0x400000, 0, 0x400000); /* 4M */
-
-	for (i = 1; i < dram_size / 0x800000; i++)
-		dmacpy(0x800000 *i, 0, 0x800000);
+	dma_meminit(CONFIG_MEM_INIT_VALUE, dram_size);
 
 	/*
 	 * Enable errors for ECC.
drivers/dma/fsl_dma.c +32 -0
index 49ea8f1..e103c91 100644
@@ -110,3 +110,35 @@ int dmacpy(phys_addr_t dest, phys_addr_t src, phys_size_t count) {
 
 	return 0;
 }
+
+#if (defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER))
+void dma_meminit(uint val, uint size)
+{
+	uint *p = 0;
+	uint i = 0;
+
+	for (*p = 0; p < (uint *)(8 * 1024); p++) {
+		if (((uint)p & 0x1f) == 0)
+			ppcDcbz((ulong)p);
+
+		*p = (uint)CONFIG_MEM_INIT_VALUE;
+
+		if (((uint)p & 0x1c) == 0x1c)
+			ppcDcbf((ulong)p);
+	}
+
+	dmacpy(0x002000, 0, 0x002000); /* 8K */
+	dmacpy(0x004000, 0, 0x004000); /* 16K */
+	dmacpy(0x008000, 0, 0x008000); /* 32K */
+	dmacpy(0x010000, 0, 0x010000); /* 64K */
+	dmacpy(0x020000, 0, 0x020000); /* 128K */
+	dmacpy(0x040000, 0, 0x040000); /* 256K */
+	dmacpy(0x080000, 0, 0x080000); /* 512K */
+	dmacpy(0x100000, 0, 0x100000); /* 1M */
+	dmacpy(0x200000, 0, 0x200000); /* 2M */
+	dmacpy(0x400000, 0, 0x400000); /* 4M */
+
+	for (i = 1; i < size / 0x800000; i++)
+		dmacpy((0x800000 * i), 0, 0x800000);
+}
+#endif
include/asm-ppc/fsl_dma.h +3 -0
index 978283a..043669e 100644
@@ -97,6 +97,9 @@ typedef struct fsl_dma {
 #ifdef CONFIG_FSL_DMA
 void dma_init(void);
 int dmacpy(phys_addr_t dest, phys_addr_t src, phys_size_t n);
+#if (defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER))
+void dma_meminit(uint val, uint size);
+#endif
 #endif
 
 #endif	/* _ASM_DMA_H_ */
Signature · 1 line
1.6.2.1
#19 lore raw

PATCH v2 10/12 fsl_dma: Make DMA transactions snoopable

In reply to Peter Tyser

Make DMA transactions snoopable so that CPUs can keep caches up-to-date. This allows dma transactions to be used for operations such as memory copies without any additional cache control operations.

---
 drivers/dma/fsl_dma.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/dma/fsl_dma.c +2 -2
index e103c91..cba5d5b 100644
@@ -72,8 +72,8 @@ static uint dma_check(void) {
 void dma_init(void) {
 	volatile fsl_dma_t *dma = &dma_base->dma[0];
 
-	out_be32(&dma->satr, FSL_DMA_SATR_SREAD_NO_SNOOP);
-	out_be32(&dma->datr, FSL_DMA_DATR_DWRITE_NO_SNOOP);
+	out_be32(&dma->satr, FSL_DMA_SATR_SREAD_SNOOP);
+	out_be32(&dma->datr, FSL_DMA_DATR_DWRITE_SNOOP);
 	out_be32(&dma->sr, 0xffffffff); /* clear any errors */
 	dma_sync();
 }
Signature · 1 line
1.6.2.1
#21 lore raw

PATCH v2 11/12 83xx: Replace CONFIG_ECC_INIT_VIA_DDRC references

In reply to Peter Tyser

Update 83xx architecture's CONFIG_ECC_INIT_VIA_DDRC references to CONFIG_ECC_INIT_VIA_DDRCONTROLLER, which other Freescale architectures use

---
 board/freescale/mpc8360emds/mpc8360emds.c |    4 ++--
 board/freescale/mpc8360erdk/mpc8360erdk.c |    4 ++--
 board/freescale/mpc837xemds/mpc837xemds.c |    4 ++--
 board/freescale/mpc837xerdb/mpc837xerdb.c |    4 ++--
 board/keymile/kmeter1/kmeter1.c           |    4 ++--
 cpu/mpc83xx/spd_sdram.c                   |    2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)
board/freescale/mpc8360emds/mpc8360emds.c +2 -2
index 85c0120..dc4dbd3 100644
@@ -116,7 +116,7 @@ int board_early_init_r(void)
 	return 0;
 }
 
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
+#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 extern void ddr_enable_ecc(unsigned int dram_size);
 #endif
 int fixed_sdram(void);
@@ -138,7 +138,7 @@ phys_size_t initdram(int board_type)
 	msize = fixed_sdram();
 #endif
 
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
+#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 	/*
 	 * Initialize DDR ECC byte
 	 */
board/freescale/mpc8360erdk/mpc8360erdk.c +2 -2
index af3b8ce..3771878 100644
@@ -268,7 +268,7 @@ int fixed_sdram(void)
 
 phys_size_t initdram(int board_type)
 {
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
+#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 	extern void ddr_enable_ecc(unsigned int dram_size);
 #endif
 	volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
@@ -281,7 +281,7 @@ phys_size_t initdram(int board_type)
 	im->sysconf.ddrlaw[0].bar = CONFIG_SYS_DDR_BASE & LAWBAR_BAR;
 	msize = fixed_sdram();
 
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
+#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 	/*
 	 * Initialize DDR ECC byte
 	 */
board/freescale/mpc837xemds/mpc837xemds.c +2 -2
index 062d762..8506892 100644
@@ -199,7 +199,7 @@ int board_early_init_r(void)
 	return 0;
 }
 
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
+#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 extern void ddr_enable_ecc(unsigned int dram_size);
 #endif
 int fixed_sdram(void);
@@ -218,7 +218,7 @@ phys_size_t initdram(int board_type)
 	msize = fixed_sdram();
 #endif
 
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
+#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 	/* Initialize DDR ECC byte */
 	ddr_enable_ecc(msize * 1024 * 1024);
 #endif
board/freescale/mpc837xerdb/mpc837xerdb.c +2 -2
index 318a3dc..a4a1927 100644
@@ -59,7 +59,7 @@ testdram(void)
 }
 #endif
 
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
+#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 void ddr_enable_ecc(unsigned int dram_size);
 #endif
 int fixed_sdram(void);
@@ -78,7 +78,7 @@ phys_size_t initdram(int board_type)
 	msize = fixed_sdram();
 #endif
 
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
+#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 	/* Initialize DDR ECC byte */
 	ddr_enable_ecc(msize * 1024 * 1024);
 #endif
board/keymile/kmeter1/kmeter1.c +2 -2
index 660d87b..3d1b941 100644
@@ -153,7 +153,7 @@ int fixed_sdram(void)
 
 phys_size_t initdram (int board_type)
 {
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
+#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 	extern void ddr_enable_ecc (unsigned int dram_size);
 #endif
 	volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
@@ -166,7 +166,7 @@ phys_size_t initdram (int board_type)
 	im->sysconf.ddrlaw[0].bar = CONFIG_SYS_DDR_BASE & LAWBAR_BAR;
 	msize = fixed_sdram ();
 
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
+#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 	/*
 	 * Initialize DDR ECC byte
 	 */
cpu/mpc83xx/spd_sdram.c +1 -1
index 97ca700..8243968 100644
@@ -830,7 +830,7 @@ long int spd_sdram()
 }
 #endif /* CONFIG_SPD_EEPROM */
 
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
+#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 /*
  * Use timebase counter, get_timer() is not availabe
  * at this point of initialization yet.
Signature · 1 line
1.6.2.1
#25 lore raw

PATCH v2 12/12 83xx: Add support for fsl_dma driver

In reply to Peter Tyser
---
 cpu/mpc83xx/cpu.c            |   85 ------------------------------------------
 cpu/mpc83xx/spd_sdram.c      |   40 ++------------------
 drivers/dma/fsl_dma.c        |   64 ++++++++++++++++++++++++-------
 include/asm-ppc/config.h     |    5 +-
 include/asm-ppc/fsl_dma.h    |   36 ++++++++++++++++++
 include/asm-ppc/immap_83xx.h |   49 ++----------------------
 include/mpc83xx.h            |   16 --------
 7 files changed, 96 insertions(+), 199 deletions(-)
cpu/mpc83xx/cpu.c +0 -85
index a5c1f00..e38a372 100644
@@ -276,91 +276,6 @@ void watchdog_reset (void)
 }
 #endif
 
-#if defined(CONFIG_DDR_ECC)
-void dma_init(void)
-{
-	volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
-	volatile dma83xx_t *dma = &immap->dma;
-	volatile u32 status = swab32(dma->dmasr0);
-	volatile u32 dmamr0 = swab32(dma->dmamr0);
-
-	debug("DMA-init\n");
-
-	/* initialize DMASARn, DMADAR and DMAABCRn */
-	dma->dmadar0 = (u32)0;
-	dma->dmasar0 = (u32)0;
-	dma->dmabcr0 = 0;
-
-	__asm__ __volatile__ ("sync");
-	__asm__ __volatile__ ("isync");
-
-	/* clear CS bit */
-	dmamr0 &= ~DMA_CHANNEL_START;
-	dma->dmamr0 = swab32(dmamr0);
-	__asm__ __volatile__ ("sync");
-	__asm__ __volatile__ ("isync");
-
-	/* while the channel is busy, spin */
-	while(status & DMA_CHANNEL_BUSY) {
-		status = swab32(dma->dmasr0);
-	}
-
-	debug("DMA-init end\n");
-}
-
-uint dma_check(void)
-{
-	volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
-	volatile dma83xx_t *dma = &immap->dma;
-	volatile u32 status = swab32(dma->dmasr0);
-	volatile u32 byte_count = swab32(dma->dmabcr0);
-
-	/* while the channel is busy, spin */
-	while (status & DMA_CHANNEL_BUSY) {
-		status = swab32(dma->dmasr0);
-	}
-
-	if (status & DMA_CHANNEL_TRANSFER_ERROR) {
-		printf ("DMA Error: status = %x @ %d\n", status, byte_count);
-	}
-
-	return status;
-}
-
-int dmacpy(phys_addr_t dest, phys_addr_t src, phys_size_t count)
-{
-	volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
-	volatile dma83xx_t *dma = &immap->dma;
-	volatile u32 dmamr0;
-
-	/* initialize DMASARn, DMADAR and DMAABCRn */
-	dma->dmadar0 = swab32((u32)dest);
-	dma->dmasar0 = swab32((u32)src);
-	dma->dmabcr0 = swab32((u32)count);
-
-	__asm__ __volatile__ ("sync");
-	__asm__ __volatile__ ("isync");
-
-	/* init direct transfer, clear CS bit */
-	dmamr0 = (DMA_CHANNEL_TRANSFER_MODE_DIRECT |
-			DMA_CHANNEL_SOURCE_ADDRESS_HOLD_8B |
-			DMA_CHANNEL_SOURCE_ADRESSS_HOLD_EN);
-
-	dma->dmamr0 = swab32(dmamr0);
-
-	__asm__ __volatile__ ("sync");
-	__asm__ __volatile__ ("isync");
-
-	/* set CS to start DMA transfer */
-	dmamr0 |= DMA_CHANNEL_START;
-	dma->dmamr0 = swab32(dmamr0);
-	__asm__ __volatile__ ("sync");
-	__asm__ __volatile__ ("isync");
-
-	return ((int)dma_check());
-}
-#endif /*CONFIG_DDR_ECC*/
-
 /*
  * Initializes on-chip ethernet controllers.
  * to override, implement board_eth_init()
cpu/mpc83xx/spd_sdram.c +4 -36
index 8243968..0f61180 100644
@@ -64,13 +64,6 @@ void board_add_ram_info(int use_default)
 }
 
 #ifdef CONFIG_SPD_EEPROM
-
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
-extern void dma_init(void);
-extern uint dma_check(void);
-extern int dmacpy(phys_addr_t dest, phys_addr_t src, phys_size_t n);
-#endif
-
 #ifndef	CONFIG_SYS_READ_SPD
 #define CONFIG_SYS_READ_SPD	i2c_read
 #endif
@@ -863,7 +856,6 @@ static __inline__ unsigned long get_tbms (void)
 /*
  * Initialize all of memory for ECC, then enable errors.
  */
-/* #define CONFIG_DDR_ECC_INIT_VIA_DMA */
 void ddr_enable_ecc(unsigned int dram_size)
 {
 	volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
@@ -872,45 +864,21 @@ void ddr_enable_ecc(unsigned int dram_size)
 	register u64 *p;
 	register uint size;
 	unsigned int pattern[2];
-#if defined(CONFIG_DDR_ECC_INIT_VIA_DMA)
-	uint i;
-#endif
+
 	icache_enable();
 	t_start = get_tbms();
 	pattern[0] = 0xdeadbeef;
 	pattern[1] = 0xdeadbeef;
 
-#if !defined(CONFIG_DDR_ECC_INIT_VIA_DMA)
+#if defined(CONFIG_DDR_ECC_INIT_VIA_DMA)
+	dma_meminit(pattern[0], dram_size);
+#else
 	debug("ddr init: CPU FP write method\n");
 	size = dram_size;
 	for (p = 0; p < (u64*)(size); p++) {
 		ppcDWstore((u32*)p, pattern);
 	}
 	__asm__ __volatile__ ("sync");
-#else
-	debug("ddr init: DMA method\n");
-	size = 0x2000;
-	for (p = 0; p < (u64*)(size); p++) {
-		ppcDWstore((u32*)p, pattern);
-	}
-	__asm__ __volatile__ ("sync");
-
-	/* Initialise DMA for direct transfer */
-	dma_init();
-	/* Start DMA to transfer */
-	dmacpy(0x2000, 0, 0x2000); /* 8K */
-	dmacpy(0x4000, 0, 0x4000); /* 16K */
-	dmacpy(0x8000, 0, 0x8000); /* 32K */
-	dmacpy(0x10000, 0, 0x10000); /* 64K */
-	dmacpy(0x20000, 0, 0x20000); /* 128K */
-	dmacpy(0x40000, 0, 0x40000); /* 256K */
-	dmacpy(0x80000, 0, 0x80000); /* 512K */
-	dmacpy(0x100000, 0, 0x100000); /* 1M */
-	dmacpy(0x200000, 0, 0x200000); /* 2M */
-	dmacpy(0x400000, 0, 0x400000); /* 4M */
-
-	for (i = 1; i < dram_size / 0x800000; i++)
-		dmacpy(0x800000 * i, 0, 0x800000);
 #endif
 
 	t_end = get_tbms();
drivers/dma/fsl_dma.c +49 -15

112 lines not on this page · raw message

include/asm-ppc/config.h +3 -2
index 9c358aa..ca143c7 100644
@@ -30,8 +30,9 @@
 #endif
 
 #ifndef CONFIG_FSL_DMA
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER) && \
-	(defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx))
+#if ((!defined CONFIG_MPC83xx && defined(CONFIG_DDR_ECC) &&	\
+	!defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)) ||		\
+	(defined(CONFIG_MPC83xx) && defined(CONFIG_DDR_ECC_INIT_VIA_DMA)))
 #define CONFIG_FSL_DMA
 #endif
 #endif
include/asm-ppc/fsl_dma.h +36 -0
index 043669e..1164191 100644
@@ -27,6 +27,41 @@
 
 #include <asm/types.h>
 
+#ifdef CONFIG_MPC83xx
+typedef struct fsl_dma {
+	uint	mr;		/* DMA mode register */
+#define FSL_DMA_MR_CS		0x00000001	/* Channel start */
+#define FSL_DMA_MR_CC		0x00000002	/* Channel continue */
+#define FSL_DMA_MR_CTM		0x00000004	/* Channel xfer mode */
+#define FSL_DMA_MR_CTM_DIRECT	0x00000004	/* Direct channel xfer mode */
+#define FSL_DMA_MR_EOTIE	0x00000080	/* End-of-transfer interrupt en */
+#define FSL_DMA_MR_PRC_MASK	0x00000c00	/* PCI read command */
+#define FSL_DMA_MR_SAHE		0x00001000	/* Source addr hold enable */
+#define FSL_DMA_MR_DAHE		0x00002000	/* Dest addr hold enable */
+#define FSL_DMA_MR_SAHTS_MASK	0x0000c000	/* Source addr hold xfer size */
+#define FSL_DMA_MR_DAHTS_MASK	0x00030000	/* Dest addr hold xfer size */
+#define FSL_DMA_MR_EMS_EN	0x00040000	/* Ext master start en */
+#define FSL_DMA_MR_IRQS		0x00080000	/* Interrupt steer */
+#define FSL_DMA_MR_DMSEN	0x00100000	/* Direct mode snooping en */
+#define FSL_DMA_MR_BWC_MASK	0x00e00000	/* Bandwidth/pause ctl */
+#define FSL_DMA_MR_DRCNT	0x0f000000	/* DMA request count */
+	uint	sr;		/* DMA status register */
+#define FSL_DMA_SR_EOCDI	0x00000001	/* End-of-chain/direct interrupt */
+#define FSL_DMA_SR_EOSI		0x00000002	/* End-of-segment interrupt */
+#define FSL_DMA_SR_CB		0x00000004	/* Channel busy */
+#define FSL_DMA_SR_TE		0x00000080	/* Transfer error */
+	uint	cdar;		/* DMA current descriptor address register */
+	char	res0[4];
+	uint	sar;		/* DMA source address register */
+	char	res1[4];
+	uint	dar;		/* DMA destination address register */
+	char	res2[4];
+	uint	bcr;		/* DMA byte count register */
+	uint	ndar;		/* DMA next descriptor address register */
+	uint	gsr;		/* DMA general status register (DMA3 ONLY!) */
+	char	res3[84];
+} fsl_dma_t;
+#else
 typedef struct fsl_dma {
 	uint	mr;		/* DMA mode register */
 #define FSL_DMA_MR_CS		0x00000001	/* Channel start */
@@ -93,6 +128,7 @@ typedef struct fsl_dma {
 	uint	dsr;		/* DMA destination stride register */
 	char	res4[56];
 } fsl_dma_t;
+#endif /* !CONFIG_MPC83xx */
 
 #ifdef CONFIG_FSL_DMA
 void dma_init(void);
include/asm-ppc/immap_83xx.h +4 -45

67 lines not on this page · raw message

include/mpc83xx.h +0 -16
index c5bd6cb..fd742c7 100644
@@ -1041,22 +1041,6 @@
 #define ECC_ERROR_MAN_SBEC		(0xff000000>>24)	/* Single Bit Error Counter 0..255 */
 #define ECC_ERROR_MAN_SBEC_SHIFT	0
 
-/* DMAMR - DMA Mode Register
- */
-#define DMA_CHANNEL_START			0x00000001	/* Bit - DMAMRn CS */
-#define DMA_CHANNEL_TRANSFER_MODE_DIRECT	0x00000004	/* Bit - DMAMRn CTM */
-#define DMA_CHANNEL_SOURCE_ADRESSS_HOLD_EN	0x00001000	/* Bit - DMAMRn SAHE */
-#define DMA_CHANNEL_SOURCE_ADDRESS_HOLD_1B	0x00000000	/* 2Bit- DMAMRn SAHTS 1byte */
-#define DMA_CHANNEL_SOURCE_ADDRESS_HOLD_2B	0x00004000	/* 2Bit- DMAMRn SAHTS 2bytes */
-#define DMA_CHANNEL_SOURCE_ADDRESS_HOLD_4B	0x00008000	/* 2Bit- DMAMRn SAHTS 4bytes */
-#define DMA_CHANNEL_SOURCE_ADDRESS_HOLD_8B	0x0000c000	/* 2Bit- DMAMRn SAHTS 8bytes */
-#define DMA_CHANNEL_SNOOP			0x00010000	/* Bit - DMAMRn DMSEN */
-
-/* DMASR - DMA Status Register
- */
-#define DMA_CHANNEL_BUSY			0x00000004	/* Bit - DMASRn CB */
-#define DMA_CHANNEL_TRANSFER_ERROR		0x00000080	/* Bit - DMASRn TE */
-
 /* CONFIG_ADDRESS - PCI Config Address Register
  */
 #define PCI_CONFIG_ADDRESS_EN		0x80000000
Signature · 1 line
1.6.2.1
Applied
#4 lore raw

PATCH v2 2/12 fsl_dma: Add bitfield definitions for common registers

In reply to Peter Tyser
Quoted 6 lines · Peter Tyser

---

drivers/dma/fsl_dma.c     |   12 +++++-----
include/asm-ppc/fsl_dma.h |   46 ++++++++++++++++++++++++++++++++++++ 
+++++++++
2 files changed, 52 insertions(+), 6 deletions(-)

applied

- k

Applied
#2 lore raw

PATCH v2 1/12 85xx, 86xx: Break out DMA code to a common file

In reply to Peter Tyser
Quoted 15 lines · Peter Tyser

DMA support is now enabled via the CONFIG_FSL_DMA define instead of the
previous CONFIG_DDR_ECC

---

cpu/mpc85xx/cpu.c        |   47 -----------------------
cpu/mpc86xx/cpu.c        |   55 ---------------------------
drivers/dma/Makefile     |    1 +
drivers/dma/fsl_dma.c    |   92 +++++++++++++++++++++++++++++++++++++ 
+++++++++
include/asm-ppc/config.h |    7 +++
include/configs/PM854.h  |    1 +
include/configs/PM856.h  |    1 +
7 files changed, 102 insertions(+), 102 deletions(-)
Quoted 1 line

create mode 100644 drivers/dma/fsl_dma.c

applied

- k

Applied
#8 lore raw

PATCH v2 4/12 fsl_dma: Add support for arbitrarily large transfers

In reply to Peter Tyser
Quoted 8 lines · Peter Tyser

Support DMA transfers larger than the DMA controller's limit of (2 ^ 26 - 1) bytes

---
drivers/dma/fsl_dma.c | 40 ++++++++++++++++++++++++++++------------

1 files changed, 28 insertions(+), 12 deletions(-)

applied

- k

Applied
#10 lore raw

PATCH v2 5/12 fsl_dma: Fix Channel Start bug in dma_check()

In reply to Peter Tyser
Quoted 5 lines · Peter Tyser

The Channel Start (CS) bit in the Mode Register (MR) should actually be
cleared as the comment in the code suggests. Previously, CS was being set, not cleared.

Quoted 8 lines

Assuming normal operation of the DMA engine, this change shouldn't have
any real affect.

---
drivers/dma/fsl_dma.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)

applied

- k

Applied
#12 lore raw

PATCH v2 6/12 8xxx: Rename dma_xfer() to dmacpy()

In reply to Peter Tyser
Quoted 4 lines · Peter Tyser

Also update dmacpy()'s argument order to match memcpy's and use phys_addr_t/phy_size_t for address/size arguments

Quoted 8 lines

---

board/mpc8540eval/mpc8540eval.c |   25 ++++++++++++-------------
board/sbc8560/sbc8560.c         |   25 ++++++++++++-------------
cpu/mpc83xx/cpu.c               |    4 ++--
cpu/mpc83xx/spd_sdram.c         |   29 ++++++++++++++---------------
cpu/mpc85xx/ddr-gen1.c          |   29 ++++++++++++++---------------
drivers/dma/fsl_dma.c           |    2 +-
6 files changed, 55 insertions(+), 59 deletions(-)

applied

- k

#22 lore raw

PATCH v2 11/12 83xx: Replace CONFIG_ECC_INIT_VIA_DDRC references

In reply to Peter Tyser
Quoted 5 lines · Peter Tyser

Update 83xx architecture's CONFIG_ECC_INIT_VIA_DDRC references to CONFIG_ECC_INIT_VIA_DDRCONTROLLER, which other Freescale architectures use

Quoted 8 lines

---

board/freescale/mpc8360emds/mpc8360emds.c |    4 ++--
board/freescale/mpc8360erdk/mpc8360erdk.c |    4 ++--
board/freescale/mpc837xemds/mpc837xemds.c |    4 ++--
board/freescale/mpc837xerdb/mpc837xerdb.c |    4 ++--
board/keymile/kmeter1/kmeter1.c           |    4 ++--
cpu/mpc83xx/spd_sdram.c                   |    2 +-
6 files changed, 11 insertions(+), 11 deletions(-)

Kim,

If you ack this I will pull this in via the "8xxx" tree with the other DMA patches. (Also 12/12)

- k

Applied
#16 lore raw

PATCH v2 8/12 85xx, 86xx: Move dma_init() call to common code

In reply to Peter Tyser
Quoted 8 lines · Peter Tyser

---

board/mpc8540eval/mpc8540eval.c |    2 +-
board/sbc8560/sbc8560.c         |    2 +-
cpu/mpc85xx/cpu_init.c          |    4 +++-
cpu/mpc85xx/ddr-gen1.c          |    2 --
cpu/mpc86xx/cpu_init.c          |    3 +++
5 files changed, 8 insertions(+), 5 deletions(-)

applied

- k

Applied
#18 lore raw

PATCH v2 9/12 fsl_dma: Break out common memory initialization function

In reply to Peter Tyser
Quoted 11 lines · Peter Tyser

---
board/mpc8540eval/mpc8540eval.c | 32

+-------------------------------
board/sbc8560/sbc8560.c         |   32  
+-------------------------------
cpu/mpc85xx/ddr-gen1.c          |   26 +-------------------------
drivers/dma/fsl_dma.c           |   32 ++++++++++++++++++++++++++++++ 
++
include/asm-ppc/fsl_dma.h       |    3 +++
5 files changed, 38 insertions(+), 87 deletions(-)

applied

- k

Applied
#20 lore raw

PATCH v2 10/12 fsl_dma: Make DMA transactions snoopable

In reply to Peter Tyser
Quoted 9 lines · Peter Tyser

Make DMA transactions snoopable so that CPUs can keep caches up-to- date.
This allows dma transactions to be used for operations such as memory copies without any additional cache control operations.

---
drivers/dma/fsl_dma.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)

applied

- k

#23 lore raw

PATCH v2 11/12 83xx: Replace CONFIG_ECC_INIT_VIA_DDRC references

In reply to Kumar Gala
Quoted 17 lines · On Wed, 1 Jul 2009 23:12:52 -0500 Kumar Gala <[email protected]> wrote:
Quoted 5 lines · Peter Tyser

Update 83xx architecture's CONFIG_ECC_INIT_VIA_DDRC references to CONFIG_ECC_INIT_VIA_DDRCONTROLLER, which other Freescale architectures use

Quoted 8 lines

---

board/freescale/mpc8360emds/mpc8360emds.c |    4 ++--
board/freescale/mpc8360erdk/mpc8360erdk.c |    4 ++--
board/freescale/mpc837xemds/mpc837xemds.c |    4 ++--
board/freescale/mpc837xerdb/mpc837xerdb.c |    4 ++--
board/keymile/kmeter1/kmeter1.c           |    4 ++--
cpu/mpc83xx/spd_sdram.c                   |    2 +-
6 files changed, 11 insertions(+), 11 deletions(-)
Quoted 4 lines

Kim,

If you ack this I will pull this in via the "8xxx" tree with the other DMA patches. (Also 12/12)

ack 11-12/12,

thanks Kumar,

Kim

Applied
#24 lore raw

PATCH v2 11/12 83xx: Replace CONFIG_ECC_INIT_VIA_DDRC references

In reply to Peter Tyser
Quoted 5 lines · Peter Tyser

Update 83xx architecture's CONFIG_ECC_INIT_VIA_DDRC references to CONFIG_ECC_INIT_VIA_DDRCONTROLLER, which other Freescale architectures use

Quoted 8 lines

---

board/freescale/mpc8360emds/mpc8360emds.c |    4 ++--
board/freescale/mpc8360erdk/mpc8360erdk.c |    4 ++--
board/freescale/mpc837xemds/mpc837xemds.c |    4 ++--
board/freescale/mpc837xerdb/mpc837xerdb.c |    4 ++--
board/keymile/kmeter1/kmeter1.c           |    4 ++--
cpu/mpc83xx/spd_sdram.c                   |    2 +-
6 files changed, 11 insertions(+), 11 deletions(-)

applied

- k

Applied
#26 lore raw

PATCH v2 12/12 83xx: Add support for fsl_dma driver

In reply to Peter Tyser
Quoted 6 lines · Peter Tyser

---
cpu/mpc83xx/cpu.c | 85
------------------------------------------

Quoted 7 lines
cpu/mpc83xx/spd_sdram.c      |   40 ++------------------
drivers/dma/fsl_dma.c        |   64 ++++++++++++++++++++++++-------
include/asm-ppc/config.h     |    5 +-
include/asm-ppc/fsl_dma.h    |   36 ++++++++++++++++++
include/asm-ppc/immap_83xx.h |   49 ++----------------------
include/mpc83xx.h            |   16 --------
7 files changed, 96 insertions(+), 199 deletions(-)

applied

- k

#27 lore raw

PATCH v2 12/12 83xx: Add support for fsl_dma driver

In reply to Peter Tyser

Hi Peter,

this patch breaks some PPC4xx boards. Those enabling CONFIG_DDR_ECC, e.g. canyonlands:

[stefan at stefan-desktop u-boot-ppc4xx (master)]$ ./MAKEALL canyonlands Configuring for canyonlands board...
fsl_dma.c:50:2: error: #error "Freescale DMA engine not supported on your processor"
make[1]: *** No rule to make target .depend', needed by libdma.a'. Stop.

On Wednesday 01 July 2009 00:15:51 Peter Tyser wrote:

<snip>

include/asm-ppc/config.h line 38

Quoted 13 lines

+++ b/include/asm-ppc/config.h

include/asm-ppc/config.h +3 -1
@@ -30,8 +30,9 @@
 #endif
 
 #ifndef CONFIG_FSL_DMA
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 && \ -	(defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx))
+#if ((!defined CONFIG_MPC83xx && defined(CONFIG_DDR_ECC) &&	\
+	!defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)) ||		\
+	(defined(CONFIG_MPC83xx) && defined(CONFIG_DDR_ECC_INIT_VIA_DMA)))
 #define CONFIG_FSL_DMA
 #endif
 #endif

The #if construct doesn't seem to work for all PPC boards. I have to admit that I don't understand the logic enabling the CONFIG_FSL_DMA define. It would be great if you (or somebody else with the FSL insight) could fix this.

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#28 lore raw

PATCH v2 12/12 83xx: Add support for fsl_dma driver

Peter,

Also, I'm not seeing anyone defining CONFIG_DDR_ECC_INIT_VIA_DMA for 83xx. I don't see any reason not to use DMA on 83xx.

- k

Quoted 51 lines · Stefan Roese

Hi Peter,

this patch breaks some PPC4xx boards. Those enabling CONFIG_DDR_ECC, e.g.
canyonlands:

[stefan at stefan-desktop u-boot-ppc4xx (master)]$ ./MAKEALL canyonlands Configuring for canyonlands board...
fsl_dma.c:50:2: error: #error "Freescale DMA engine not supported on your
processor"
make[1]: *** No rule to make target .depend', needed by libdma.a'. Stop.

On Wednesday 01 July 2009 00:15:51 Peter Tyser wrote:

<snip>

Quoted 12 lines

+++ b/include/asm-ppc/config.h

include/asm-ppc/config.h +3 -1
@@ -30,8 +30,9 @@
 #endif
 
 #ifndef CONFIG_FSL_DMA
-#if defined(CONFIG_DDR_ECC) && ! 
 defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 && \ -	(defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx))
+#if ((!defined CONFIG_MPC83xx && defined(CONFIG_DDR_ECC) &&	\
+	!defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)) ||		\
+	(defined(CONFIG_MPC83xx) && defined(CONFIG_DDR_ECC_INIT_VIA_DMA)))
 #define CONFIG_FSL_DMA
Quoted 2 lines

#endif
#endif

The #if construct doesn't seem to work for all PPC boards. I have to admit
that I don't understand the logic enabling the CONFIG_FSL_DMA define. It would
be great if you (or somebody else with the FSL insight) could fix this.

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#32 lore raw

PATCH v2 12/12 83xx: Add support for fsl_dma driver

In reply to Stefan Roese

Hi Stefan,

Quoted 4 lines
Quoted 4 lines

+++ b/include/asm-ppc/config.h

(quoted diff) +0 -0
@@ -30,8 +30,9 @@
 #endif
 
Quoted 13 lines

include/asm-ppc/config.h line 38

Quoted 9 lines
include/asm-ppc/config.h +3 -1
 #ifndef CONFIG_FSL_DMA
-#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
 && \ -	(defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx))
+#if ((!defined CONFIG_MPC83xx && defined(CONFIG_DDR_ECC) &&	\
+	!defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)) ||		\
+	(defined(CONFIG_MPC83xx) && defined(CONFIG_DDR_ECC_INIT_VIA_DMA)))
 #define CONFIG_FSL_DMA
 #endif
 #endif

The #if construct doesn't seem to work for all PPC boards. I have to admit that I don't understand the logic enabling the CONFIG_FSL_DMA define. It would be great if you (or somebody else with the FSL insight) could fix this.

Thanks for the catch. I'll send a cleanup patch shortly.

Peter

#29 lore raw

PATCH v2 12/12 83xx: Add support for fsl_dma driver

In reply to Kumar Gala
Quoted 4 lines · Kumar Gala

Peter,

Also, I'm not seeing anyone defining CONFIG_DDR_ECC_INIT_VIA_DMA for 83xx. I don't see any reason not to use DMA on 83xx.

When I submitted the original patch I didn't see any 83xx boards using either CONFIG_ECC_INIT_VIA_DDRCONTROLLER or CONFIG_DDR_ECC_INIT_VIA_DMA. It didn't look like the 83xx platform supported the CONFIG_ECC_INIT_VIA_DDRCONTROLLER option at all, although some 83xx boards make reference to !CONFIG_DDR_ECC_INIT_VIA_DMA.

I don't have any 83xx boards to test on and am not that familiar with the 83xx so I didn't look into fixing the inconsistencies. In a perfect world CONFIG_ECC_INIT_VIA_DDRCONTROLLER would be enabled for all 83xx cpus that supported it, and the DMA init would be the default.

I'd be happy to send a patch to change the 83xx arch to use DMA to initialize ECC when !CONFIG_ECC_INIT_VIA_DDRCONTROLLER if someone else will test. Do all 83xx CPUs have the Elo DMA controller DMA engine?

Best,
Peter

#30 lore raw

PATCH v2 12/12 83xx: Add support for fsl_dma driver

Quoted 19 lines · Peter Tyser
Quoted 4 lines · Kumar Gala

Peter,

Also, I'm not seeing anyone defining CONFIG_DDR_ECC_INIT_VIA_DMA for 83xx. I don't see any reason not to use DMA on 83xx.

When I submitted the original patch I didn't see any 83xx boards using either CONFIG_ECC_INIT_VIA_DDRCONTROLLER or CONFIG_DDR_ECC_INIT_VIA_DMA.
It didn't look like the 83xx platform supported the CONFIG_ECC_INIT_VIA_DDRCONTROLLER option at all, although some 83xx boards make reference to !CONFIG_DDR_ECC_INIT_VIA_DMA.

I don't have any 83xx boards to test on and am not that familiar with the 83xx so I didn't look into fixing the inconsistencies. In a perfect
world CONFIG_ECC_INIT_VIA_DDRCONTROLLER would be enabled for all 83xx cpus that supported it, and the DMA init would be the default.

Quoted 3 lines

I'd be happy to send a patch to change the 83xx arch to use DMA to initialize ECC when !CONFIG_ECC_INIT_VIA_DDRCONTROLLER if someone else will test. Do all 83xx CPUs have the Elo DMA controller DMA engine?

Yes, all 83xx's have Elo DMA controller.

- k

#31 lore raw

PATCH v2 12/12 83xx: Add support for fsl_dma driver

In reply to Peter Tyser
Quoted 12 lines · Peter Tyser
Quoted 4 lines · Kumar Gala

Peter,

Also, I'm not seeing anyone defining CONFIG_DDR_ECC_INIT_VIA_DMA for 83xx. I don't see any reason not to use DMA on 83xx.

When I submitted the original patch I didn't see any 83xx boards using either CONFIG_ECC_INIT_VIA_DDRCONTROLLER or CONFIG_DDR_ECC_INIT_VIA_DMA. It didn't look like the 83xx platform supported the CONFIG_ECC_INIT_VIA_DDRCONTROLLER option at all, although some 83xx boards make reference to !CONFIG_DDR_ECC_INIT_VIA_DMA.

Quoted 9 lines

I don't have any 83xx boards to test on and am not that familiar with the 83xx so I didn't look into fixing the inconsistencies. In a perfect world CONFIG_ECC_INIT_VIA_DDRCONTROLLER would be enabled for all 83xx cpus that supported it, and the DMA init would be the default.

I'd be happy to send a patch to change the 83xx arch to use DMA to initialize ECC when !CONFIG_ECC_INIT_VIA_DDRCONTROLLER if someone else will test. Do all 83xx CPUs have the Elo DMA controller DMA engine?

I'm always happy to test anything on an mpc8349emds.

I don't have any ECC RAM for my mpc8349emds board, but I do have a custom 8349ea-based board with ECC RAM. The U-Boot port is just a trimmed down copy of the mpc8349emds port, so I can test with that.

Ira