commproc.h 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  1. /*
  2. * MPC8xx Communication Processor Module.
  3. * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
  4. *
  5. * (C) Copyright 2000-2006
  6. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  7. *
  8. * This file contains structures and information for the communication
  9. * processor channels. Some CPM control and status is available
  10. * throught the MPC8xx internal memory map. See immap.h for details.
  11. * This file only contains what I need for the moment, not the total
  12. * CPM capabilities. I (or someone else) will add definitions as they
  13. * are needed. -- Dan
  14. *
  15. */
  16. #ifndef __CPM_8XX__
  17. #define __CPM_8XX__
  18. #include <asm/8xx_immap.h>
  19. /* CPM Command register.
  20. */
  21. #define CPM_CR_RST ((ushort)0x8000)
  22. #define CPM_CR_OPCODE ((ushort)0x0f00)
  23. #define CPM_CR_CHAN ((ushort)0x00f0)
  24. #define CPM_CR_FLG ((ushort)0x0001)
  25. /* Some commands (there are more...later)
  26. */
  27. #define CPM_CR_INIT_TRX ((ushort)0x0000)
  28. #define CPM_CR_INIT_RX ((ushort)0x0001)
  29. #define CPM_CR_INIT_TX ((ushort)0x0002)
  30. #define CPM_CR_HUNT_MODE ((ushort)0x0003)
  31. #define CPM_CR_STOP_TX ((ushort)0x0004)
  32. #define CPM_CR_RESTART_TX ((ushort)0x0006)
  33. #define CPM_CR_SET_GADDR ((ushort)0x0008)
  34. /* Channel numbers.
  35. */
  36. #define CPM_CR_CH_SCC1 ((ushort)0x0000)
  37. #define CPM_CR_CH_I2C ((ushort)0x0001) /* I2C and IDMA1 */
  38. #define CPM_CR_CH_SCC2 ((ushort)0x0004)
  39. #define CPM_CR_CH_SPI ((ushort)0x0005) /* SPI/IDMA2/Timers */
  40. #define CPM_CR_CH_SCC3 ((ushort)0x0008)
  41. #define CPM_CR_CH_SMC1 ((ushort)0x0009) /* SMC1 / DSP1 */
  42. #define CPM_CR_CH_SCC4 ((ushort)0x000c)
  43. #define CPM_CR_CH_SMC2 ((ushort)0x000d) /* SMC2 / DSP2 */
  44. #define mk_cr_cmd(CH, CMD) ((CMD << 8) | (CH << 4))
  45. /*
  46. * DPRAM defines and allocation functions
  47. */
  48. /* The dual ported RAM is multi-functional. Some areas can be (and are
  49. * being) used for microcode. There is an area that can only be used
  50. * as data ram for buffer descriptors, which is all we use right now.
  51. * Currently the first 512 and last 256 bytes are used for microcode.
  52. */
  53. #ifdef CONFIG_SYS_ALLOC_DPRAM
  54. #define CPM_DATAONLY_BASE ((uint)0x0800)
  55. #define CPM_DATAONLY_SIZE ((uint)0x0700)
  56. #define CPM_DP_NOSPACE ((uint)0x7fffffff)
  57. #else
  58. #define CPM_SERIAL_BASE 0x0800
  59. #define CPM_I2C_BASE 0x0820
  60. #define CPM_SPI_BASE 0x0840
  61. #define CPM_FEC_BASE 0x0860
  62. #define CPM_SERIAL2_BASE 0x08E0
  63. #define CPM_SCC_BASE 0x0900
  64. #define CPM_POST_BASE 0x0980
  65. #define CPM_WLKBD_BASE 0x0a00
  66. #endif
  67. #ifndef CONFIG_SYS_CPM_POST_WORD_ADDR
  68. #define CPM_POST_WORD_ADDR 0x07FC
  69. #else
  70. #define CPM_POST_WORD_ADDR CONFIG_SYS_CPM_POST_WORD_ADDR
  71. #endif
  72. #ifndef CONFIG_SYS_CPM_BOOTCOUNT_ADDR
  73. #define CPM_BOOTCOUNT_ADDR (CPM_POST_WORD_ADDR - 2*sizeof(ulong))
  74. #else
  75. #define CPM_BOOTCOUNT_ADDR CONFIG_SYS_CPM_BOOTCOUNT_ADDR
  76. #endif
  77. #define BD_IIC_START ((uint) 0x0400) /* <- please use CPM_I2C_BASE !! */
  78. /* Export the base address of the communication processor registers
  79. * and dual port ram.
  80. */
  81. extern cpm8xx_t *cpmp; /* Pointer to comm processor */
  82. /* Buffer descriptors used by many of the CPM protocols.
  83. */
  84. typedef struct cpm_buf_desc {
  85. ushort cbd_sc; /* Status and Control */
  86. ushort cbd_datlen; /* Data length in buffer */
  87. uint cbd_bufaddr; /* Buffer address in host memory */
  88. } cbd_t;
  89. #define BD_SC_EMPTY ((ushort)0x8000) /* Receive is empty */
  90. #define BD_SC_READY ((ushort)0x8000) /* Transmit is ready */
  91. #define BD_SC_WRAP ((ushort)0x2000) /* Last buffer descriptor */
  92. #define BD_SC_INTRPT ((ushort)0x1000) /* Interrupt on change */
  93. #define BD_SC_LAST ((ushort)0x0800) /* Last buffer in frame */
  94. #define BD_SC_TC ((ushort)0x0400) /* Transmit CRC */
  95. #define BD_SC_CM ((ushort)0x0200) /* Continous mode */
  96. #define BD_SC_ID ((ushort)0x0100) /* Rec'd too many idles */
  97. #define BD_SC_P ((ushort)0x0100) /* xmt preamble */
  98. #define BD_SC_BR ((ushort)0x0020) /* Break received */
  99. #define BD_SC_FR ((ushort)0x0010) /* Framing error */
  100. #define BD_SC_PR ((ushort)0x0008) /* Parity error */
  101. #define BD_SC_OV ((ushort)0x0002) /* Overrun */
  102. #define BD_SC_CD ((ushort)0x0001) /* Carrier Detect lost */
  103. /* Parameter RAM offsets.
  104. */
  105. #define PROFF_SCC1 ((uint)0x0000)
  106. #define PROFF_IIC ((uint)0x0080)
  107. #define PROFF_REVNUM ((uint)0x00b0)
  108. #define PROFF_SCC2 ((uint)0x0100)
  109. #define PROFF_SPI ((uint)0x0180)
  110. #define PROFF_SCC3 ((uint)0x0200)
  111. #define PROFF_SMC1 ((uint)0x0280)
  112. #define PROFF_SCC4 ((uint)0x0300)
  113. #define PROFF_SMC2 ((uint)0x0380)
  114. /* Define enough so I can at least use the serial port as a UART.
  115. */
  116. typedef struct smc_uart {
  117. ushort smc_rbase; /* Rx Buffer descriptor base address */
  118. ushort smc_tbase; /* Tx Buffer descriptor base address */
  119. u_char smc_rfcr; /* Rx function code */
  120. u_char smc_tfcr; /* Tx function code */
  121. ushort smc_mrblr; /* Max receive buffer length */
  122. uint smc_rstate; /* Internal */
  123. uint smc_idp; /* Internal */
  124. ushort smc_rbptr; /* Internal */
  125. ushort smc_ibc; /* Internal */
  126. uint smc_rxtmp; /* Internal */
  127. uint smc_tstate; /* Internal */
  128. uint smc_tdp; /* Internal */
  129. ushort smc_tbptr; /* Internal */
  130. ushort smc_tbc; /* Internal */
  131. uint smc_txtmp; /* Internal */
  132. ushort smc_maxidl; /* Maximum idle characters */
  133. ushort smc_tmpidl; /* Temporary idle counter */
  134. ushort smc_brklen; /* Last received break length */
  135. ushort smc_brkec; /* rcv'd break condition counter */
  136. ushort smc_brkcr; /* xmt break count register */
  137. ushort smc_rmask; /* Temporary bit mask */
  138. u_char res1[8];
  139. ushort smc_rpbase; /* Relocation pointer */
  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. /* SI Clock Route Register
  218. */
  219. #define SICR_RCLK_SCC1_BRG1 ((uint)0x00000000)
  220. #define SICR_TCLK_SCC1_BRG1 ((uint)0x00000000)
  221. #define SICR_RCLK_SCC2_BRG2 ((uint)0x00000800)
  222. #define SICR_TCLK_SCC2_BRG2 ((uint)0x00000100)
  223. #define SICR_RCLK_SCC3_BRG3 ((uint)0x00100000)
  224. #define SICR_TCLK_SCC3_BRG3 ((uint)0x00020000)
  225. #define SICR_RCLK_SCC4_BRG4 ((uint)0x18000000)
  226. #define SICR_TCLK_SCC4_BRG4 ((uint)0x03000000)
  227. /* SCCs.
  228. */
  229. #define SCC_GSMRH_IRP ((uint)0x00040000)
  230. #define SCC_GSMRH_GDE ((uint)0x00010000)
  231. #define SCC_GSMRH_TCRC_CCITT ((uint)0x00008000)
  232. #define SCC_GSMRH_TCRC_BISYNC ((uint)0x00004000)
  233. #define SCC_GSMRH_TCRC_HDLC ((uint)0x00000000)
  234. #define SCC_GSMRH_REVD ((uint)0x00002000)
  235. #define SCC_GSMRH_TRX ((uint)0x00001000)
  236. #define SCC_GSMRH_TTX ((uint)0x00000800)
  237. #define SCC_GSMRH_CDP ((uint)0x00000400)
  238. #define SCC_GSMRH_CTSP ((uint)0x00000200)
  239. #define SCC_GSMRH_CDS ((uint)0x00000100)
  240. #define SCC_GSMRH_CTSS ((uint)0x00000080)
  241. #define SCC_GSMRH_TFL ((uint)0x00000040)
  242. #define SCC_GSMRH_RFW ((uint)0x00000020)
  243. #define SCC_GSMRH_TXSY ((uint)0x00000010)
  244. #define SCC_GSMRH_SYNL16 ((uint)0x0000000c)
  245. #define SCC_GSMRH_SYNL8 ((uint)0x00000008)
  246. #define SCC_GSMRH_SYNL4 ((uint)0x00000004)
  247. #define SCC_GSMRH_RTSM ((uint)0x00000002)
  248. #define SCC_GSMRH_RSYN ((uint)0x00000001)
  249. #define SCC_GSMRL_SIR ((uint)0x80000000) /* SCC2 only */
  250. #define SCC_GSMRL_EDGE_NONE ((uint)0x60000000)
  251. #define SCC_GSMRL_EDGE_NEG ((uint)0x40000000)
  252. #define SCC_GSMRL_EDGE_POS ((uint)0x20000000)
  253. #define SCC_GSMRL_EDGE_BOTH ((uint)0x00000000)
  254. #define SCC_GSMRL_TCI ((uint)0x10000000)
  255. #define SCC_GSMRL_TSNC_3 ((uint)0x0c000000)
  256. #define SCC_GSMRL_TSNC_4 ((uint)0x08000000)
  257. #define SCC_GSMRL_TSNC_14 ((uint)0x04000000)
  258. #define SCC_GSMRL_TSNC_INF ((uint)0x00000000)
  259. #define SCC_GSMRL_RINV ((uint)0x02000000)
  260. #define SCC_GSMRL_TINV ((uint)0x01000000)
  261. #define SCC_GSMRL_TPL_128 ((uint)0x00c00000)
  262. #define SCC_GSMRL_TPL_64 ((uint)0x00a00000)
  263. #define SCC_GSMRL_TPL_48 ((uint)0x00800000)
  264. #define SCC_GSMRL_TPL_32 ((uint)0x00600000)
  265. #define SCC_GSMRL_TPL_16 ((uint)0x00400000)
  266. #define SCC_GSMRL_TPL_8 ((uint)0x00200000)
  267. #define SCC_GSMRL_TPL_NONE ((uint)0x00000000)
  268. #define SCC_GSMRL_TPP_ALL1 ((uint)0x00180000)
  269. #define SCC_GSMRL_TPP_01 ((uint)0x00100000)
  270. #define SCC_GSMRL_TPP_10 ((uint)0x00080000)
  271. #define SCC_GSMRL_TPP_ZEROS ((uint)0x00000000)
  272. #define SCC_GSMRL_TEND ((uint)0x00040000)
  273. #define SCC_GSMRL_TDCR_32 ((uint)0x00030000)
  274. #define SCC_GSMRL_TDCR_16 ((uint)0x00020000)
  275. #define SCC_GSMRL_TDCR_8 ((uint)0x00010000)
  276. #define SCC_GSMRL_TDCR_1 ((uint)0x00000000)
  277. #define SCC_GSMRL_RDCR_32 ((uint)0x0000c000)
  278. #define SCC_GSMRL_RDCR_16 ((uint)0x00008000)
  279. #define SCC_GSMRL_RDCR_8 ((uint)0x00004000)
  280. #define SCC_GSMRL_RDCR_1 ((uint)0x00000000)
  281. #define SCC_GSMRL_RENC_DFMAN ((uint)0x00003000)
  282. #define SCC_GSMRL_RENC_MANCH ((uint)0x00002000)
  283. #define SCC_GSMRL_RENC_FM0 ((uint)0x00001000)
  284. #define SCC_GSMRL_RENC_NRZI ((uint)0x00000800)
  285. #define SCC_GSMRL_RENC_NRZ ((uint)0x00000000)
  286. #define SCC_GSMRL_TENC_DFMAN ((uint)0x00000600)
  287. #define SCC_GSMRL_TENC_MANCH ((uint)0x00000400)
  288. #define SCC_GSMRL_TENC_FM0 ((uint)0x00000200)
  289. #define SCC_GSMRL_TENC_NRZI ((uint)0x00000100)
  290. #define SCC_GSMRL_TENC_NRZ ((uint)0x00000000)
  291. #define SCC_GSMRL_DIAG_LE ((uint)0x000000c0) /* Loop and echo */
  292. #define SCC_GSMRL_DIAG_ECHO ((uint)0x00000080)
  293. #define SCC_GSMRL_DIAG_LOOP ((uint)0x00000040)
  294. #define SCC_GSMRL_DIAG_NORM ((uint)0x00000000)
  295. #define SCC_GSMRL_ENR ((uint)0x00000020)
  296. #define SCC_GSMRL_ENT ((uint)0x00000010)
  297. #define SCC_GSMRL_MODE_ENET ((uint)0x0000000c)
  298. #define SCC_GSMRL_MODE_DDCMP ((uint)0x00000009)
  299. #define SCC_GSMRL_MODE_BISYNC ((uint)0x00000008)
  300. #define SCC_GSMRL_MODE_V14 ((uint)0x00000007)
  301. #define SCC_GSMRL_MODE_AHDLC ((uint)0x00000006)
  302. #define SCC_GSMRL_MODE_PROFIBUS ((uint)0x00000005)
  303. #define SCC_GSMRL_MODE_UART ((uint)0x00000004)
  304. #define SCC_GSMRL_MODE_SS7 ((uint)0x00000003)
  305. #define SCC_GSMRL_MODE_ATALK ((uint)0x00000002)
  306. #define SCC_GSMRL_MODE_HDLC ((uint)0x00000000)
  307. #define SCC_TODR_TOD ((ushort)0x8000)
  308. /* SCC Event and Mask register.
  309. */
  310. #define SCCM_TXE ((unsigned char)0x10)
  311. #define SCCM_BSY ((unsigned char)0x04)
  312. #define SCCM_TX ((unsigned char)0x02)
  313. #define SCCM_RX ((unsigned char)0x01)
  314. typedef struct scc_param {
  315. ushort scc_rbase; /* Rx Buffer descriptor base address */
  316. ushort scc_tbase; /* Tx Buffer descriptor base address */
  317. u_char scc_rfcr; /* Rx function code */
  318. u_char scc_tfcr; /* Tx function code */
  319. ushort scc_mrblr; /* Max receive buffer length */
  320. uint scc_rstate; /* Internal */
  321. uint scc_idp; /* Internal */
  322. ushort scc_rbptr; /* Internal */
  323. ushort scc_ibc; /* Internal */
  324. uint scc_rxtmp; /* Internal */
  325. uint scc_tstate; /* Internal */
  326. uint scc_tdp; /* Internal */
  327. ushort scc_tbptr; /* Internal */
  328. ushort scc_tbc; /* Internal */
  329. uint scc_txtmp; /* Internal */
  330. uint scc_rcrc; /* Internal */
  331. uint scc_tcrc; /* Internal */
  332. } sccp_t;
  333. /* Function code bits.
  334. */
  335. #define SCC_EB ((u_char)0x10) /* Set big endian byte order */
  336. /* CPM Ethernet through SCCx.
  337. */
  338. typedef struct scc_enet {
  339. sccp_t sen_genscc;
  340. uint sen_cpres; /* Preset CRC */
  341. uint sen_cmask; /* Constant mask for CRC */
  342. uint sen_crcec; /* CRC Error counter */
  343. uint sen_alec; /* alignment error counter */
  344. uint sen_disfc; /* discard frame counter */
  345. ushort sen_pads; /* Tx short frame pad character */
  346. ushort sen_retlim; /* Retry limit threshold */
  347. ushort sen_retcnt; /* Retry limit counter */
  348. ushort sen_maxflr; /* maximum frame length register */
  349. ushort sen_minflr; /* minimum frame length register */
  350. ushort sen_maxd1; /* maximum DMA1 length */
  351. ushort sen_maxd2; /* maximum DMA2 length */
  352. ushort sen_maxd; /* Rx max DMA */
  353. ushort sen_dmacnt; /* Rx DMA counter */
  354. ushort sen_maxb; /* Max BD byte count */
  355. ushort sen_gaddr1; /* Group address filter */
  356. ushort sen_gaddr2;
  357. ushort sen_gaddr3;
  358. ushort sen_gaddr4;
  359. uint sen_tbuf0data0; /* Save area 0 - current frame */
  360. uint sen_tbuf0data1; /* Save area 1 - current frame */
  361. uint sen_tbuf0rba; /* Internal */
  362. uint sen_tbuf0crc; /* Internal */
  363. ushort sen_tbuf0bcnt; /* Internal */
  364. ushort sen_paddrh; /* physical address (MSB) */
  365. ushort sen_paddrm;
  366. ushort sen_paddrl; /* physical address (LSB) */
  367. ushort sen_pper; /* persistence */
  368. ushort sen_rfbdptr; /* Rx first BD pointer */
  369. ushort sen_tfbdptr; /* Tx first BD pointer */
  370. ushort sen_tlbdptr; /* Tx last BD pointer */
  371. uint sen_tbuf1data0; /* Save area 0 - current frame */
  372. uint sen_tbuf1data1; /* Save area 1 - current frame */
  373. uint sen_tbuf1rba; /* Internal */
  374. uint sen_tbuf1crc; /* Internal */
  375. ushort sen_tbuf1bcnt; /* Internal */
  376. ushort sen_txlen; /* Tx Frame length counter */
  377. ushort sen_iaddr1; /* Individual address filter */
  378. ushort sen_iaddr2;
  379. ushort sen_iaddr3;
  380. ushort sen_iaddr4;
  381. ushort sen_boffcnt; /* Backoff counter */
  382. /* NOTE: Some versions of the manual have the following items
  383. * incorrectly documented. Below is the proper order.
  384. */
  385. ushort sen_taddrh; /* temp address (MSB) */
  386. ushort sen_taddrm;
  387. ushort sen_taddrl; /* temp address (LSB) */
  388. } scc_enet_t;
  389. /**********************************************************************
  390. *
  391. * Board specific configuration settings.
  392. *
  393. * Please note that we use the presence of a #define SCC_ENET and/or
  394. * #define FEC_ENET to enable the SCC resp. FEC ethernet drivers.
  395. **********************************************************************/
  396. /*** BSEIP **********************************************************/
  397. #ifdef CONFIG_BSEIP
  398. /* This ENET stuff is for the MPC823 with ethernet on SCC2.
  399. * This is unique to the BSE ip-Engine board.
  400. */
  401. #define PROFF_ENET PROFF_SCC2
  402. #define CPM_CR_ENET CPM_CR_CH_SCC2
  403. #define SCC_ENET 1
  404. #define PA_ENET_RXD ((ushort)0x0004)
  405. #define PA_ENET_TXD ((ushort)0x0008)
  406. #define PA_ENET_TCLK ((ushort)0x0100)
  407. #define PA_ENET_RCLK ((ushort)0x0200)
  408. #define PB_ENET_TENA ((uint)0x00002000)
  409. #define PC_ENET_CLSN ((ushort)0x0040)
  410. #define PC_ENET_RENA ((ushort)0x0080)
  411. /* BSE uses port B and C bits for PHY control also.
  412. */
  413. #define PB_BSE_POWERUP ((uint)0x00000004)
  414. #define PB_BSE_FDXDIS ((uint)0x00008000)
  415. #define PC_BSE_LOOPBACK ((ushort)0x0800)
  416. #define SICR_ENET_MASK ((uint)0x0000ff00)
  417. #define SICR_ENET_CLKRT ((uint)0x00002c00)
  418. #endif /* CONFIG_BSEIP */
  419. /*** ESTEEM 192E **************************************************/
  420. #ifdef CONFIG_ESTEEM192E
  421. /* ESTEEM192E
  422. * This ENET stuff is for the MPC850 with ethernet on SCC2. This
  423. * is very similar to the RPX-Lite configuration.
  424. * Note TENA , LOOPBACK , FDPLEX_DIS on Port B.
  425. */
  426. #define PROFF_ENET PROFF_SCC2
  427. #define CPM_CR_ENET CPM_CR_CH_SCC2
  428. #define SCC_ENET 1
  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. #define PB_ENET_LOOPBACK ((uint)0x00004000)
  439. #define PB_ENET_FDPLEX_DIS ((uint)0x00008000)
  440. #endif
  441. /*** IP860 **********************************************************/
  442. #if defined(CONFIG_IP860)
  443. /* Bits in parallel I/O port registers that have to be set/cleared
  444. * to configure the pins for SCC1 use.
  445. */
  446. #define PROFF_ENET PROFF_SCC1
  447. #define CPM_CR_ENET CPM_CR_CH_SCC1
  448. #define SCC_ENET 0
  449. #define PA_ENET_RXD ((ushort)0x0001) /* PA 15 */
  450. #define PA_ENET_TXD ((ushort)0x0002) /* PA 14 */
  451. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  452. #define PA_ENET_TCLK ((ushort)0x0100) /* PA 7 */
  453. #define PC_ENET_TENA ((ushort)0x0001) /* PC 15 */
  454. #define PC_ENET_CLSN ((ushort)0x0010) /* PC 11 */
  455. #define PC_ENET_RENA ((ushort)0x0020) /* PC 10 */
  456. #define PB_ENET_RESET (uint)0x00000008 /* PB 28 */
  457. #define PB_ENET_JABD (uint)0x00000004 /* PB 29 */
  458. /* Control bits in the SICR to route TCLK (CLK1) and RCLK (CLK2) to
  459. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  460. */
  461. #define SICR_ENET_MASK ((uint)0x000000ff)
  462. #define SICR_ENET_CLKRT ((uint)0x0000002C)
  463. #endif /* CONFIG_IP860 */
  464. /*** IVMS8 **********************************************************/
  465. /* The IVMS8 uses the FEC on a MPC860T for Ethernet */
  466. #if defined(CONFIG_IVMS8) || defined(CONFIG_IVML24)
  467. #define FEC_ENET /* use FEC for EThernet */
  468. #undef SCC_ENET
  469. #define PB_ENET_POWER ((uint)0x00010000) /* PB 15 */
  470. #define PC_ENET_RESET ((ushort)0x0010) /* PC 11 */
  471. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  472. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  473. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  474. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  475. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  476. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  477. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  478. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  479. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  480. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  481. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  482. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  483. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  484. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  485. #endif /* CONFIG_IVMS8, CONFIG_IVML24 */
  486. /*** LWMON **********************************************************/
  487. #if defined(CONFIG_LWMON)
  488. /* Bits in parallel I/O port registers that have to be set/cleared
  489. * to configure the pins for SCC2 use.
  490. */
  491. #define PROFF_ENET PROFF_SCC2
  492. #define CPM_CR_ENET CPM_CR_CH_SCC2
  493. #define SCC_ENET 1
  494. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  495. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  496. #define PA_ENET_RCLK ((ushort)0x0800) /* PA 4 */
  497. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  498. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  499. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  500. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  501. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK4) to
  502. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  503. */
  504. #define SICR_ENET_MASK ((uint)0x0000ff00)
  505. #define SICR_ENET_CLKRT ((uint)0x00003E00)
  506. #endif /* CONFIG_LWMON */
  507. /*** KM8XX *********************************************************/
  508. /* The KM8XX Service Module uses SCC3 for Ethernet */
  509. #ifdef CONFIG_KM8XX
  510. #define PROFF_ENET PROFF_SCC3 /* Ethernet on SCC3 */
  511. #define CPM_CR_ENET CPM_CR_CH_SCC3
  512. #define SCC_ENET 2
  513. #define PA_ENET_RXD ((ushort)0x0010) /* PA 11 */
  514. #define PA_ENET_TXD ((ushort)0x0020) /* PA 10 */
  515. #define PA_ENET_RCLK ((ushort)0x1000) /* PA 3 CLK 5 */
  516. #define PA_ENET_TCLK ((ushort)0x2000) /* PA 2 CLK 6 */
  517. #define PC_ENET_TENA ((ushort)0x0004) /* PC 13 */
  518. #define PC_ENET_RENA ((ushort)0x0200) /* PC 6 */
  519. #define PC_ENET_CLSN ((ushort)0x0100) /* PC 7 */
  520. /* Control bits in the SICR to route TCLK (CLK6) and RCLK (CLK5) to
  521. * SCC3. Also, make sure GR3 (bit 8) and SC3 (bit 9) are zero.
  522. */
  523. #define SICR_ENET_MASK ((uint)0x00FF0000)
  524. #define SICR_ENET_CLKRT ((uint)0x00250000)
  525. #endif /* CONFIG_KM8XX */
  526. /*** NETVIA *******************************************************/
  527. #if defined(CONFIG_NETVIA)
  528. /* Bits in parallel I/O port registers that have to be set/cleared
  529. * to configure the pins for SCC2 use.
  530. */
  531. #define PROFF_ENET PROFF_SCC2
  532. #define CPM_CR_ENET CPM_CR_CH_SCC2
  533. #define SCC_ENET 1
  534. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  535. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  536. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  537. #define PA_ENET_TCLK ((ushort)0x0800) /* PA 4 */
  538. #if !defined(CONFIG_NETVIA_VERSION) || CONFIG_NETVIA_VERSION == 1
  539. # define PB_ENET_PDN ((ushort)0x4000) /* PB 17 */
  540. #elif CONFIG_NETVIA_VERSION >= 2
  541. # define PC_ENET_PDN ((ushort)0x0008) /* PC 12 */
  542. #endif
  543. #define PB_ENET_TENA ((ushort)0x2000) /* PB 18 */
  544. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  545. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  546. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  547. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  548. */
  549. #define SICR_ENET_MASK ((uint)0x0000ff00)
  550. #define SICR_ENET_CLKRT ((uint)0x00002f00)
  551. #endif /* CONFIG_NETVIA */
  552. /*** SPD823TS ******************************************************/
  553. #ifdef CONFIG_SPD823TS
  554. /* Bits in parallel I/O port registers that have to be set/cleared
  555. * to configure the pins for SCC2 use.
  556. */
  557. #define PROFF_ENET PROFF_SCC2 /* Ethernet on SCC2 */
  558. #define CPM_CR_ENET CPM_CR_CH_SCC2
  559. #define SCC_ENET 1
  560. #define PA_ENET_MDC ((ushort)0x0001) /* PA 15 !!! */
  561. #define PA_ENET_MDIO ((ushort)0x0002) /* PA 14 !!! */
  562. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  563. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  564. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  565. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  566. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  567. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  568. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  569. #define PC_ENET_RESET ((ushort)0x0100) /* PC 7 !!! */
  570. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK2) to
  571. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  572. */
  573. #define SICR_ENET_MASK ((uint)0x0000ff00)
  574. #define SICR_ENET_CLKRT ((uint)0x00002E00)
  575. #endif /* CONFIG_SPD823TS */
  576. /*** MVS1, TQM823L/M, TQM850L/M, TQM885D, R360MPI **********/
  577. #if (defined(CONFIG_MVS) && CONFIG_MVS < 2) || \
  578. defined(CONFIG_R360MPI) || \
  579. defined(CONFIG_RRVISION)|| defined(CONFIG_TQM823L) || \
  580. defined(CONFIG_TQM823M) || defined(CONFIG_TQM850L) || \
  581. defined(CONFIG_TQM850M) || defined(CONFIG_TQM885D) || \
  582. defined(CONFIG_RRVISION)
  583. /* Bits in parallel I/O port registers that have to be set/cleared
  584. * to configure the pins for SCC2 use.
  585. */
  586. #define PROFF_ENET PROFF_SCC2
  587. #define CPM_CR_ENET CPM_CR_CH_SCC2
  588. #define SCC_ENET 1
  589. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  590. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  591. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  592. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  593. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  594. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  595. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  596. #if defined(CONFIG_R360MPI)
  597. #define PC_ENET_LBK ((ushort)0x0008) /* PC 12 */
  598. #endif /* CONFIG_R360MPI */
  599. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  600. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  601. */
  602. #define SICR_ENET_MASK ((uint)0x0000ff00)
  603. #define SICR_ENET_CLKRT ((uint)0x00002600)
  604. # ifdef CONFIG_FEC_ENET /* Use FEC for Fast Ethernet */
  605. #define FEC_ENET
  606. # endif /* CONFIG_FEC_ENET */
  607. #endif /* CONFIG_MVS v1, CONFIG_TQM823L/M, CONFIG_TQM850L/M, etc. */
  608. /*** TQM855L/M, TQM860L/M, TQM862L/M, TQM866L/M *********************/
  609. #if defined(CONFIG_TQM855L) || defined(CONFIG_TQM855M) || \
  610. defined(CONFIG_TQM860L) || defined(CONFIG_TQM860M) || \
  611. defined(CONFIG_TQM862L) || defined(CONFIG_TQM862M) || \
  612. defined(CONFIG_TQM866L) || defined(CONFIG_TQM866M)
  613. # ifdef CONFIG_SCC1_ENET /* use SCC for 10Mbps Ethernet */
  614. /* Bits in parallel I/O port registers that have to be set/cleared
  615. * to configure the pins for SCC1 use.
  616. */
  617. #define PROFF_ENET PROFF_SCC1
  618. #define CPM_CR_ENET CPM_CR_CH_SCC1
  619. #define SCC_ENET 0
  620. #define PA_ENET_RXD ((ushort)0x0001) /* PA 15 */
  621. #define PA_ENET_TXD ((ushort)0x0002) /* PA 14 */
  622. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  623. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  624. #define PC_ENET_TENA ((ushort)0x0001) /* PC 15 */
  625. #define PC_ENET_CLSN ((ushort)0x0010) /* PC 11 */
  626. #define PC_ENET_RENA ((ushort)0x0020) /* PC 10 */
  627. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  628. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  629. */
  630. #define SICR_ENET_MASK ((uint)0x000000ff)
  631. #define SICR_ENET_CLKRT ((uint)0x00000026)
  632. # endif /* CONFIG_SCC1_ENET */
  633. # ifdef CONFIG_FEC_ENET /* Use FEC for Fast Ethernet */
  634. #define FEC_ENET
  635. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  636. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  637. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  638. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  639. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  640. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  641. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  642. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  643. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  644. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  645. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  646. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  647. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  648. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  649. # endif /* CONFIG_FEC_ENET */
  650. #endif /* CONFIG_TQM855L/M, TQM860L/M, TQM862L/M */
  651. /*********************************************************************/
  652. /* SCC Event register as used by Ethernet.
  653. */
  654. #define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
  655. #define SCCE_ENET_TXE ((ushort)0x0010) /* Transmit Error */
  656. #define SCCE_ENET_RXF ((ushort)0x0008) /* Full frame received */
  657. #define SCCE_ENET_BSY ((ushort)0x0004) /* All incoming buffers full */
  658. #define SCCE_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */
  659. #define SCCE_ENET_RXB ((ushort)0x0001) /* A buffer was received */
  660. /* SCC Mode Register (PSMR) as used by Ethernet.
  661. */
  662. #define SCC_PSMR_HBC ((ushort)0x8000) /* Enable heartbeat */
  663. #define SCC_PSMR_FC ((ushort)0x4000) /* Force collision */
  664. #define SCC_PSMR_RSH ((ushort)0x2000) /* Receive short frames */
  665. #define SCC_PSMR_IAM ((ushort)0x1000) /* Check individual hash */
  666. #define SCC_PSMR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */
  667. #define SCC_PSMR_PRO ((ushort)0x0200) /* Promiscuous mode */
  668. #define SCC_PSMR_BRO ((ushort)0x0100) /* Catch broadcast pkts */
  669. #define SCC_PSMR_SBT ((ushort)0x0080) /* Special backoff timer */
  670. #define SCC_PSMR_LPB ((ushort)0x0040) /* Set Loopback mode */
  671. #define SCC_PSMR_SIP ((ushort)0x0020) /* Sample Input Pins */
  672. #define SCC_PSMR_LCW ((ushort)0x0010) /* Late collision window */
  673. #define SCC_PSMR_NIB22 ((ushort)0x000a) /* Start frame search */
  674. #define SCC_PSMR_FDE ((ushort)0x0001) /* Full duplex enable */
  675. /* Buffer descriptor control/status used by Ethernet receive.
  676. */
  677. #define BD_ENET_RX_EMPTY ((ushort)0x8000)
  678. #define BD_ENET_RX_WRAP ((ushort)0x2000)
  679. #define BD_ENET_RX_INTR ((ushort)0x1000)
  680. #define BD_ENET_RX_LAST ((ushort)0x0800)
  681. #define BD_ENET_RX_FIRST ((ushort)0x0400)
  682. #define BD_ENET_RX_MISS ((ushort)0x0100)
  683. #define BD_ENET_RX_LG ((ushort)0x0020)
  684. #define BD_ENET_RX_NO ((ushort)0x0010)
  685. #define BD_ENET_RX_SH ((ushort)0x0008)
  686. #define BD_ENET_RX_CR ((ushort)0x0004)
  687. #define BD_ENET_RX_OV ((ushort)0x0002)
  688. #define BD_ENET_RX_CL ((ushort)0x0001)
  689. #define BD_ENET_RX_STATS ((ushort)0x013f) /* All status bits */
  690. /* Buffer descriptor control/status used by Ethernet transmit.
  691. */
  692. #define BD_ENET_TX_READY ((ushort)0x8000)
  693. #define BD_ENET_TX_PAD ((ushort)0x4000)
  694. #define BD_ENET_TX_WRAP ((ushort)0x2000)
  695. #define BD_ENET_TX_INTR ((ushort)0x1000)
  696. #define BD_ENET_TX_LAST ((ushort)0x0800)
  697. #define BD_ENET_TX_TC ((ushort)0x0400)
  698. #define BD_ENET_TX_DEF ((ushort)0x0200)
  699. #define BD_ENET_TX_HB ((ushort)0x0100)
  700. #define BD_ENET_TX_LC ((ushort)0x0080)
  701. #define BD_ENET_TX_RL ((ushort)0x0040)
  702. #define BD_ENET_TX_RCMASK ((ushort)0x003c)
  703. #define BD_ENET_TX_UN ((ushort)0x0002)
  704. #define BD_ENET_TX_CSL ((ushort)0x0001)
  705. #define BD_ENET_TX_STATS ((ushort)0x03ff) /* All status bits */
  706. /* SCC as UART
  707. */
  708. typedef struct scc_uart {
  709. sccp_t scc_genscc;
  710. uint scc_res1; /* Reserved */
  711. uint scc_res2; /* Reserved */
  712. ushort scc_maxidl; /* Maximum idle chars */
  713. ushort scc_idlc; /* temp idle counter */
  714. ushort scc_brkcr; /* Break count register */
  715. ushort scc_parec; /* receive parity error counter */
  716. ushort scc_frmec; /* receive framing error counter */
  717. ushort scc_nosec; /* receive noise counter */
  718. ushort scc_brkec; /* receive break condition counter */
  719. ushort scc_brkln; /* last received break length */
  720. ushort scc_uaddr1; /* UART address character 1 */
  721. ushort scc_uaddr2; /* UART address character 2 */
  722. ushort scc_rtemp; /* Temp storage */
  723. ushort scc_toseq; /* Transmit out of sequence char */
  724. ushort scc_char1; /* control character 1 */
  725. ushort scc_char2; /* control character 2 */
  726. ushort scc_char3; /* control character 3 */
  727. ushort scc_char4; /* control character 4 */
  728. ushort scc_char5; /* control character 5 */
  729. ushort scc_char6; /* control character 6 */
  730. ushort scc_char7; /* control character 7 */
  731. ushort scc_char8; /* control character 8 */
  732. ushort scc_rccm; /* receive control character mask */
  733. ushort scc_rccr; /* receive control character register */
  734. ushort scc_rlbc; /* receive last break character */
  735. } scc_uart_t;
  736. /* SCC Event and Mask registers when it is used as a UART.
  737. */
  738. #define UART_SCCM_GLR ((ushort)0x1000)
  739. #define UART_SCCM_GLT ((ushort)0x0800)
  740. #define UART_SCCM_AB ((ushort)0x0200)
  741. #define UART_SCCM_IDL ((ushort)0x0100)
  742. #define UART_SCCM_GRA ((ushort)0x0080)
  743. #define UART_SCCM_BRKE ((ushort)0x0040)
  744. #define UART_SCCM_BRKS ((ushort)0x0020)
  745. #define UART_SCCM_CCR ((ushort)0x0008)
  746. #define UART_SCCM_BSY ((ushort)0x0004)
  747. #define UART_SCCM_TX ((ushort)0x0002)
  748. #define UART_SCCM_RX ((ushort)0x0001)
  749. /* The SCC PSMR when used as a UART.
  750. */
  751. #define SCU_PSMR_FLC ((ushort)0x8000)
  752. #define SCU_PSMR_SL ((ushort)0x4000)
  753. #define SCU_PSMR_CL ((ushort)0x3000)
  754. #define SCU_PSMR_UM ((ushort)0x0c00)
  755. #define SCU_PSMR_FRZ ((ushort)0x0200)
  756. #define SCU_PSMR_RZS ((ushort)0x0100)
  757. #define SCU_PSMR_SYN ((ushort)0x0080)
  758. #define SCU_PSMR_DRT ((ushort)0x0040)
  759. #define SCU_PSMR_PEN ((ushort)0x0010)
  760. #define SCU_PSMR_RPM ((ushort)0x000c)
  761. #define SCU_PSMR_REVP ((ushort)0x0008)
  762. #define SCU_PSMR_TPM ((ushort)0x0003)
  763. #define SCU_PSMR_TEVP ((ushort)0x0003)
  764. /* CPM Transparent mode SCC.
  765. */
  766. typedef struct scc_trans {
  767. sccp_t st_genscc;
  768. uint st_cpres; /* Preset CRC */
  769. uint st_cmask; /* Constant mask for CRC */
  770. } scc_trans_t;
  771. #define BD_SCC_TX_LAST ((ushort)0x0800)
  772. /* IIC parameter RAM.
  773. */
  774. typedef struct iic {
  775. ushort iic_rbase; /* Rx Buffer descriptor base address */
  776. ushort iic_tbase; /* Tx Buffer descriptor base address */
  777. u_char iic_rfcr; /* Rx function code */
  778. u_char iic_tfcr; /* Tx function code */
  779. ushort iic_mrblr; /* Max receive buffer length */
  780. uint iic_rstate; /* Internal */
  781. uint iic_rdp; /* Internal */
  782. ushort iic_rbptr; /* Internal */
  783. ushort iic_rbc; /* Internal */
  784. uint iic_rxtmp; /* Internal */
  785. uint iic_tstate; /* Internal */
  786. uint iic_tdp; /* Internal */
  787. ushort iic_tbptr; /* Internal */
  788. ushort iic_tbc; /* Internal */
  789. uint iic_txtmp; /* Internal */
  790. uint iic_res; /* reserved */
  791. ushort iic_rpbase; /* Relocation pointer */
  792. ushort iic_res2; /* reserved */
  793. } iic_t;
  794. /* SPI parameter RAM.
  795. */
  796. typedef struct spi {
  797. ushort spi_rbase; /* Rx Buffer descriptor base address */
  798. ushort spi_tbase; /* Tx Buffer descriptor base address */
  799. u_char spi_rfcr; /* Rx function code */
  800. u_char spi_tfcr; /* Tx function code */
  801. ushort spi_mrblr; /* Max receive buffer length */
  802. uint spi_rstate; /* Internal */
  803. uint spi_rdp; /* Internal */
  804. ushort spi_rbptr; /* Internal */
  805. ushort spi_rbc; /* Internal */
  806. uint spi_rxtmp; /* Internal */
  807. uint spi_tstate; /* Internal */
  808. uint spi_tdp; /* Internal */
  809. ushort spi_tbptr; /* Internal */
  810. ushort spi_tbc; /* Internal */
  811. uint spi_txtmp; /* Internal */
  812. uint spi_res;
  813. ushort spi_rpbase; /* Relocation pointer */
  814. ushort spi_res2;
  815. } spi_t;
  816. /* SPI Mode register.
  817. */
  818. #define SPMODE_LOOP ((ushort)0x4000) /* Loopback */
  819. #define SPMODE_CI ((ushort)0x2000) /* Clock Invert */
  820. #define SPMODE_CP ((ushort)0x1000) /* Clock Phase */
  821. #define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */
  822. #define SPMODE_REV ((ushort)0x0400) /* Reversed Data */
  823. #define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */
  824. #define SPMODE_EN ((ushort)0x0100) /* Enable */
  825. #define SPMODE_LENMSK ((ushort)0x00f0) /* character length */
  826. #define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */
  827. #define SPMODE_LEN(x) ((((x)-1)&0xF)<<4)
  828. #define SPMODE_PM(x) ((x) &0xF)
  829. /* HDLC parameter RAM.
  830. */
  831. typedef struct hdlc_pram_s {
  832. /*
  833. * SCC parameter RAM
  834. */
  835. ushort rbase; /* Rx Buffer descriptor base address */
  836. ushort tbase; /* Tx Buffer descriptor base address */
  837. uchar rfcr; /* Rx function code */
  838. uchar tfcr; /* Tx function code */
  839. ushort mrblr; /* Rx buffer length */
  840. ulong rstate; /* Rx internal state */
  841. ulong rptr; /* Rx internal data pointer */
  842. ushort rbptr; /* rb BD Pointer */
  843. ushort rcount; /* Rx internal byte count */
  844. ulong rtemp; /* Rx temp */
  845. ulong tstate; /* Tx internal state */
  846. ulong tptr; /* Tx internal data pointer */
  847. ushort tbptr; /* Tx BD pointer */
  848. ushort tcount; /* Tx byte count */
  849. ulong ttemp; /* Tx temp */
  850. ulong rcrc; /* temp receive CRC */
  851. ulong tcrc; /* temp transmit CRC */
  852. /*
  853. * HDLC specific parameter RAM
  854. */
  855. uchar res[4]; /* reserved */
  856. ulong c_mask; /* CRC constant */
  857. ulong c_pres; /* CRC preset */
  858. ushort disfc; /* discarded frame counter */
  859. ushort crcec; /* CRC error counter */
  860. ushort abtsc; /* abort sequence counter */
  861. ushort nmarc; /* nonmatching address rx cnt */
  862. ushort retrc; /* frame retransmission cnt */
  863. ushort mflr; /* maximum frame length reg */
  864. ushort max_cnt; /* maximum length counter */
  865. ushort rfthr; /* received frames threshold */
  866. ushort rfcnt; /* received frames count */
  867. ushort hmask; /* user defined frm addr mask */
  868. ushort haddr1; /* user defined frm address 1 */
  869. ushort haddr2; /* user defined frm address 2 */
  870. ushort haddr3; /* user defined frm address 3 */
  871. ushort haddr4; /* user defined frm address 4 */
  872. ushort tmp; /* temp */
  873. ushort tmp_mb; /* temp */
  874. } hdlc_pram_t;
  875. /* CPM interrupts. There are nearly 32 interrupts generated by CPM
  876. * channels or devices. All of these are presented to the PPC core
  877. * as a single interrupt. The CPM interrupt handler dispatches its
  878. * own handlers, in a similar fashion to the PPC core handler. We
  879. * use the table as defined in the manuals (i.e. no special high
  880. * priority and SCC1 == SCCa, etc...).
  881. */
  882. #define CPMVEC_NR 32
  883. #define CPMVEC_OFFSET 0x00010000
  884. #define CPMVEC_PIO_PC15 ((ushort)0x1f | CPMVEC_OFFSET)
  885. #define CPMVEC_SCC1 ((ushort)0x1e | CPMVEC_OFFSET)
  886. #define CPMVEC_SCC2 ((ushort)0x1d | CPMVEC_OFFSET)
  887. #define CPMVEC_SCC3 ((ushort)0x1c | CPMVEC_OFFSET)
  888. #define CPMVEC_SCC4 ((ushort)0x1b | CPMVEC_OFFSET)
  889. #define CPMVEC_PIO_PC14 ((ushort)0x1a | CPMVEC_OFFSET)
  890. #define CPMVEC_TIMER1 ((ushort)0x19 | CPMVEC_OFFSET)
  891. #define CPMVEC_PIO_PC13 ((ushort)0x18 | CPMVEC_OFFSET)
  892. #define CPMVEC_PIO_PC12 ((ushort)0x17 | CPMVEC_OFFSET)
  893. #define CPMVEC_SDMA_CB_ERR ((ushort)0x16 | CPMVEC_OFFSET)
  894. #define CPMVEC_IDMA1 ((ushort)0x15 | CPMVEC_OFFSET)
  895. #define CPMVEC_IDMA2 ((ushort)0x14 | CPMVEC_OFFSET)
  896. #define CPMVEC_TIMER2 ((ushort)0x12 | CPMVEC_OFFSET)
  897. #define CPMVEC_RISCTIMER ((ushort)0x11 | CPMVEC_OFFSET)
  898. #define CPMVEC_I2C ((ushort)0x10 | CPMVEC_OFFSET)
  899. #define CPMVEC_PIO_PC11 ((ushort)0x0f | CPMVEC_OFFSET)
  900. #define CPMVEC_PIO_PC10 ((ushort)0x0e | CPMVEC_OFFSET)
  901. #define CPMVEC_TIMER3 ((ushort)0x0c | CPMVEC_OFFSET)
  902. #define CPMVEC_PIO_PC9 ((ushort)0x0b | CPMVEC_OFFSET)
  903. #define CPMVEC_PIO_PC8 ((ushort)0x0a | CPMVEC_OFFSET)
  904. #define CPMVEC_PIO_PC7 ((ushort)0x09 | CPMVEC_OFFSET)
  905. #define CPMVEC_TIMER4 ((ushort)0x07 | CPMVEC_OFFSET)
  906. #define CPMVEC_PIO_PC6 ((ushort)0x06 | CPMVEC_OFFSET)
  907. #define CPMVEC_SPI ((ushort)0x05 | CPMVEC_OFFSET)
  908. #define CPMVEC_SMC1 ((ushort)0x04 | CPMVEC_OFFSET)
  909. #define CPMVEC_SMC2 ((ushort)0x03 | CPMVEC_OFFSET)
  910. #define CPMVEC_PIO_PC5 ((ushort)0x02 | CPMVEC_OFFSET)
  911. #define CPMVEC_PIO_PC4 ((ushort)0x01 | CPMVEC_OFFSET)
  912. #define CPMVEC_ERROR ((ushort)0x00 | CPMVEC_OFFSET)
  913. extern void irq_install_handler(int vec, void (*handler)(void *), void *dev_id);
  914. /* CPM interrupt configuration vector.
  915. */
  916. #define CICR_SCD_SCC4 ((uint)0x00c00000) /* SCC4 @ SCCd */
  917. #define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */
  918. #define CICR_SCB_SCC2 ((uint)0x00040000) /* SCC2 @ SCCb */
  919. #define CICR_SCA_SCC1 ((uint)0x00000000) /* SCC1 @ SCCa */
  920. #define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrrupt */
  921. #define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */
  922. #define CICR_IEN ((uint)0x00000080) /* Int. enable */
  923. #define CICR_SPS ((uint)0x00000001) /* SCC Spread */
  924. #endif /* __CPM_8XX__ */