Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright 2002 Integrated Device Technology, Inc.
0004  *      All rights reserved.
0005  *
0006  * DMA register definition.
0007  *
0008  * Author : ryan.holmQVist@idt.com
0009  * Date   : 20011005
0010  */
0011 
0012 #ifndef _ASM_RC32434_DMA_V_H_
0013 #define _ASM_RC32434_DMA_V_H_
0014 
0015 #include  <asm/mach-rc32434/dma.h>
0016 #include  <asm/mach-rc32434/rc32434.h>
0017 
0018 #define DMA_CHAN_OFFSET     0x14
0019 #define IS_DMA_USED(X)      (((X) & \
0020                 (DMA_DESC_FINI | DMA_DESC_DONE | DMA_DESC_TERM)) \
0021                 != 0)
0022 #define DMA_COUNT(count)    ((count) & DMA_DESC_COUNT_MSK)
0023 
0024 #define DMA_HALT_TIMEOUT    500
0025 
0026 static inline int rc32434_halt_dma(struct dma_reg *ch)
0027 {
0028     int timeout = 1;
0029     if (__raw_readl(&ch->dmac) & DMA_CHAN_RUN_BIT) {
0030         __raw_writel(0, &ch->dmac);
0031         for (timeout = DMA_HALT_TIMEOUT; timeout > 0; timeout--) {
0032             if (__raw_readl(&ch->dmas) & DMA_STAT_HALT) {
0033                 __raw_writel(0, &ch->dmas);
0034                 break;
0035             }
0036         }
0037     }
0038 
0039     return timeout ? 0 : 1;
0040 }
0041 
0042 static inline void rc32434_start_dma(struct dma_reg *ch, u32 dma_addr)
0043 {
0044     __raw_writel(0, &ch->dmandptr);
0045     __raw_writel(dma_addr, &ch->dmadptr);
0046 }
0047 
0048 static inline void rc32434_chain_dma(struct dma_reg *ch, u32 dma_addr)
0049 {
0050     __raw_writel(dma_addr, &ch->dmandptr);
0051 }
0052 
0053 #endif  /* _ASM_RC32434_DMA_V_H_ */