commproc.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. /*
  2. * 68360 Communication Processor Module.
  3. * Copyright (c) 2000 Michael Leslie <mleslie@lineo.com> (mc68360) after:
  4. * Copyright (c) 1997 Dan Malek <dmalek@jlc.net> (mpc8xx)
  5. *
  6. * This file contains structures and information for the communication
  7. * processor channels. Some CPM control and status is available
  8. * through the 68360 internal memory map. See include/asm/360_immap.h for details.
  9. * This file is not a complete map of all of the 360 QUICC's capabilities
  10. *
  11. * On the MBX board, EPPC-Bug loads CPM microcode into the first 512
  12. * bytes of the DP RAM and relocates the I2C parameter area to the
  13. * IDMA1 space. The remaining DP RAM is available for buffer descriptors
  14. * or other use.
  15. */
  16. #ifndef __CPM_360__
  17. #define __CPM_360__
  18. /* CPM Command register masks: */
  19. #define CPM_CR_RST ((ushort)0x8000)
  20. #define CPM_CR_OPCODE ((ushort)0x0f00)
  21. #define CPM_CR_CHAN ((ushort)0x00f0)
  22. #define CPM_CR_FLG ((ushort)0x0001)
  23. /* CPM Command set (opcodes): */
  24. #define CPM_CR_INIT_TRX ((ushort)0x0000)
  25. #define CPM_CR_INIT_RX ((ushort)0x0001)
  26. #define CPM_CR_INIT_TX ((ushort)0x0002)
  27. #define CPM_CR_HUNT_MODE ((ushort)0x0003)
  28. #define CPM_CR_STOP_TX ((ushort)0x0004)
  29. #define CPM_CR_GRSTOP_TX ((ushort)0x0005)
  30. #define CPM_CR_RESTART_TX ((ushort)0x0006)
  31. #define CPM_CR_CLOSE_RXBD ((ushort)0x0007)
  32. #define CPM_CR_SET_GADDR ((ushort)0x0008)
  33. #define CPM_CR_GCI_TIMEOUT ((ushort)0x0009)
  34. #define CPM_CR_GCI_ABORT ((ushort)0x000a)
  35. #define CPM_CR_RESET_BCS ((ushort)0x000a)
  36. /* CPM Channel numbers. */
  37. #define CPM_CR_CH_SCC1 ((ushort)0x0000)
  38. #define CPM_CR_CH_SCC2 ((ushort)0x0004)
  39. #define CPM_CR_CH_SPI ((ushort)0x0005) /* SPI / Timers */
  40. #define CPM_CR_CH_TMR ((ushort)0x0005)
  41. #define CPM_CR_CH_SCC3 ((ushort)0x0008)
  42. #define CPM_CR_CH_SMC1 ((ushort)0x0009) /* SMC1 / IDMA1 */
  43. #define CPM_CR_CH_IDMA1 ((ushort)0x0009)
  44. #define CPM_CR_CH_SCC4 ((ushort)0x000c)
  45. #define CPM_CR_CH_SMC2 ((ushort)0x000d) /* SMC2 / IDMA2 */
  46. #define CPM_CR_CH_IDMA2 ((ushort)0x000d)
  47. #define mk_cr_cmd(CH, CMD) ((CMD << 8) | (CH << 4))
  48. #if 1 /* mleslie: I dinna think we have any such restrictions on
  49. * DP RAM aboard the 360 board - see the MC68360UM p.3-3 */
  50. /* The dual ported RAM is multi-functional. Some areas can be (and are
  51. * being) used for microcode. There is an area that can only be used
  52. * as data ram for buffer descriptors, which is all we use right now.
  53. * Currently the first 512 and last 256 bytes are used for microcode.
  54. */
  55. /* mleslie: The uCquicc board is using no extra microcode in DPRAM */
  56. #define CPM_DATAONLY_BASE ((uint)0x0000)
  57. #define CPM_DATAONLY_SIZE ((uint)0x0800)
  58. #define CPM_DP_NOSPACE ((uint)0x7fffffff)
  59. #endif
  60. /* Export the base address of the communication processor registers
  61. * and dual port ram. */
  62. /* extern cpm360_t *cpmp; */ /* Pointer to comm processor */
  63. extern QUICC *pquicc;
  64. uint m360_cpm_dpalloc(uint size);
  65. /* void *m360_cpm_hostalloc(uint size); */
  66. void m360_cpm_setbrg(uint brg, uint rate);
  67. #if 0 /* use QUICC_BD declared in include/asm/m68360_quicc.h */
  68. /* Buffer descriptors used by many of the CPM protocols. */
  69. typedef struct cpm_buf_desc {
  70. ushort cbd_sc; /* Status and Control */
  71. ushort cbd_datlen; /* Data length in buffer */
  72. uint cbd_bufaddr; /* Buffer address in host memory */
  73. } cbd_t;
  74. #endif
  75. /* rx bd status/control bits */
  76. #define BD_SC_EMPTY ((ushort)0x8000) /* Recieve is empty */
  77. #define BD_SC_WRAP ((ushort)0x2000) /* Last buffer descriptor in table */
  78. #define BD_SC_INTRPT ((ushort)0x1000) /* Interrupt on change */
  79. #define BD_SC_LAST ((ushort)0x0800) /* Last buffer in frame OR control char */
  80. #define BD_SC_FIRST ((ushort)0x0400) /* 1st buffer in an HDLC frame */
  81. #define BD_SC_ADDR ((ushort)0x0400) /* 1st byte is a multidrop address */
  82. #define BD_SC_CM ((ushort)0x0200) /* Continous mode */
  83. #define BD_SC_ID ((ushort)0x0100) /* Received too many idles */
  84. #define BD_SC_AM ((ushort)0x0080) /* Multidrop address match */
  85. #define BD_SC_DE ((ushort)0x0080) /* DPLL Error (HDLC) */
  86. #define BD_SC_BR ((ushort)0x0020) /* Break received */
  87. #define BD_SC_LG ((ushort)0x0020) /* Frame length violation (HDLC) */
  88. #define BD_SC_FR ((ushort)0x0010) /* Framing error */
  89. #define BD_SC_NO ((ushort)0x0010) /* Nonoctet aligned frame (HDLC) */
  90. #define BD_SC_PR ((ushort)0x0008) /* Parity error */
  91. #define BD_SC_AB ((ushort)0x0008) /* Received abort Sequence (HDLC) */
  92. #define BD_SC_OV ((ushort)0x0002) /* Overrun */
  93. #define BD_SC_CD ((ushort)0x0001) /* Carrier Detect lost */
  94. /* tx bd status/control bits (as differ from rx bd) */
  95. #define BD_SC_READY ((ushort)0x8000) /* Transmit is ready */
  96. #define BD_SC_TC ((ushort)0x0400) /* Transmit CRC */
  97. #define BD_SC_P ((ushort)0x0100) /* xmt preamble */
  98. #define BD_SC_UN ((ushort)0x0002) /* Underrun */
  99. /* Parameter RAM offsets. */
  100. /* In 2.4 ppc, the PROFF_S?C? are used as byte offsets into DPRAM.
  101. * In 2.0, we use a more structured C struct map of DPRAM, and so
  102. * instead, we need only a parameter ram `slot' */
  103. #define PRSLOT_SCC1 0
  104. #define PRSLOT_SCC2 1
  105. #define PRSLOT_SCC3 2
  106. #define PRSLOT_SMC1 2
  107. #define PRSLOT_SCC4 3
  108. #define PRSLOT_SMC2 3
  109. /* #define PROFF_SCC1 ((uint)0x0000) */
  110. /* #define PROFF_SCC2 ((uint)0x0100) */
  111. /* #define PROFF_SCC3 ((uint)0x0200) */
  112. /* #define PROFF_SMC1 ((uint)0x0280) */
  113. /* #define PROFF_SCC4 ((uint)0x0300) */
  114. /* #define PROFF_SMC2 ((uint)0x0380) */
  115. /* Define enough so I can at least use the serial port as a UART.
  116. * The MBX uses SMC1 as the host serial port.
  117. */
  118. typedef struct smc_uart {
  119. ushort smc_rbase; /* Rx Buffer descriptor base address */
  120. ushort smc_tbase; /* Tx Buffer descriptor base address */
  121. u_char smc_rfcr; /* Rx function code */
  122. u_char smc_tfcr; /* Tx function code */
  123. ushort smc_mrblr; /* Max receive buffer length */
  124. uint smc_rstate; /* Internal */
  125. uint smc_idp; /* Internal */
  126. ushort smc_rbptr; /* Internal */
  127. ushort smc_ibc; /* Internal */
  128. uint smc_rxtmp; /* Internal */
  129. uint smc_tstate; /* Internal */
  130. uint smc_tdp; /* Internal */
  131. ushort smc_tbptr; /* Internal */
  132. ushort smc_tbc; /* Internal */
  133. uint smc_txtmp; /* Internal */
  134. ushort smc_maxidl; /* Maximum idle characters */
  135. ushort smc_tmpidl; /* Temporary idle counter */
  136. ushort smc_brklen; /* Last received break length */
  137. ushort smc_brkec; /* rcv'd break condition counter */
  138. ushort smc_brkcr; /* xmt break count register */
  139. ushort smc_rmask; /* Temporary bit mask */
  140. } smc_uart_t;
  141. /* Function code bits.
  142. */
  143. #define SMC_EB ((u_char)0x10) /* Set big endian byte order */
  144. /* SMC uart mode register.
  145. */
  146. #define SMCMR_REN ((ushort)0x0001)
  147. #define SMCMR_TEN ((ushort)0x0002)
  148. #define SMCMR_DM ((ushort)0x000c)
  149. #define SMCMR_SM_GCI ((ushort)0x0000)
  150. #define SMCMR_SM_UART ((ushort)0x0020)
  151. #define SMCMR_SM_TRANS ((ushort)0x0030)
  152. #define SMCMR_SM_MASK ((ushort)0x0030)
  153. #define SMCMR_PM_EVEN ((ushort)0x0100) /* Even parity, else odd */
  154. #define SMCMR_REVD SMCMR_PM_EVEN
  155. #define SMCMR_PEN ((ushort)0x0200) /* Parity enable */
  156. #define SMCMR_BS SMCMR_PEN
  157. #define SMCMR_SL ((ushort)0x0400) /* Two stops, else one */
  158. #define SMCR_CLEN_MASK ((ushort)0x7800) /* Character length */
  159. #define smcr_mk_clen(C) (((C) << 11) & SMCR_CLEN_MASK)
  160. /* SMC2 as Centronics parallel printer. It is half duplex, in that
  161. * it can only receive or transmit. The parameter ram values for
  162. * each direction are either unique or properly overlap, so we can
  163. * include them in one structure.
  164. */
  165. typedef struct smc_centronics {
  166. ushort scent_rbase;
  167. ushort scent_tbase;
  168. u_char scent_cfcr;
  169. u_char scent_smask;
  170. ushort scent_mrblr;
  171. uint scent_rstate;
  172. uint scent_r_ptr;
  173. ushort scent_rbptr;
  174. ushort scent_r_cnt;
  175. uint scent_rtemp;
  176. uint scent_tstate;
  177. uint scent_t_ptr;
  178. ushort scent_tbptr;
  179. ushort scent_t_cnt;
  180. uint scent_ttemp;
  181. ushort scent_max_sl;
  182. ushort scent_sl_cnt;
  183. ushort scent_character1;
  184. ushort scent_character2;
  185. ushort scent_character3;
  186. ushort scent_character4;
  187. ushort scent_character5;
  188. ushort scent_character6;
  189. ushort scent_character7;
  190. ushort scent_character8;
  191. ushort scent_rccm;
  192. ushort scent_rccr;
  193. } smc_cent_t;
  194. /* Centronics Status Mask Register.
  195. */
  196. #define SMC_CENT_F ((u_char)0x08)
  197. #define SMC_CENT_PE ((u_char)0x04)
  198. #define SMC_CENT_S ((u_char)0x02)
  199. /* SMC Event and Mask register.
  200. */
  201. #define SMCM_BRKE ((unsigned char)0x40) /* When in UART Mode */
  202. #define SMCM_BRK ((unsigned char)0x10) /* When in UART Mode */
  203. #define SMCM_TXE ((unsigned char)0x10) /* When in Transparent Mode */
  204. #define SMCM_BSY ((unsigned char)0x04)
  205. #define SMCM_TX ((unsigned char)0x02)
  206. #define SMCM_RX ((unsigned char)0x01)
  207. /* Baud rate generators.
  208. */
  209. #define CPM_BRG_RST ((uint)0x00020000)
  210. #define CPM_BRG_EN ((uint)0x00010000)
  211. #define CPM_BRG_EXTC_INT ((uint)0x00000000)
  212. #define CPM_BRG_EXTC_CLK2 ((uint)0x00004000)
  213. #define CPM_BRG_EXTC_CLK6 ((uint)0x00008000)
  214. #define CPM_BRG_ATB ((uint)0x00002000)
  215. #define CPM_BRG_CD_MASK ((uint)0x00001ffe)
  216. #define CPM_BRG_DIV16 ((uint)0x00000001)
  217. /* SCCs.
  218. */
  219. #define SCC_GSMRH_IRP ((uint)0x00040000)
  220. #define SCC_GSMRH_GDE ((uint)0x00010000)
  221. #define SCC_GSMRH_TCRC_CCITT ((uint)0x00008000)
  222. #define SCC_GSMRH_TCRC_BISYNC ((uint)0x00004000)
  223. #define SCC_GSMRH_TCRC_HDLC ((uint)0x00000000)
  224. #define SCC_GSMRH_REVD ((uint)0x00002000)
  225. #define SCC_GSMRH_TRX ((uint)0x00001000)
  226. #define SCC_GSMRH_TTX ((uint)0x00000800)
  227. #define SCC_GSMRH_CDP ((uint)0x00000400)
  228. #define SCC_GSMRH_CTSP ((uint)0x00000200)
  229. #define SCC_GSMRH_CDS ((uint)0x00000100)
  230. #define SCC_GSMRH_CTSS ((uint)0x00000080)
  231. #define SCC_GSMRH_TFL ((uint)0x00000040)
  232. #define SCC_GSMRH_RFW ((uint)0x00000020)
  233. #define SCC_GSMRH_TXSY ((uint)0x00000010)
  234. #define SCC_GSMRH_SYNL16 ((uint)0x0000000c)
  235. #define SCC_GSMRH_SYNL8 ((uint)0x00000008)
  236. #define SCC_GSMRH_SYNL4 ((uint)0x00000004)
  237. #define SCC_GSMRH_RTSM ((uint)0x00000002)
  238. #define SCC_GSMRH_RSYN ((uint)0x00000001)
  239. #define SCC_GSMRL_SIR ((uint)0x80000000) /* SCC2 only */
  240. #define SCC_GSMRL_EDGE_NONE ((uint)0x60000000)
  241. #define SCC_GSMRL_EDGE_NEG ((uint)0x40000000)
  242. #define SCC_GSMRL_EDGE_POS ((uint)0x20000000)
  243. #define SCC_GSMRL_EDGE_BOTH ((uint)0x00000000)
  244. #define SCC_GSMRL_TCI ((uint)0x10000000)
  245. #define SCC_GSMRL_TSNC_3 ((uint)0x0c000000)
  246. #define SCC_GSMRL_TSNC_4 ((uint)0x08000000)
  247. #define SCC_GSMRL_TSNC_14 ((uint)0x04000000)
  248. #define SCC_GSMRL_TSNC_INF ((uint)0x00000000)
  249. #define SCC_GSMRL_RINV ((uint)0x02000000)
  250. #define SCC_GSMRL_TINV ((uint)0x01000000)
  251. #define SCC_GSMRL_TPL_128 ((uint)0x00c00000)
  252. #define SCC_GSMRL_TPL_64 ((uint)0x00a00000)
  253. #define SCC_GSMRL_TPL_48 ((uint)0x00800000)
  254. #define SCC_GSMRL_TPL_32 ((uint)0x00600000)
  255. #define SCC_GSMRL_TPL_16 ((uint)0x00400000)
  256. #define SCC_GSMRL_TPL_8 ((uint)0x00200000)
  257. #define SCC_GSMRL_TPL_NONE ((uint)0x00000000)
  258. #define SCC_GSMRL_TPP_ALL1 ((uint)0x00180000)
  259. #define SCC_GSMRL_TPP_01 ((uint)0x00100000)
  260. #define SCC_GSMRL_TPP_10 ((uint)0x00080000)
  261. #define SCC_GSMRL_TPP_ZEROS ((uint)0x00000000)
  262. #define SCC_GSMRL_TEND ((uint)0x00040000)
  263. #define SCC_GSMRL_TDCR_32 ((uint)0x00030000)
  264. #define SCC_GSMRL_TDCR_16 ((uint)0x00020000)
  265. #define SCC_GSMRL_TDCR_8 ((uint)0x00010000)
  266. #define SCC_GSMRL_TDCR_1 ((uint)0x00000000)
  267. #define SCC_GSMRL_RDCR_32 ((uint)0x0000c000)
  268. #define SCC_GSMRL_RDCR_16 ((uint)0x00008000)
  269. #define SCC_GSMRL_RDCR_8 ((uint)0x00004000)
  270. #define SCC_GSMRL_RDCR_1 ((uint)0x00000000)
  271. #define SCC_GSMRL_RENC_DFMAN ((uint)0x00003000)
  272. #define SCC_GSMRL_RENC_MANCH ((uint)0x00002000)
  273. #define SCC_GSMRL_RENC_FM0 ((uint)0x00001000)
  274. #define SCC_GSMRL_RENC_NRZI ((uint)0x00000800)
  275. #define SCC_GSMRL_RENC_NRZ ((uint)0x00000000)
  276. #define SCC_GSMRL_TENC_DFMAN ((uint)0x00000600)
  277. #define SCC_GSMRL_TENC_MANCH ((uint)0x00000400)
  278. #define SCC_GSMRL_TENC_FM0 ((uint)0x00000200)
  279. #define SCC_GSMRL_TENC_NRZI ((uint)0x00000100)
  280. #define SCC_GSMRL_TENC_NRZ ((uint)0x00000000)
  281. #define SCC_GSMRL_DIAG_LE ((uint)0x000000c0) /* Loop and echo */
  282. #define SCC_GSMRL_DIAG_ECHO ((uint)0x00000080)
  283. #define SCC_GSMRL_DIAG_LOOP ((uint)0x00000040)
  284. #define SCC_GSMRL_DIAG_NORM ((uint)0x00000000)
  285. #define SCC_GSMRL_ENR ((uint)0x00000020)
  286. #define SCC_GSMRL_ENT ((uint)0x00000010)
  287. #define SCC_GSMRL_MODE_ENET ((uint)0x0000000c)
  288. #define SCC_GSMRL_MODE_DDCMP ((uint)0x00000009)
  289. #define SCC_GSMRL_MODE_BISYNC ((uint)0x00000008)
  290. #define SCC_GSMRL_MODE_V14 ((uint)0x00000007)
  291. #define SCC_GSMRL_MODE_AHDLC ((uint)0x00000006)
  292. #define SCC_GSMRL_MODE_PROFIBUS ((uint)0x00000005)
  293. #define SCC_GSMRL_MODE_UART ((uint)0x00000004)
  294. #define SCC_GSMRL_MODE_SS7 ((uint)0x00000003)
  295. #define SCC_GSMRL_MODE_ATALK ((uint)0x00000002)
  296. #define SCC_GSMRL_MODE_HDLC ((uint)0x00000000)
  297. #define SCC_TODR_TOD ((ushort)0x8000)
  298. /* SCC Event and Mask register.
  299. */
  300. #define SCCM_TXE ((unsigned char)0x10)
  301. #define SCCM_BSY ((unsigned char)0x04)
  302. #define SCCM_TX ((unsigned char)0x02)
  303. #define SCCM_RX ((unsigned char)0x01)
  304. typedef struct scc_param {
  305. ushort scc_rbase; /* Rx Buffer descriptor base address */
  306. ushort scc_tbase; /* Tx Buffer descriptor base address */
  307. u_char scc_rfcr; /* Rx function code */
  308. u_char scc_tfcr; /* Tx function code */
  309. ushort scc_mrblr; /* Max receive buffer length */
  310. uint scc_rstate; /* Internal */
  311. uint scc_idp; /* Internal */
  312. ushort scc_rbptr; /* Internal */
  313. ushort scc_ibc; /* Internal */
  314. uint scc_rxtmp; /* Internal */
  315. uint scc_tstate; /* Internal */
  316. uint scc_tdp; /* Internal */
  317. ushort scc_tbptr; /* Internal */
  318. ushort scc_tbc; /* Internal */
  319. uint scc_txtmp; /* Internal */
  320. uint scc_rcrc; /* Internal */
  321. uint scc_tcrc; /* Internal */
  322. } sccp_t;
  323. /* Function code bits.
  324. */
  325. #define SCC_EB ((u_char)0x10) /* Set big endian byte order */
  326. #define SCC_FC_DMA ((u_char)0x08) /* Set SDMA */
  327. /* CPM Ethernet through SCC1.
  328. */
  329. typedef struct scc_enet {
  330. sccp_t sen_genscc;
  331. uint sen_cpres; /* Preset CRC */
  332. uint sen_cmask; /* Constant mask for CRC */
  333. uint sen_crcec; /* CRC Error counter */
  334. uint sen_alec; /* alignment error counter */
  335. uint sen_disfc; /* discard frame counter */
  336. ushort sen_pads; /* Tx short frame pad character */
  337. ushort sen_retlim; /* Retry limit threshold */
  338. ushort sen_retcnt; /* Retry limit counter */
  339. ushort sen_maxflr; /* maximum frame length register */
  340. ushort sen_minflr; /* minimum frame length register */
  341. ushort sen_maxd1; /* maximum DMA1 length */
  342. ushort sen_maxd2; /* maximum DMA2 length */
  343. ushort sen_maxd; /* Rx max DMA */
  344. ushort sen_dmacnt; /* Rx DMA counter */
  345. ushort sen_maxb; /* Max BD byte count */
  346. ushort sen_gaddr1; /* Group address filter */
  347. ushort sen_gaddr2;
  348. ushort sen_gaddr3;
  349. ushort sen_gaddr4;
  350. uint sen_tbuf0data0; /* Save area 0 - current frame */
  351. uint sen_tbuf0data1; /* Save area 1 - current frame */
  352. uint sen_tbuf0rba; /* Internal */
  353. uint sen_tbuf0crc; /* Internal */
  354. ushort sen_tbuf0bcnt; /* Internal */
  355. ushort sen_paddrh; /* physical address (MSB) */
  356. ushort sen_paddrm;
  357. ushort sen_paddrl; /* physical address (LSB) */
  358. ushort sen_pper; /* persistence */
  359. ushort sen_rfbdptr; /* Rx first BD pointer */
  360. ushort sen_tfbdptr; /* Tx first BD pointer */
  361. ushort sen_tlbdptr; /* Tx last BD pointer */
  362. uint sen_tbuf1data0; /* Save area 0 - current frame */
  363. uint sen_tbuf1data1; /* Save area 1 - current frame */
  364. uint sen_tbuf1rba; /* Internal */
  365. uint sen_tbuf1crc; /* Internal */
  366. ushort sen_tbuf1bcnt; /* Internal */
  367. ushort sen_txlen; /* Tx Frame length counter */
  368. ushort sen_iaddr1; /* Individual address filter */
  369. ushort sen_iaddr2;
  370. ushort sen_iaddr3;
  371. ushort sen_iaddr4;
  372. ushort sen_boffcnt; /* Backoff counter */
  373. /* NOTE: Some versions of the manual have the following items
  374. * incorrectly documented. Below is the proper order.
  375. */
  376. ushort sen_taddrh; /* temp address (MSB) */
  377. ushort sen_taddrm;
  378. ushort sen_taddrl; /* temp address (LSB) */
  379. } scc_enet_t;
  380. #if defined (CONFIG_UCQUICC)
  381. /* uCquicc has the following signals connected to Ethernet:
  382. * 68360 - lxt905
  383. * PA0/RXD1 - rxd
  384. * PA1/TXD1 - txd
  385. * PA8/CLK1 - tclk
  386. * PA9/CLK2 - rclk
  387. * PC0/!RTS1 - t_en
  388. * PC1/!CTS1 - col
  389. * PC5/!CD1 - cd
  390. */
  391. #define PA_ENET_RXD PA_RXD1
  392. #define PA_ENET_TXD PA_TXD1
  393. #define PA_ENET_TCLK PA_CLK1
  394. #define PA_ENET_RCLK PA_CLK2
  395. #define PC_ENET_TENA PC_RTS1
  396. #define PC_ENET_CLSN PC_CTS1
  397. #define PC_ENET_RENA PC_CD1
  398. /* Control bits in the SICR to route TCLK (CLK1) and RCLK (CLK2) to
  399. * SCC1.
  400. */
  401. #define SICR_ENET_MASK ((uint)0x000000ff)
  402. #define SICR_ENET_CLKRT ((uint)0x0000002c)
  403. #endif /* config_ucquicc */
  404. #ifdef MBX
  405. /* Bits in parallel I/O port registers that have to be set/cleared
  406. * to configure the pins for SCC1 use. The TCLK and RCLK seem unique
  407. * to the MBX860 board. Any two of the four available clocks could be
  408. * used, and the MPC860 cookbook manual has an example using different
  409. * clock pins.
  410. */
  411. #define PA_ENET_RXD ((ushort)0x0001)
  412. #define PA_ENET_TXD ((ushort)0x0002)
  413. #define PA_ENET_TCLK ((ushort)0x0200)
  414. #define PA_ENET_RCLK ((ushort)0x0800)
  415. #define PC_ENET_TENA ((ushort)0x0001)
  416. #define PC_ENET_CLSN ((ushort)0x0010)
  417. #define PC_ENET_RENA ((ushort)0x0020)
  418. /* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
  419. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  420. */
  421. #define SICR_ENET_MASK ((uint)0x000000ff)
  422. #define SICR_ENET_CLKRT ((uint)0x0000003d)
  423. #endif
  424. #ifdef CONFIG_RPXLITE
  425. /* This ENET stuff is for the MPC850 with ethernet on SCC2. Some of
  426. * this may be unique to the RPX-Lite configuration.
  427. * Note TENA is on Port B.
  428. */
  429. #define PA_ENET_RXD ((ushort)0x0004)
  430. #define PA_ENET_TXD ((ushort)0x0008)
  431. #define PA_ENET_TCLK ((ushort)0x0200)
  432. #define PA_ENET_RCLK ((ushort)0x0800)
  433. #define PB_ENET_TENA ((uint)0x00002000)
  434. #define PC_ENET_CLSN ((ushort)0x0040)
  435. #define PC_ENET_RENA ((ushort)0x0080)
  436. #define SICR_ENET_MASK ((uint)0x0000ff00)
  437. #define SICR_ENET_CLKRT ((uint)0x00003d00)
  438. #endif
  439. #ifdef CONFIG_BSEIP
  440. /* This ENET stuff is for the MPC823 with ethernet on SCC2.
  441. * This is unique to the BSE ip-Engine board.
  442. */
  443. #define PA_ENET_RXD ((ushort)0x0004)
  444. #define PA_ENET_TXD ((ushort)0x0008)
  445. #define PA_ENET_TCLK ((ushort)0x0100)
  446. #define PA_ENET_RCLK ((ushort)0x0200)
  447. #define PB_ENET_TENA ((uint)0x00002000)
  448. #define PC_ENET_CLSN ((ushort)0x0040)
  449. #define PC_ENET_RENA ((ushort)0x0080)
  450. /* BSE uses port B and C bits for PHY control also.
  451. */
  452. #define PB_BSE_POWERUP ((uint)0x00000004)
  453. #define PB_BSE_FDXDIS ((uint)0x00008000)
  454. #define PC_BSE_LOOPBACK ((ushort)0x0800)
  455. #define SICR_ENET_MASK ((uint)0x0000ff00)
  456. #define SICR_ENET_CLKRT ((uint)0x00002c00)
  457. #endif
  458. /* SCC Event register as used by Ethernet.
  459. */
  460. #define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
  461. #define SCCE_ENET_TXE ((ushort)0x0010) /* Transmit Error */
  462. #define SCCE_ENET_RXF ((ushort)0x0008) /* Full frame received */
  463. #define SCCE_ENET_BSY ((ushort)0x0004) /* All incoming buffers full */
  464. #define SCCE_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */
  465. #define SCCE_ENET_RXB ((ushort)0x0001) /* A buffer was received */
  466. /* SCC Mode Register (PMSR) as used by Ethernet.
  467. */
  468. #define SCC_PMSR_HBC ((ushort)0x8000) /* Enable heartbeat */
  469. #define SCC_PMSR_FC ((ushort)0x4000) /* Force collision */
  470. #define SCC_PMSR_RSH ((ushort)0x2000) /* Receive short frames */
  471. #define SCC_PMSR_IAM ((ushort)0x1000) /* Check individual hash */
  472. #define SCC_PMSR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */
  473. #define SCC_PMSR_PRO ((ushort)0x0200) /* Promiscuous mode */
  474. #define SCC_PMSR_BRO ((ushort)0x0100) /* Catch broadcast pkts */
  475. #define SCC_PMSR_SBT ((ushort)0x0080) /* Special backoff timer */
  476. #define SCC_PMSR_LPB ((ushort)0x0040) /* Set Loopback mode */
  477. #define SCC_PMSR_SIP ((ushort)0x0020) /* Sample Input Pins */
  478. #define SCC_PMSR_LCW ((ushort)0x0010) /* Late collision window */
  479. #define SCC_PMSR_NIB22 ((ushort)0x000a) /* Start frame search */
  480. #define SCC_PMSR_FDE ((ushort)0x0001) /* Full duplex enable */
  481. /* Buffer descriptor control/status used by Ethernet receive.
  482. */
  483. #define BD_ENET_RX_EMPTY ((ushort)0x8000)
  484. #define BD_ENET_RX_WRAP ((ushort)0x2000)
  485. #define BD_ENET_RX_INTR ((ushort)0x1000)
  486. #define BD_ENET_RX_LAST ((ushort)0x0800)
  487. #define BD_ENET_RX_FIRST ((ushort)0x0400)
  488. #define BD_ENET_RX_MISS ((ushort)0x0100)
  489. #define BD_ENET_RX_LG ((ushort)0x0020)
  490. #define BD_ENET_RX_NO ((ushort)0x0010)
  491. #define BD_ENET_RX_SH ((ushort)0x0008)
  492. #define BD_ENET_RX_CR ((ushort)0x0004)
  493. #define BD_ENET_RX_OV ((ushort)0x0002)
  494. #define BD_ENET_RX_CL ((ushort)0x0001)
  495. #define BD_ENET_RX_STATS ((ushort)0x013f) /* All status bits */
  496. /* Buffer descriptor control/status used by Ethernet transmit.
  497. */
  498. #define BD_ENET_TX_READY ((ushort)0x8000)
  499. #define BD_ENET_TX_PAD ((ushort)0x4000)
  500. #define BD_ENET_TX_WRAP ((ushort)0x2000)
  501. #define BD_ENET_TX_INTR ((ushort)0x1000)
  502. #define BD_ENET_TX_LAST ((ushort)0x0800)
  503. #define BD_ENET_TX_TC ((ushort)0x0400)
  504. #define BD_ENET_TX_DEF ((ushort)0x0200)
  505. #define BD_ENET_TX_HB ((ushort)0x0100)
  506. #define BD_ENET_TX_LC ((ushort)0x0080)
  507. #define BD_ENET_TX_RL ((ushort)0x0040)
  508. #define BD_ENET_TX_RCMASK ((ushort)0x003c)
  509. #define BD_ENET_TX_UN ((ushort)0x0002)
  510. #define BD_ENET_TX_CSL ((ushort)0x0001)
  511. #define BD_ENET_TX_STATS ((ushort)0x03ff) /* All status bits */
  512. /* SCC as UART
  513. */
  514. typedef struct scc_uart {
  515. sccp_t scc_genscc;
  516. uint scc_res1; /* Reserved */
  517. uint scc_res2; /* Reserved */
  518. ushort scc_maxidl; /* Maximum idle chars */
  519. ushort scc_idlc; /* temp idle counter */
  520. ushort scc_brkcr; /* Break count register */
  521. ushort scc_parec; /* receive parity error counter */
  522. ushort scc_frmec; /* receive framing error counter */
  523. ushort scc_nosec; /* receive noise counter */
  524. ushort scc_brkec; /* receive break condition counter */
  525. ushort scc_brkln; /* last received break length */
  526. ushort scc_uaddr1; /* UART address character 1 */
  527. ushort scc_uaddr2; /* UART address character 2 */
  528. ushort scc_rtemp; /* Temp storage */
  529. ushort scc_toseq; /* Transmit out of sequence char */
  530. ushort scc_char1; /* control character 1 */
  531. ushort scc_char2; /* control character 2 */
  532. ushort scc_char3; /* control character 3 */
  533. ushort scc_char4; /* control character 4 */
  534. ushort scc_char5; /* control character 5 */
  535. ushort scc_char6; /* control character 6 */
  536. ushort scc_char7; /* control character 7 */
  537. ushort scc_char8; /* control character 8 */
  538. ushort scc_rccm; /* receive control character mask */
  539. ushort scc_rccr; /* receive control character register */
  540. ushort scc_rlbc; /* receive last break character */
  541. } scc_uart_t;
  542. /* SCC Event and Mask registers when it is used as a UART.
  543. */
  544. #define UART_SCCM_GLR ((ushort)0x1000)
  545. #define UART_SCCM_GLT ((ushort)0x0800)
  546. #define UART_SCCM_AB ((ushort)0x0200)
  547. #define UART_SCCM_IDL ((ushort)0x0100)
  548. #define UART_SCCM_GRA ((ushort)0x0080)
  549. #define UART_SCCM_BRKE ((ushort)0x0040)
  550. #define UART_SCCM_BRKS ((ushort)0x0020)
  551. #define UART_SCCM_CCR ((ushort)0x0008)
  552. #define UART_SCCM_BSY ((ushort)0x0004)
  553. #define UART_SCCM_TX ((ushort)0x0002)
  554. #define UART_SCCM_RX ((ushort)0x0001)
  555. /* The SCC PMSR when used as a UART.
  556. */
  557. #define SCU_PMSR_FLC ((ushort)0x8000)
  558. #define SCU_PMSR_SL ((ushort)0x4000)
  559. #define SCU_PMSR_CL ((ushort)0x3000)
  560. #define SCU_PMSR_UM ((ushort)0x0c00)
  561. #define SCU_PMSR_FRZ ((ushort)0x0200)
  562. #define SCU_PMSR_RZS ((ushort)0x0100)
  563. #define SCU_PMSR_SYN ((ushort)0x0080)
  564. #define SCU_PMSR_DRT ((ushort)0x0040)
  565. #define SCU_PMSR_PEN ((ushort)0x0010)
  566. #define SCU_PMSR_RPM ((ushort)0x000c)
  567. #define SCU_PMSR_REVP ((ushort)0x0008)
  568. #define SCU_PMSR_TPM ((ushort)0x0003)
  569. #define SCU_PMSR_TEVP ((ushort)0x0003)
  570. /* CPM Transparent mode SCC.
  571. */
  572. typedef struct scc_trans {
  573. sccp_t st_genscc;
  574. uint st_cpres; /* Preset CRC */
  575. uint st_cmask; /* Constant mask for CRC */
  576. } scc_trans_t;
  577. #define BD_SCC_TX_LAST ((ushort)0x0800)
  578. /* CPM interrupts. There are nearly 32 interrupts generated by CPM
  579. * channels or devices. All of these are presented to the PPC core
  580. * as a single interrupt. The CPM interrupt handler dispatches its
  581. * own handlers, in a similar fashion to the PPC core handler. We
  582. * use the table as defined in the manuals (i.e. no special high
  583. * priority and SCC1 == SCCa, etc...).
  584. */
  585. /* #define CPMVEC_NR 32 */
  586. /* #define CPMVEC_PIO_PC15 ((ushort)0x1f) */
  587. /* #define CPMVEC_SCC1 ((ushort)0x1e) */
  588. /* #define CPMVEC_SCC2 ((ushort)0x1d) */
  589. /* #define CPMVEC_SCC3 ((ushort)0x1c) */
  590. /* #define CPMVEC_SCC4 ((ushort)0x1b) */
  591. /* #define CPMVEC_PIO_PC14 ((ushort)0x1a) */
  592. /* #define CPMVEC_TIMER1 ((ushort)0x19) */
  593. /* #define CPMVEC_PIO_PC13 ((ushort)0x18) */
  594. /* #define CPMVEC_PIO_PC12 ((ushort)0x17) */
  595. /* #define CPMVEC_SDMA_CB_ERR ((ushort)0x16) */
  596. /* #define CPMVEC_IDMA1 ((ushort)0x15) */
  597. /* #define CPMVEC_IDMA2 ((ushort)0x14) */
  598. /* #define CPMVEC_TIMER2 ((ushort)0x12) */
  599. /* #define CPMVEC_RISCTIMER ((ushort)0x11) */
  600. /* #define CPMVEC_I2C ((ushort)0x10) */
  601. /* #define CPMVEC_PIO_PC11 ((ushort)0x0f) */
  602. /* #define CPMVEC_PIO_PC10 ((ushort)0x0e) */
  603. /* #define CPMVEC_TIMER3 ((ushort)0x0c) */
  604. /* #define CPMVEC_PIO_PC9 ((ushort)0x0b) */
  605. /* #define CPMVEC_PIO_PC8 ((ushort)0x0a) */
  606. /* #define CPMVEC_PIO_PC7 ((ushort)0x09) */
  607. /* #define CPMVEC_TIMER4 ((ushort)0x07) */
  608. /* #define CPMVEC_PIO_PC6 ((ushort)0x06) */
  609. /* #define CPMVEC_SPI ((ushort)0x05) */
  610. /* #define CPMVEC_SMC1 ((ushort)0x04) */
  611. /* #define CPMVEC_SMC2 ((ushort)0x03) */
  612. /* #define CPMVEC_PIO_PC5 ((ushort)0x02) */
  613. /* #define CPMVEC_PIO_PC4 ((ushort)0x01) */
  614. /* #define CPMVEC_ERROR ((ushort)0x00) */
  615. extern void cpm_install_handler(int vec, void (*handler)(void *), void *dev_id);
  616. /* CPM interrupt configuration vector.
  617. */
  618. #define CICR_SCD_SCC4 ((uint)0x00c00000) /* SCC4 @ SCCd */
  619. #define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */
  620. #define CICR_SCB_SCC2 ((uint)0x00040000) /* SCC2 @ SCCb */
  621. #define CICR_SCA_SCC1 ((uint)0x00000000) /* SCC1 @ SCCa */
  622. #define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrupt */
  623. #define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */
  624. #define CICR_IEN ((uint)0x00000080) /* Int. enable */
  625. #define CICR_SPS ((uint)0x00000001) /* SCC Spread */
  626. #endif /* __CPM_360__ */