xref: /openbmc/linux/arch/xtensa/include/asm/dma.h (revision abb4970a)
1367b8112SChris Zankel /*
2367b8112SChris Zankel  * include/asm-xtensa/dma.h
3367b8112SChris Zankel  *
4367b8112SChris Zankel  * This file is subject to the terms and conditions of the GNU General Public
5367b8112SChris Zankel  * License.  See the file "COPYING" in the main directory of this archive
6367b8112SChris Zankel  * for more details.
7367b8112SChris Zankel  *
8367b8112SChris Zankel  * Copyright (C) 2003 - 2005 Tensilica Inc.
9367b8112SChris Zankel  */
10367b8112SChris Zankel 
11367b8112SChris Zankel #ifndef _XTENSA_DMA_H
12367b8112SChris Zankel #define _XTENSA_DMA_H
13367b8112SChris Zankel 
14367b8112SChris Zankel #include <asm/io.h>		/* need byte IO */
15367b8112SChris Zankel 
16367b8112SChris Zankel /*
17367b8112SChris Zankel  * This is only to be defined if we have PC-like DMA.
18367b8112SChris Zankel  * By default this is not true on an Xtensa processor,
19367b8112SChris Zankel  * however on boards with a PCI bus, such functionality
20367b8112SChris Zankel  * might be emulated externally.
21367b8112SChris Zankel  *
22367b8112SChris Zankel  * NOTE:  there still exists driver code that assumes
23367b8112SChris Zankel  * this is defined, eg. drivers/sound/soundcard.c (as of 2.4).
24367b8112SChris Zankel  */
25367b8112SChris Zankel #define MAX_DMA_CHANNELS	8
26367b8112SChris Zankel 
27367b8112SChris Zankel /*
28367b8112SChris Zankel  * The maximum virtual address to which DMA transfers
29367b8112SChris Zankel  * can be performed on this platform.
30367b8112SChris Zankel  *
31367b8112SChris Zankel  * NOTE: This is board (platform) specific, not processor-specific!
32367b8112SChris Zankel  *
33367b8112SChris Zankel  * NOTE: This assumes DMA transfers can only be performed on
34367b8112SChris Zankel  *	the section of physical memory contiguously mapped in virtual
35367b8112SChris Zankel  *	space for the kernel.  For the Xtensa architecture, this
36367b8112SChris Zankel  *	means the maximum possible size of this DMA area is
37367b8112SChris Zankel  *	the size of the statically mapped kernel segment
38367b8112SChris Zankel  *	(XCHAL_KSEG_{CACHED,BYPASS}_SIZE), ie. 128 MB.
39367b8112SChris Zankel  *
4025985edcSLucas De Marchi  * NOTE: When the entire KSEG area is DMA capable, we subtract
41367b8112SChris Zankel  *	one from the max address so that the virt_to_phys() macro
42367b8112SChris Zankel  *	works correctly on the address (otherwise the address
43367b8112SChris Zankel  *	enters another area, and virt_to_phys() may not return
44367b8112SChris Zankel  *	the value desired).
45367b8112SChris Zankel  */
46367b8112SChris Zankel 
47e5083a63SJohannes Weiner #ifndef MAX_DMA_ADDRESS
48367b8112SChris Zankel #define MAX_DMA_ADDRESS		(PAGE_OFFSET + XCHAL_KIO_SIZE - 1)
49e5083a63SJohannes Weiner #endif
50367b8112SChris Zankel 
51367b8112SChris Zankel /* Reserve and release a DMA channel */
52367b8112SChris Zankel extern int request_dma(unsigned int dmanr, const char * device_id);
53367b8112SChris Zankel extern void free_dma(unsigned int dmanr);
54367b8112SChris Zankel 
55367b8112SChris Zankel #endif
56