1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * This file is subject to the terms and conditions of the GNU General Public 3*4882a593Smuzhiyun * License. See the file "COPYING" in the main directory of this archive 4*4882a593Smuzhiyun * for more details. 5*4882a593Smuzhiyun * 6*4882a593Smuzhiyun * Copyright (C) 2006 Ralf Baechle <ralf@linux-mips.org> 7*4882a593Smuzhiyun * 8*4882a593Smuzhiyun */ 9*4882a593Smuzhiyun #ifndef __ASM_DMA_COHERENCE_H 10*4882a593Smuzhiyun #define __ASM_DMA_COHERENCE_H 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun enum coherent_io_user_state { 13*4882a593Smuzhiyun IO_COHERENCE_DEFAULT, 14*4882a593Smuzhiyun IO_COHERENCE_ENABLED, 15*4882a593Smuzhiyun IO_COHERENCE_DISABLED, 16*4882a593Smuzhiyun }; 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun #if defined(CONFIG_DMA_PERDEV_COHERENT) 19*4882a593Smuzhiyun /* Don't provide (hw_)coherentio to avoid misuse */ 20*4882a593Smuzhiyun #elif defined(CONFIG_DMA_MAYBE_COHERENT) 21*4882a593Smuzhiyun extern enum coherent_io_user_state coherentio; 22*4882a593Smuzhiyun extern int hw_coherentio; 23*4882a593Smuzhiyun dev_is_dma_coherent(struct device * dev)24*4882a593Smuzhiyunstatic inline bool dev_is_dma_coherent(struct device *dev) 25*4882a593Smuzhiyun { 26*4882a593Smuzhiyun return coherentio == IO_COHERENCE_ENABLED || 27*4882a593Smuzhiyun (coherentio == IO_COHERENCE_DEFAULT && hw_coherentio); 28*4882a593Smuzhiyun } 29*4882a593Smuzhiyun #else 30*4882a593Smuzhiyun #ifdef CONFIG_DMA_NONCOHERENT 31*4882a593Smuzhiyun #define coherentio IO_COHERENCE_DISABLED 32*4882a593Smuzhiyun #else 33*4882a593Smuzhiyun #define coherentio IO_COHERENCE_ENABLED 34*4882a593Smuzhiyun #endif 35*4882a593Smuzhiyun #define hw_coherentio 0 36*4882a593Smuzhiyun #endif /* CONFIG_DMA_MAYBE_COHERENT */ 37*4882a593Smuzhiyun 38*4882a593Smuzhiyun #endif 39