8xxx dma updates
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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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
@@ -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
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
@@ -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
PATCH v2 4/12 fsl_dma: Add support for arbitrarily large transfers
In reply to Peter TyserSupport 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
@@ -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
PATCH v2 5/12 fsl_dma: Fix Channel Start bug in dma_check()
In reply to Peter TyserThe 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
@@ -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
PATCH v2 6/12 8xxx: Rename dma_xfer() to dmacpy()
In reply to Peter TyserAlso 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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
@@ -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
@@ -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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v2 10/12 fsl_dma: Make DMA transactions snoopable
In reply to Peter TyserMake 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
@@ -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
PATCH v2 11/12 83xx: Replace CONFIG_ECC_INIT_VIA_DDRC references
In reply to Peter TyserUpdate 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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
@@ -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
@@ -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) registeru64 *p; registeruint 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
@@ -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
@@ -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
@@ -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
Kumar Gala
AppliedPATCH v2 3/12 fsl_dma: Use proper I/O access functions
In reply to Peter TyserQuoted 4 lines · Peter Tyser
Signed-off-by Peter Tyser <[email protected]>---
drivers/dma/fsl_dma.c| 32 ++++++++++++++++++--------------1 files changed, 18 insertions(+), 14 deletions(-)
applied
- k
Kumar Gala
AppliedPATCH v2 2/12 fsl_dma: Add bitfield definitions for common registers
In reply to Peter TyserQuoted 6 lines · Peter Tyser
Signed-off-by Peter Tyser <[email protected]>---
drivers/dma/fsl_dma.c | 12 +++++----- include/asm-ppc/fsl_dma.h | 46 ++++++++++++++++++++++++++++++++++++ +++++++++ 2 files changed, 52 insertions(+), 6 deletions(-)
applied
- k
Kumar Gala
AppliedPATCH v2 1/12 85xx, 86xx: Break out DMA code to a common file
In reply to Peter TyserQuoted 15 lines · Peter Tyser
DMA support is now enabled via the
CONFIG_FSL_DMAdefine instead of the
previousCONFIG_DDR_ECCSigned-off-by Peter Tyser <[email protected]>---
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
Kumar Gala
AppliedPATCH v2 4/12 fsl_dma: Add support for arbitrarily large transfers
In reply to Peter TyserQuoted 8 lines · Peter Tyser
Support DMA transfers larger than the DMA controller's limit of (2 ^ 26 - 1) bytes
Signed-off-by Peter Tyser <[email protected]>---
drivers/dma/fsl_dma.c| 40 ++++++++++++++++++++++++++++------------1 files changed, 28 insertions(+), 12 deletions(-)
applied
- k
Kumar Gala
AppliedPATCH v2 5/12 fsl_dma: Fix Channel Start bug in dma_check()
In reply to Peter TyserQuoted 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.Signed-off-by Peter Tyser <[email protected]>---
drivers/dma/fsl_dma.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)
applied
- k
Kumar Gala
AppliedPATCH v2 6/12 8xxx: Rename dma_xfer() to dmacpy()
In reply to Peter TyserQuoted 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
Signed-off-by Peter Tyser <[email protected]>
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
PATCH v2 11/12 83xx: Replace CONFIG_ECC_INIT_VIA_DDRC references
In reply to Peter TyserQuoted 5 lines · Peter Tyser
Update 83xx architecture's
CONFIG_ECC_INIT_VIA_DDRCreferences toCONFIG_ECC_INIT_VIA_DDRCONTROLLER, which other Freescale architectures useSigned-off-by Peter Tyser <[email protected]>
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
Kumar Gala
AppliedPATCH v2 7/12 fsl_dma: Move dma function prototypes to common header file
In reply to Peter TyserQuoted 5 lines · Peter Tyser
Signed-off-by Peter Tyser <[email protected]>---
cpu/mpc85xx/ddr-gen1.c | 4 ---- include/asm-ppc/fsl_dma.h | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-)
applied
- k
Kumar Gala
AppliedPATCH v2 8/12 85xx, 86xx: Move dma_init() call to common code
In reply to Peter TyserQuoted 8 lines · Peter Tyser
Signed-off-by Peter Tyser <[email protected]>---
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
Kumar Gala
AppliedPATCH v2 9/12 fsl_dma: Break out common memory initialization function
In reply to Peter TyserQuoted 11 lines · Peter Tyser
Signed-off-by Peter Tyser <[email protected]>---
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
Kumar Gala
AppliedPATCH v2 10/12 fsl_dma: Make DMA transactions snoopable
In reply to Peter TyserQuoted 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.Signed-off-by Peter Tyser <[email protected]>---
drivers/dma/fsl_dma.c| 4 ++--1 files changed, 2 insertions(+), 2 deletions(-)
applied
- k
PATCH v2 11/12 83xx: Replace CONFIG_ECC_INIT_VIA_DDRC references
In reply to Kumar GalaQuoted 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_DDRCreferences toCONFIG_ECC_INIT_VIA_DDRCONTROLLER, which other Freescale architectures useSigned-off-by Peter Tyser <[email protected]>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
Kumar Gala
AppliedPATCH v2 11/12 83xx: Replace CONFIG_ECC_INIT_VIA_DDRC references
In reply to Peter TyserQuoted 5 lines · Peter Tyser
Update 83xx architecture's
CONFIG_ECC_INIT_VIA_DDRCreferences toCONFIG_ECC_INIT_VIA_DDRCONTROLLER, which other Freescale architectures useSigned-off-by Peter Tyser <[email protected]>
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
Kumar Gala
AppliedPATCH v2 12/12 83xx: Add support for fsl_dma driver
In reply to Peter TyserQuoted 6 lines · Peter Tyser
Signed-off-by Peter Tyser <[email protected]>Reviewed-by Ira W. Snyder <[email protected]>Tested-by Ira W. Snyder <[email protected]>---
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
PATCH v2 12/12 83xx: Add support for fsl_dma driver
In reply to Peter TyserHi 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.hinclude/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
=====================================================================
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 bylibdma.a'. Stop.On Wednesday 01 July 2009 00:15:51 Peter Tyser wrote:
<snip>
Quoted 12 lines
+++
b/include/asm-ppc/config.hinclude/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
#endifThe #if construct doesn't seem to work for all PPC boards. I have to admit
that I don't understand the logic enabling theCONFIG_FSL_DMAdefine. 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
=====================================================================
PATCH v2 12/12 83xx: Add support for fsl_dma driver
In reply to Stefan RoeseHi 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_DMAdefine. 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
PATCH v2 12/12 83xx: Add support for fsl_dma driver
In reply to Kumar GalaQuoted 4 lines · Kumar Gala
Peter,
Also, I'm not seeing anyone defining
CONFIG_DDR_ECC_INIT_VIA_DMAfor 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
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_DMAfor 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_DDRCONTROLLERorCONFIG_DDR_ECC_INIT_VIA_DMA.
It didn't look like the 83xx platform supported theCONFIG_ECC_INIT_VIA_DDRCONTROLLERoption 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
worldCONFIG_ECC_INIT_VIA_DDRCONTROLLERwould 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
PATCH v2 12/12 83xx: Add support for fsl_dma driver
In reply to Peter TyserQuoted 12 lines · Peter Tyser
Quoted 4 lines · Kumar Gala
Peter,
Also, I'm not seeing anyone defining
CONFIG_DDR_ECC_INIT_VIA_DMAfor 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_DDRCONTROLLERorCONFIG_DDR_ECC_INIT_VIA_DMA. It didn't look like the 83xx platform supported theCONFIG_ECC_INIT_VIA_DDRCONTROLLERoption 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_DDRCONTROLLERwould 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