shdma.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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/sh_dma.h>
  16. #include <linux/shdma-base.h>
  17. #include <linux/dmaengine.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/list.h>
  20. #define SH_DMAE_MAX_CHANNELS 20
  21. #define SH_DMAE_TCR_MAX 0x00FFFFFF /* 16MB */
  22. struct device;
  23. struct sh_dmae_chan {
  24. struct shdma_chan shdma_chan;
  25. const struct sh_dmae_slave_config *config; /* Slave DMA configuration */
  26. int xmit_shift; /* log_2(bytes_per_xfer) */
  27. void __iomem *base;
  28. char dev_id[16]; /* unique name per DMAC of channel */
  29. int pm_error;
  30. dma_addr_t slave_addr;
  31. };
  32. struct sh_dmae_device {
  33. struct shdma_dev shdma_dev;
  34. struct sh_dmae_chan *chan[SH_DMAE_MAX_CHANNELS];
  35. const struct sh_dmae_pdata *pdata;
  36. struct list_head node;
  37. void __iomem *chan_reg;
  38. void __iomem *dmars;
  39. unsigned int chcr_offset;
  40. u32 chcr_ie_bit;
  41. };
  42. struct sh_dmae_regs {
  43. u32 sar; /* SAR / source address */
  44. u32 dar; /* DAR / destination address */
  45. u32 tcr; /* TCR / transfer count */
  46. };
  47. struct sh_dmae_desc {
  48. struct sh_dmae_regs hw;
  49. struct shdma_desc shdma_desc;
  50. };
  51. #define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, shdma_chan)
  52. #define to_sh_desc(lh) container_of(lh, struct sh_desc, node)
  53. #define tx_to_sh_desc(tx) container_of(tx, struct sh_desc, async_tx)
  54. #define to_sh_dev(chan) container_of(chan->shdma_chan.dma_chan.device,\
  55. struct sh_dmae_device, shdma_dev.dma_dev)
  56. #ifdef CONFIG_SH_DMAE_R8A73A4
  57. extern const struct sh_dmae_pdata r8a73a4_dma_pdata;
  58. #define r8a73a4_shdma_devid (&r8a73a4_dma_pdata)
  59. #else
  60. #define r8a73a4_shdma_devid NULL
  61. #endif
  62. #endif /* __DMA_SHDMA_H */