1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2384740dcSRalf Baechle /* 3384740dcSRalf Baechle * Copyright 2002 Integrated Device Technology, Inc. 4384740dcSRalf Baechle * All rights reserved. 5384740dcSRalf Baechle * 6384740dcSRalf Baechle * DMA register definition. 7384740dcSRalf Baechle * 8384740dcSRalf Baechle * Author : ryan.holmQVist@idt.com 9384740dcSRalf Baechle * Date : 20011005 10384740dcSRalf Baechle */ 11384740dcSRalf Baechle 12384740dcSRalf Baechle #ifndef __ASM_RC32434_DMA_H 13384740dcSRalf Baechle #define __ASM_RC32434_DMA_H 14384740dcSRalf Baechle 15384740dcSRalf Baechle #include <asm/mach-rc32434/rb.h> 16384740dcSRalf Baechle 17384740dcSRalf Baechle #define DMA0_BASE_ADDR 0x18040000 18384740dcSRalf Baechle 19384740dcSRalf Baechle /* 20384740dcSRalf Baechle * DMA descriptor (in physical memory). 21384740dcSRalf Baechle */ 22384740dcSRalf Baechle 23384740dcSRalf Baechle struct dma_desc { 24384740dcSRalf Baechle u32 control; /* Control. use DMAD_* */ 25384740dcSRalf Baechle u32 ca; /* Current Address. */ 26384740dcSRalf Baechle u32 devcs; /* Device control and status. */ 27384740dcSRalf Baechle u32 link; /* Next descriptor in chain. */ 28384740dcSRalf Baechle }; 29384740dcSRalf Baechle 30384740dcSRalf Baechle #define DMA_DESC_SIZ sizeof(struct dma_desc) 31384740dcSRalf Baechle #define DMA_DESC_COUNT_BIT 0 32384740dcSRalf Baechle #define DMA_DESC_COUNT_MSK 0x0003ffff 33384740dcSRalf Baechle #define DMA_DESC_DS_BIT 20 34384740dcSRalf Baechle #define DMA_DESC_DS_MSK 0x00300000 35384740dcSRalf Baechle 36384740dcSRalf Baechle #define DMA_DESC_DEV_CMD_BIT 22 37384740dcSRalf Baechle #define DMA_DESC_DEV_CMD_MSK 0x01c00000 38384740dcSRalf Baechle 39384740dcSRalf Baechle /* DMA command sizes */ 40384740dcSRalf Baechle #define DMA_DESC_DEV_CMD_BYTE 0 41384740dcSRalf Baechle #define DMA_DESC_DEV_CMD_HLF_WD 1 42384740dcSRalf Baechle #define DMA_DESC_DEV_CMD_WORD 2 43384740dcSRalf Baechle #define DMA_DESC_DEV_CMD_2WORDS 3 44384740dcSRalf Baechle #define DMA_DESC_DEV_CMD_4WORDS 4 45384740dcSRalf Baechle #define DMA_DESC_DEV_CMD_6WORDS 5 46384740dcSRalf Baechle #define DMA_DESC_DEV_CMD_8WORDS 6 47384740dcSRalf Baechle #define DMA_DESC_DEV_CMD_16WORDS 7 48384740dcSRalf Baechle 49384740dcSRalf Baechle /* DMA descriptors interrupts */ 50384740dcSRalf Baechle #define DMA_DESC_COF (1 << 25) /* Chain on finished */ 51384740dcSRalf Baechle #define DMA_DESC_COD (1 << 26) /* Chain on done */ 52384740dcSRalf Baechle #define DMA_DESC_IOF (1 << 27) /* Interrupt on finished */ 53384740dcSRalf Baechle #define DMA_DESC_IOD (1 << 28) /* Interrupt on done */ 54384740dcSRalf Baechle #define DMA_DESC_TERM (1 << 29) /* Terminated */ 55384740dcSRalf Baechle #define DMA_DESC_DONE (1 << 30) /* Done */ 56384740dcSRalf Baechle #define DMA_DESC_FINI (1 << 31) /* Finished */ 57384740dcSRalf Baechle 58384740dcSRalf Baechle /* 59384740dcSRalf Baechle * DMA register (within Internal Register Map). 60384740dcSRalf Baechle */ 61384740dcSRalf Baechle 62384740dcSRalf Baechle struct dma_reg { 63384740dcSRalf Baechle u32 dmac; /* Control. */ 64384740dcSRalf Baechle u32 dmas; /* Status. */ 65384740dcSRalf Baechle u32 dmasm; /* Mask. */ 66384740dcSRalf Baechle u32 dmadptr; /* Descriptor pointer. */ 67384740dcSRalf Baechle u32 dmandptr; /* Next descriptor pointer. */ 68384740dcSRalf Baechle }; 69384740dcSRalf Baechle 70384740dcSRalf Baechle /* DMA channels specific registers */ 71384740dcSRalf Baechle #define DMA_CHAN_RUN_BIT (1 << 0) 72384740dcSRalf Baechle #define DMA_CHAN_DONE_BIT (1 << 1) 73384740dcSRalf Baechle #define DMA_CHAN_MODE_BIT (1 << 2) 74384740dcSRalf Baechle #define DMA_CHAN_MODE_MSK 0x0000000c 75384740dcSRalf Baechle #define DMA_CHAN_MODE_AUTO 0 76384740dcSRalf Baechle #define DMA_CHAN_MODE_BURST 1 77384740dcSRalf Baechle #define DMA_CHAN_MODE_XFRT 2 78384740dcSRalf Baechle #define DMA_CHAN_MODE_RSVD 3 79384740dcSRalf Baechle #define DMA_CHAN_ACT_BIT (1 << 4) 80384740dcSRalf Baechle 81384740dcSRalf Baechle /* DMA status registers */ 82384740dcSRalf Baechle #define DMA_STAT_FINI (1 << 0) 83384740dcSRalf Baechle #define DMA_STAT_DONE (1 << 1) 84384740dcSRalf Baechle #define DMA_STAT_CHAIN (1 << 2) 85384740dcSRalf Baechle #define DMA_STAT_ERR (1 << 3) 86384740dcSRalf Baechle #define DMA_STAT_HALT (1 << 4) 87384740dcSRalf Baechle 88384740dcSRalf Baechle /* 89384740dcSRalf Baechle * DMA channel definitions 90384740dcSRalf Baechle */ 91384740dcSRalf Baechle 92384740dcSRalf Baechle #define DMA_CHAN_ETH_RCV 0 93384740dcSRalf Baechle #define DMA_CHAN_ETH_XMT 1 94384740dcSRalf Baechle #define DMA_CHAN_MEM_TO_FIFO 2 95384740dcSRalf Baechle #define DMA_CHAN_FIFO_TO_MEM 3 96384740dcSRalf Baechle #define DMA_CHAN_PCI_TO_MEM 4 97384740dcSRalf Baechle #define DMA_CHAN_MEM_TO_PCI 5 98384740dcSRalf Baechle #define DMA_CHAN_COUNT 6 99384740dcSRalf Baechle 100384740dcSRalf Baechle struct dma_channel { 101384740dcSRalf Baechle struct dma_reg ch[DMA_CHAN_COUNT]; 102384740dcSRalf Baechle }; 103384740dcSRalf Baechle 104384740dcSRalf Baechle #endif /* __ASM_RC32434_DMA_H */ 105