162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * include/asm-xtensa/dma.h 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 562306a36Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 662306a36Sopenharmony_ci * for more details. 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Copyright (C) 2003 - 2005 Tensilica Inc. 962306a36Sopenharmony_ci */ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#ifndef _XTENSA_DMA_H 1262306a36Sopenharmony_ci#define _XTENSA_DMA_H 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include <asm/io.h> /* need byte IO */ 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci/* 1762306a36Sopenharmony_ci * This is only to be defined if we have PC-like DMA. 1862306a36Sopenharmony_ci * By default this is not true on an Xtensa processor, 1962306a36Sopenharmony_ci * however on boards with a PCI bus, such functionality 2062306a36Sopenharmony_ci * might be emulated externally. 2162306a36Sopenharmony_ci * 2262306a36Sopenharmony_ci * NOTE: there still exists driver code that assumes 2362306a36Sopenharmony_ci * this is defined, eg. drivers/sound/soundcard.c (as of 2.4). 2462306a36Sopenharmony_ci */ 2562306a36Sopenharmony_ci#define MAX_DMA_CHANNELS 8 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci/* 2862306a36Sopenharmony_ci * The maximum virtual address to which DMA transfers 2962306a36Sopenharmony_ci * can be performed on this platform. 3062306a36Sopenharmony_ci * 3162306a36Sopenharmony_ci * NOTE: This is board (platform) specific, not processor-specific! 3262306a36Sopenharmony_ci * 3362306a36Sopenharmony_ci * NOTE: This assumes DMA transfers can only be performed on 3462306a36Sopenharmony_ci * the section of physical memory contiguously mapped in virtual 3562306a36Sopenharmony_ci * space for the kernel. For the Xtensa architecture, this 3662306a36Sopenharmony_ci * means the maximum possible size of this DMA area is 3762306a36Sopenharmony_ci * the size of the statically mapped kernel segment 3862306a36Sopenharmony_ci * (XCHAL_KSEG_{CACHED,BYPASS}_SIZE), ie. 128 MB. 3962306a36Sopenharmony_ci * 4062306a36Sopenharmony_ci * NOTE: When the entire KSEG area is DMA capable, we subtract 4162306a36Sopenharmony_ci * one from the max address so that the virt_to_phys() macro 4262306a36Sopenharmony_ci * works correctly on the address (otherwise the address 4362306a36Sopenharmony_ci * enters another area, and virt_to_phys() may not return 4462306a36Sopenharmony_ci * the value desired). 4562306a36Sopenharmony_ci */ 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci#ifndef MAX_DMA_ADDRESS 4862306a36Sopenharmony_ci#define MAX_DMA_ADDRESS (PAGE_OFFSET + XCHAL_KIO_SIZE - 1) 4962306a36Sopenharmony_ci#endif 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci/* Reserve and release a DMA channel */ 5262306a36Sopenharmony_ciextern int request_dma(unsigned int dmanr, const char * device_id); 5362306a36Sopenharmony_ciextern void free_dma(unsigned int dmanr); 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci#endif 56