commproc.h 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256
  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. /*** BSEIP **********************************************************/
  420. #ifdef CONFIG_FLAGADM
  421. /* Enet configuration for the FLAGADM */
  422. /* Enet on SCC2 */
  423. #define PROFF_ENET PROFF_SCC2
  424. #define CPM_CR_ENET CPM_CR_CH_SCC2
  425. #define SCC_ENET 1
  426. #define PA_ENET_RXD ((ushort)0x0004)
  427. #define PA_ENET_TXD ((ushort)0x0008)
  428. #define PA_ENET_TCLK ((ushort)0x0100)
  429. #define PA_ENET_RCLK ((ushort)0x0400)
  430. #define PB_ENET_TENA ((uint)0x00002000)
  431. #define PC_ENET_CLSN ((ushort)0x0040)
  432. #define PC_ENET_RENA ((ushort)0x0080)
  433. #define SICR_ENET_MASK ((uint)0x0000ff00)
  434. #define SICR_ENET_CLKRT ((uint)0x00003400)
  435. #endif /* CONFIG_FLAGADM */
  436. /*** ELPT860 *********************************************************/
  437. #ifdef CONFIG_ELPT860
  438. /* Bits in parallel I/O port registers that have to be set/cleared
  439. * to configure the pins for SCC1 use.
  440. */
  441. # define PROFF_ENET PROFF_SCC1
  442. # define CPM_CR_ENET CPM_CR_CH_SCC1
  443. # define SCC_ENET 0
  444. # define PA_ENET_RXD ((ushort)0x0001) /* PA 15 */
  445. # define PA_ENET_TXD ((ushort)0x0002) /* PA 14 */
  446. # define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  447. # define PA_ENET_TCLK ((ushort)0x0200) /* PA 6 */
  448. # define PC_ENET_TENA ((ushort)0x0001) /* PC 15 */
  449. # define PC_ENET_CLSN ((ushort)0x0010) /* PC 11 */
  450. # define PC_ENET_RENA ((ushort)0x0020) /* PC 10 */
  451. /* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK1) to
  452. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  453. */
  454. # define SICR_ENET_MASK ((uint)0x000000FF)
  455. # define SICR_ENET_CLKRT ((uint)0x00000025)
  456. #endif /* CONFIG_ELPT860 */
  457. /*** ESTEEM 192E **************************************************/
  458. #ifdef CONFIG_ESTEEM192E
  459. /* ESTEEM192E
  460. * This ENET stuff is for the MPC850 with ethernet on SCC2. This
  461. * is very similar to the RPX-Lite configuration.
  462. * Note TENA , LOOPBACK , FDPLEX_DIS on Port B.
  463. */
  464. #define PROFF_ENET PROFF_SCC2
  465. #define CPM_CR_ENET CPM_CR_CH_SCC2
  466. #define SCC_ENET 1
  467. #define PA_ENET_RXD ((ushort)0x0004)
  468. #define PA_ENET_TXD ((ushort)0x0008)
  469. #define PA_ENET_TCLK ((ushort)0x0200)
  470. #define PA_ENET_RCLK ((ushort)0x0800)
  471. #define PB_ENET_TENA ((uint)0x00002000)
  472. #define PC_ENET_CLSN ((ushort)0x0040)
  473. #define PC_ENET_RENA ((ushort)0x0080)
  474. #define SICR_ENET_MASK ((uint)0x0000ff00)
  475. #define SICR_ENET_CLKRT ((uint)0x00003d00)
  476. #define PB_ENET_LOOPBACK ((uint)0x00004000)
  477. #define PB_ENET_FDPLEX_DIS ((uint)0x00008000)
  478. #endif
  479. /*** FPS850L, FPS860L ************************************************/
  480. #if defined(CONFIG_FPS850L) || defined(CONFIG_FPS860L)
  481. /* Bits in parallel I/O port registers that have to be set/cleared
  482. * to configure the pins for SCC2 use.
  483. */
  484. #define PROFF_ENET PROFF_SCC2
  485. #define CPM_CR_ENET CPM_CR_CH_SCC2
  486. #define SCC_ENET 1
  487. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  488. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  489. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  490. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  491. #define PC_ENET_TENA ((ushort)0x0002) /* PC 14 */
  492. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  493. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  494. /* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
  495. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  496. */
  497. #define SICR_ENET_MASK ((uint)0x0000ff00)
  498. #define SICR_ENET_CLKRT ((uint)0x00002600)
  499. #endif /* CONFIG_FPS850L, CONFIG_FPS860L */
  500. /*** GEN860T **********************************************************/
  501. #if defined(CONFIG_GEN860T)
  502. #undef SCC_ENET
  503. #define FEC_ENET
  504. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  505. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  506. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  507. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  508. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  509. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  510. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  511. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  512. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  513. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  514. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  515. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  516. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  517. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3-15 */
  518. #endif /* CONFIG_GEN860T */
  519. /*** HERMES-PRO ******************************************************/
  520. /* The HERMES-PRO uses the FEC on a MPC860T for Ethernet */
  521. #ifdef CONFIG_HERMES
  522. #define FEC_ENET /* use FEC for EThernet */
  523. #undef SCC_ENET
  524. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  525. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  526. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  527. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  528. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  529. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  530. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  531. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  532. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  533. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  534. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  535. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  536. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  537. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  538. #endif /* CONFIG_HERMES */
  539. /*** ICU862 **********************************************************/
  540. #if defined(CONFIG_ICU862)
  541. #ifdef CONFIG_FEC_ENET
  542. #define FEC_ENET /* use FEC for EThernet */
  543. #endif /* CONFIG_FEC_ETHERNET */
  544. #endif /* CONFIG_ICU862 */
  545. /*** IP860 **********************************************************/
  546. #if defined(CONFIG_IP860)
  547. /* Bits in parallel I/O port registers that have to be set/cleared
  548. * to configure the pins for SCC1 use.
  549. */
  550. #define PROFF_ENET PROFF_SCC1
  551. #define CPM_CR_ENET CPM_CR_CH_SCC1
  552. #define SCC_ENET 0
  553. #define PA_ENET_RXD ((ushort)0x0001) /* PA 15 */
  554. #define PA_ENET_TXD ((ushort)0x0002) /* PA 14 */
  555. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  556. #define PA_ENET_TCLK ((ushort)0x0100) /* PA 7 */
  557. #define PC_ENET_TENA ((ushort)0x0001) /* PC 15 */
  558. #define PC_ENET_CLSN ((ushort)0x0010) /* PC 11 */
  559. #define PC_ENET_RENA ((ushort)0x0020) /* PC 10 */
  560. #define PB_ENET_RESET (uint)0x00000008 /* PB 28 */
  561. #define PB_ENET_JABD (uint)0x00000004 /* PB 29 */
  562. /* Control bits in the SICR to route TCLK (CLK1) and RCLK (CLK2) to
  563. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  564. */
  565. #define SICR_ENET_MASK ((uint)0x000000ff)
  566. #define SICR_ENET_CLKRT ((uint)0x0000002C)
  567. #endif /* CONFIG_IP860 */
  568. /*** IVMS8 **********************************************************/
  569. /* The IVMS8 uses the FEC on a MPC860T for Ethernet */
  570. #if defined(CONFIG_IVMS8) || defined(CONFIG_IVML24)
  571. #define FEC_ENET /* use FEC for EThernet */
  572. #undef SCC_ENET
  573. #define PB_ENET_POWER ((uint)0x00010000) /* PB 15 */
  574. #define PC_ENET_RESET ((ushort)0x0010) /* PC 11 */
  575. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  576. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  577. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  578. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  579. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  580. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  581. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  582. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  583. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  584. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  585. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  586. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  587. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  588. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  589. #endif /* CONFIG_IVMS8, CONFIG_IVML24 */
  590. /*** KUP4K, KUP4X ****************************************************/
  591. /* The KUP4 boards uses the FEC on a MPC8xx for Ethernet */
  592. #if defined(CONFIG_KUP4K) || defined(CONFIG_KUP4X)
  593. #define FEC_ENET /* use FEC for EThernet */
  594. #undef SCC_ENET
  595. #define PB_ENET_POWER ((uint)0x00010000) /* PB 15 */
  596. #define PC_ENET_RESET ((ushort)0x0010) /* PC 11 */
  597. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  598. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  599. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  600. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  601. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  602. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  603. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  604. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  605. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  606. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  607. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  608. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  609. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  610. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  611. #endif /* CONFIG_KUP4K */
  612. /*** LWMON **********************************************************/
  613. #if defined(CONFIG_LWMON)
  614. /* Bits in parallel I/O port registers that have to be set/cleared
  615. * to configure the pins for SCC2 use.
  616. */
  617. #define PROFF_ENET PROFF_SCC2
  618. #define CPM_CR_ENET CPM_CR_CH_SCC2
  619. #define SCC_ENET 1
  620. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  621. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  622. #define PA_ENET_RCLK ((ushort)0x0800) /* PA 4 */
  623. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  624. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  625. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  626. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  627. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK4) to
  628. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  629. */
  630. #define SICR_ENET_MASK ((uint)0x0000ff00)
  631. #define SICR_ENET_CLKRT ((uint)0x00003E00)
  632. #endif /* CONFIG_LWMON */
  633. /*** KM8XX *********************************************************/
  634. /* The KM8XX Service Module uses SCC3 for Ethernet */
  635. #ifdef CONFIG_KM8XX
  636. #define PROFF_ENET PROFF_SCC3 /* Ethernet on SCC3 */
  637. #define CPM_CR_ENET CPM_CR_CH_SCC3
  638. #define SCC_ENET 2
  639. #define PA_ENET_RXD ((ushort)0x0010) /* PA 11 */
  640. #define PA_ENET_TXD ((ushort)0x0020) /* PA 10 */
  641. #define PA_ENET_RCLK ((ushort)0x1000) /* PA 3 CLK 5 */
  642. #define PA_ENET_TCLK ((ushort)0x2000) /* PA 2 CLK 6 */
  643. #define PC_ENET_TENA ((ushort)0x0004) /* PC 13 */
  644. #define PC_ENET_RENA ((ushort)0x0200) /* PC 6 */
  645. #define PC_ENET_CLSN ((ushort)0x0100) /* PC 7 */
  646. /* Control bits in the SICR to route TCLK (CLK6) and RCLK (CLK5) to
  647. * SCC3. Also, make sure GR3 (bit 8) and SC3 (bit 9) are zero.
  648. */
  649. #define SICR_ENET_MASK ((uint)0x00FF0000)
  650. #define SICR_ENET_CLKRT ((uint)0x00250000)
  651. #endif /* CONFIG_KM8XX */
  652. /*** MHPC ********************************************************/
  653. #if defined(CONFIG_MHPC)
  654. /* This ENET stuff is for the MHPC with ethernet on SCC2.
  655. * Note TENA is on Port B.
  656. */
  657. #define PROFF_ENET PROFF_SCC2
  658. #define CPM_CR_ENET CPM_CR_CH_SCC2
  659. #define SCC_ENET 1
  660. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  661. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  662. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  663. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  664. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  665. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  666. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  667. #define SICR_ENET_MASK ((uint)0x0000ff00)
  668. #define SICR_ENET_CLKRT ((uint)0x00002e00) /* RCLK-CLK2, TCLK-CLK3 */
  669. #endif /* CONFIG_MHPC */
  670. /*** NETVIA *******************************************************/
  671. #if defined(CONFIG_NETVIA)
  672. /* Bits in parallel I/O port registers that have to be set/cleared
  673. * to configure the pins for SCC2 use.
  674. */
  675. #define PROFF_ENET PROFF_SCC2
  676. #define CPM_CR_ENET CPM_CR_CH_SCC2
  677. #define SCC_ENET 1
  678. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  679. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  680. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  681. #define PA_ENET_TCLK ((ushort)0x0800) /* PA 4 */
  682. #if !defined(CONFIG_NETVIA_VERSION) || CONFIG_NETVIA_VERSION == 1
  683. # define PB_ENET_PDN ((ushort)0x4000) /* PB 17 */
  684. #elif CONFIG_NETVIA_VERSION >= 2
  685. # define PC_ENET_PDN ((ushort)0x0008) /* PC 12 */
  686. #endif
  687. #define PB_ENET_TENA ((ushort)0x2000) /* PB 18 */
  688. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  689. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  690. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  691. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  692. */
  693. #define SICR_ENET_MASK ((uint)0x0000ff00)
  694. #define SICR_ENET_CLKRT ((uint)0x00002f00)
  695. #endif /* CONFIG_NETVIA */
  696. /*** SM850 *********************************************************/
  697. /* The SM850 Service Module uses SCC2 for IrDA and SCC3 for Ethernet */
  698. #ifdef CONFIG_SM850
  699. #define PROFF_ENET PROFF_SCC3 /* Ethernet on SCC3 */
  700. #define CPM_CR_ENET CPM_CR_CH_SCC3
  701. #define SCC_ENET 2
  702. #define PB_ENET_RXD ((uint)0x00000004) /* PB 29 */
  703. #define PB_ENET_TXD ((uint)0x00000002) /* PB 30 */
  704. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  705. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  706. #define PC_ENET_LBK ((ushort)0x0008) /* PC 12 */
  707. #define PC_ENET_TENA ((ushort)0x0004) /* PC 13 */
  708. #define PC_ENET_RENA ((ushort)0x0800) /* PC 4 */
  709. #define PC_ENET_CLSN ((ushort)0x0400) /* PC 5 */
  710. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  711. * SCC3. Also, make sure GR3 (bit 8) and SC3 (bit 9) are zero.
  712. */
  713. #define SICR_ENET_MASK ((uint)0x00FF0000)
  714. #define SICR_ENET_CLKRT ((uint)0x00260000)
  715. #endif /* CONFIG_SM850 */
  716. /*** SPD823TS ******************************************************/
  717. #ifdef CONFIG_SPD823TS
  718. /* Bits in parallel I/O port registers that have to be set/cleared
  719. * to configure the pins for SCC2 use.
  720. */
  721. #define PROFF_ENET PROFF_SCC2 /* Ethernet on SCC2 */
  722. #define CPM_CR_ENET CPM_CR_CH_SCC2
  723. #define SCC_ENET 1
  724. #define PA_ENET_MDC ((ushort)0x0001) /* PA 15 !!! */
  725. #define PA_ENET_MDIO ((ushort)0x0002) /* PA 14 !!! */
  726. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  727. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  728. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  729. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  730. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  731. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  732. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  733. #define PC_ENET_RESET ((ushort)0x0100) /* PC 7 !!! */
  734. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK2) to
  735. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  736. */
  737. #define SICR_ENET_MASK ((uint)0x0000ff00)
  738. #define SICR_ENET_CLKRT ((uint)0x00002E00)
  739. #endif /* CONFIG_SPD823TS */
  740. /*** MVS1, TQM823L/M, TQM850L/M, TQM885D, R360MPI **********/
  741. #if (defined(CONFIG_MVS) && CONFIG_MVS < 2) || \
  742. defined(CONFIG_R360MPI) || \
  743. defined(CONFIG_RRVISION)|| defined(CONFIG_TQM823L) || \
  744. defined(CONFIG_TQM823M) || defined(CONFIG_TQM850L) || \
  745. defined(CONFIG_TQM850M) || defined(CONFIG_TQM885D) || \
  746. defined(CONFIG_RRVISION)|| defined(CONFIG_VIRTLAB2)
  747. /* Bits in parallel I/O port registers that have to be set/cleared
  748. * to configure the pins for SCC2 use.
  749. */
  750. #define PROFF_ENET PROFF_SCC2
  751. #define CPM_CR_ENET CPM_CR_CH_SCC2
  752. #if (!defined(CONFIG_TK885D)) /* TK885D does not use SCC Ethernet */
  753. #define SCC_ENET 1
  754. #endif
  755. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  756. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  757. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  758. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  759. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  760. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  761. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  762. #if defined(CONFIG_R360MPI)
  763. #define PC_ENET_LBK ((ushort)0x0008) /* PC 12 */
  764. #endif /* CONFIG_R360MPI */
  765. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  766. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  767. */
  768. #define SICR_ENET_MASK ((uint)0x0000ff00)
  769. #define SICR_ENET_CLKRT ((uint)0x00002600)
  770. # ifdef CONFIG_FEC_ENET /* Use FEC for Fast Ethernet */
  771. #define FEC_ENET
  772. # endif /* CONFIG_FEC_ENET */
  773. #endif /* CONFIG_MVS v1, CONFIG_TQM823L/M, CONFIG_TQM850L/M, etc. */
  774. /*** TQM855L/M, TQM860L/M, TQM862L/M, TQM866L/M *********************/
  775. #if defined(CONFIG_TQM855L) || defined(CONFIG_TQM855M) || \
  776. defined(CONFIG_TQM860L) || defined(CONFIG_TQM860M) || \
  777. defined(CONFIG_TQM862L) || defined(CONFIG_TQM862M) || \
  778. defined(CONFIG_TQM866L) || defined(CONFIG_TQM866M)
  779. # ifdef CONFIG_SCC1_ENET /* use SCC for 10Mbps Ethernet */
  780. /* Bits in parallel I/O port registers that have to be set/cleared
  781. * to configure the pins for SCC1 use.
  782. */
  783. #define PROFF_ENET PROFF_SCC1
  784. #define CPM_CR_ENET CPM_CR_CH_SCC1
  785. #define SCC_ENET 0
  786. #define PA_ENET_RXD ((ushort)0x0001) /* PA 15 */
  787. #define PA_ENET_TXD ((ushort)0x0002) /* PA 14 */
  788. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  789. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  790. #define PC_ENET_TENA ((ushort)0x0001) /* PC 15 */
  791. #define PC_ENET_CLSN ((ushort)0x0010) /* PC 11 */
  792. #define PC_ENET_RENA ((ushort)0x0020) /* PC 10 */
  793. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  794. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  795. */
  796. #define SICR_ENET_MASK ((uint)0x000000ff)
  797. #define SICR_ENET_CLKRT ((uint)0x00000026)
  798. # endif /* CONFIG_SCC1_ENET */
  799. # ifdef CONFIG_FEC_ENET /* Use FEC for Fast Ethernet */
  800. #define FEC_ENET
  801. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  802. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  803. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  804. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  805. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  806. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  807. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  808. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  809. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  810. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  811. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  812. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  813. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  814. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  815. # endif /* CONFIG_FEC_ENET */
  816. #endif /* CONFIG_TQM855L/M, TQM860L/M, TQM862L/M */
  817. /*********************************************************************/
  818. /* SCC Event register as used by Ethernet.
  819. */
  820. #define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
  821. #define SCCE_ENET_TXE ((ushort)0x0010) /* Transmit Error */
  822. #define SCCE_ENET_RXF ((ushort)0x0008) /* Full frame received */
  823. #define SCCE_ENET_BSY ((ushort)0x0004) /* All incoming buffers full */
  824. #define SCCE_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */
  825. #define SCCE_ENET_RXB ((ushort)0x0001) /* A buffer was received */
  826. /* SCC Mode Register (PSMR) as used by Ethernet.
  827. */
  828. #define SCC_PSMR_HBC ((ushort)0x8000) /* Enable heartbeat */
  829. #define SCC_PSMR_FC ((ushort)0x4000) /* Force collision */
  830. #define SCC_PSMR_RSH ((ushort)0x2000) /* Receive short frames */
  831. #define SCC_PSMR_IAM ((ushort)0x1000) /* Check individual hash */
  832. #define SCC_PSMR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */
  833. #define SCC_PSMR_PRO ((ushort)0x0200) /* Promiscuous mode */
  834. #define SCC_PSMR_BRO ((ushort)0x0100) /* Catch broadcast pkts */
  835. #define SCC_PSMR_SBT ((ushort)0x0080) /* Special backoff timer */
  836. #define SCC_PSMR_LPB ((ushort)0x0040) /* Set Loopback mode */
  837. #define SCC_PSMR_SIP ((ushort)0x0020) /* Sample Input Pins */
  838. #define SCC_PSMR_LCW ((ushort)0x0010) /* Late collision window */
  839. #define SCC_PSMR_NIB22 ((ushort)0x000a) /* Start frame search */
  840. #define SCC_PSMR_FDE ((ushort)0x0001) /* Full duplex enable */
  841. /* Buffer descriptor control/status used by Ethernet receive.
  842. */
  843. #define BD_ENET_RX_EMPTY ((ushort)0x8000)
  844. #define BD_ENET_RX_WRAP ((ushort)0x2000)
  845. #define BD_ENET_RX_INTR ((ushort)0x1000)
  846. #define BD_ENET_RX_LAST ((ushort)0x0800)
  847. #define BD_ENET_RX_FIRST ((ushort)0x0400)
  848. #define BD_ENET_RX_MISS ((ushort)0x0100)
  849. #define BD_ENET_RX_LG ((ushort)0x0020)
  850. #define BD_ENET_RX_NO ((ushort)0x0010)
  851. #define BD_ENET_RX_SH ((ushort)0x0008)
  852. #define BD_ENET_RX_CR ((ushort)0x0004)
  853. #define BD_ENET_RX_OV ((ushort)0x0002)
  854. #define BD_ENET_RX_CL ((ushort)0x0001)
  855. #define BD_ENET_RX_STATS ((ushort)0x013f) /* All status bits */
  856. /* Buffer descriptor control/status used by Ethernet transmit.
  857. */
  858. #define BD_ENET_TX_READY ((ushort)0x8000)
  859. #define BD_ENET_TX_PAD ((ushort)0x4000)
  860. #define BD_ENET_TX_WRAP ((ushort)0x2000)
  861. #define BD_ENET_TX_INTR ((ushort)0x1000)
  862. #define BD_ENET_TX_LAST ((ushort)0x0800)
  863. #define BD_ENET_TX_TC ((ushort)0x0400)
  864. #define BD_ENET_TX_DEF ((ushort)0x0200)
  865. #define BD_ENET_TX_HB ((ushort)0x0100)
  866. #define BD_ENET_TX_LC ((ushort)0x0080)
  867. #define BD_ENET_TX_RL ((ushort)0x0040)
  868. #define BD_ENET_TX_RCMASK ((ushort)0x003c)
  869. #define BD_ENET_TX_UN ((ushort)0x0002)
  870. #define BD_ENET_TX_CSL ((ushort)0x0001)
  871. #define BD_ENET_TX_STATS ((ushort)0x03ff) /* All status bits */
  872. /* SCC as UART
  873. */
  874. typedef struct scc_uart {
  875. sccp_t scc_genscc;
  876. uint scc_res1; /* Reserved */
  877. uint scc_res2; /* Reserved */
  878. ushort scc_maxidl; /* Maximum idle chars */
  879. ushort scc_idlc; /* temp idle counter */
  880. ushort scc_brkcr; /* Break count register */
  881. ushort scc_parec; /* receive parity error counter */
  882. ushort scc_frmec; /* receive framing error counter */
  883. ushort scc_nosec; /* receive noise counter */
  884. ushort scc_brkec; /* receive break condition counter */
  885. ushort scc_brkln; /* last received break length */
  886. ushort scc_uaddr1; /* UART address character 1 */
  887. ushort scc_uaddr2; /* UART address character 2 */
  888. ushort scc_rtemp; /* Temp storage */
  889. ushort scc_toseq; /* Transmit out of sequence char */
  890. ushort scc_char1; /* control character 1 */
  891. ushort scc_char2; /* control character 2 */
  892. ushort scc_char3; /* control character 3 */
  893. ushort scc_char4; /* control character 4 */
  894. ushort scc_char5; /* control character 5 */
  895. ushort scc_char6; /* control character 6 */
  896. ushort scc_char7; /* control character 7 */
  897. ushort scc_char8; /* control character 8 */
  898. ushort scc_rccm; /* receive control character mask */
  899. ushort scc_rccr; /* receive control character register */
  900. ushort scc_rlbc; /* receive last break character */
  901. } scc_uart_t;
  902. /* SCC Event and Mask registers when it is used as a UART.
  903. */
  904. #define UART_SCCM_GLR ((ushort)0x1000)
  905. #define UART_SCCM_GLT ((ushort)0x0800)
  906. #define UART_SCCM_AB ((ushort)0x0200)
  907. #define UART_SCCM_IDL ((ushort)0x0100)
  908. #define UART_SCCM_GRA ((ushort)0x0080)
  909. #define UART_SCCM_BRKE ((ushort)0x0040)
  910. #define UART_SCCM_BRKS ((ushort)0x0020)
  911. #define UART_SCCM_CCR ((ushort)0x0008)
  912. #define UART_SCCM_BSY ((ushort)0x0004)
  913. #define UART_SCCM_TX ((ushort)0x0002)
  914. #define UART_SCCM_RX ((ushort)0x0001)
  915. /* The SCC PSMR when used as a UART.
  916. */
  917. #define SCU_PSMR_FLC ((ushort)0x8000)
  918. #define SCU_PSMR_SL ((ushort)0x4000)
  919. #define SCU_PSMR_CL ((ushort)0x3000)
  920. #define SCU_PSMR_UM ((ushort)0x0c00)
  921. #define SCU_PSMR_FRZ ((ushort)0x0200)
  922. #define SCU_PSMR_RZS ((ushort)0x0100)
  923. #define SCU_PSMR_SYN ((ushort)0x0080)
  924. #define SCU_PSMR_DRT ((ushort)0x0040)
  925. #define SCU_PSMR_PEN ((ushort)0x0010)
  926. #define SCU_PSMR_RPM ((ushort)0x000c)
  927. #define SCU_PSMR_REVP ((ushort)0x0008)
  928. #define SCU_PSMR_TPM ((ushort)0x0003)
  929. #define SCU_PSMR_TEVP ((ushort)0x0003)
  930. /* CPM Transparent mode SCC.
  931. */
  932. typedef struct scc_trans {
  933. sccp_t st_genscc;
  934. uint st_cpres; /* Preset CRC */
  935. uint st_cmask; /* Constant mask for CRC */
  936. } scc_trans_t;
  937. #define BD_SCC_TX_LAST ((ushort)0x0800)
  938. /* IIC parameter RAM.
  939. */
  940. typedef struct iic {
  941. ushort iic_rbase; /* Rx Buffer descriptor base address */
  942. ushort iic_tbase; /* Tx Buffer descriptor base address */
  943. u_char iic_rfcr; /* Rx function code */
  944. u_char iic_tfcr; /* Tx function code */
  945. ushort iic_mrblr; /* Max receive buffer length */
  946. uint iic_rstate; /* Internal */
  947. uint iic_rdp; /* Internal */
  948. ushort iic_rbptr; /* Internal */
  949. ushort iic_rbc; /* Internal */
  950. uint iic_rxtmp; /* Internal */
  951. uint iic_tstate; /* Internal */
  952. uint iic_tdp; /* Internal */
  953. ushort iic_tbptr; /* Internal */
  954. ushort iic_tbc; /* Internal */
  955. uint iic_txtmp; /* Internal */
  956. uint iic_res; /* reserved */
  957. ushort iic_rpbase; /* Relocation pointer */
  958. ushort iic_res2; /* reserved */
  959. } iic_t;
  960. /* SPI parameter RAM.
  961. */
  962. typedef struct spi {
  963. ushort spi_rbase; /* Rx Buffer descriptor base address */
  964. ushort spi_tbase; /* Tx Buffer descriptor base address */
  965. u_char spi_rfcr; /* Rx function code */
  966. u_char spi_tfcr; /* Tx function code */
  967. ushort spi_mrblr; /* Max receive buffer length */
  968. uint spi_rstate; /* Internal */
  969. uint spi_rdp; /* Internal */
  970. ushort spi_rbptr; /* Internal */
  971. ushort spi_rbc; /* Internal */
  972. uint spi_rxtmp; /* Internal */
  973. uint spi_tstate; /* Internal */
  974. uint spi_tdp; /* Internal */
  975. ushort spi_tbptr; /* Internal */
  976. ushort spi_tbc; /* Internal */
  977. uint spi_txtmp; /* Internal */
  978. uint spi_res;
  979. ushort spi_rpbase; /* Relocation pointer */
  980. ushort spi_res2;
  981. } spi_t;
  982. /* SPI Mode register.
  983. */
  984. #define SPMODE_LOOP ((ushort)0x4000) /* Loopback */
  985. #define SPMODE_CI ((ushort)0x2000) /* Clock Invert */
  986. #define SPMODE_CP ((ushort)0x1000) /* Clock Phase */
  987. #define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */
  988. #define SPMODE_REV ((ushort)0x0400) /* Reversed Data */
  989. #define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */
  990. #define SPMODE_EN ((ushort)0x0100) /* Enable */
  991. #define SPMODE_LENMSK ((ushort)0x00f0) /* character length */
  992. #define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */
  993. #define SPMODE_LEN(x) ((((x)-1)&0xF)<<4)
  994. #define SPMODE_PM(x) ((x) &0xF)
  995. /* HDLC parameter RAM.
  996. */
  997. typedef struct hdlc_pram_s {
  998. /*
  999. * SCC parameter RAM
  1000. */
  1001. ushort rbase; /* Rx Buffer descriptor base address */
  1002. ushort tbase; /* Tx Buffer descriptor base address */
  1003. uchar rfcr; /* Rx function code */
  1004. uchar tfcr; /* Tx function code */
  1005. ushort mrblr; /* Rx buffer length */
  1006. ulong rstate; /* Rx internal state */
  1007. ulong rptr; /* Rx internal data pointer */
  1008. ushort rbptr; /* rb BD Pointer */
  1009. ushort rcount; /* Rx internal byte count */
  1010. ulong rtemp; /* Rx temp */
  1011. ulong tstate; /* Tx internal state */
  1012. ulong tptr; /* Tx internal data pointer */
  1013. ushort tbptr; /* Tx BD pointer */
  1014. ushort tcount; /* Tx byte count */
  1015. ulong ttemp; /* Tx temp */
  1016. ulong rcrc; /* temp receive CRC */
  1017. ulong tcrc; /* temp transmit CRC */
  1018. /*
  1019. * HDLC specific parameter RAM
  1020. */
  1021. uchar res[4]; /* reserved */
  1022. ulong c_mask; /* CRC constant */
  1023. ulong c_pres; /* CRC preset */
  1024. ushort disfc; /* discarded frame counter */
  1025. ushort crcec; /* CRC error counter */
  1026. ushort abtsc; /* abort sequence counter */
  1027. ushort nmarc; /* nonmatching address rx cnt */
  1028. ushort retrc; /* frame retransmission cnt */
  1029. ushort mflr; /* maximum frame length reg */
  1030. ushort max_cnt; /* maximum length counter */
  1031. ushort rfthr; /* received frames threshold */
  1032. ushort rfcnt; /* received frames count */
  1033. ushort hmask; /* user defined frm addr mask */
  1034. ushort haddr1; /* user defined frm address 1 */
  1035. ushort haddr2; /* user defined frm address 2 */
  1036. ushort haddr3; /* user defined frm address 3 */
  1037. ushort haddr4; /* user defined frm address 4 */
  1038. ushort tmp; /* temp */
  1039. ushort tmp_mb; /* temp */
  1040. } hdlc_pram_t;
  1041. /* CPM interrupts. There are nearly 32 interrupts generated by CPM
  1042. * channels or devices. All of these are presented to the PPC core
  1043. * as a single interrupt. The CPM interrupt handler dispatches its
  1044. * own handlers, in a similar fashion to the PPC core handler. We
  1045. * use the table as defined in the manuals (i.e. no special high
  1046. * priority and SCC1 == SCCa, etc...).
  1047. */
  1048. #define CPMVEC_NR 32
  1049. #define CPMVEC_OFFSET 0x00010000
  1050. #define CPMVEC_PIO_PC15 ((ushort)0x1f | CPMVEC_OFFSET)
  1051. #define CPMVEC_SCC1 ((ushort)0x1e | CPMVEC_OFFSET)
  1052. #define CPMVEC_SCC2 ((ushort)0x1d | CPMVEC_OFFSET)
  1053. #define CPMVEC_SCC3 ((ushort)0x1c | CPMVEC_OFFSET)
  1054. #define CPMVEC_SCC4 ((ushort)0x1b | CPMVEC_OFFSET)
  1055. #define CPMVEC_PIO_PC14 ((ushort)0x1a | CPMVEC_OFFSET)
  1056. #define CPMVEC_TIMER1 ((ushort)0x19 | CPMVEC_OFFSET)
  1057. #define CPMVEC_PIO_PC13 ((ushort)0x18 | CPMVEC_OFFSET)
  1058. #define CPMVEC_PIO_PC12 ((ushort)0x17 | CPMVEC_OFFSET)
  1059. #define CPMVEC_SDMA_CB_ERR ((ushort)0x16 | CPMVEC_OFFSET)
  1060. #define CPMVEC_IDMA1 ((ushort)0x15 | CPMVEC_OFFSET)
  1061. #define CPMVEC_IDMA2 ((ushort)0x14 | CPMVEC_OFFSET)
  1062. #define CPMVEC_TIMER2 ((ushort)0x12 | CPMVEC_OFFSET)
  1063. #define CPMVEC_RISCTIMER ((ushort)0x11 | CPMVEC_OFFSET)
  1064. #define CPMVEC_I2C ((ushort)0x10 | CPMVEC_OFFSET)
  1065. #define CPMVEC_PIO_PC11 ((ushort)0x0f | CPMVEC_OFFSET)
  1066. #define CPMVEC_PIO_PC10 ((ushort)0x0e | CPMVEC_OFFSET)
  1067. #define CPMVEC_TIMER3 ((ushort)0x0c | CPMVEC_OFFSET)
  1068. #define CPMVEC_PIO_PC9 ((ushort)0x0b | CPMVEC_OFFSET)
  1069. #define CPMVEC_PIO_PC8 ((ushort)0x0a | CPMVEC_OFFSET)
  1070. #define CPMVEC_PIO_PC7 ((ushort)0x09 | CPMVEC_OFFSET)
  1071. #define CPMVEC_TIMER4 ((ushort)0x07 | CPMVEC_OFFSET)
  1072. #define CPMVEC_PIO_PC6 ((ushort)0x06 | CPMVEC_OFFSET)
  1073. #define CPMVEC_SPI ((ushort)0x05 | CPMVEC_OFFSET)
  1074. #define CPMVEC_SMC1 ((ushort)0x04 | CPMVEC_OFFSET)
  1075. #define CPMVEC_SMC2 ((ushort)0x03 | CPMVEC_OFFSET)
  1076. #define CPMVEC_PIO_PC5 ((ushort)0x02 | CPMVEC_OFFSET)
  1077. #define CPMVEC_PIO_PC4 ((ushort)0x01 | CPMVEC_OFFSET)
  1078. #define CPMVEC_ERROR ((ushort)0x00 | CPMVEC_OFFSET)
  1079. extern void irq_install_handler(int vec, void (*handler)(void *), void *dev_id);
  1080. /* CPM interrupt configuration vector.
  1081. */
  1082. #define CICR_SCD_SCC4 ((uint)0x00c00000) /* SCC4 @ SCCd */
  1083. #define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */
  1084. #define CICR_SCB_SCC2 ((uint)0x00040000) /* SCC2 @ SCCb */
  1085. #define CICR_SCA_SCC1 ((uint)0x00000000) /* SCC1 @ SCCa */
  1086. #define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrrupt */
  1087. #define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */
  1088. #define CICR_IEN ((uint)0x00000080) /* Int. enable */
  1089. #define CICR_SPS ((uint)0x00000001) /* SCC Spread */
  1090. #endif /* __CPM_8XX__ */