m68360_regs.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. /***********************************
  2. * $Id: m68360_regs.h,v 1.2 2002/10/26 15:03:55 gerg Exp $
  3. ***********************************
  4. *
  5. ***************************************
  6. * Definitions of the QUICC registers
  7. ***************************************
  8. */
  9. #ifndef __REGISTERS_H
  10. #define __REGISTERS_H
  11. #define CLEAR_BIT(x, bit) x =bit
  12. /*****************************************************************
  13. Command Register
  14. *****************************************************************/
  15. /* bit fields within command register */
  16. #define SOFTWARE_RESET 0x8000
  17. #define CMD_OPCODE 0x0f00
  18. #define CMD_CHANNEL 0x00f0
  19. #define CMD_FLAG 0x0001
  20. /* general command opcodes */
  21. #define INIT_RXTX_PARAMS 0x0000
  22. #define INIT_RX_PARAMS 0x0100
  23. #define INIT_TX_PARAMS 0x0200
  24. #define ENTER_HUNT_MODE 0x0300
  25. #define STOP_TX 0x0400
  26. #define GR_STOP_TX 0x0500
  27. #define RESTART_TX 0x0600
  28. #define CLOSE_RX_BD 0x0700
  29. #define SET_ENET_GROUP 0x0800
  30. #define RESET_ENET_GROUP 0x0900
  31. /* quicc32 CP commands */
  32. #define STOP_TX_32 0x0e00 /*add chan# bits 2-6 */
  33. #define ENTER_HUNT_MODE_32 0x1e00
  34. /* quicc32 mask/event SCC register */
  35. #define GOV 0x01
  36. #define GUN 0x02
  37. #define GINT 0x04
  38. #define IQOV 0x08
  39. /* Timer commands */
  40. #define SET_TIMER 0x0800
  41. /* Multi channel Interrupt structure */
  42. #define INTR_VALID 0x8000 /* Valid interrupt entry */
  43. #define INTR_WRAP 0x4000 /* Wrap bit in the interrupt entry table */
  44. #define INTR_CH_NU 0x07c0 /* Channel Num in interrupt table */
  45. #define INTR_MASK_BITS 0x383f
  46. /*
  47. * General SCC mode register (GSMR)
  48. */
  49. #define MODE_HDLC 0x0
  50. #define MODE_APPLE_TALK 0x2
  51. #define MODE_SS7 0x3
  52. #define MODE_UART 0x4
  53. #define MODE_PROFIBUS 0x5
  54. #define MODE_ASYNC_HDLC 0x6
  55. #define MODE_V14 0x7
  56. #define MODE_BISYNC 0x8
  57. #define MODE_DDCMP 0x9
  58. #define MODE_MULTI_CHANNEL 0xa
  59. #define MODE_ETHERNET 0xc
  60. #define DIAG_NORMAL 0x0
  61. #define DIAG_LOCAL_LPB 0x1
  62. #define DIAG_AUTO_ECHO 0x2
  63. #define DIAG_LBP_ECHO 0x3
  64. /* For RENC and TENC fields in GSMR */
  65. #define ENC_NRZ 0x0
  66. #define ENC_NRZI 0x1
  67. #define ENC_FM0 0x2
  68. #define ENC_MANCH 0x4
  69. #define ENC_DIFF_MANC 0x6
  70. /* For TDCR and RDCR fields in GSMR */
  71. #define CLOCK_RATE_1 0x0
  72. #define CLOCK_RATE_8 0x1
  73. #define CLOCK_RATE_16 0x2
  74. #define CLOCK_RATE_32 0x3
  75. #define TPP_00 0x0
  76. #define TPP_10 0x1
  77. #define TPP_01 0x2
  78. #define TPP_11 0x3
  79. #define TPL_NO 0x0
  80. #define TPL_8 0x1
  81. #define TPL_16 0x2
  82. #define TPL_32 0x3
  83. #define TPL_48 0x4
  84. #define TPL_64 0x5
  85. #define TPL_128 0x6
  86. #define TSNC_INFINITE 0x0
  87. #define TSNC_14_65 0x1
  88. #define TSNC_4_15 0x2
  89. #define TSNC_3_1 0x3
  90. #define EDGE_BOTH 0x0
  91. #define EDGE_POS 0x1
  92. #define EDGE_NEG 0x2
  93. #define EDGE_NO 0x3
  94. #define SYNL_NO 0x0
  95. #define SYNL_4 0x1
  96. #define SYNL_8 0x2
  97. #define SYNL_16 0x3
  98. #define TCRC_CCITT16 0x0
  99. #define TCRC_CRC16 0x1
  100. #define TCRC_CCITT32 0x2
  101. /*****************************************************************
  102. TODR (Transmit on demand) Register
  103. *****************************************************************/
  104. #define TODR_TOD 0x8000 /* Transmit on demand */
  105. /*****************************************************************
  106. CICR register settings
  107. *****************************************************************/
  108. /* note that relative irq priorities of the SCCs can be reordered
  109. * if desired - see p. 7-377 of the MC68360UM */
  110. #define CICR_SCA_SCC1 ((uint)0x00000000) /* SCC1 @ SCCa */
  111. #define CICR_SCB_SCC2 ((uint)0x00040000) /* SCC2 @ SCCb */
  112. #define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */
  113. #define CICR_SCD_SCC4 ((uint)0x00c00000) /* SCC4 @ SCCd */
  114. #define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrupt */
  115. #define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */
  116. #define CICR_VBA_MASK ((uint)0x000000e0) /* Vector Base Address */
  117. #define CICR_SPS ((uint)0x00000001) /* SCC Spread */
  118. /*****************************************************************
  119. Interrupt bits for CIPR and CIMR (MC68360UM p. 7-379)
  120. *****************************************************************/
  121. #define INTR_PIO_PC0 0x80000000 /* parallel I/O C bit 0 */
  122. #define INTR_SCC1 0x40000000 /* SCC port 1 */
  123. #define INTR_SCC2 0x20000000 /* SCC port 2 */
  124. #define INTR_SCC3 0x10000000 /* SCC port 3 */
  125. #define INTR_SCC4 0x08000000 /* SCC port 4 */
  126. #define INTR_PIO_PC1 0x04000000 /* parallel i/o C bit 1 */
  127. #define INTR_TIMER1 0x02000000 /* timer 1 */
  128. #define INTR_PIO_PC2 0x01000000 /* parallel i/o C bit 2 */
  129. #define INTR_PIO_PC3 0x00800000 /* parallel i/o C bit 3 */
  130. #define INTR_SDMA_BERR 0x00400000 /* SDMA channel bus error */
  131. #define INTR_DMA1 0x00200000 /* idma 1 */
  132. #define INTR_DMA2 0x00100000 /* idma 2 */
  133. #define INTR_TIMER2 0x00040000 /* timer 2 */
  134. #define INTR_CP_TIMER 0x00020000 /* CP timer */
  135. #define INTR_PIP_STATUS 0x00010000 /* PIP status */
  136. #define INTR_PIO_PC4 0x00008000 /* parallel i/o C bit 4 */
  137. #define INTR_PIO_PC5 0x00004000 /* parallel i/o C bit 5 */
  138. #define INTR_TIMER3 0x00001000 /* timer 3 */
  139. #define INTR_PIO_PC6 0x00000800 /* parallel i/o C bit 6 */
  140. #define INTR_PIO_PC7 0x00000400 /* parallel i/o C bit 7 */
  141. #define INTR_PIO_PC8 0x00000200 /* parallel i/o C bit 8 */
  142. #define INTR_TIMER4 0x00000080 /* timer 4 */
  143. #define INTR_PIO_PC9 0x00000040 /* parallel i/o C bit 9 */
  144. #define INTR_SCP 0x00000020 /* SCP */
  145. #define INTR_SMC1 0x00000010 /* SMC 1 */
  146. #define INTR_SMC2 0x00000008 /* SMC 2 */
  147. #define INTR_PIO_PC10 0x00000004 /* parallel i/o C bit 10 */
  148. #define INTR_PIO_PC11 0x00000002 /* parallel i/o C bit 11 */
  149. #define INTR_ERR 0x00000001 /* error */
  150. /*****************************************************************
  151. CPM Interrupt vector encodings (MC68360UM p. 7-376)
  152. *****************************************************************/
  153. #define CPMVEC_NR 32
  154. #define CPMVEC_PIO_PC0 0x1f
  155. #define CPMVEC_SCC1 0x1e
  156. #define CPMVEC_SCC2 0x1d
  157. #define CPMVEC_SCC3 0x1c
  158. #define CPMVEC_SCC4 0x1b
  159. #define CPMVEC_PIO_PC1 0x1a
  160. #define CPMVEC_TIMER1 0x19
  161. #define CPMVEC_PIO_PC2 0x18
  162. #define CPMVEC_PIO_PC3 0x17
  163. #define CPMVEC_SDMA_CB_ERR 0x16
  164. #define CPMVEC_IDMA1 0x15
  165. #define CPMVEC_IDMA2 0x14
  166. #define CPMVEC_RESERVED3 0x13
  167. #define CPMVEC_TIMER2 0x12
  168. #define CPMVEC_RISCTIMER 0x11
  169. #define CPMVEC_RESERVED2 0x10
  170. #define CPMVEC_PIO_PC4 0x0f
  171. #define CPMVEC_PIO_PC5 0x0e
  172. #define CPMVEC_TIMER3 0x0c
  173. #define CPMVEC_PIO_PC6 0x0b
  174. #define CPMVEC_PIO_PC7 0x0a
  175. #define CPMVEC_PIO_PC8 0x09
  176. #define CPMVEC_RESERVED1 0x08
  177. #define CPMVEC_TIMER4 0x07
  178. #define CPMVEC_PIO_PC9 0x06
  179. #define CPMVEC_SPI 0x05
  180. #define CPMVEC_SMC1 0x04
  181. #define CPMVEC_SMC2 0x03
  182. #define CPMVEC_PIO_PC10 0x02
  183. #define CPMVEC_PIO_PC11 0x01
  184. #define CPMVEC_ERROR 0x00
  185. /* #define CPMVEC_PIO_PC0 ((ushort)0x1f) */
  186. /* #define CPMVEC_SCC1 ((ushort)0x1e) */
  187. /* #define CPMVEC_SCC2 ((ushort)0x1d) */
  188. /* #define CPMVEC_SCC3 ((ushort)0x1c) */
  189. /* #define CPMVEC_SCC4 ((ushort)0x1b) */
  190. /* #define CPMVEC_PIO_PC1 ((ushort)0x1a) */
  191. /* #define CPMVEC_TIMER1 ((ushort)0x19) */
  192. /* #define CPMVEC_PIO_PC2 ((ushort)0x18) */
  193. /* #define CPMVEC_PIO_PC3 ((ushort)0x17) */
  194. /* #define CPMVEC_SDMA_CB_ERR ((ushort)0x16) */
  195. /* #define CPMVEC_IDMA1 ((ushort)0x15) */
  196. /* #define CPMVEC_IDMA2 ((ushort)0x14) */
  197. /* #define CPMVEC_RESERVED3 ((ushort)0x13) */
  198. /* #define CPMVEC_TIMER2 ((ushort)0x12) */
  199. /* #define CPMVEC_RISCTIMER ((ushort)0x11) */
  200. /* #define CPMVEC_RESERVED2 ((ushort)0x10) */
  201. /* #define CPMVEC_PIO_PC4 ((ushort)0x0f) */
  202. /* #define CPMVEC_PIO_PC5 ((ushort)0x0e) */
  203. /* #define CPMVEC_TIMER3 ((ushort)0x0c) */
  204. /* #define CPMVEC_PIO_PC6 ((ushort)0x0b) */
  205. /* #define CPMVEC_PIO_PC7 ((ushort)0x0a) */
  206. /* #define CPMVEC_PIO_PC8 ((ushort)0x09) */
  207. /* #define CPMVEC_RESERVED1 ((ushort)0x08) */
  208. /* #define CPMVEC_TIMER4 ((ushort)0x07) */
  209. /* #define CPMVEC_PIO_PC9 ((ushort)0x06) */
  210. /* #define CPMVEC_SPI ((ushort)0x05) */
  211. /* #define CPMVEC_SMC1 ((ushort)0x04) */
  212. /* #define CPMVEC_SMC2 ((ushort)0x03) */
  213. /* #define CPMVEC_PIO_PC10 ((ushort)0x02) */
  214. /* #define CPMVEC_PIO_PC11 ((ushort)0x01) */
  215. /* #define CPMVEC_ERROR ((ushort)0x00) */
  216. /*****************************************************************
  217. * PIO control registers
  218. *****************************************************************/
  219. /* Port A - See 360UM p. 7-358
  220. *
  221. * Note that most of these pins have alternate functions
  222. */
  223. /* The macros are nice, but there are all sorts of references to 1-indexed
  224. * facilities on the 68360... */
  225. /* #define PA_RXD(n) ((ushort)(0x01<<(2*n))) */
  226. /* #define PA_TXD(n) ((ushort)(0x02<<(2*n))) */
  227. #define PA_RXD1 ((ushort)0x0001)
  228. #define PA_TXD1 ((ushort)0x0002)
  229. #define PA_RXD2 ((ushort)0x0004)
  230. #define PA_TXD2 ((ushort)0x0008)
  231. #define PA_RXD3 ((ushort)0x0010)
  232. #define PA_TXD3 ((ushort)0x0020)
  233. #define PA_RXD4 ((ushort)0x0040)
  234. #define PA_TXD4 ((ushort)0x0080)
  235. #define PA_CLK1 ((ushort)0x0100)
  236. #define PA_CLK2 ((ushort)0x0200)
  237. #define PA_CLK3 ((ushort)0x0400)
  238. #define PA_CLK4 ((ushort)0x0800)
  239. #define PA_CLK5 ((ushort)0x1000)
  240. #define PA_CLK6 ((ushort)0x2000)
  241. #define PA_CLK7 ((ushort)0x4000)
  242. #define PA_CLK8 ((ushort)0x8000)
  243. /* Port B - See 360UM p. 7-362
  244. */
  245. /* Port C - See 360UM p. 7-365
  246. */
  247. #define PC_RTS1 ((ushort)0x0001)
  248. #define PC_RTS2 ((ushort)0x0002)
  249. #define PC__RTS3 ((ushort)0x0004) /* !RTS3 */
  250. #define PC__RTS4 ((ushort)0x0008) /* !RTS4 */
  251. #define PC_CTS1 ((ushort)0x0010)
  252. #define PC_CD1 ((ushort)0x0020)
  253. #define PC_CTS2 ((ushort)0x0040)
  254. #define PC_CD2 ((ushort)0x0080)
  255. #define PC_CTS3 ((ushort)0x0100)
  256. #define PC_CD3 ((ushort)0x0200)
  257. #define PC_CTS4 ((ushort)0x0400)
  258. #define PC_CD4 ((ushort)0x0800)
  259. /*****************************************************************
  260. chip select option register
  261. *****************************************************************/
  262. #define DTACK 0xe000
  263. #define ADR_MASK 0x1ffc
  264. #define RDWR_MASK 0x0002
  265. #define FC_MASK 0x0001
  266. /*****************************************************************
  267. tbase and rbase registers
  268. *****************************************************************/
  269. #define TBD_ADDR(quicc,pram) ((struct quicc_bd *) \
  270. (quicc->ch_or_u.u.udata_bd_ucode + pram->tbase))
  271. #define RBD_ADDR(quicc,pram) ((struct quicc_bd *) \
  272. (quicc->ch_or_u.u.udata_bd_ucode + pram->rbase))
  273. #define TBD_CUR_ADDR(quicc,pram) ((struct quicc_bd *) \
  274. (quicc->ch_or_u.u.udata_bd_ucode + pram->tbptr))
  275. #define RBD_CUR_ADDR(quicc,pram) ((struct quicc_bd *) \
  276. (quicc->ch_or_u.u.udata_bd_ucode + pram->rbptr))
  277. #define TBD_SET_CUR_ADDR(bd,quicc,pram) pram->tbptr = \
  278. ((unsigned short)((char *)(bd) - (char *)(quicc->ch_or_u.u.udata_bd_ucode)))
  279. #define RBD_SET_CUR_ADDR(bd,quicc,pram) pram->rbptr = \
  280. ((unsigned short)((char *)(bd) - (char *)(quicc->ch_or_u.u.udata_bd_ucode)))
  281. #define INCREASE_TBD(bd,quicc,pram) { \
  282. if((bd)->status & T_W) \
  283. (bd) = TBD_ADDR(quicc,pram); \
  284. else \
  285. (bd)++; \
  286. }
  287. #define DECREASE_TBD(bd,quicc,pram) { \
  288. if ((bd) == TBD_ADDR(quicc, pram)) \
  289. while (!((bd)->status & T_W)) \
  290. (bd)++; \
  291. else \
  292. (bd)--; \
  293. }
  294. #define INCREASE_RBD(bd,quicc,pram) { \
  295. if((bd)->status & R_W) \
  296. (bd) = RBD_ADDR(quicc,pram); \
  297. else \
  298. (bd)++; \
  299. }
  300. #define DECREASE_RBD(bd,quicc,pram) { \
  301. if ((bd) == RBD_ADDR(quicc, pram)) \
  302. while (!((bd)->status & T_W)) \
  303. (bd)++; \
  304. else \
  305. (bd)--; \
  306. }
  307. /*****************************************************************
  308. Macros for Multi channel
  309. *****************************************************************/
  310. #define QMC_BASE(quicc,page) (struct global_multi_pram *)(&quicc->pram[page])
  311. #define MCBASE(quicc,page) (unsigned long)(quicc->pram[page].m.mcbase)
  312. #define CHANNEL_PRAM_BASE(quicc,channel) ((struct quicc32_pram *) \
  313. (&(quicc->ch_or_u.ch_pram_tbl[channel])))
  314. #define TBD_32_ADDR(quicc,page,channel) ((struct quicc_bd *) \
  315. (MCBASE(quicc,page) + (CHANNEL_PRAM_BASE(quicc,channel)->tbase)))
  316. #define RBD_32_ADDR(quicc,page,channel) ((struct quicc_bd *) \
  317. (MCBASE(quicc,page) + (CHANNEL_PRAM_BASE(quicc,channel)->rbase)))
  318. #define TBD_32_CUR_ADDR(quicc,page,channel) ((struct quicc_bd *) \
  319. (MCBASE(quicc,page) + (CHANNEL_PRAM_BASE(quicc,channel)->tbptr)))
  320. #define RBD_32_CUR_ADDR(quicc,page,channel) ((struct quicc_bd *) \
  321. (MCBASE(quicc,page) + (CHANNEL_PRAM_BASE(quicc,channel)->rbptr)))
  322. #define TBD_32_SET_CUR_ADDR(bd,quicc,page,channel) \
  323. CHANNEL_PRAM_BASE(quicc,channel)->tbptr = \
  324. ((unsigned short)((char *)(bd) - (char *)(MCBASE(quicc,page))))
  325. #define RBD_32_SET_CUR_ADDR(bd,quicc,page,channel) \
  326. CHANNEL_PRAM_BASE(quicc,channel)->rbptr = \
  327. ((unsigned short)((char *)(bd) - (char *)(MCBASE(quicc,page))))
  328. #define INCREASE_TBD_32(bd,quicc,page,channel) { \
  329. if((bd)->status & T_W) \
  330. (bd) = TBD_32_ADDR(quicc,page,channel); \
  331. else \
  332. (bd)++; \
  333. }
  334. #define DECREASE_TBD_32(bd,quicc,page,channel) { \
  335. if ((bd) == TBD_32_ADDR(quicc, page,channel)) \
  336. while (!((bd)->status & T_W)) \
  337. (bd)++; \
  338. else \
  339. (bd)--; \
  340. }
  341. #define INCREASE_RBD_32(bd,quicc,page,channel) { \
  342. if((bd)->status & R_W) \
  343. (bd) = RBD_32_ADDR(quicc,page,channel); \
  344. else \
  345. (bd)++; \
  346. }
  347. #define DECREASE_RBD_32(bd,quicc,page,channel) { \
  348. if ((bd) == RBD_32_ADDR(quicc, page,channel)) \
  349. while (!((bd)->status & T_W)) \
  350. (bd)++; \
  351. else \
  352. (bd)--; \
  353. }
  354. #endif