shdma.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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/dmaengine.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/list.h>
  18. #include <asm/dmaengine.h>
  19. #define SH_DMA_TCR_MAX 0x00FFFFFF /* 16MB */
  20. struct sh_dmae_regs {
  21. u32 sar; /* SAR / source address */
  22. u32 dar; /* DAR / destination address */
  23. u32 tcr; /* TCR / transfer count */
  24. };
  25. struct sh_desc {
  26. struct sh_dmae_regs hw;
  27. struct list_head node;
  28. struct dma_async_tx_descriptor async_tx;
  29. enum dma_data_direction direction;
  30. dma_cookie_t cookie;
  31. int chunks;
  32. int mark;
  33. };
  34. struct device;
  35. struct sh_dmae_chan {
  36. dma_cookie_t completed_cookie; /* The maximum cookie completed */
  37. spinlock_t desc_lock; /* Descriptor operation lock */
  38. struct list_head ld_queue; /* Link descriptors queue */
  39. struct list_head ld_free; /* Link descriptors free */
  40. struct dma_chan common; /* DMA common channel */
  41. struct device *dev; /* Channel device */
  42. struct tasklet_struct tasklet; /* Tasklet */
  43. int descs_allocated; /* desc count */
  44. int xmit_shift; /* log_2(bytes_per_xfer) */
  45. int irq;
  46. int id; /* Raw id of this channel */
  47. u32 __iomem *base;
  48. char dev_id[16]; /* unique name per DMAC of channel */
  49. };
  50. struct sh_dmae_device {
  51. struct dma_device common;
  52. struct sh_dmae_chan *chan[SH_DMAC_MAX_CHANNELS];
  53. struct sh_dmae_pdata *pdata;
  54. u32 __iomem *chan_reg;
  55. u16 __iomem *dmars;
  56. };
  57. #define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, common)
  58. #define to_sh_desc(lh) container_of(lh, struct sh_desc, node)
  59. #define tx_to_sh_desc(tx) container_of(tx, struct sh_desc, async_tx)
  60. #endif /* __DMA_SHDMA_H */