-
-#if defined(CONFIG_DDR_ECC)
-void
-dma_init(void)
-{
- volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
- volatile ccsr_dma_t *dma = &immap->im_dma;
-
- dma->satr0 = 0x00040000;
- dma->datr0 = 0x00040000;
- asm("sync; isync");
-}
-
-uint
-dma_check(void)
-{
- volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
- volatile ccsr_dma_t *dma = &immap->im_dma;
- volatile uint status = dma->sr0;
-
- /* While the channel is busy, spin */
- while ((status & 4) == 4) {
- status = dma->sr0;
- }
-
- if (status != 0) {
- printf("DMA Error: status = %x\n", status);
- }
- return status;
-}
-
-int
-dma_xfer(void *dest, uint count, void *src)
-{
- volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
- volatile ccsr_dma_t *dma = &immap->im_dma;
-
- dma->dar0 = (uint) dest;
- dma->sar0 = (uint) src;
- dma->bcr0 = count;
- dma->mr0 = 0xf000004;
- asm("sync;isync");
- dma->mr0 = 0xf000005;
- asm("sync;isync");
- return dma_check();
-}
-
-#endif /* CONFIG_DDR_ECC */
-
-