internal.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Driver for the Synopsys DesignWare DMA Controller
  3. *
  4. * Copyright (C) 2013 Intel Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef _DW_DMAC_INTERNAL_H
  11. #define _DW_DMAC_INTERNAL_H
  12. #include <linux/device.h>
  13. #include <linux/dw_dmac.h>
  14. #include "regs.h"
  15. /**
  16. * struct dw_dma_chip - representation of DesignWare DMA controller hardware
  17. * @dev: struct device of the DMA controller
  18. * @irq: irq line
  19. * @regs: memory mapped I/O space
  20. * @dw: struct dw_dma that is filed by dw_dma_probe()
  21. */
  22. struct dw_dma_chip {
  23. struct device *dev;
  24. int irq;
  25. void __iomem *regs;
  26. struct dw_dma *dw;
  27. };
  28. /* Export to the platform drivers */
  29. int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata);
  30. int dw_dma_remove(struct dw_dma_chip *chip);
  31. void dw_dma_shutdown(struct dw_dma_chip *chip);
  32. #ifdef CONFIG_PM_SLEEP
  33. int dw_dma_suspend(struct dw_dma_chip *chip);
  34. int dw_dma_resume(struct dw_dma_chip *chip);
  35. #endif /* CONFIG_PM_SLEEP */
  36. /**
  37. * dwc_get_dms - get destination master
  38. * @slave: pointer to the custom slave configuration
  39. *
  40. * Returns destination master in the custom slave configuration if defined, or
  41. * default value otherwise.
  42. */
  43. static inline unsigned int dwc_get_dms(struct dw_dma_slave *slave)
  44. {
  45. return slave ? slave->dst_master : 0;
  46. }
  47. /**
  48. * dwc_get_sms - get source master
  49. * @slave: pointer to the custom slave configuration
  50. *
  51. * Returns source master in the custom slave configuration if defined, or
  52. * default value otherwise.
  53. */
  54. static inline unsigned int dwc_get_sms(struct dw_dma_slave *slave)
  55. {
  56. return slave ? slave->src_master : 1;
  57. }
  58. #endif /* _DW_DMAC_INTERNAL_H */