1a47a12beSStefan Roese /* 2a47a12beSStefan Roese * Freescale DMA Controller 3a47a12beSStefan Roese * 4a47a12beSStefan Roese * Copyright 2006 Freescale Semiconductor, Inc. 5a47a12beSStefan Roese * 6*5b8031ccSTom Rini * SPDX-License-Identifier: GPL-2.0 7a47a12beSStefan Roese */ 8a47a12beSStefan Roese 9a47a12beSStefan Roese #ifndef _ASM_FSL_DMA_H_ 10a47a12beSStefan Roese #define _ASM_FSL_DMA_H_ 11a47a12beSStefan Roese 12a47a12beSStefan Roese #include <asm/types.h> 13a47a12beSStefan Roese 14a47a12beSStefan Roese #ifdef CONFIG_MPC83xx 15a47a12beSStefan Roese typedef struct fsl_dma { 16a47a12beSStefan Roese uint mr; /* DMA mode register */ 17a47a12beSStefan Roese #define FSL_DMA_MR_CS 0x00000001 /* Channel start */ 18a47a12beSStefan Roese #define FSL_DMA_MR_CC 0x00000002 /* Channel continue */ 19a47a12beSStefan Roese #define FSL_DMA_MR_CTM 0x00000004 /* Channel xfer mode */ 20a47a12beSStefan Roese #define FSL_DMA_MR_CTM_DIRECT 0x00000004 /* Direct channel xfer mode */ 21a47a12beSStefan Roese #define FSL_DMA_MR_EOTIE 0x00000080 /* End-of-transfer interrupt en */ 22a47a12beSStefan Roese #define FSL_DMA_MR_PRC_MASK 0x00000c00 /* PCI read command */ 23a47a12beSStefan Roese #define FSL_DMA_MR_SAHE 0x00001000 /* Source addr hold enable */ 24a47a12beSStefan Roese #define FSL_DMA_MR_DAHE 0x00002000 /* Dest addr hold enable */ 25a47a12beSStefan Roese #define FSL_DMA_MR_SAHTS_MASK 0x0000c000 /* Source addr hold xfer size */ 26a47a12beSStefan Roese #define FSL_DMA_MR_DAHTS_MASK 0x00030000 /* Dest addr hold xfer size */ 27a47a12beSStefan Roese #define FSL_DMA_MR_EMS_EN 0x00040000 /* Ext master start en */ 28a47a12beSStefan Roese #define FSL_DMA_MR_IRQS 0x00080000 /* Interrupt steer */ 29a47a12beSStefan Roese #define FSL_DMA_MR_DMSEN 0x00100000 /* Direct mode snooping en */ 30a47a12beSStefan Roese #define FSL_DMA_MR_BWC_MASK 0x00e00000 /* Bandwidth/pause ctl */ 31a47a12beSStefan Roese #define FSL_DMA_MR_DRCNT 0x0f000000 /* DMA request count */ 32a47a12beSStefan Roese uint sr; /* DMA status register */ 33a47a12beSStefan Roese #define FSL_DMA_SR_EOCDI 0x00000001 /* End-of-chain/direct interrupt */ 34a47a12beSStefan Roese #define FSL_DMA_SR_EOSI 0x00000002 /* End-of-segment interrupt */ 35a47a12beSStefan Roese #define FSL_DMA_SR_CB 0x00000004 /* Channel busy */ 36a47a12beSStefan Roese #define FSL_DMA_SR_TE 0x00000080 /* Transfer error */ 37a47a12beSStefan Roese uint cdar; /* DMA current descriptor address register */ 38a47a12beSStefan Roese char res0[4]; 39a47a12beSStefan Roese uint sar; /* DMA source address register */ 40a47a12beSStefan Roese char res1[4]; 41a47a12beSStefan Roese uint dar; /* DMA destination address register */ 42a47a12beSStefan Roese char res2[4]; 43a47a12beSStefan Roese uint bcr; /* DMA byte count register */ 44a47a12beSStefan Roese uint ndar; /* DMA next descriptor address register */ 45a47a12beSStefan Roese uint gsr; /* DMA general status register (DMA3 ONLY!) */ 46a47a12beSStefan Roese char res3[84]; 47a47a12beSStefan Roese } fsl_dma_t; 48a47a12beSStefan Roese #else 49a47a12beSStefan Roese typedef struct fsl_dma { 50a47a12beSStefan Roese uint mr; /* DMA mode register */ 51a47a12beSStefan Roese #define FSL_DMA_MR_CS 0x00000001 /* Channel start */ 52a47a12beSStefan Roese #define FSL_DMA_MR_CC 0x00000002 /* Channel continue */ 53a47a12beSStefan Roese #define FSL_DMA_MR_CTM 0x00000004 /* Channel xfer mode */ 54a47a12beSStefan Roese #define FSL_DMA_MR_CTM_DIRECT 0x00000004 /* Direct channel xfer mode */ 55a47a12beSStefan Roese #define FSL_DMA_MR_CA 0x00000008 /* Channel abort */ 56a47a12beSStefan Roese #define FSL_DMA_MR_CDSM 0x00000010 57a47a12beSStefan Roese #define FSL_DMA_MR_XFE 0x00000020 /* Extended features en */ 58a47a12beSStefan Roese #define FSL_DMA_MR_EIE 0x00000040 /* Error interrupt en */ 59a47a12beSStefan Roese #define FSL_DMA_MR_EOLSIE 0x00000080 /* End-of-lists interrupt en */ 60a47a12beSStefan Roese #define FSL_DMA_MR_EOLNIE 0x00000100 /* End-of-links interrupt en */ 61a47a12beSStefan Roese #define FSL_DMA_MR_EOSIE 0x00000200 /* End-of-seg interrupt en */ 62a47a12beSStefan Roese #define FSL_DMA_MR_SRW 0x00000400 /* Single register write */ 63a47a12beSStefan Roese #define FSL_DMA_MR_SAHE 0x00001000 /* Source addr hold enable */ 64a47a12beSStefan Roese #define FSL_DMA_MR_DAHE 0x00002000 /* Dest addr hold enable */ 65a47a12beSStefan Roese #define FSL_DMA_MR_SAHTS_MASK 0x0000c000 /* Source addr hold xfer size */ 66a47a12beSStefan Roese #define FSL_DMA_MR_DAHTS_MASK 0x00030000 /* Dest addr hold xfer size */ 67a47a12beSStefan Roese #define FSL_DMA_MR_EMS_EN 0x00040000 /* Ext master start en */ 68a47a12beSStefan Roese #define FSL_DMA_MR_EMP_EN 0x00200000 /* Ext master pause en */ 69a47a12beSStefan Roese #define FSL_DMA_MR_BWC_MASK 0x0f000000 /* Bandwidth/pause ctl */ 70a47a12beSStefan Roese #define FSL_DMA_MR_BWC_DIS 0x0f000000 /* Bandwidth/pause ctl disable */ 71a47a12beSStefan Roese uint sr; /* DMA status register */ 72a47a12beSStefan Roese #define FSL_DMA_SR_EOLSI 0x00000001 /* End-of-list interrupt */ 73a47a12beSStefan Roese #define FSL_DMA_SR_EOSI 0x00000002 /* End-of-segment interrupt */ 74a47a12beSStefan Roese #define FSL_DMA_SR_CB 0x00000004 /* Channel busy */ 75a47a12beSStefan Roese #define FSL_DMA_SR_EOLNI 0x00000008 /* End-of-links interrupt */ 76a47a12beSStefan Roese #define FSL_DMA_SR_PE 0x00000010 /* Programming error */ 77a47a12beSStefan Roese #define FSL_DMA_SR_CH 0x00000020 /* Channel halted */ 78a47a12beSStefan Roese #define FSL_DMA_SR_TE 0x00000080 /* Transfer error */ 79a47a12beSStefan Roese char res0[4]; 80a47a12beSStefan Roese uint clndar; /* DMA current link descriptor address register */ 81a47a12beSStefan Roese uint satr; /* DMA source attributes register */ 82a47a12beSStefan Roese #define FSL_DMA_SATR_ESAD_MASK 0x000001ff /* Extended source addr */ 83a47a12beSStefan Roese #define FSL_DMA_SATR_SREAD_NO_SNOOP 0x00040000 /* Read, don't snoop */ 84a47a12beSStefan Roese #define FSL_DMA_SATR_SREAD_SNOOP 0x00050000 /* Read, snoop */ 85a47a12beSStefan Roese #define FSL_DMA_SATR_SREAD_UNLOCK 0x00070000 /* Read, unlock l2 */ 86a47a12beSStefan Roese #define FSL_DMA_SATR_STRAN_MASK 0x00f00000 /* Source interface */ 87a47a12beSStefan Roese #define FSL_DMA_SATR_SSME 0x01000000 /* Source stride en */ 88a47a12beSStefan Roese #define FSL_DMA_SATR_SPCIORDER 0x02000000 /* PCI transaction order */ 89a47a12beSStefan Roese #define FSL_DMA_SATR_STFLOWLVL_MASK 0x0c000000 /* RIO flow level */ 90a47a12beSStefan Roese #define FSL_DMA_SATR_SBPATRMU 0x20000000 /* Bypass ATMU */ 91a47a12beSStefan Roese uint sar; /* DMA source address register */ 92a47a12beSStefan Roese uint datr; /* DMA destination attributes register */ 93a47a12beSStefan Roese #define FSL_DMA_DATR_EDAD_MASK 0x000001ff /* Extended dest addr */ 94a47a12beSStefan Roese #define FSL_DMA_DATR_DWRITE_NO_SNOOP 0x00040000 /* Write, don't snoop */ 95a47a12beSStefan Roese #define FSL_DMA_DATR_DWRITE_SNOOP 0x00050000 /* Write, snoop */ 96a47a12beSStefan Roese #define FSL_DMA_DATR_DWRITE_ALLOC 0x00060000 /* Write, alloc l2 */ 97a47a12beSStefan Roese #define FSL_DMA_DATR_DWRITE_LOCK 0x00070000 /* Write, lock l2 */ 98a47a12beSStefan Roese #define FSL_DMA_DATR_DTRAN_MASK 0x00f00000 /* Dest interface */ 99a47a12beSStefan Roese #define FSL_DMA_DATR_DSME 0x01000000 /* Dest stride en */ 100a47a12beSStefan Roese #define FSL_DMA_DATR_DPCIORDER 0x02000000 /* PCI transaction order */ 101a47a12beSStefan Roese #define FSL_DMA_DATR_DTFLOWLVL_MASK 0x0c000000 /* RIO flow level */ 102a47a12beSStefan Roese #define FSL_DMA_DATR_DBPATRMU 0x20000000 /* Bypass ATMU */ 103a47a12beSStefan Roese uint dar; /* DMA destination address register */ 104a47a12beSStefan Roese uint bcr; /* DMA byte count register */ 105a47a12beSStefan Roese char res1[4]; 106a47a12beSStefan Roese uint nlndar; /* DMA next link descriptor address register */ 107a47a12beSStefan Roese char res2[8]; 108a47a12beSStefan Roese uint clabdar; /* DMA current List - alternate base descriptor address Register */ 109a47a12beSStefan Roese char res3[4]; 110a47a12beSStefan Roese uint nlsdar; /* DMA next list descriptor address register */ 111a47a12beSStefan Roese uint ssr; /* DMA source stride register */ 112a47a12beSStefan Roese uint dsr; /* DMA destination stride register */ 113a47a12beSStefan Roese char res4[56]; 114a47a12beSStefan Roese } fsl_dma_t; 115a47a12beSStefan Roese #endif /* !CONFIG_MPC83xx */ 116a47a12beSStefan Roese 117a47a12beSStefan Roese #ifdef CONFIG_FSL_DMA 118a47a12beSStefan Roese void dma_init(void); 119a47a12beSStefan Roese int dmacpy(phys_addr_t dest, phys_addr_t src, phys_size_t n); 120a47a12beSStefan Roese #if (defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)) 121a47a12beSStefan Roese void dma_meminit(uint val, uint size); 122a47a12beSStefan Roese #endif 123a47a12beSStefan Roese #endif 124a47a12beSStefan Roese 125a47a12beSStefan Roese #endif /* _ASM_DMA_H_ */ 126