dma-sh.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * arch/sh/include/asm/dma-sh.h
  3. *
  4. * Copyright (C) 2000 Takashi YOSHII
  5. * Copyright (C) 2003 Paul Mundt
  6. *
  7. * This file is subject to the terms and conditions of the GNU General Public
  8. * License. See the file "COPYING" in the main directory of this archive
  9. * for more details.
  10. */
  11. #ifndef __DMA_SH_H
  12. #define __DMA_SH_H
  13. #include <asm/dma.h>
  14. #include <cpu/dma.h>
  15. /* DMAOR contorl: The DMAOR access size is different by CPU.*/
  16. #if defined(CONFIG_CPU_SUBTYPE_SH7723) || \
  17. defined(CONFIG_CPU_SUBTYPE_SH7724) || \
  18. defined(CONFIG_CPU_SUBTYPE_SH7780) || \
  19. defined(CONFIG_CPU_SUBTYPE_SH7785)
  20. #define dmaor_read_reg(n) \
  21. (n ? ctrl_inw(SH_DMAC_BASE1 + DMAOR) \
  22. : ctrl_inw(SH_DMAC_BASE0 + DMAOR))
  23. #define dmaor_write_reg(n, data) \
  24. (n ? ctrl_outw(data, SH_DMAC_BASE1 + DMAOR) \
  25. : ctrl_outw(data, SH_DMAC_BASE0 + DMAOR))
  26. #else /* Other CPU */
  27. #define dmaor_read_reg(n) ctrl_inw(SH_DMAC_BASE0 + DMAOR)
  28. #define dmaor_write_reg(n, data) ctrl_outw(data, SH_DMAC_BASE0 + DMAOR)
  29. #endif
  30. static int dmte_irq_map[] __maybe_unused = {
  31. #if (MAX_DMA_CHANNELS >= 4)
  32. DMTE0_IRQ,
  33. DMTE0_IRQ + 1,
  34. DMTE0_IRQ + 2,
  35. DMTE0_IRQ + 3,
  36. #endif
  37. #if (MAX_DMA_CHANNELS >= 6)
  38. DMTE4_IRQ,
  39. DMTE4_IRQ + 1,
  40. #endif
  41. #if (MAX_DMA_CHANNELS >= 8)
  42. DMTE6_IRQ,
  43. DMTE6_IRQ + 1,
  44. #endif
  45. #if (MAX_DMA_CHANNELS >= 12)
  46. DMTE8_IRQ,
  47. DMTE9_IRQ,
  48. DMTE10_IRQ,
  49. DMTE11_IRQ,
  50. #endif
  51. };
  52. /* Definitions for the SuperH DMAC */
  53. #define REQ_L 0x00000000
  54. #define REQ_E 0x00080000
  55. #define RACK_H 0x00000000
  56. #define RACK_L 0x00040000
  57. #define ACK_R 0x00000000
  58. #define ACK_W 0x00020000
  59. #define ACK_H 0x00000000
  60. #define ACK_L 0x00010000
  61. #define DM_INC 0x00004000
  62. #define DM_DEC 0x00008000
  63. #define SM_INC 0x00001000
  64. #define SM_DEC 0x00002000
  65. #define RS_IN 0x00000200
  66. #define RS_OUT 0x00000300
  67. #define TS_BLK 0x00000040
  68. #define TM_BUR 0x00000020
  69. #define CHCR_DE 0x00000001
  70. #define CHCR_TE 0x00000002
  71. #define CHCR_IE 0x00000004
  72. /* DMAOR definitions */
  73. #define DMAOR_AE 0x00000004
  74. #define DMAOR_NMIF 0x00000002
  75. #define DMAOR_DME 0x00000001
  76. /*
  77. * Define the default configuration for dual address memory-memory transfer.
  78. * The 0x400 value represents auto-request, external->external.
  79. */
  80. #define RS_DUAL (DM_INC | SM_INC | 0x400 | TS_32)
  81. /* DMA base address */
  82. static u32 dma_base_addr[] __maybe_unused = {
  83. #if (MAX_DMA_CHANNELS >= 4)
  84. SH_DMAC_BASE0 + 0x00, /* channel 0 */
  85. SH_DMAC_BASE0 + 0x10,
  86. SH_DMAC_BASE0 + 0x20,
  87. SH_DMAC_BASE0 + 0x30,
  88. #endif
  89. #if (MAX_DMA_CHANNELS >= 6)
  90. SH_DMAC_BASE0 + 0x50,
  91. SH_DMAC_BASE0 + 0x60,
  92. #endif
  93. #if (MAX_DMA_CHANNELS >= 8)
  94. SH_DMAC_BASE1 + 0x00,
  95. SH_DMAC_BASE1 + 0x10,
  96. #endif
  97. #if (MAX_DMA_CHANNELS >= 12)
  98. SH_DMAC_BASE1 + 0x20,
  99. SH_DMAC_BASE1 + 0x30,
  100. SH_DMAC_BASE1 + 0x50,
  101. SH_DMAC_BASE1 + 0x60, /* channel 11 */
  102. #endif
  103. };
  104. /* DMA register */
  105. #define SAR 0x00
  106. #define DAR 0x04
  107. #define TCR 0x08
  108. #define CHCR 0x0C
  109. #define DMAOR 0x40
  110. /*
  111. * for dma engine
  112. *
  113. * SuperH DMA mode
  114. */
  115. #define SHDMA_MIX_IRQ (1 << 1)
  116. #define SHDMA_DMAOR1 (1 << 2)
  117. #define SHDMA_DMAE1 (1 << 3)
  118. struct sh_dmae_pdata {
  119. unsigned int mode;
  120. };
  121. #endif /* __DMA_SH_H */