ste_dma40.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. #ifndef STE_DMA40_H
  3. #define STE_DMA40_H
  4. /*
  5. * Maximum size for a single dma descriptor
  6. * Size is limited to 16 bits.
  7. * Size is in the units of addr-widths (1,2,4,8 bytes)
  8. * Larger transfers will be split up to multiple linked desc
  9. */
  10. #define STEDMA40_MAX_SEG_SIZE 0xFFFF
  11. /* dev types for memcpy */
  12. #define STEDMA40_DEV_DST_MEMORY (-1)
  13. #define STEDMA40_DEV_SRC_MEMORY (-1)
  14. enum stedma40_mode {
  15. STEDMA40_MODE_LOGICAL = 0,
  16. STEDMA40_MODE_PHYSICAL,
  17. STEDMA40_MODE_OPERATION,
  18. };
  19. enum stedma40_mode_opt {
  20. STEDMA40_PCHAN_BASIC_MODE = 0,
  21. STEDMA40_LCHAN_SRC_LOG_DST_LOG = 0,
  22. STEDMA40_PCHAN_MODULO_MODE,
  23. STEDMA40_PCHAN_DOUBLE_DST_MODE,
  24. STEDMA40_LCHAN_SRC_PHY_DST_LOG,
  25. STEDMA40_LCHAN_SRC_LOG_DST_PHY,
  26. };
  27. #define STEDMA40_ESIZE_8_BIT 0x0
  28. #define STEDMA40_ESIZE_16_BIT 0x1
  29. #define STEDMA40_ESIZE_32_BIT 0x2
  30. #define STEDMA40_ESIZE_64_BIT 0x3
  31. /* The value 4 indicates that PEN-reg shall be set to 0 */
  32. #define STEDMA40_PSIZE_PHY_1 0x4
  33. #define STEDMA40_PSIZE_PHY_2 0x0
  34. #define STEDMA40_PSIZE_PHY_4 0x1
  35. #define STEDMA40_PSIZE_PHY_8 0x2
  36. #define STEDMA40_PSIZE_PHY_16 0x3
  37. /*
  38. * The number of elements differ in logical and
  39. * physical mode
  40. */
  41. #define STEDMA40_PSIZE_LOG_1 STEDMA40_PSIZE_PHY_2
  42. #define STEDMA40_PSIZE_LOG_4 STEDMA40_PSIZE_PHY_4
  43. #define STEDMA40_PSIZE_LOG_8 STEDMA40_PSIZE_PHY_8
  44. #define STEDMA40_PSIZE_LOG_16 STEDMA40_PSIZE_PHY_16
  45. /* Maximum number of possible physical channels */
  46. #define STEDMA40_MAX_PHYS 32
  47. enum stedma40_flow_ctrl {
  48. STEDMA40_NO_FLOW_CTRL,
  49. STEDMA40_FLOW_CTRL,
  50. };
  51. /**
  52. * struct stedma40_half_channel_info - dst/src channel configuration
  53. *
  54. * @big_endian: true if the src/dst should be read as big endian
  55. * @data_width: Data width of the src/dst hardware
  56. * @p_size: Burst size
  57. * @flow_ctrl: Flow control on/off.
  58. */
  59. struct stedma40_half_channel_info {
  60. bool big_endian;
  61. enum dma_slave_buswidth data_width;
  62. int psize;
  63. enum stedma40_flow_ctrl flow_ctrl;
  64. };
  65. /**
  66. * struct stedma40_chan_cfg - Structure to be filled by client drivers.
  67. *
  68. * @dir: MEM 2 MEM, PERIPH 2 MEM , MEM 2 PERIPH, PERIPH 2 PERIPH
  69. * @high_priority: true if high-priority
  70. * @realtime: true if realtime mode is to be enabled. Only available on DMA40
  71. * version 3+, i.e DB8500v2+
  72. * @mode: channel mode: physical, logical, or operation
  73. * @mode_opt: options for the chosen channel mode
  74. * @dev_type: src/dst device type (driver uses dir to figure out which)
  75. * @src_info: Parameters for dst half channel
  76. * @dst_info: Parameters for dst half channel
  77. * @use_fixed_channel: if true, use physical channel specified by phy_channel
  78. * @phy_channel: physical channel to use, only if use_fixed_channel is true
  79. *
  80. * This structure has to be filled by the client drivers.
  81. * It is recommended to do all dma configurations for clients in the machine.
  82. *
  83. */
  84. struct stedma40_chan_cfg {
  85. enum dma_transfer_direction dir;
  86. bool high_priority;
  87. bool realtime;
  88. enum stedma40_mode mode;
  89. enum stedma40_mode_opt mode_opt;
  90. int dev_type;
  91. struct stedma40_half_channel_info src_info;
  92. struct stedma40_half_channel_info dst_info;
  93. bool use_fixed_channel;
  94. int phy_channel;
  95. };
  96. #endif /* STE_DMA40_H */