at_hdmac.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * Header file for the Atmel AHB DMA Controller driver
  3. *
  4. * Copyright (C) 2008 Atmel 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 as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #ifndef AT_HDMAC_H
  12. #define AT_HDMAC_H
  13. #include <linux/dmaengine.h>
  14. /**
  15. * struct at_dma_platform_data - Controller configuration parameters
  16. * @nr_channels: Number of channels supported by hardware (max 8)
  17. * @cap_mask: dma_capability flags supported by the platform
  18. */
  19. struct at_dma_platform_data {
  20. unsigned int nr_channels;
  21. dma_cap_mask_t cap_mask;
  22. };
  23. /**
  24. * enum at_dma_slave_width - DMA slave register access width.
  25. * @AT_DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
  26. * @AT_DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
  27. * @AT_DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses
  28. */
  29. enum at_dma_slave_width {
  30. AT_DMA_SLAVE_WIDTH_8BIT = 0,
  31. AT_DMA_SLAVE_WIDTH_16BIT,
  32. AT_DMA_SLAVE_WIDTH_32BIT,
  33. };
  34. /**
  35. * struct at_dma_slave - Controller-specific information about a slave
  36. * @dma_dev: required DMA master device
  37. * @tx_reg: physical address of data register used for
  38. * memory-to-peripheral transfers
  39. * @rx_reg: physical address of data register used for
  40. * peripheral-to-memory transfers
  41. * @reg_width: peripheral register width
  42. * @cfg: Platform-specific initializer for the CFG register
  43. * @ctrla: Platform-specific initializer for the CTRLA register
  44. */
  45. struct at_dma_slave {
  46. struct device *dma_dev;
  47. dma_addr_t tx_reg;
  48. dma_addr_t rx_reg;
  49. enum at_dma_slave_width reg_width;
  50. u32 cfg;
  51. u32 ctrla;
  52. };
  53. /* Platform-configurable bits in CFG */
  54. #define ATC_SRC_PER(h) (0xFU & (h)) /* Channel src rq associated with periph handshaking ifc h */
  55. #define ATC_DST_PER(h) ((0xFU & (h)) << 4) /* Channel dst rq associated with periph handshaking ifc h */
  56. #define ATC_SRC_REP (0x1 << 8) /* Source Replay Mod */
  57. #define ATC_SRC_H2SEL (0x1 << 9) /* Source Handshaking Mod */
  58. #define ATC_SRC_H2SEL_SW (0x0 << 9)
  59. #define ATC_SRC_H2SEL_HW (0x1 << 9)
  60. #define ATC_DST_REP (0x1 << 12) /* Destination Replay Mod */
  61. #define ATC_DST_H2SEL (0x1 << 13) /* Destination Handshaking Mod */
  62. #define ATC_DST_H2SEL_SW (0x0 << 13)
  63. #define ATC_DST_H2SEL_HW (0x1 << 13)
  64. #define ATC_SOD (0x1 << 16) /* Stop On Done */
  65. #define ATC_LOCK_IF (0x1 << 20) /* Interface Lock */
  66. #define ATC_LOCK_B (0x1 << 21) /* AHB Bus Lock */
  67. #define ATC_LOCK_IF_L (0x1 << 22) /* Master Interface Arbiter Lock */
  68. #define ATC_LOCK_IF_L_CHUNK (0x0 << 22)
  69. #define ATC_LOCK_IF_L_BUFFER (0x1 << 22)
  70. #define ATC_AHB_PROT_MASK (0x7 << 24) /* AHB Protection */
  71. #define ATC_FIFOCFG_MASK (0x3 << 28) /* FIFO Request Configuration */
  72. #define ATC_FIFOCFG_LARGESTBURST (0x0 << 28)
  73. #define ATC_FIFOCFG_HALFFIFO (0x1 << 28)
  74. #define ATC_FIFOCFG_ENOUGHSPACE (0x2 << 28)
  75. /* Platform-configurable bits in CTRLA */
  76. #define ATC_SCSIZE_MASK (0x7 << 16) /* Source Chunk Transfer Size */
  77. #define ATC_SCSIZE_1 (0x0 << 16)
  78. #define ATC_SCSIZE_4 (0x1 << 16)
  79. #define ATC_SCSIZE_8 (0x2 << 16)
  80. #define ATC_SCSIZE_16 (0x3 << 16)
  81. #define ATC_SCSIZE_32 (0x4 << 16)
  82. #define ATC_SCSIZE_64 (0x5 << 16)
  83. #define ATC_SCSIZE_128 (0x6 << 16)
  84. #define ATC_SCSIZE_256 (0x7 << 16)
  85. #define ATC_DCSIZE_MASK (0x7 << 20) /* Destination Chunk Transfer Size */
  86. #define ATC_DCSIZE_1 (0x0 << 20)
  87. #define ATC_DCSIZE_4 (0x1 << 20)
  88. #define ATC_DCSIZE_8 (0x2 << 20)
  89. #define ATC_DCSIZE_16 (0x3 << 20)
  90. #define ATC_DCSIZE_32 (0x4 << 20)
  91. #define ATC_DCSIZE_64 (0x5 << 20)
  92. #define ATC_DCSIZE_128 (0x6 << 20)
  93. #define ATC_DCSIZE_256 (0x7 << 20)
  94. #endif /* AT_HDMAC_H */