dw.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. * @pdata: pointer to platform data
  27. */
  28. struct dw_dma_chip {
  29. struct device *dev;
  30. int irq;
  31. void __iomem *regs;
  32. struct clk *clk;
  33. struct dw_dma *dw;
  34. const struct dw_dma_platform_data *pdata;
  35. };
  36. /* Export to the platform drivers */
  37. #if IS_ENABLED(CONFIG_DW_DMAC_CORE)
  38. int dw_dma_probe(struct dw_dma_chip *chip);
  39. int dw_dma_remove(struct dw_dma_chip *chip);
  40. #else
  41. static inline int dw_dma_probe(struct dw_dma_chip *chip) { return -ENODEV; }
  42. static inline int dw_dma_remove(struct dw_dma_chip *chip) { return 0; }
  43. #endif /* CONFIG_DW_DMAC_CORE */
  44. /* DMA API extensions */
  45. struct dw_desc;
  46. struct dw_cyclic_desc {
  47. struct dw_desc **desc;
  48. unsigned long periods;
  49. void (*period_callback)(void *param);
  50. void *period_callback_param;
  51. };
  52. struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
  53. dma_addr_t buf_addr, size_t buf_len, size_t period_len,
  54. enum dma_transfer_direction direction);
  55. void dw_dma_cyclic_free(struct dma_chan *chan);
  56. int dw_dma_cyclic_start(struct dma_chan *chan);
  57. void dw_dma_cyclic_stop(struct dma_chan *chan);
  58. dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan);
  59. dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan);
  60. #endif /* _DMA_DW_H */