shdma.h 1.9 KB

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