internal.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Driver for the Synopsys DesignWare DMA Controller
  4. *
  5. * Copyright (C) 2013 Intel Corporation
  6. */
  7. #ifndef _DMA_DW_INTERNAL_H
  8. #define _DMA_DW_INTERNAL_H
  9. #include <linux/dma/dw.h>
  10. #include "regs.h"
  11. int do_dma_probe(struct dw_dma_chip *chip);
  12. int do_dma_remove(struct dw_dma_chip *chip);
  13. void do_dw_dma_on(struct dw_dma *dw);
  14. void do_dw_dma_off(struct dw_dma *dw);
  15. int do_dw_dma_disable(struct dw_dma_chip *chip);
  16. int do_dw_dma_enable(struct dw_dma_chip *chip);
  17. extern bool dw_dma_filter(struct dma_chan *chan, void *param);
  18. #ifdef CONFIG_ACPI
  19. void dw_dma_acpi_controller_register(struct dw_dma *dw);
  20. void dw_dma_acpi_controller_free(struct dw_dma *dw);
  21. #else /* !CONFIG_ACPI */
  22. static inline void dw_dma_acpi_controller_register(struct dw_dma *dw) {}
  23. static inline void dw_dma_acpi_controller_free(struct dw_dma *dw) {}
  24. #endif /* !CONFIG_ACPI */
  25. struct platform_device;
  26. #ifdef CONFIG_OF
  27. struct dw_dma_platform_data *dw_dma_parse_dt(struct platform_device *pdev);
  28. void dw_dma_of_controller_register(struct dw_dma *dw);
  29. void dw_dma_of_controller_free(struct dw_dma *dw);
  30. #else
  31. static inline struct dw_dma_platform_data *dw_dma_parse_dt(struct platform_device *pdev)
  32. {
  33. return NULL;
  34. }
  35. static inline void dw_dma_of_controller_register(struct dw_dma *dw) {}
  36. static inline void dw_dma_of_controller_free(struct dw_dma *dw) {}
  37. #endif
  38. struct dw_dma_chip_pdata {
  39. const struct dw_dma_platform_data *pdata;
  40. int (*probe)(struct dw_dma_chip *chip);
  41. int (*remove)(struct dw_dma_chip *chip);
  42. struct dw_dma_chip *chip;
  43. u8 m_master;
  44. u8 p_master;
  45. };
  46. static __maybe_unused const struct dw_dma_chip_pdata dw_dma_chip_pdata = {
  47. .probe = dw_dma_probe,
  48. .remove = dw_dma_remove,
  49. .m_master = 0,
  50. .p_master = 1,
  51. };
  52. static const struct dw_dma_platform_data idma32_pdata = {
  53. .nr_channels = 8,
  54. .chan_allocation_order = CHAN_ALLOCATION_ASCENDING,
  55. .chan_priority = CHAN_PRIORITY_ASCENDING,
  56. .block_size = 131071,
  57. .nr_masters = 1,
  58. .data_width = {4},
  59. .multi_block = {1, 1, 1, 1, 1, 1, 1, 1},
  60. };
  61. static __maybe_unused const struct dw_dma_chip_pdata idma32_chip_pdata = {
  62. .pdata = &idma32_pdata,
  63. .probe = idma32_dma_probe,
  64. .remove = idma32_dma_remove,
  65. .m_master = 0,
  66. .p_master = 0,
  67. };
  68. static const struct dw_dma_platform_data xbar_pdata = {
  69. .nr_channels = 8,
  70. .chan_allocation_order = CHAN_ALLOCATION_ASCENDING,
  71. .chan_priority = CHAN_PRIORITY_ASCENDING,
  72. .block_size = 131071,
  73. .nr_masters = 1,
  74. .data_width = {4},
  75. .quirks = DW_DMA_QUIRK_XBAR_PRESENT,
  76. };
  77. static __maybe_unused const struct dw_dma_chip_pdata xbar_chip_pdata = {
  78. .pdata = &xbar_pdata,
  79. .probe = idma32_dma_probe,
  80. .remove = idma32_dma_remove,
  81. .m_master = 0,
  82. .p_master = 0,
  83. };
  84. #endif /* _DMA_DW_INTERNAL_H */