dw.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Driver for the Synopsys DesignWare DMA Controller
  3. *
  4. * Copyright (C) 2007 Atmel Corporation
  5. * Copyright (C) 2010-2011 ST Microelectronics
  6. * Copyright (C) 2014 Intel Corporation
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef _DMA_DW_H
  13. #define _DMA_DW_H
  14. #include <linux/clk.h>
  15. #include <linux/device.h>
  16. #include <linux/dmaengine.h>
  17. #include <linux/platform_data/dma-dw.h>
  18. struct dw_dma;
  19. /**
  20. * struct dw_dma_chip - representation of DesignWare DMA controller hardware
  21. * @dev: struct device of the DMA controller
  22. * @irq: irq line
  23. * @regs: memory mapped I/O space
  24. * @clk: hclk clock
  25. * @dw: struct dw_dma that is filed by dw_dma_probe()
  26. */
  27. struct dw_dma_chip {
  28. struct device *dev;
  29. int irq;
  30. void __iomem *regs;
  31. struct clk *clk;
  32. struct dw_dma *dw;
  33. };
  34. /* Export to the platform drivers */
  35. int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata);
  36. int dw_dma_remove(struct dw_dma_chip *chip);
  37. /* DMA API extensions */
  38. struct dw_desc;
  39. struct dw_cyclic_desc {
  40. struct dw_desc **desc;
  41. unsigned long periods;
  42. void (*period_callback)(void *param);
  43. void *period_callback_param;
  44. };
  45. struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
  46. dma_addr_t buf_addr, size_t buf_len, size_t period_len,
  47. enum dma_transfer_direction direction);
  48. void dw_dma_cyclic_free(struct dma_chan *chan);
  49. int dw_dma_cyclic_start(struct dma_chan *chan);
  50. void dw_dma_cyclic_stop(struct dma_chan *chan);
  51. dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan);
  52. dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan);
  53. #endif /* _DMA_DW_H */