1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 #ifndef __DMA_SHDMA_H
  10 #define __DMA_SHDMA_H
  11 
  12 #include <linux/sh_dma.h>
  13 #include <linux/shdma-base.h>
  14 #include <linux/dmaengine.h>
  15 #include <linux/interrupt.h>
  16 #include <linux/list.h>
  17 
  18 #define SH_DMAE_MAX_CHANNELS 20
  19 #define SH_DMAE_TCR_MAX 0x00FFFFFF      
  20 
  21 struct device;
  22 
  23 struct sh_dmae_chan {
  24         struct shdma_chan shdma_chan;
  25         const struct sh_dmae_slave_config *config; 
  26         int xmit_shift;                 
  27         void __iomem *base;
  28         char dev_id[16];                
  29         int pm_error;
  30         dma_addr_t slave_addr;
  31 };
  32 
  33 struct sh_dmae_device {
  34         struct shdma_dev shdma_dev;
  35         struct sh_dmae_chan *chan[SH_DMAE_MAX_CHANNELS];
  36         const struct sh_dmae_pdata *pdata;
  37         struct list_head node;
  38         void __iomem *chan_reg;
  39         void __iomem *dmars;
  40         unsigned int chcr_offset;
  41         u32 chcr_ie_bit;
  42 };
  43 
  44 struct sh_dmae_regs {
  45         u32 sar; 
  46         u32 dar; 
  47         u32 tcr; 
  48 };
  49 
  50 struct sh_dmae_desc {
  51         struct sh_dmae_regs hw;
  52         struct shdma_desc shdma_desc;
  53 };
  54 
  55 #define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, shdma_chan)
  56 #define to_sh_desc(lh) container_of(lh, struct sh_desc, node)
  57 #define tx_to_sh_desc(tx) container_of(tx, struct sh_desc, async_tx)
  58 #define to_sh_dev(chan) container_of(chan->shdma_chan.dma_chan.device,\
  59                                      struct sh_dmae_device, shdma_dev.dma_dev)
  60 
  61 #endif