commproc.h 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016
  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. /*** MVS1, TQM823L/M, TQM850L/M, TQM885D, R360MPI **********/
  553. #if (defined(CONFIG_MVS) && CONFIG_MVS < 2) || \
  554. defined(CONFIG_R360MPI) || \
  555. defined(CONFIG_RRVISION)|| defined(CONFIG_TQM823L) || \
  556. defined(CONFIG_TQM823M) || defined(CONFIG_TQM850L) || \
  557. defined(CONFIG_TQM850M) || defined(CONFIG_TQM885D) || \
  558. defined(CONFIG_RRVISION)
  559. /* Bits in parallel I/O port registers that have to be set/cleared
  560. * to configure the pins for SCC2 use.
  561. */
  562. #define PROFF_ENET PROFF_SCC2
  563. #define CPM_CR_ENET CPM_CR_CH_SCC2
  564. #define SCC_ENET 1
  565. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  566. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  567. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  568. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  569. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  570. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  571. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  572. #if defined(CONFIG_R360MPI)
  573. #define PC_ENET_LBK ((ushort)0x0008) /* PC 12 */
  574. #endif /* CONFIG_R360MPI */
  575. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  576. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  577. */
  578. #define SICR_ENET_MASK ((uint)0x0000ff00)
  579. #define SICR_ENET_CLKRT ((uint)0x00002600)
  580. # ifdef CONFIG_FEC_ENET /* Use FEC for Fast Ethernet */
  581. #define FEC_ENET
  582. # endif /* CONFIG_FEC_ENET */
  583. #endif /* CONFIG_MVS v1, CONFIG_TQM823L/M, CONFIG_TQM850L/M, etc. */
  584. /*** TQM855L/M, TQM860L/M, TQM862L/M, TQM866L/M *********************/
  585. #if defined(CONFIG_TQM855L) || defined(CONFIG_TQM855M) || \
  586. defined(CONFIG_TQM860L) || defined(CONFIG_TQM860M) || \
  587. defined(CONFIG_TQM862L) || defined(CONFIG_TQM862M) || \
  588. defined(CONFIG_TQM866L) || defined(CONFIG_TQM866M)
  589. # ifdef CONFIG_SCC1_ENET /* use SCC for 10Mbps Ethernet */
  590. /* Bits in parallel I/O port registers that have to be set/cleared
  591. * to configure the pins for SCC1 use.
  592. */
  593. #define PROFF_ENET PROFF_SCC1
  594. #define CPM_CR_ENET CPM_CR_CH_SCC1
  595. #define SCC_ENET 0
  596. #define PA_ENET_RXD ((ushort)0x0001) /* PA 15 */
  597. #define PA_ENET_TXD ((ushort)0x0002) /* PA 14 */
  598. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  599. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  600. #define PC_ENET_TENA ((ushort)0x0001) /* PC 15 */
  601. #define PC_ENET_CLSN ((ushort)0x0010) /* PC 11 */
  602. #define PC_ENET_RENA ((ushort)0x0020) /* PC 10 */
  603. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  604. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  605. */
  606. #define SICR_ENET_MASK ((uint)0x000000ff)
  607. #define SICR_ENET_CLKRT ((uint)0x00000026)
  608. # endif /* CONFIG_SCC1_ENET */
  609. # ifdef CONFIG_FEC_ENET /* Use FEC for Fast Ethernet */
  610. #define FEC_ENET
  611. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  612. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  613. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  614. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  615. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  616. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  617. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  618. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  619. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  620. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  621. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  622. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  623. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  624. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  625. # endif /* CONFIG_FEC_ENET */
  626. #endif /* CONFIG_TQM855L/M, TQM860L/M, TQM862L/M */
  627. /*********************************************************************/
  628. /* SCC Event register as used by Ethernet.
  629. */
  630. #define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
  631. #define SCCE_ENET_TXE ((ushort)0x0010) /* Transmit Error */
  632. #define SCCE_ENET_RXF ((ushort)0x0008) /* Full frame received */
  633. #define SCCE_ENET_BSY ((ushort)0x0004) /* All incoming buffers full */
  634. #define SCCE_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */
  635. #define SCCE_ENET_RXB ((ushort)0x0001) /* A buffer was received */
  636. /* SCC Mode Register (PSMR) as used by Ethernet.
  637. */
  638. #define SCC_PSMR_HBC ((ushort)0x8000) /* Enable heartbeat */
  639. #define SCC_PSMR_FC ((ushort)0x4000) /* Force collision */
  640. #define SCC_PSMR_RSH ((ushort)0x2000) /* Receive short frames */
  641. #define SCC_PSMR_IAM ((ushort)0x1000) /* Check individual hash */
  642. #define SCC_PSMR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */
  643. #define SCC_PSMR_PRO ((ushort)0x0200) /* Promiscuous mode */
  644. #define SCC_PSMR_BRO ((ushort)0x0100) /* Catch broadcast pkts */
  645. #define SCC_PSMR_SBT ((ushort)0x0080) /* Special backoff timer */
  646. #define SCC_PSMR_LPB ((ushort)0x0040) /* Set Loopback mode */
  647. #define SCC_PSMR_SIP ((ushort)0x0020) /* Sample Input Pins */
  648. #define SCC_PSMR_LCW ((ushort)0x0010) /* Late collision window */
  649. #define SCC_PSMR_NIB22 ((ushort)0x000a) /* Start frame search */
  650. #define SCC_PSMR_FDE ((ushort)0x0001) /* Full duplex enable */
  651. /* Buffer descriptor control/status used by Ethernet receive.
  652. */
  653. #define BD_ENET_RX_EMPTY ((ushort)0x8000)
  654. #define BD_ENET_RX_WRAP ((ushort)0x2000)
  655. #define BD_ENET_RX_INTR ((ushort)0x1000)
  656. #define BD_ENET_RX_LAST ((ushort)0x0800)
  657. #define BD_ENET_RX_FIRST ((ushort)0x0400)
  658. #define BD_ENET_RX_MISS ((ushort)0x0100)
  659. #define BD_ENET_RX_LG ((ushort)0x0020)
  660. #define BD_ENET_RX_NO ((ushort)0x0010)
  661. #define BD_ENET_RX_SH ((ushort)0x0008)
  662. #define BD_ENET_RX_CR ((ushort)0x0004)
  663. #define BD_ENET_RX_OV ((ushort)0x0002)
  664. #define BD_ENET_RX_CL ((ushort)0x0001)
  665. #define BD_ENET_RX_STATS ((ushort)0x013f) /* All status bits */
  666. /* Buffer descriptor control/status used by Ethernet transmit.
  667. */
  668. #define BD_ENET_TX_READY ((ushort)0x8000)
  669. #define BD_ENET_TX_PAD ((ushort)0x4000)
  670. #define BD_ENET_TX_WRAP ((ushort)0x2000)
  671. #define BD_ENET_TX_INTR ((ushort)0x1000)
  672. #define BD_ENET_TX_LAST ((ushort)0x0800)
  673. #define BD_ENET_TX_TC ((ushort)0x0400)
  674. #define BD_ENET_TX_DEF ((ushort)0x0200)
  675. #define BD_ENET_TX_HB ((ushort)0x0100)
  676. #define BD_ENET_TX_LC ((ushort)0x0080)
  677. #define BD_ENET_TX_RL ((ushort)0x0040)
  678. #define BD_ENET_TX_RCMASK ((ushort)0x003c)
  679. #define BD_ENET_TX_UN ((ushort)0x0002)
  680. #define BD_ENET_TX_CSL ((ushort)0x0001)
  681. #define BD_ENET_TX_STATS ((ushort)0x03ff) /* All status bits */
  682. /* SCC as UART
  683. */
  684. typedef struct scc_uart {
  685. sccp_t scc_genscc;
  686. uint scc_res1; /* Reserved */
  687. uint scc_res2; /* Reserved */
  688. ushort scc_maxidl; /* Maximum idle chars */
  689. ushort scc_idlc; /* temp idle counter */
  690. ushort scc_brkcr; /* Break count register */
  691. ushort scc_parec; /* receive parity error counter */
  692. ushort scc_frmec; /* receive framing error counter */
  693. ushort scc_nosec; /* receive noise counter */
  694. ushort scc_brkec; /* receive break condition counter */
  695. ushort scc_brkln; /* last received break length */
  696. ushort scc_uaddr1; /* UART address character 1 */
  697. ushort scc_uaddr2; /* UART address character 2 */
  698. ushort scc_rtemp; /* Temp storage */
  699. ushort scc_toseq; /* Transmit out of sequence char */
  700. ushort scc_char1; /* control character 1 */
  701. ushort scc_char2; /* control character 2 */
  702. ushort scc_char3; /* control character 3 */
  703. ushort scc_char4; /* control character 4 */
  704. ushort scc_char5; /* control character 5 */
  705. ushort scc_char6; /* control character 6 */
  706. ushort scc_char7; /* control character 7 */
  707. ushort scc_char8; /* control character 8 */
  708. ushort scc_rccm; /* receive control character mask */
  709. ushort scc_rccr; /* receive control character register */
  710. ushort scc_rlbc; /* receive last break character */
  711. } scc_uart_t;
  712. /* SCC Event and Mask registers when it is used as a UART.
  713. */
  714. #define UART_SCCM_GLR ((ushort)0x1000)
  715. #define UART_SCCM_GLT ((ushort)0x0800)
  716. #define UART_SCCM_AB ((ushort)0x0200)
  717. #define UART_SCCM_IDL ((ushort)0x0100)
  718. #define UART_SCCM_GRA ((ushort)0x0080)
  719. #define UART_SCCM_BRKE ((ushort)0x0040)
  720. #define UART_SCCM_BRKS ((ushort)0x0020)
  721. #define UART_SCCM_CCR ((ushort)0x0008)
  722. #define UART_SCCM_BSY ((ushort)0x0004)
  723. #define UART_SCCM_TX ((ushort)0x0002)
  724. #define UART_SCCM_RX ((ushort)0x0001)
  725. /* The SCC PSMR when used as a UART.
  726. */
  727. #define SCU_PSMR_FLC ((ushort)0x8000)
  728. #define SCU_PSMR_SL ((ushort)0x4000)
  729. #define SCU_PSMR_CL ((ushort)0x3000)
  730. #define SCU_PSMR_UM ((ushort)0x0c00)
  731. #define SCU_PSMR_FRZ ((ushort)0x0200)
  732. #define SCU_PSMR_RZS ((ushort)0x0100)
  733. #define SCU_PSMR_SYN ((ushort)0x0080)
  734. #define SCU_PSMR_DRT ((ushort)0x0040)
  735. #define SCU_PSMR_PEN ((ushort)0x0010)
  736. #define SCU_PSMR_RPM ((ushort)0x000c)
  737. #define SCU_PSMR_REVP ((ushort)0x0008)
  738. #define SCU_PSMR_TPM ((ushort)0x0003)
  739. #define SCU_PSMR_TEVP ((ushort)0x0003)
  740. /* CPM Transparent mode SCC.
  741. */
  742. typedef struct scc_trans {
  743. sccp_t st_genscc;
  744. uint st_cpres; /* Preset CRC */
  745. uint st_cmask; /* Constant mask for CRC */
  746. } scc_trans_t;
  747. #define BD_SCC_TX_LAST ((ushort)0x0800)
  748. /* IIC parameter RAM.
  749. */
  750. typedef struct iic {
  751. ushort iic_rbase; /* Rx Buffer descriptor base address */
  752. ushort iic_tbase; /* Tx Buffer descriptor base address */
  753. u_char iic_rfcr; /* Rx function code */
  754. u_char iic_tfcr; /* Tx function code */
  755. ushort iic_mrblr; /* Max receive buffer length */
  756. uint iic_rstate; /* Internal */
  757. uint iic_rdp; /* Internal */
  758. ushort iic_rbptr; /* Internal */
  759. ushort iic_rbc; /* Internal */
  760. uint iic_rxtmp; /* Internal */
  761. uint iic_tstate; /* Internal */
  762. uint iic_tdp; /* Internal */
  763. ushort iic_tbptr; /* Internal */
  764. ushort iic_tbc; /* Internal */
  765. uint iic_txtmp; /* Internal */
  766. uint iic_res; /* reserved */
  767. ushort iic_rpbase; /* Relocation pointer */
  768. ushort iic_res2; /* reserved */
  769. } iic_t;
  770. /* SPI parameter RAM.
  771. */
  772. typedef struct spi {
  773. ushort spi_rbase; /* Rx Buffer descriptor base address */
  774. ushort spi_tbase; /* Tx Buffer descriptor base address */
  775. u_char spi_rfcr; /* Rx function code */
  776. u_char spi_tfcr; /* Tx function code */
  777. ushort spi_mrblr; /* Max receive buffer length */
  778. uint spi_rstate; /* Internal */
  779. uint spi_rdp; /* Internal */
  780. ushort spi_rbptr; /* Internal */
  781. ushort spi_rbc; /* Internal */
  782. uint spi_rxtmp; /* Internal */
  783. uint spi_tstate; /* Internal */
  784. uint spi_tdp; /* Internal */
  785. ushort spi_tbptr; /* Internal */
  786. ushort spi_tbc; /* Internal */
  787. uint spi_txtmp; /* Internal */
  788. uint spi_res;
  789. ushort spi_rpbase; /* Relocation pointer */
  790. ushort spi_res2;
  791. } spi_t;
  792. /* SPI Mode register.
  793. */
  794. #define SPMODE_LOOP ((ushort)0x4000) /* Loopback */
  795. #define SPMODE_CI ((ushort)0x2000) /* Clock Invert */
  796. #define SPMODE_CP ((ushort)0x1000) /* Clock Phase */
  797. #define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */
  798. #define SPMODE_REV ((ushort)0x0400) /* Reversed Data */
  799. #define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */
  800. #define SPMODE_EN ((ushort)0x0100) /* Enable */
  801. #define SPMODE_LENMSK ((ushort)0x00f0) /* character length */
  802. #define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */
  803. #define SPMODE_LEN(x) ((((x)-1)&0xF)<<4)
  804. #define SPMODE_PM(x) ((x) &0xF)
  805. /* HDLC parameter RAM.
  806. */
  807. typedef struct hdlc_pram_s {
  808. /*
  809. * SCC parameter RAM
  810. */
  811. ushort rbase; /* Rx Buffer descriptor base address */
  812. ushort tbase; /* Tx Buffer descriptor base address */
  813. uchar rfcr; /* Rx function code */
  814. uchar tfcr; /* Tx function code */
  815. ushort mrblr; /* Rx buffer length */
  816. ulong rstate; /* Rx internal state */
  817. ulong rptr; /* Rx internal data pointer */
  818. ushort rbptr; /* rb BD Pointer */
  819. ushort rcount; /* Rx internal byte count */
  820. ulong rtemp; /* Rx temp */
  821. ulong tstate; /* Tx internal state */
  822. ulong tptr; /* Tx internal data pointer */
  823. ushort tbptr; /* Tx BD pointer */
  824. ushort tcount; /* Tx byte count */
  825. ulong ttemp; /* Tx temp */
  826. ulong rcrc; /* temp receive CRC */
  827. ulong tcrc; /* temp transmit CRC */
  828. /*
  829. * HDLC specific parameter RAM
  830. */
  831. uchar res[4]; /* reserved */
  832. ulong c_mask; /* CRC constant */
  833. ulong c_pres; /* CRC preset */
  834. ushort disfc; /* discarded frame counter */
  835. ushort crcec; /* CRC error counter */
  836. ushort abtsc; /* abort sequence counter */
  837. ushort nmarc; /* nonmatching address rx cnt */
  838. ushort retrc; /* frame retransmission cnt */
  839. ushort mflr; /* maximum frame length reg */
  840. ushort max_cnt; /* maximum length counter */
  841. ushort rfthr; /* received frames threshold */
  842. ushort rfcnt; /* received frames count */
  843. ushort hmask; /* user defined frm addr mask */
  844. ushort haddr1; /* user defined frm address 1 */
  845. ushort haddr2; /* user defined frm address 2 */
  846. ushort haddr3; /* user defined frm address 3 */
  847. ushort haddr4; /* user defined frm address 4 */
  848. ushort tmp; /* temp */
  849. ushort tmp_mb; /* temp */
  850. } hdlc_pram_t;
  851. /* CPM interrupts. There are nearly 32 interrupts generated by CPM
  852. * channels or devices. All of these are presented to the PPC core
  853. * as a single interrupt. The CPM interrupt handler dispatches its
  854. * own handlers, in a similar fashion to the PPC core handler. We
  855. * use the table as defined in the manuals (i.e. no special high
  856. * priority and SCC1 == SCCa, etc...).
  857. */
  858. #define CPMVEC_NR 32
  859. #define CPMVEC_OFFSET 0x00010000
  860. #define CPMVEC_PIO_PC15 ((ushort)0x1f | CPMVEC_OFFSET)
  861. #define CPMVEC_SCC1 ((ushort)0x1e | CPMVEC_OFFSET)
  862. #define CPMVEC_SCC2 ((ushort)0x1d | CPMVEC_OFFSET)
  863. #define CPMVEC_SCC3 ((ushort)0x1c | CPMVEC_OFFSET)
  864. #define CPMVEC_SCC4 ((ushort)0x1b | CPMVEC_OFFSET)
  865. #define CPMVEC_PIO_PC14 ((ushort)0x1a | CPMVEC_OFFSET)
  866. #define CPMVEC_TIMER1 ((ushort)0x19 | CPMVEC_OFFSET)
  867. #define CPMVEC_PIO_PC13 ((ushort)0x18 | CPMVEC_OFFSET)
  868. #define CPMVEC_PIO_PC12 ((ushort)0x17 | CPMVEC_OFFSET)
  869. #define CPMVEC_SDMA_CB_ERR ((ushort)0x16 | CPMVEC_OFFSET)
  870. #define CPMVEC_IDMA1 ((ushort)0x15 | CPMVEC_OFFSET)
  871. #define CPMVEC_IDMA2 ((ushort)0x14 | CPMVEC_OFFSET)
  872. #define CPMVEC_TIMER2 ((ushort)0x12 | CPMVEC_OFFSET)
  873. #define CPMVEC_RISCTIMER ((ushort)0x11 | CPMVEC_OFFSET)
  874. #define CPMVEC_I2C ((ushort)0x10 | CPMVEC_OFFSET)
  875. #define CPMVEC_PIO_PC11 ((ushort)0x0f | CPMVEC_OFFSET)
  876. #define CPMVEC_PIO_PC10 ((ushort)0x0e | CPMVEC_OFFSET)
  877. #define CPMVEC_TIMER3 ((ushort)0x0c | CPMVEC_OFFSET)
  878. #define CPMVEC_PIO_PC9 ((ushort)0x0b | CPMVEC_OFFSET)
  879. #define CPMVEC_PIO_PC8 ((ushort)0x0a | CPMVEC_OFFSET)
  880. #define CPMVEC_PIO_PC7 ((ushort)0x09 | CPMVEC_OFFSET)
  881. #define CPMVEC_TIMER4 ((ushort)0x07 | CPMVEC_OFFSET)
  882. #define CPMVEC_PIO_PC6 ((ushort)0x06 | CPMVEC_OFFSET)
  883. #define CPMVEC_SPI ((ushort)0x05 | CPMVEC_OFFSET)
  884. #define CPMVEC_SMC1 ((ushort)0x04 | CPMVEC_OFFSET)
  885. #define CPMVEC_SMC2 ((ushort)0x03 | CPMVEC_OFFSET)
  886. #define CPMVEC_PIO_PC5 ((ushort)0x02 | CPMVEC_OFFSET)
  887. #define CPMVEC_PIO_PC4 ((ushort)0x01 | CPMVEC_OFFSET)
  888. #define CPMVEC_ERROR ((ushort)0x00 | CPMVEC_OFFSET)
  889. extern void irq_install_handler(int vec, void (*handler)(void *), void *dev_id);
  890. /* CPM interrupt configuration vector.
  891. */
  892. #define CICR_SCD_SCC4 ((uint)0x00c00000) /* SCC4 @ SCCd */
  893. #define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */
  894. #define CICR_SCB_SCC2 ((uint)0x00040000) /* SCC2 @ SCCb */
  895. #define CICR_SCA_SCC1 ((uint)0x00000000) /* SCC1 @ SCCa */
  896. #define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrrupt */
  897. #define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */
  898. #define CICR_IEN ((uint)0x00000080) /* Int. enable */
  899. #define CICR_SPS ((uint)0x00000001) /* SCC Spread */
  900. #endif /* __CPM_8XX__ */