/*1* driver/dma/coh901318_lli.h2*3* Copyright (C) 2007-2009 ST-Ericsson4* License terms: GNU General Public License (GPL) version 25* Support functions for handling lli for coh9013186* Author: Per Friden <[email protected]>7*/89#ifndef COH901318_LLI_H10#define COH901318_LLI_H1112#include <mach/coh901318.h>1314struct device;1516struct coh901318_pool {17spinlock_t lock;18struct dma_pool *dmapool;19struct device *dev;2021#ifdef CONFIG_DEBUG_FS22int debugfs_pool_counter;23#endif24};2526struct device;27/**28* coh901318_pool_create() - Creates an dma pool for lli:s29* @pool: pool handle30* @dev: dma device31* @lli_nbr: number of lli:s in the pool32* @algin: address alignemtn of lli:s33* returns 0 on success otherwise none zero34*/35int coh901318_pool_create(struct coh901318_pool *pool,36struct device *dev,37size_t lli_nbr, size_t align);3839/**40* coh901318_pool_destroy() - Destroys the dma pool41* @pool: pool handle42* returns 0 on success otherwise none zero43*/44int coh901318_pool_destroy(struct coh901318_pool *pool);4546/**47* coh901318_lli_alloc() - Allocates a linked list48*49* @pool: pool handle50* @len: length to list51* return: none NULL if success otherwise NULL52*/53struct coh901318_lli *54coh901318_lli_alloc(struct coh901318_pool *pool,55unsigned int len);5657/**58* coh901318_lli_free() - Returns the linked list items to the pool59* @pool: pool handle60* @lli: reference to lli pointer to be freed61*/62void coh901318_lli_free(struct coh901318_pool *pool,63struct coh901318_lli **lli);6465/**66* coh901318_lli_fill_memcpy() - Prepares the lli:s for dma memcpy67* @pool: pool handle68* @lli: allocated lli69* @src: src address70* @size: transfer size71* @dst: destination address72* @ctrl_chained: ctrl for chained lli73* @ctrl_last: ctrl for the last lli74* returns number of CPU interrupts for the lli, negative on error.75*/76int77coh901318_lli_fill_memcpy(struct coh901318_pool *pool,78struct coh901318_lli *lli,79dma_addr_t src, unsigned int size,80dma_addr_t dst, u32 ctrl_chained, u32 ctrl_last);8182/**83* coh901318_lli_fill_single() - Prepares the lli:s for dma single transfer84* @pool: pool handle85* @lli: allocated lli86* @buf: transfer buffer87* @size: transfer size88* @dev_addr: address of periphal89* @ctrl_chained: ctrl for chained lli90* @ctrl_last: ctrl for the last lli91* @dir: direction of transfer (to or from device)92* returns number of CPU interrupts for the lli, negative on error.93*/94int95coh901318_lli_fill_single(struct coh901318_pool *pool,96struct coh901318_lli *lli,97dma_addr_t buf, unsigned int size,98dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl_last,99enum dma_data_direction dir);100101/**102* coh901318_lli_fill_single() - Prepares the lli:s for dma scatter list transfer103* @pool: pool handle104* @lli: allocated lli105* @sg: scatter gather list106* @nents: number of entries in sg107* @dev_addr: address of periphal108* @ctrl_chained: ctrl for chained lli109* @ctrl: ctrl of middle lli110* @ctrl_last: ctrl for the last lli111* @dir: direction of transfer (to or from device)112* @ctrl_irq_mask: ctrl mask for CPU interrupt113* returns number of CPU interrupts for the lli, negative on error.114*/115int116coh901318_lli_fill_sg(struct coh901318_pool *pool,117struct coh901318_lli *lli,118struct scatterlist *sg, unsigned int nents,119dma_addr_t dev_addr, u32 ctrl_chained,120u32 ctrl, u32 ctrl_last,121enum dma_data_direction dir, u32 ctrl_irq_mask);122123#endif /* COH901318_LLI_H */124125126