fsl_dma.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * mpc8610-pcm.h - ALSA PCM interface for the Freescale MPC8610 SoC
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef _MPC8610_PCM_H
  9. #define _MPC8610_PCM_H
  10. struct ccsr_dma {
  11. u8 res0[0x100];
  12. struct ccsr_dma_channel {
  13. __be32 mr; /* Mode register */
  14. __be32 sr; /* Status register */
  15. __be32 eclndar; /* Current link descriptor extended addr reg */
  16. __be32 clndar; /* Current link descriptor address register */
  17. __be32 satr; /* Source attributes register */
  18. __be32 sar; /* Source address register */
  19. __be32 datr; /* Destination attributes register */
  20. __be32 dar; /* Destination address register */
  21. __be32 bcr; /* Byte count register */
  22. __be32 enlndar; /* Next link descriptor extended address reg */
  23. __be32 nlndar; /* Next link descriptor address register */
  24. u8 res1[4];
  25. __be32 eclsdar; /* Current list descriptor extended addr reg */
  26. __be32 clsdar; /* Current list descriptor address register */
  27. __be32 enlsdar; /* Next list descriptor extended address reg */
  28. __be32 nlsdar; /* Next list descriptor address register */
  29. __be32 ssr; /* Source stride register */
  30. __be32 dsr; /* Destination stride register */
  31. u8 res2[0x38];
  32. } channel[4];
  33. __be32 dgsr;
  34. };
  35. #define CCSR_DMA_MR_BWC_DISABLED 0x0F000000
  36. #define CCSR_DMA_MR_BWC_SHIFT 24
  37. #define CCSR_DMA_MR_BWC_MASK 0x0F000000
  38. #define CCSR_DMA_MR_BWC(x) \
  39. ((ilog2(x) << CCSR_DMA_MR_BWC_SHIFT) & CCSR_DMA_MR_BWC_MASK)
  40. #define CCSR_DMA_MR_EMP_EN 0x00200000
  41. #define CCSR_DMA_MR_EMS_EN 0x00040000
  42. #define CCSR_DMA_MR_DAHTS_MASK 0x00030000
  43. #define CCSR_DMA_MR_DAHTS_1 0x00000000
  44. #define CCSR_DMA_MR_DAHTS_2 0x00010000
  45. #define CCSR_DMA_MR_DAHTS_4 0x00020000
  46. #define CCSR_DMA_MR_DAHTS_8 0x00030000
  47. #define CCSR_DMA_MR_SAHTS_MASK 0x0000C000
  48. #define CCSR_DMA_MR_SAHTS_1 0x00000000
  49. #define CCSR_DMA_MR_SAHTS_2 0x00004000
  50. #define CCSR_DMA_MR_SAHTS_4 0x00008000
  51. #define CCSR_DMA_MR_SAHTS_8 0x0000C000
  52. #define CCSR_DMA_MR_DAHE 0x00002000
  53. #define CCSR_DMA_MR_SAHE 0x00001000
  54. #define CCSR_DMA_MR_SRW 0x00000400
  55. #define CCSR_DMA_MR_EOSIE 0x00000200
  56. #define CCSR_DMA_MR_EOLNIE 0x00000100
  57. #define CCSR_DMA_MR_EOLSIE 0x00000080
  58. #define CCSR_DMA_MR_EIE 0x00000040
  59. #define CCSR_DMA_MR_XFE 0x00000020
  60. #define CCSR_DMA_MR_CDSM_SWSM 0x00000010
  61. #define CCSR_DMA_MR_CA 0x00000008
  62. #define CCSR_DMA_MR_CTM 0x00000004
  63. #define CCSR_DMA_MR_CC 0x00000002
  64. #define CCSR_DMA_MR_CS 0x00000001
  65. #define CCSR_DMA_SR_TE 0x00000080
  66. #define CCSR_DMA_SR_CH 0x00000020
  67. #define CCSR_DMA_SR_PE 0x00000010
  68. #define CCSR_DMA_SR_EOLNI 0x00000008
  69. #define CCSR_DMA_SR_CB 0x00000004
  70. #define CCSR_DMA_SR_EOSI 0x00000002
  71. #define CCSR_DMA_SR_EOLSI 0x00000001
  72. /* ECLNDAR takes bits 32-36 of the CLNDAR register */
  73. static inline u32 CCSR_DMA_ECLNDAR_ADDR(u64 x)
  74. {
  75. return (x >> 32) & 0xf;
  76. }
  77. #define CCSR_DMA_CLNDAR_ADDR(x) ((x) & 0xFFFFFFFE)
  78. #define CCSR_DMA_CLNDAR_EOSIE 0x00000008
  79. /* SATR and DATR, combined */
  80. #define CCSR_DMA_ATR_PBATMU 0x20000000
  81. #define CCSR_DMA_ATR_TFLOWLVL_0 0x00000000
  82. #define CCSR_DMA_ATR_TFLOWLVL_1 0x06000000
  83. #define CCSR_DMA_ATR_TFLOWLVL_2 0x08000000
  84. #define CCSR_DMA_ATR_TFLOWLVL_3 0x0C000000
  85. #define CCSR_DMA_ATR_PCIORDER 0x02000000
  86. #define CCSR_DMA_ATR_SME 0x01000000
  87. #define CCSR_DMA_ATR_NOSNOOP 0x00040000
  88. #define CCSR_DMA_ATR_SNOOP 0x00050000
  89. #define CCSR_DMA_ATR_ESAD_MASK 0x0000000F
  90. /**
  91. * List Descriptor for extended chaining mode DMA operations.
  92. *
  93. * The CLSDAR register points to the first (in a linked-list) List
  94. * Descriptor. Each object must be aligned on a 32-byte boundary. Each
  95. * list descriptor points to a linked-list of link Descriptors.
  96. */
  97. struct fsl_dma_list_descriptor {
  98. __be64 next; /* Address of next list descriptor */
  99. __be64 first_link; /* Address of first link descriptor */
  100. __be32 source; /* Source stride */
  101. __be32 dest; /* Destination stride */
  102. u8 res[8]; /* Reserved */
  103. } __attribute__ ((aligned(32), packed));
  104. /**
  105. * Link Descriptor for basic and extended chaining mode DMA operations.
  106. *
  107. * A Link Descriptor points to a single DMA buffer. Each link descriptor
  108. * must be aligned on a 32-byte boundary.
  109. */
  110. struct fsl_dma_link_descriptor {
  111. __be32 source_attr; /* Programmed into SATR register */
  112. __be32 source_addr; /* Programmed into SAR register */
  113. __be32 dest_attr; /* Programmed into DATR register */
  114. __be32 dest_addr; /* Programmed into DAR register */
  115. __be64 next; /* Address of next link descriptor */
  116. __be32 count; /* Byte count */
  117. u8 res[4]; /* Reserved */
  118. } __attribute__ ((aligned(32), packed));
  119. #endif