shdma.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Renesas SuperH DMA Engine support
  3. *
  4. * Copyright (C) 2009 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
  5. * Copyright (C) 2009 Renesas Solutions, Inc. All rights reserved.
  6. *
  7. * This is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. */
  13. #ifndef __DMA_SHDMA_H
  14. #define __DMA_SHDMA_H
  15. #include <linux/shdma-base.h>
  16. #include <linux/dmaengine.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/list.h>
  19. #define SH_DMAE_MAX_CHANNELS 20
  20. #define SH_DMAE_TCR_MAX 0x00FFFFFF /* 16MB */
  21. struct device;
  22. struct sh_dmae_chan {
  23. struct shdma_chan shdma_chan;
  24. int xmit_shift; /* log_2(bytes_per_xfer) */
  25. u32 __iomem *base;
  26. char dev_id[16]; /* unique name per DMAC of channel */
  27. int pm_error;
  28. };
  29. struct sh_dmae_device {
  30. struct shdma_dev shdma_dev;
  31. struct sh_dmae_chan *chan[SH_DMAE_MAX_CHANNELS];
  32. struct sh_dmae_pdata *pdata;
  33. struct list_head node;
  34. u32 __iomem *chan_reg;
  35. u16 __iomem *dmars;
  36. unsigned int chcr_offset;
  37. u32 chcr_ie_bit;
  38. };
  39. struct sh_dmae_regs {
  40. u32 sar; /* SAR / source address */
  41. u32 dar; /* DAR / destination address */
  42. u32 tcr; /* TCR / transfer count */
  43. };
  44. struct sh_dmae_desc {
  45. struct sh_dmae_regs hw;
  46. struct shdma_desc shdma_desc;
  47. };
  48. #define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, shdma_chan)
  49. #define to_sh_desc(lh) container_of(lh, struct sh_desc, node)
  50. #define tx_to_sh_desc(tx) container_of(tx, struct sh_desc, async_tx)
  51. #define to_sh_dev(chan) container_of(chan->shdma_chan.dma_chan.device,\
  52. struct sh_dmae_device, shdma_dev.dma_dev)
  53. #endif /* __DMA_SHDMA_H */