shdma.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 device;
  21. struct sh_dmae_chan {
  22. dma_cookie_t completed_cookie; /* The maximum cookie completed */
  23. spinlock_t desc_lock; /* Descriptor operation lock */
  24. struct list_head ld_queue; /* Link descriptors queue */
  25. struct list_head ld_free; /* Link descriptors free */
  26. struct dma_chan common; /* DMA common channel */
  27. struct device *dev; /* Channel device */
  28. struct tasklet_struct tasklet; /* Tasklet */
  29. int descs_allocated; /* desc count */
  30. int xmit_shift; /* log_2(bytes_per_xfer) */
  31. int irq;
  32. int id; /* Raw id of this channel */
  33. u32 __iomem *base;
  34. char dev_id[16]; /* unique name per DMAC of channel */
  35. };
  36. struct sh_dmae_device {
  37. struct dma_device common;
  38. struct sh_dmae_chan *chan[SH_DMAC_MAX_CHANNELS];
  39. struct sh_dmae_pdata *pdata;
  40. u32 __iomem *chan_reg;
  41. u16 __iomem *dmars;
  42. };
  43. #define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, common)
  44. #define to_sh_desc(lh) container_of(lh, struct sh_desc, node)
  45. #define tx_to_sh_desc(tx) container_of(tx, struct sh_desc, async_tx)
  46. #endif /* __DMA_SHDMA_H */