shdma.h 1.9 KB

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