dma-sh.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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_SH7780) || \
  18. defined(CONFIG_CPU_SUBTYPE_SH7785)
  19. #define dmaor_read_reg(n) \
  20. (n ? ctrl_inw(SH_DMAC_BASE1 + DMAOR) \
  21. : ctrl_inw(SH_DMAC_BASE0 + DMAOR))
  22. #define dmaor_write_reg(n, data) \
  23. (n ? ctrl_outw(data, SH_DMAC_BASE1 + DMAOR) \
  24. : ctrl_outw(data, SH_DMAC_BASE0 + DMAOR))
  25. #else /* Other CPU */
  26. #define dmaor_read_reg(n) ctrl_inw(SH_DMAC_BASE0 + DMAOR)
  27. #define dmaor_write_reg(n, data) ctrl_outw(data, SH_DMAC_BASE0 + DMAOR)
  28. #endif
  29. static int dmte_irq_map[] __maybe_unused = {
  30. #if (MAX_DMA_CHANNELS >= 4)
  31. DMTE0_IRQ,
  32. DMTE0_IRQ + 1,
  33. DMTE0_IRQ + 2,
  34. DMTE0_IRQ + 3,
  35. #endif
  36. #if (MAX_DMA_CHANNELS >= 6)
  37. DMTE4_IRQ,
  38. DMTE4_IRQ + 1,
  39. #endif
  40. #if (MAX_DMA_CHANNELS >= 8)
  41. DMTE6_IRQ,
  42. DMTE6_IRQ + 1,
  43. #endif
  44. #if (MAX_DMA_CHANNELS >= 12)
  45. DMTE8_IRQ,
  46. DMTE9_IRQ,
  47. DMTE10_IRQ,
  48. DMTE11_IRQ,
  49. #endif
  50. };
  51. /* Definitions for the SuperH DMAC */
  52. #define REQ_L 0x00000000
  53. #define REQ_E 0x00080000
  54. #define RACK_H 0x00000000
  55. #define RACK_L 0x00040000
  56. #define ACK_R 0x00000000
  57. #define ACK_W 0x00020000
  58. #define ACK_H 0x00000000
  59. #define ACK_L 0x00010000
  60. #define DM_INC 0x00004000
  61. #define DM_DEC 0x00008000
  62. #define SM_INC 0x00001000
  63. #define SM_DEC 0x00002000
  64. #define RS_IN 0x00000200
  65. #define RS_OUT 0x00000300
  66. #define TS_BLK 0x00000040
  67. #define TM_BUR 0x00000020
  68. #define CHCR_DE 0x00000001
  69. #define CHCR_TE 0x00000002
  70. #define CHCR_IE 0x00000004
  71. /* DMAOR definitions */
  72. #define DMAOR_AE 0x00000004
  73. #define DMAOR_NMIF 0x00000002
  74. #define DMAOR_DME 0x00000001
  75. /*
  76. * Define the default configuration for dual address memory-memory transfer.
  77. * The 0x400 value represents auto-request, external->external.
  78. */
  79. #define RS_DUAL (DM_INC | SM_INC | 0x400 | TS_32)
  80. /* DMA base address */
  81. static u32 dma_base_addr[] __maybe_unused = {
  82. #if (MAX_DMA_CHANNELS >= 4)
  83. SH_DMAC_BASE0 + 0x00, /* channel 0 */
  84. SH_DMAC_BASE0 + 0x10,
  85. SH_DMAC_BASE0 + 0x20,
  86. SH_DMAC_BASE0 + 0x30,
  87. #endif
  88. #if (MAX_DMA_CHANNELS >= 6)
  89. SH_DMAC_BASE0 + 0x50,
  90. SH_DMAC_BASE0 + 0x60,
  91. #endif
  92. #if (MAX_DMA_CHANNELS >= 8)
  93. SH_DMAC_BASE1 + 0x00,
  94. SH_DMAC_BASE1 + 0x10,
  95. #endif
  96. #if (MAX_DMA_CHANNELS >= 12)
  97. SH_DMAC_BASE1 + 0x20,
  98. SH_DMAC_BASE1 + 0x30,
  99. SH_DMAC_BASE1 + 0x50,
  100. SH_DMAC_BASE1 + 0x60, /* channel 11 */
  101. #endif
  102. };
  103. /* DMA register */
  104. #define SAR 0x00
  105. #define DAR 0x04
  106. #define TCR 0x08
  107. #define CHCR 0x0C
  108. #define DMAOR 0x40
  109. #endif /* __DMA_SH_H */