commproc.h 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628
  1. /*
  2. * MPC8xx Communication Processor Module.
  3. * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
  4. *
  5. * This file contains structures and information for the communication
  6. * processor channels. Some CPM control and status is available
  7. * throught the MPC8xx internal memory map. See immap.h for details.
  8. * This file only contains what I need for the moment, not the total
  9. * CPM capabilities. I (or someone else) will add definitions as they
  10. * are needed. -- Dan
  11. *
  12. * On the MBX board, EPPC-Bug loads CPM microcode into the first 512
  13. * bytes of the DP RAM and relocates the I2C parameter area to the
  14. * IDMA1 space. The remaining DP RAM is available for buffer descriptors
  15. * or other use.
  16. */
  17. #ifndef __CPM_8XX__
  18. #define __CPM_8XX__
  19. #include <linux/config.h>
  20. #include <asm/8xx_immap.h>
  21. /* CPM Command register.
  22. */
  23. #define CPM_CR_RST ((ushort)0x8000)
  24. #define CPM_CR_OPCODE ((ushort)0x0f00)
  25. #define CPM_CR_CHAN ((ushort)0x00f0)
  26. #define CPM_CR_FLG ((ushort)0x0001)
  27. /* Some commands (there are more...later)
  28. */
  29. #define CPM_CR_INIT_TRX ((ushort)0x0000)
  30. #define CPM_CR_INIT_RX ((ushort)0x0001)
  31. #define CPM_CR_INIT_TX ((ushort)0x0002)
  32. #define CPM_CR_HUNT_MODE ((ushort)0x0003)
  33. #define CPM_CR_STOP_TX ((ushort)0x0004)
  34. #define CPM_CR_RESTART_TX ((ushort)0x0006)
  35. #define CPM_CR_SET_GADDR ((ushort)0x0008)
  36. /* Channel numbers.
  37. */
  38. #define CPM_CR_CH_SCC1 ((ushort)0x0000)
  39. #define CPM_CR_CH_I2C ((ushort)0x0001) /* I2C and IDMA1 */
  40. #define CPM_CR_CH_SCC2 ((ushort)0x0004)
  41. #define CPM_CR_CH_SPI ((ushort)0x0005) /* SPI / IDMA2 / Timers */
  42. #define CPM_CR_CH_SCC3 ((ushort)0x0008)
  43. #define CPM_CR_CH_SMC1 ((ushort)0x0009) /* SMC1 / DSP1 */
  44. #define CPM_CR_CH_SCC4 ((ushort)0x000c)
  45. #define CPM_CR_CH_SMC2 ((ushort)0x000d) /* SMC2 / DSP2 */
  46. #define mk_cr_cmd(CH, CMD) ((CMD << 8) | (CH << 4))
  47. /*
  48. * DPRAM defines and allocation functions
  49. */
  50. /* The dual ported RAM is multi-functional. Some areas can be (and are
  51. * being) used for microcode. There is an area that can only be used
  52. * as data ram for buffer descriptors, which is all we use right now.
  53. * Currently the first 512 and last 256 bytes are used for microcode.
  54. */
  55. #ifdef CFG_ALLOC_DPRAM
  56. #define CPM_DATAONLY_BASE ((uint)0x0800)
  57. #define CPM_DATAONLY_SIZE ((uint)0x0700)
  58. #define CPM_DP_NOSPACE ((uint)0x7fffffff)
  59. #else
  60. #define CPM_SERIAL_BASE 0x0800
  61. #define CPM_I2C_BASE 0x0820
  62. #define CPM_SPI_BASE 0x0840
  63. #define CPM_FEC_BASE 0x0860
  64. #define CPM_WLKBD_BASE 0x0880
  65. #define CPM_SCC_BASE 0x0900
  66. #define CPM_POST_BASE 0x0980
  67. #endif
  68. #ifndef CFG_CPM_POST_WORD_ADDR
  69. #define CPM_POST_WORD_ADDR 0x07FC
  70. #else
  71. #define CPM_POST_WORD_ADDR CFG_CPM_POST_WORD_ADDR
  72. #endif
  73. #define BD_IIC_START ((uint) 0x0400) /* <- please use CPM_I2C_BASE !! */
  74. /* Export the base address of the communication processor registers
  75. * and dual port ram.
  76. */
  77. extern cpm8xx_t *cpmp; /* Pointer to comm processor */
  78. /* Buffer descriptors used by many of the CPM protocols.
  79. */
  80. typedef struct cpm_buf_desc {
  81. ushort cbd_sc; /* Status and Control */
  82. ushort cbd_datlen; /* Data length in buffer */
  83. uint cbd_bufaddr; /* Buffer address in host memory */
  84. } cbd_t;
  85. #define BD_SC_EMPTY ((ushort)0x8000) /* Recieve is empty */
  86. #define BD_SC_READY ((ushort)0x8000) /* Transmit is ready */
  87. #define BD_SC_WRAP ((ushort)0x2000) /* Last buffer descriptor */
  88. #define BD_SC_INTRPT ((ushort)0x1000) /* Interrupt on change */
  89. #define BD_SC_LAST ((ushort)0x0800) /* Last buffer in frame */
  90. #define BD_SC_TC ((ushort)0x0400) /* Transmit CRC */
  91. #define BD_SC_CM ((ushort)0x0200) /* Continous mode */
  92. #define BD_SC_ID ((ushort)0x0100) /* Rec'd too many idles */
  93. #define BD_SC_P ((ushort)0x0100) /* xmt preamble */
  94. #define BD_SC_BR ((ushort)0x0020) /* Break received */
  95. #define BD_SC_FR ((ushort)0x0010) /* Framing error */
  96. #define BD_SC_PR ((ushort)0x0008) /* Parity error */
  97. #define BD_SC_OV ((ushort)0x0002) /* Overrun */
  98. #define BD_SC_CD ((ushort)0x0001) /* Carrier Detect lost */
  99. /* Parameter RAM offsets.
  100. */
  101. #define PROFF_SCC1 ((uint)0x0000)
  102. #define PROFF_IIC ((uint)0x0080)
  103. #define PROFF_SCC2 ((uint)0x0100)
  104. #define PROFF_SPI ((uint)0x0180)
  105. #define PROFF_SCC3 ((uint)0x0200)
  106. #define PROFF_SMC1 ((uint)0x0280)
  107. #define PROFF_SCC4 ((uint)0x0300)
  108. #define PROFF_SMC2 ((uint)0x0380)
  109. /* Define enough so I can at least use the serial port as a UART.
  110. * The MBX uses SMC1 as the host serial port.
  111. */
  112. typedef struct smc_uart {
  113. ushort smc_rbase; /* Rx Buffer descriptor base address */
  114. ushort smc_tbase; /* Tx Buffer descriptor base address */
  115. u_char smc_rfcr; /* Rx function code */
  116. u_char smc_tfcr; /* Tx function code */
  117. ushort smc_mrblr; /* Max receive buffer length */
  118. uint smc_rstate; /* Internal */
  119. uint smc_idp; /* Internal */
  120. ushort smc_rbptr; /* Internal */
  121. ushort smc_ibc; /* Internal */
  122. uint smc_rxtmp; /* Internal */
  123. uint smc_tstate; /* Internal */
  124. uint smc_tdp; /* Internal */
  125. ushort smc_tbptr; /* Internal */
  126. ushort smc_tbc; /* Internal */
  127. uint smc_txtmp; /* Internal */
  128. ushort smc_maxidl; /* Maximum idle characters */
  129. ushort smc_tmpidl; /* Temporary idle counter */
  130. ushort smc_brklen; /* Last received break length */
  131. ushort smc_brkec; /* rcv'd break condition counter */
  132. ushort smc_brkcr; /* xmt break count register */
  133. ushort smc_rmask; /* Temporary bit mask */
  134. } smc_uart_t;
  135. /* Function code bits.
  136. */
  137. #define SMC_EB ((u_char)0x10) /* Set big endian byte order */
  138. /* SMC uart mode register.
  139. */
  140. #define SMCMR_REN ((ushort)0x0001)
  141. #define SMCMR_TEN ((ushort)0x0002)
  142. #define SMCMR_DM ((ushort)0x000c)
  143. #define SMCMR_SM_GCI ((ushort)0x0000)
  144. #define SMCMR_SM_UART ((ushort)0x0020)
  145. #define SMCMR_SM_TRANS ((ushort)0x0030)
  146. #define SMCMR_SM_MASK ((ushort)0x0030)
  147. #define SMCMR_PM_EVEN ((ushort)0x0100) /* Even parity, else odd */
  148. #define SMCMR_REVD SMCMR_PM_EVEN
  149. #define SMCMR_PEN ((ushort)0x0200) /* Parity enable */
  150. #define SMCMR_BS SMCMR_PEN
  151. #define SMCMR_SL ((ushort)0x0400) /* Two stops, else one */
  152. #define SMCR_CLEN_MASK ((ushort)0x7800) /* Character length */
  153. #define smcr_mk_clen(C) (((C) << 11) & SMCR_CLEN_MASK)
  154. /* SMC2 as Centronics parallel printer. It is half duplex, in that
  155. * it can only receive or transmit. The parameter ram values for
  156. * each direction are either unique or properly overlap, so we can
  157. * include them in one structure.
  158. */
  159. typedef struct smc_centronics {
  160. ushort scent_rbase;
  161. ushort scent_tbase;
  162. u_char scent_cfcr;
  163. u_char scent_smask;
  164. ushort scent_mrblr;
  165. uint scent_rstate;
  166. uint scent_r_ptr;
  167. ushort scent_rbptr;
  168. ushort scent_r_cnt;
  169. uint scent_rtemp;
  170. uint scent_tstate;
  171. uint scent_t_ptr;
  172. ushort scent_tbptr;
  173. ushort scent_t_cnt;
  174. uint scent_ttemp;
  175. ushort scent_max_sl;
  176. ushort scent_sl_cnt;
  177. ushort scent_character1;
  178. ushort scent_character2;
  179. ushort scent_character3;
  180. ushort scent_character4;
  181. ushort scent_character5;
  182. ushort scent_character6;
  183. ushort scent_character7;
  184. ushort scent_character8;
  185. ushort scent_rccm;
  186. ushort scent_rccr;
  187. } smc_cent_t;
  188. /* Centronics Status Mask Register.
  189. */
  190. #define SMC_CENT_F ((u_char)0x08)
  191. #define SMC_CENT_PE ((u_char)0x04)
  192. #define SMC_CENT_S ((u_char)0x02)
  193. /* SMC Event and Mask register.
  194. */
  195. #define SMCM_BRKE ((unsigned char)0x40) /* When in UART Mode */
  196. #define SMCM_BRK ((unsigned char)0x10) /* When in UART Mode */
  197. #define SMCM_TXE ((unsigned char)0x10) /* When in Transparent Mode */
  198. #define SMCM_BSY ((unsigned char)0x04)
  199. #define SMCM_TX ((unsigned char)0x02)
  200. #define SMCM_RX ((unsigned char)0x01)
  201. /* Baud rate generators.
  202. */
  203. #define CPM_BRG_RST ((uint)0x00020000)
  204. #define CPM_BRG_EN ((uint)0x00010000)
  205. #define CPM_BRG_EXTC_INT ((uint)0x00000000)
  206. #define CPM_BRG_EXTC_CLK2 ((uint)0x00004000)
  207. #define CPM_BRG_EXTC_CLK6 ((uint)0x00008000)
  208. #define CPM_BRG_ATB ((uint)0x00002000)
  209. #define CPM_BRG_CD_MASK ((uint)0x00001ffe)
  210. #define CPM_BRG_DIV16 ((uint)0x00000001)
  211. /* SI Clock Route Register
  212. */
  213. #define SICR_RCLK_SCC1_BRG1 ((uint)0x00000000)
  214. #define SICR_TCLK_SCC1_BRG1 ((uint)0x00000000)
  215. #define SICR_RCLK_SCC2_BRG2 ((uint)0x00000800)
  216. #define SICR_TCLK_SCC2_BRG2 ((uint)0x00000100)
  217. #define SICR_RCLK_SCC3_BRG3 ((uint)0x00100000)
  218. #define SICR_TCLK_SCC3_BRG3 ((uint)0x00020000)
  219. #define SICR_RCLK_SCC4_BRG4 ((uint)0x18000000)
  220. #define SICR_TCLK_SCC4_BRG4 ((uint)0x03000000)
  221. /* SCCs.
  222. */
  223. #define SCC_GSMRH_IRP ((uint)0x00040000)
  224. #define SCC_GSMRH_GDE ((uint)0x00010000)
  225. #define SCC_GSMRH_TCRC_CCITT ((uint)0x00008000)
  226. #define SCC_GSMRH_TCRC_BISYNC ((uint)0x00004000)
  227. #define SCC_GSMRH_TCRC_HDLC ((uint)0x00000000)
  228. #define SCC_GSMRH_REVD ((uint)0x00002000)
  229. #define SCC_GSMRH_TRX ((uint)0x00001000)
  230. #define SCC_GSMRH_TTX ((uint)0x00000800)
  231. #define SCC_GSMRH_CDP ((uint)0x00000400)
  232. #define SCC_GSMRH_CTSP ((uint)0x00000200)
  233. #define SCC_GSMRH_CDS ((uint)0x00000100)
  234. #define SCC_GSMRH_CTSS ((uint)0x00000080)
  235. #define SCC_GSMRH_TFL ((uint)0x00000040)
  236. #define SCC_GSMRH_RFW ((uint)0x00000020)
  237. #define SCC_GSMRH_TXSY ((uint)0x00000010)
  238. #define SCC_GSMRH_SYNL16 ((uint)0x0000000c)
  239. #define SCC_GSMRH_SYNL8 ((uint)0x00000008)
  240. #define SCC_GSMRH_SYNL4 ((uint)0x00000004)
  241. #define SCC_GSMRH_RTSM ((uint)0x00000002)
  242. #define SCC_GSMRH_RSYN ((uint)0x00000001)
  243. #define SCC_GSMRL_SIR ((uint)0x80000000) /* SCC2 only */
  244. #define SCC_GSMRL_EDGE_NONE ((uint)0x60000000)
  245. #define SCC_GSMRL_EDGE_NEG ((uint)0x40000000)
  246. #define SCC_GSMRL_EDGE_POS ((uint)0x20000000)
  247. #define SCC_GSMRL_EDGE_BOTH ((uint)0x00000000)
  248. #define SCC_GSMRL_TCI ((uint)0x10000000)
  249. #define SCC_GSMRL_TSNC_3 ((uint)0x0c000000)
  250. #define SCC_GSMRL_TSNC_4 ((uint)0x08000000)
  251. #define SCC_GSMRL_TSNC_14 ((uint)0x04000000)
  252. #define SCC_GSMRL_TSNC_INF ((uint)0x00000000)
  253. #define SCC_GSMRL_RINV ((uint)0x02000000)
  254. #define SCC_GSMRL_TINV ((uint)0x01000000)
  255. #define SCC_GSMRL_TPL_128 ((uint)0x00c00000)
  256. #define SCC_GSMRL_TPL_64 ((uint)0x00a00000)
  257. #define SCC_GSMRL_TPL_48 ((uint)0x00800000)
  258. #define SCC_GSMRL_TPL_32 ((uint)0x00600000)
  259. #define SCC_GSMRL_TPL_16 ((uint)0x00400000)
  260. #define SCC_GSMRL_TPL_8 ((uint)0x00200000)
  261. #define SCC_GSMRL_TPL_NONE ((uint)0x00000000)
  262. #define SCC_GSMRL_TPP_ALL1 ((uint)0x00180000)
  263. #define SCC_GSMRL_TPP_01 ((uint)0x00100000)
  264. #define SCC_GSMRL_TPP_10 ((uint)0x00080000)
  265. #define SCC_GSMRL_TPP_ZEROS ((uint)0x00000000)
  266. #define SCC_GSMRL_TEND ((uint)0x00040000)
  267. #define SCC_GSMRL_TDCR_32 ((uint)0x00030000)
  268. #define SCC_GSMRL_TDCR_16 ((uint)0x00020000)
  269. #define SCC_GSMRL_TDCR_8 ((uint)0x00010000)
  270. #define SCC_GSMRL_TDCR_1 ((uint)0x00000000)
  271. #define SCC_GSMRL_RDCR_32 ((uint)0x0000c000)
  272. #define SCC_GSMRL_RDCR_16 ((uint)0x00008000)
  273. #define SCC_GSMRL_RDCR_8 ((uint)0x00004000)
  274. #define SCC_GSMRL_RDCR_1 ((uint)0x00000000)
  275. #define SCC_GSMRL_RENC_DFMAN ((uint)0x00003000)
  276. #define SCC_GSMRL_RENC_MANCH ((uint)0x00002000)
  277. #define SCC_GSMRL_RENC_FM0 ((uint)0x00001000)
  278. #define SCC_GSMRL_RENC_NRZI ((uint)0x00000800)
  279. #define SCC_GSMRL_RENC_NRZ ((uint)0x00000000)
  280. #define SCC_GSMRL_TENC_DFMAN ((uint)0x00000600)
  281. #define SCC_GSMRL_TENC_MANCH ((uint)0x00000400)
  282. #define SCC_GSMRL_TENC_FM0 ((uint)0x00000200)
  283. #define SCC_GSMRL_TENC_NRZI ((uint)0x00000100)
  284. #define SCC_GSMRL_TENC_NRZ ((uint)0x00000000)
  285. #define SCC_GSMRL_DIAG_LE ((uint)0x000000c0) /* Loop and echo */
  286. #define SCC_GSMRL_DIAG_ECHO ((uint)0x00000080)
  287. #define SCC_GSMRL_DIAG_LOOP ((uint)0x00000040)
  288. #define SCC_GSMRL_DIAG_NORM ((uint)0x00000000)
  289. #define SCC_GSMRL_ENR ((uint)0x00000020)
  290. #define SCC_GSMRL_ENT ((uint)0x00000010)
  291. #define SCC_GSMRL_MODE_ENET ((uint)0x0000000c)
  292. #define SCC_GSMRL_MODE_DDCMP ((uint)0x00000009)
  293. #define SCC_GSMRL_MODE_BISYNC ((uint)0x00000008)
  294. #define SCC_GSMRL_MODE_V14 ((uint)0x00000007)
  295. #define SCC_GSMRL_MODE_AHDLC ((uint)0x00000006)
  296. #define SCC_GSMRL_MODE_PROFIBUS ((uint)0x00000005)
  297. #define SCC_GSMRL_MODE_UART ((uint)0x00000004)
  298. #define SCC_GSMRL_MODE_SS7 ((uint)0x00000003)
  299. #define SCC_GSMRL_MODE_ATALK ((uint)0x00000002)
  300. #define SCC_GSMRL_MODE_HDLC ((uint)0x00000000)
  301. #define SCC_TODR_TOD ((ushort)0x8000)
  302. /* SCC Event and Mask register.
  303. */
  304. #define SCCM_TXE ((unsigned char)0x10)
  305. #define SCCM_BSY ((unsigned char)0x04)
  306. #define SCCM_TX ((unsigned char)0x02)
  307. #define SCCM_RX ((unsigned char)0x01)
  308. typedef struct scc_param {
  309. ushort scc_rbase; /* Rx Buffer descriptor base address */
  310. ushort scc_tbase; /* Tx Buffer descriptor base address */
  311. u_char scc_rfcr; /* Rx function code */
  312. u_char scc_tfcr; /* Tx function code */
  313. ushort scc_mrblr; /* Max receive buffer length */
  314. uint scc_rstate; /* Internal */
  315. uint scc_idp; /* Internal */
  316. ushort scc_rbptr; /* Internal */
  317. ushort scc_ibc; /* Internal */
  318. uint scc_rxtmp; /* Internal */
  319. uint scc_tstate; /* Internal */
  320. uint scc_tdp; /* Internal */
  321. ushort scc_tbptr; /* Internal */
  322. ushort scc_tbc; /* Internal */
  323. uint scc_txtmp; /* Internal */
  324. uint scc_rcrc; /* Internal */
  325. uint scc_tcrc; /* Internal */
  326. } sccp_t;
  327. /* Function code bits.
  328. */
  329. #define SCC_EB ((u_char)0x10) /* Set big endian byte order */
  330. /* CPM Ethernet through SCCx.
  331. */
  332. typedef struct scc_enet {
  333. sccp_t sen_genscc;
  334. uint sen_cpres; /* Preset CRC */
  335. uint sen_cmask; /* Constant mask for CRC */
  336. uint sen_crcec; /* CRC Error counter */
  337. uint sen_alec; /* alignment error counter */
  338. uint sen_disfc; /* discard frame counter */
  339. ushort sen_pads; /* Tx short frame pad character */
  340. ushort sen_retlim; /* Retry limit threshold */
  341. ushort sen_retcnt; /* Retry limit counter */
  342. ushort sen_maxflr; /* maximum frame length register */
  343. ushort sen_minflr; /* minimum frame length register */
  344. ushort sen_maxd1; /* maximum DMA1 length */
  345. ushort sen_maxd2; /* maximum DMA2 length */
  346. ushort sen_maxd; /* Rx max DMA */
  347. ushort sen_dmacnt; /* Rx DMA counter */
  348. ushort sen_maxb; /* Max BD byte count */
  349. ushort sen_gaddr1; /* Group address filter */
  350. ushort sen_gaddr2;
  351. ushort sen_gaddr3;
  352. ushort sen_gaddr4;
  353. uint sen_tbuf0data0; /* Save area 0 - current frame */
  354. uint sen_tbuf0data1; /* Save area 1 - current frame */
  355. uint sen_tbuf0rba; /* Internal */
  356. uint sen_tbuf0crc; /* Internal */
  357. ushort sen_tbuf0bcnt; /* Internal */
  358. ushort sen_paddrh; /* physical address (MSB) */
  359. ushort sen_paddrm;
  360. ushort sen_paddrl; /* physical address (LSB) */
  361. ushort sen_pper; /* persistence */
  362. ushort sen_rfbdptr; /* Rx first BD pointer */
  363. ushort sen_tfbdptr; /* Tx first BD pointer */
  364. ushort sen_tlbdptr; /* Tx last BD pointer */
  365. uint sen_tbuf1data0; /* Save area 0 - current frame */
  366. uint sen_tbuf1data1; /* Save area 1 - current frame */
  367. uint sen_tbuf1rba; /* Internal */
  368. uint sen_tbuf1crc; /* Internal */
  369. ushort sen_tbuf1bcnt; /* Internal */
  370. ushort sen_txlen; /* Tx Frame length counter */
  371. ushort sen_iaddr1; /* Individual address filter */
  372. ushort sen_iaddr2;
  373. ushort sen_iaddr3;
  374. ushort sen_iaddr4;
  375. ushort sen_boffcnt; /* Backoff counter */
  376. /* NOTE: Some versions of the manual have the following items
  377. * incorrectly documented. Below is the proper order.
  378. */
  379. ushort sen_taddrh; /* temp address (MSB) */
  380. ushort sen_taddrm;
  381. ushort sen_taddrl; /* temp address (LSB) */
  382. } scc_enet_t;
  383. /**********************************************************************
  384. *
  385. * Board specific configuration settings.
  386. *
  387. * Please note that we use the presence of a #define SCC_ENET and/or
  388. * #define FEC_ENET to enable the SCC resp. FEC ethernet drivers.
  389. **********************************************************************/
  390. /*** ADS *************************************************************/
  391. #if defined(CONFIG_MPC860) && defined(CONFIG_ADS)
  392. /* This ENET stuff is for the MPC860ADS with ethernet on SCC1.
  393. */
  394. #define PROFF_ENET PROFF_SCC1
  395. #define CPM_CR_ENET CPM_CR_CH_SCC1
  396. #define SCC_ENET 0
  397. #define PA_ENET_RXD ((ushort)0x0001)
  398. #define PA_ENET_TXD ((ushort)0x0002)
  399. #define PA_ENET_TCLK ((ushort)0x0100)
  400. #define PA_ENET_RCLK ((ushort)0x0200)
  401. #define PB_ENET_TENA ((uint)0x00001000)
  402. #define PC_ENET_CLSN ((ushort)0x0010)
  403. #define PC_ENET_RENA ((ushort)0x0020)
  404. #define SICR_ENET_MASK ((uint)0x000000ff)
  405. #define SICR_ENET_CLKRT ((uint)0x0000002c)
  406. /* 68160 PHY control */
  407. #define PC_ENET_ETHLOOP ((ushort)0x0800)
  408. #define PC_ENET_TPFLDL ((ushort)0x0400)
  409. #define PC_ENET_TPSQEL ((ushort)0x0200)
  410. #endif /* MPC860ADS */
  411. /*** AMX860 **********************************************/
  412. #if defined(CONFIG_AMX860)
  413. /* This ENET stuff is for the AMX860 with ethernet on SCC1.
  414. */
  415. #define PROFF_ENET PROFF_SCC1
  416. #define CPM_CR_ENET CPM_CR_CH_SCC1
  417. #define SCC_ENET 0
  418. #define PA_ENET_RXD ((ushort)0x0001)
  419. #define PA_ENET_TXD ((ushort)0x0002)
  420. #define PA_ENET_TCLK ((ushort)0x0400)
  421. #define PA_ENET_RCLK ((ushort)0x0800)
  422. #define PB_ENET_TENA ((uint)0x00001000)
  423. #define PC_ENET_CLSN ((ushort)0x0010)
  424. #define PC_ENET_RENA ((ushort)0x0020)
  425. #define SICR_ENET_MASK ((uint)0x000000ff)
  426. #define SICR_ENET_CLKRT ((uint)0x0000003e)
  427. /* 68160 PHY control */
  428. #define PB_ENET_ETHLOOP ((uint)0x00020000)
  429. #define PB_ENET_TPFLDL ((uint)0x00010000)
  430. #define PB_ENET_TPSQEL ((uint)0x00008000)
  431. #define PD_ENET_ETH_EN ((ushort)0x0004)
  432. #endif /* CONFIG_AMX860 */
  433. /*** BSEIP **********************************************************/
  434. #ifdef CONFIG_BSEIP
  435. /* This ENET stuff is for the MPC823 with ethernet on SCC2.
  436. * This is unique to the BSE ip-Engine board.
  437. */
  438. #define PROFF_ENET PROFF_SCC2
  439. #define CPM_CR_ENET CPM_CR_CH_SCC2
  440. #define SCC_ENET 1
  441. #define PA_ENET_RXD ((ushort)0x0004)
  442. #define PA_ENET_TXD ((ushort)0x0008)
  443. #define PA_ENET_TCLK ((ushort)0x0100)
  444. #define PA_ENET_RCLK ((ushort)0x0200)
  445. #define PB_ENET_TENA ((uint)0x00002000)
  446. #define PC_ENET_CLSN ((ushort)0x0040)
  447. #define PC_ENET_RENA ((ushort)0x0080)
  448. /* BSE uses port B and C bits for PHY control also.
  449. */
  450. #define PB_BSE_POWERUP ((uint)0x00000004)
  451. #define PB_BSE_FDXDIS ((uint)0x00008000)
  452. #define PC_BSE_LOOPBACK ((ushort)0x0800)
  453. #define SICR_ENET_MASK ((uint)0x0000ff00)
  454. #define SICR_ENET_CLKRT ((uint)0x00002c00)
  455. #endif /* CONFIG_BSEIP */
  456. /*** BSEIP **********************************************************/
  457. #ifdef CONFIG_FLAGADM
  458. /* Enet configuration for the FLAGADM */
  459. /* Enet on SCC2 */
  460. #define PROFF_ENET PROFF_SCC2
  461. #define CPM_CR_ENET CPM_CR_CH_SCC2
  462. #define SCC_ENET 1
  463. #define PA_ENET_RXD ((ushort)0x0004)
  464. #define PA_ENET_TXD ((ushort)0x0008)
  465. #define PA_ENET_TCLK ((ushort)0x0100)
  466. #define PA_ENET_RCLK ((ushort)0x0400)
  467. #define PB_ENET_TENA ((uint)0x00002000)
  468. #define PC_ENET_CLSN ((ushort)0x0040)
  469. #define PC_ENET_RENA ((ushort)0x0080)
  470. #define SICR_ENET_MASK ((uint)0x0000ff00)
  471. #define SICR_ENET_CLKRT ((uint)0x00003400)
  472. #endif /* CONFIG_FLAGADM */
  473. /*** C2MON **********************************************************/
  474. #ifdef CONFIG_C2MON
  475. # ifndef CONFIG_FEC_ENET /* use SCC for 10Mbps Ethernet */
  476. # error "Ethernet on SCC not supported on C2MON Board!"
  477. # else /* Use FEC for Fast Ethernet */
  478. #undef SCC_ENET
  479. #define FEC_ENET
  480. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  481. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  482. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  483. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  484. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  485. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  486. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  487. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  488. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  489. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  490. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  491. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  492. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  493. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  494. # endif /* CONFIG_FEC_ENET */
  495. #endif /* CONFIG_C2MON */
  496. /*********************************************************************/
  497. /*** CCM and PCU E ***********************************************/
  498. /* The PCU E and CCM use the FEC on a MPC860T for Ethernet */
  499. #if defined (CONFIG_PCU_E) || defined(CONFIG_CCM)
  500. #define FEC_ENET /* use FEC for EThernet */
  501. #undef SCC_ENET
  502. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  503. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  504. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  505. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  506. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  507. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  508. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  509. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  510. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  511. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  512. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  513. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  514. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  515. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  516. #endif /* CONFIG_PCU_E, CONFIG_CCM */
  517. /*** ESTEEM 192E **************************************************/
  518. #ifdef CONFIG_ESTEEM192E
  519. /* ESTEEM192E
  520. * This ENET stuff is for the MPC850 with ethernet on SCC2. This
  521. * is very similar to the RPX-Lite configuration.
  522. * Note TENA , LOOPBACK , FDPLEX_DIS on Port B.
  523. */
  524. #define PROFF_ENET PROFF_SCC2
  525. #define CPM_CR_ENET CPM_CR_CH_SCC2
  526. #define SCC_ENET 1
  527. #define PA_ENET_RXD ((ushort)0x0004)
  528. #define PA_ENET_TXD ((ushort)0x0008)
  529. #define PA_ENET_TCLK ((ushort)0x0200)
  530. #define PA_ENET_RCLK ((ushort)0x0800)
  531. #define PB_ENET_TENA ((uint)0x00002000)
  532. #define PC_ENET_CLSN ((ushort)0x0040)
  533. #define PC_ENET_RENA ((ushort)0x0080)
  534. #define SICR_ENET_MASK ((uint)0x0000ff00)
  535. #define SICR_ENET_CLKRT ((uint)0x00003d00)
  536. #define PB_ENET_LOOPBACK ((uint)0x00004000)
  537. #define PB_ENET_FDPLEX_DIS ((uint)0x00008000)
  538. #endif
  539. /*** FADS823 ********************************************************/
  540. #if defined(CONFIG_MPC823FADS) && defined(CONFIG_FADS)
  541. /* This ENET stuff is for the MPC823FADS with ethernet on SCC2.
  542. */
  543. #ifdef CONFIG_SCC2_ENET
  544. #define PROFF_ENET PROFF_SCC2
  545. #define CPM_CR_ENET CPM_CR_CH_SCC2
  546. #define SCC_ENET 1
  547. #define CPMVEC_ENET CPMVEC_SCC2
  548. #endif
  549. #ifdef CONFIG_SCC1_ENET
  550. #define PROFF_ENET PROFF_SCC1
  551. #define CPM_CR_ENET CPM_CR_CH_SCC1
  552. #define SCC_ENET 0
  553. #define CPMVEC_ENET CPMVEC_SCC1
  554. #endif
  555. #define PA_ENET_RXD ((ushort)0x0004)
  556. #define PA_ENET_TXD ((ushort)0x0008)
  557. #define PA_ENET_TCLK ((ushort)0x0400)
  558. #define PA_ENET_RCLK ((ushort)0x0200)
  559. #define PB_ENET_TENA ((uint)0x00002000)
  560. #define PC_ENET_CLSN ((ushort)0x0040)
  561. #define PC_ENET_RENA ((ushort)0x0080)
  562. #define SICR_ENET_MASK ((uint)0x0000ff00)
  563. #define SICR_ENET_CLKRT ((uint)0x00002e00)
  564. #endif /* CONFIG_FADS823FADS */
  565. /*** FADS850SAR ********************************************************/
  566. #if defined(CONFIG_MPC850SAR) && defined(CONFIG_FADS)
  567. /* This ENET stuff is for the MPC850SAR with ethernet on SCC2. Some of
  568. * this may be unique to the FADS850SAR configuration.
  569. * Note TENA is on Port B.
  570. */
  571. #define PROFF_ENET PROFF_SCC2
  572. #define CPM_CR_ENET CPM_CR_CH_SCC2
  573. #define SCC_ENET 1
  574. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  575. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  576. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  577. #define PA_ENET_TCLK ((ushort)0x0800) /* PA 4 */
  578. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  579. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  580. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  581. #define SICR_ENET_MASK ((uint)0x0000ff00)
  582. #define SICR_ENET_CLKRT ((uint)0x00002f00) /* RCLK-CLK2, TCLK-CLK4 */
  583. #endif /* CONFIG_FADS850SAR */
  584. /*** FADS860T********************************************************/
  585. #if defined(CONFIG_MPC860T) && defined(CONFIG_FADS)
  586. /* This ENET stuff is for the MPC860TFADS with ethernet on SCC1.
  587. */
  588. #ifdef CONFIG_SCC1_ENET
  589. #define SCC_ENET 0
  590. #endif /* CONFIG_SCC1_ETHERNET */
  591. #define PROFF_ENET PROFF_SCC1
  592. #define CPM_CR_ENET CPM_CR_CH_SCC1
  593. #define PA_ENET_RXD ((ushort)0x0001)
  594. #define PA_ENET_TXD ((ushort)0x0002)
  595. #define PA_ENET_TCLK ((ushort)0x0100)
  596. #define PA_ENET_RCLK ((ushort)0x0200)
  597. #define PB_ENET_TENA ((uint)0x00001000)
  598. #define PC_ENET_CLSN ((ushort)0x0010)
  599. #define PC_ENET_RENA ((ushort)0x0020)
  600. #define SICR_ENET_MASK ((uint)0x000000ff)
  601. #define SICR_ENET_CLKRT ((uint)0x0000002c)
  602. /* This ENET stuff is for the MPC860TFADS with ethernet on FEC.
  603. */
  604. #ifdef CONFIG_FEC_ENET
  605. #define FEC_ENET /* use FEC for EThernet */
  606. #endif /* CONFIG_FEC_ETHERNET */
  607. #endif /* CONFIG_FADS860T */
  608. /*** FPS850L, FPS860L ************************************************/
  609. #if defined(CONFIG_FPS850L) || defined(CONFIG_FPS860L)
  610. /* Bits in parallel I/O port registers that have to be set/cleared
  611. * to configure the pins for SCC2 use.
  612. */
  613. #define PROFF_ENET PROFF_SCC2
  614. #define CPM_CR_ENET CPM_CR_CH_SCC2
  615. #define SCC_ENET 1
  616. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  617. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  618. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  619. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  620. #define PC_ENET_TENA ((ushort)0x0002) /* PC 14 */
  621. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  622. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  623. /* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
  624. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  625. */
  626. #define SICR_ENET_MASK ((uint)0x0000ff00)
  627. #define SICR_ENET_CLKRT ((uint)0x00002600)
  628. #endif /* CONFIG_FPS850L, CONFIG_FPS860L */
  629. /*** GEN860T **********************************************************/
  630. #if defined(CONFIG_GEN860T)
  631. #undef SCC_ENET
  632. #define FEC_ENET
  633. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  634. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  635. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  636. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  637. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  638. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  639. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  640. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  641. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  642. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  643. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  644. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  645. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  646. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3-15 */
  647. #endif /* CONFIG_GEN860T */
  648. /*** GENIETV ********************************************************/
  649. #if defined(CONFIG_GENIETV)
  650. /* Ethernet is only on SCC2 */
  651. #define CONFIG_SCC2_ENET
  652. #define PROFF_ENET PROFF_SCC2
  653. #define CPM_CR_ENET CPM_CR_CH_SCC2
  654. #define SCC_ENET 1
  655. #define CPMVEC_ENET CPMVEC_SCC2
  656. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  657. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  658. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  659. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  660. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  661. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  662. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  663. #define SICR_ENET_MASK ((uint)0x0000ff00)
  664. #define SICR_ENET_CLKRT ((uint)0x00002e00)
  665. #endif /* CONFIG_GENIETV */
  666. /*** GTH ******************************************************/
  667. #ifdef CONFIG_GTH
  668. #ifdef CONFIG_FEC_ENET
  669. #define FEC_ENET /* use FEC for EThernet */
  670. #endif /* CONFIG_FEC_ETHERNET */
  671. /* This ENET stuff is for GTH 10 Mbit ( SCC ) */
  672. #define PROFF_ENET PROFF_SCC1
  673. #define CPM_CR_ENET CPM_CR_CH_SCC1
  674. #define SCC_ENET 0
  675. #define PA_ENET_RXD ((ushort)0x0001) /* PA15 */
  676. #define PA_ENET_TXD ((ushort)0x0002) /* PA14 */
  677. #define PA_ENET_TCLK ((ushort)0x0800) /* PA4 */
  678. #define PA_ENET_RCLK ((ushort)0x0400) /* PA5 */
  679. #define PB_ENET_TENA ((uint)0x00001000) /* PB19 */
  680. #define PC_ENET_CLSN ((ushort)0x0010) /* PC11 */
  681. #define PC_ENET_RENA ((ushort)0x0020) /* PC10 */
  682. /* NOTE. This is reset for 10Mbit port only */
  683. #define PC_ENET_RESET ((ushort)0x0100) /* PC 7 */
  684. #define SICR_ENET_MASK ((uint)0x000000ff)
  685. /* TCLK PA4 -->CLK4, RCLK PA5 -->CLK3 */
  686. #define SICR_ENET_CLKRT ((uint)0x00000037)
  687. #endif /* CONFIG_GTH */
  688. /*** HERMES-PRO ******************************************************/
  689. /* The HERMES-PRO uses the FEC on a MPC860T for Ethernet */
  690. #ifdef CONFIG_HERMES
  691. #define FEC_ENET /* use FEC for EThernet */
  692. #undef SCC_ENET
  693. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  694. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  695. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  696. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  697. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  698. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  699. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  700. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  701. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  702. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  703. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  704. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  705. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  706. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  707. #endif /* CONFIG_HERMES */
  708. /*** IAD210 **********************************************************/
  709. /* The IAD210 uses the FEC on a MPC860P for Ethernet */
  710. #if defined(CONFIG_IAD210)
  711. # define FEC_ENET /* use FEC for Ethernet */
  712. # undef SCC_ENET
  713. # define PD_MII_TXD1 ((ushort) 0x1000 ) /* PD 3 */
  714. # define PD_MII_TXD2 ((ushort) 0x0800 ) /* PD 4 */
  715. # define PD_MII_TXD3 ((ushort) 0x0400 ) /* PD 5 */
  716. # define PD_MII_RX_DV ((ushort) 0x0200 ) /* PD 6 */
  717. # define PD_MII_RX_ERR ((ushort) 0x0100 ) /* PD 7 */
  718. # define PD_MII_RX_CLK ((ushort) 0x0080 ) /* PD 8 */
  719. # define PD_MII_TXD0 ((ushort) 0x0040 ) /* PD 9 */
  720. # define PD_MII_RXD0 ((ushort) 0x0020 ) /* PD 10 */
  721. # define PD_MII_TX_ERR ((ushort) 0x0010 ) /* PD 11 */
  722. # define PD_MII_MDC ((ushort) 0x0008 ) /* PD 12 */
  723. # define PD_MII_RXD1 ((ushort) 0x0004 ) /* PD 13 */
  724. # define PD_MII_RXD2 ((ushort) 0x0002 ) /* PD 14 */
  725. # define PD_MII_RXD3 ((ushort) 0x0001 ) /* PD 15 */
  726. # define PD_MII_MASK ((ushort) 0x1FFF ) /* PD 3...15 */
  727. #endif /* CONFIG_IAD210 */
  728. /*** ICU862 **********************************************************/
  729. #if defined(CONFIG_ICU862)
  730. #ifdef CONFIG_FEC_ENET
  731. #define FEC_ENET /* use FEC for EThernet */
  732. #endif /* CONFIG_FEC_ETHERNET */
  733. #endif /* CONFIG_ICU862 */
  734. /*** IP860 **********************************************************/
  735. #if defined(CONFIG_IP860)
  736. /* Bits in parallel I/O port registers that have to be set/cleared
  737. * to configure the pins for SCC1 use.
  738. */
  739. #define PROFF_ENET PROFF_SCC1
  740. #define CPM_CR_ENET CPM_CR_CH_SCC1
  741. #define SCC_ENET 0
  742. #define PA_ENET_RXD ((ushort)0x0001) /* PA 15 */
  743. #define PA_ENET_TXD ((ushort)0x0002) /* PA 14 */
  744. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  745. #define PA_ENET_TCLK ((ushort)0x0100) /* PA 7 */
  746. #define PC_ENET_TENA ((ushort)0x0001) /* PC 15 */
  747. #define PC_ENET_CLSN ((ushort)0x0010) /* PC 11 */
  748. #define PC_ENET_RENA ((ushort)0x0020) /* PC 10 */
  749. #define PB_ENET_RESET (uint)0x00000008 /* PB 28 */
  750. #define PB_ENET_JABD (uint)0x00000004 /* PB 29 */
  751. /* Control bits in the SICR to route TCLK (CLK1) and RCLK (CLK2) to
  752. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  753. */
  754. #define SICR_ENET_MASK ((uint)0x000000ff)
  755. #define SICR_ENET_CLKRT ((uint)0x0000002C)
  756. #endif /* CONFIG_IP860 */
  757. /*** IVMS8 **********************************************************/
  758. /* The IVMS8 uses the FEC on a MPC860T for Ethernet */
  759. #if defined(CONFIG_IVMS8) || defined(CONFIG_IVML24)
  760. #define FEC_ENET /* use FEC for EThernet */
  761. #undef SCC_ENET
  762. #define PB_ENET_POWER ((uint)0x00010000) /* PB 15 */
  763. #define PC_ENET_RESET ((ushort)0x0010) /* PC 11 */
  764. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  765. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  766. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  767. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  768. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  769. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  770. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  771. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  772. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  773. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  774. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  775. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  776. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  777. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  778. #endif /* CONFIG_IVMS8, CONFIG_IVML24 */
  779. /*** KUP4K *********************************************************/
  780. /* The KUP4K uses the FEC on a MPC855T for Ethernet */
  781. #if defined(CONFIG_KUP4K)
  782. #define FEC_ENET /* use FEC for EThernet */
  783. #undef SCC_ENET
  784. #define PB_ENET_POWER ((uint)0x00010000) /* PB 15 */
  785. #define PC_ENET_RESET ((ushort)0x0010) /* PC 11 */
  786. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  787. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  788. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  789. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  790. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  791. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  792. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  793. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  794. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  795. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  796. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  797. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  798. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  799. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  800. #endif /* CONFIG_KUP4K */
  801. /*** LANTEC *********************************************************/
  802. #if defined(CONFIG_LANTEC) && CONFIG_LANTEC >= 2
  803. /* Bits in parallel I/O port registers that have to be set/cleared
  804. * to configure the pins for SCC2 use.
  805. */
  806. #define PROFF_ENET PROFF_SCC2
  807. #define CPM_CR_ENET CPM_CR_CH_SCC2
  808. #define SCC_ENET 1
  809. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  810. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  811. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  812. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  813. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  814. #define PC_ENET_LBK ((ushort)0x0010) /* PC 11 */
  815. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  816. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  817. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK2) to
  818. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  819. */
  820. #define SICR_ENET_MASK ((uint)0x0000FF00)
  821. #define SICR_ENET_CLKRT ((uint)0x00002E00)
  822. #endif /* CONFIG_LANTEC v2 */
  823. /*** LWMON **********************************************************/
  824. #if defined(CONFIG_LWMON) && !defined(CONFIG_8xx_CONS_SCC2)
  825. /* Bits in parallel I/O port registers that have to be set/cleared
  826. * to configure the pins for SCC2 use.
  827. */
  828. #define PROFF_ENET PROFF_SCC2
  829. #define CPM_CR_ENET CPM_CR_CH_SCC2
  830. #define SCC_ENET 1
  831. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  832. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  833. #define PA_ENET_RCLK ((ushort)0x0800) /* PA 4 */
  834. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  835. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  836. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  837. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  838. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK4) to
  839. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  840. */
  841. #define SICR_ENET_MASK ((uint)0x0000ff00)
  842. #define SICR_ENET_CLKRT ((uint)0x00003E00)
  843. #endif /* CONFIG_LWMON */
  844. /*** NX823 ***********************************************/
  845. #if defined(CONFIG_NX823)
  846. /* Bits in parallel I/O port registers that have to be set/cleared
  847. * to configure the pins for SCC1 use.
  848. */
  849. #define PROFF_ENET PROFF_SCC2
  850. #define CPM_CR_ENET CPM_CR_CH_SCC2
  851. #define SCC_ENET 1
  852. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  853. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  854. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  855. #define PA_ENET_TCLK ((ushort)0x0800) /* PA 4 */
  856. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  857. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  858. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  859. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  860. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  861. */
  862. #define SICR_ENET_MASK ((uint)0x0000ff00)
  863. #define SICR_ENET_CLKRT ((uint)0x00002f00)
  864. #endif /* CONFIG_NX823 */
  865. /*** MBX ************************************************************/
  866. #ifdef CONFIG_MBX
  867. /* Bits in parallel I/O port registers that have to be set/cleared
  868. * to configure the pins for SCC1 use. The TCLK and RCLK seem unique
  869. * to the MBX860 board. Any two of the four available clocks could be
  870. * used, and the MPC860 cookbook manual has an example using different
  871. * clock pins.
  872. */
  873. #define PROFF_ENET PROFF_SCC1
  874. #define CPM_CR_ENET CPM_CR_CH_SCC1
  875. #define SCC_ENET 0
  876. #define PA_ENET_RXD ((ushort)0x0001)
  877. #define PA_ENET_TXD ((ushort)0x0002)
  878. #define PA_ENET_TCLK ((ushort)0x0200)
  879. #define PA_ENET_RCLK ((ushort)0x0800)
  880. #define PC_ENET_TENA ((ushort)0x0001)
  881. #define PC_ENET_CLSN ((ushort)0x0010)
  882. #define PC_ENET_RENA ((ushort)0x0020)
  883. /* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
  884. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  885. */
  886. #define SICR_ENET_MASK ((uint)0x000000ff)
  887. #define SICR_ENET_CLKRT ((uint)0x0000003d)
  888. #endif /* CONFIG_MBX */
  889. /*** MHPC ********************************************************/
  890. #if defined(CONFIG_MHPC)
  891. /* This ENET stuff is for the MHPC with ethernet on SCC2.
  892. * Note TENA is on Port B.
  893. */
  894. #define PROFF_ENET PROFF_SCC2
  895. #define CPM_CR_ENET CPM_CR_CH_SCC2
  896. #define SCC_ENET 1
  897. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  898. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  899. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  900. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  901. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  902. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  903. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  904. #define SICR_ENET_MASK ((uint)0x0000ff00)
  905. #define SICR_ENET_CLKRT ((uint)0x00002e00) /* RCLK-CLK2, TCLK-CLK3 */
  906. #endif /* CONFIG_MHPC */
  907. /*** RPXCLASSIC *****************************************************/
  908. #ifdef CONFIG_RPXCLASSIC
  909. #ifdef CONFIG_FEC_ENET
  910. # define FEC_ENET /* use FEC for EThernet */
  911. # undef SCC_ENET
  912. #else /* ! CONFIG_FEC_ENET */
  913. /* Bits in parallel I/O port registers that have to be set/cleared
  914. * to configure the pins for SCC1 use.
  915. */
  916. #define PROFF_ENET PROFF_SCC1
  917. #define CPM_CR_ENET CPM_CR_CH_SCC1
  918. #define SCC_ENET 0
  919. #define PA_ENET_RXD ((ushort)0x0001)
  920. #define PA_ENET_TXD ((ushort)0x0002)
  921. #define PA_ENET_TCLK ((ushort)0x0200)
  922. #define PA_ENET_RCLK ((ushort)0x0800)
  923. #define PB_ENET_TENA ((uint)0x00001000)
  924. #define PC_ENET_CLSN ((ushort)0x0010)
  925. #define PC_ENET_RENA ((ushort)0x0020)
  926. /* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
  927. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  928. */
  929. #define SICR_ENET_MASK ((uint)0x000000ff)
  930. #define SICR_ENET_CLKRT ((uint)0x0000003d)
  931. #endif /* CONFIG_FEC_ENET */
  932. #endif /* CONFIG_RPXCLASSIC */
  933. /*** RPXLITE ********************************************************/
  934. #ifdef CONFIG_RPXLITE
  935. /* This ENET stuff is for the MPC850 with ethernet on SCC2. Some of
  936. * this may be unique to the RPX-Lite configuration.
  937. * Note TENA is on Port B.
  938. */
  939. #define PROFF_ENET PROFF_SCC2
  940. #define CPM_CR_ENET CPM_CR_CH_SCC2
  941. #define SCC_ENET 1
  942. #define PA_ENET_RXD ((ushort)0x0004)
  943. #define PA_ENET_TXD ((ushort)0x0008)
  944. #define PA_ENET_TCLK ((ushort)0x0200)
  945. #define PA_ENET_RCLK ((ushort)0x0800)
  946. #define PB_ENET_TENA ((uint)0x00002000)
  947. #define PC_ENET_CLSN ((ushort)0x0040)
  948. #define PC_ENET_RENA ((ushort)0x0080)
  949. #define SICR_ENET_MASK ((uint)0x0000ff00)
  950. #define SICR_ENET_CLKRT ((uint)0x00003d00)
  951. #endif /* CONFIG_RPXLITE */
  952. /*** SM850 *********************************************************/
  953. /* The SM850 Service Module uses SCC2 for IrDA and SCC3 for Ethernet */
  954. #ifdef CONFIG_SM850
  955. #define PROFF_ENET PROFF_SCC3 /* Ethernet on SCC3 */
  956. #define CPM_CR_ENET CPM_CR_CH_SCC3
  957. #define SCC_ENET 2
  958. #define PB_ENET_RXD ((uint)0x00000004) /* PB 29 */
  959. #define PB_ENET_TXD ((uint)0x00000002) /* PB 30 */
  960. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  961. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  962. #define PC_ENET_LBK ((ushort)0x0008) /* PC 12 */
  963. #define PC_ENET_TENA ((ushort)0x0004) /* PC 13 */
  964. #define PC_ENET_RENA ((ushort)0x0800) /* PC 4 */
  965. #define PC_ENET_CLSN ((ushort)0x0400) /* PC 5 */
  966. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  967. * SCC3. Also, make sure GR3 (bit 8) and SC3 (bit 9) are zero.
  968. */
  969. #define SICR_ENET_MASK ((uint)0x00FF0000)
  970. #define SICR_ENET_CLKRT ((uint)0x00260000)
  971. #endif /* CONFIG_SM850 */
  972. /*** SPD823TS ******************************************************/
  973. #ifdef CONFIG_SPD823TS
  974. /* Bits in parallel I/O port registers that have to be set/cleared
  975. * to configure the pins for SCC2 use.
  976. */
  977. #define PROFF_ENET PROFF_SCC2 /* Ethernet on SCC2 */
  978. #define CPM_CR_ENET CPM_CR_CH_SCC2
  979. #define SCC_ENET 1
  980. #define PA_ENET_MDC ((ushort)0x0001) /* PA 15 !!! */
  981. #define PA_ENET_MDIO ((ushort)0x0002) /* PA 14 !!! */
  982. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  983. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  984. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  985. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  986. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  987. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  988. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  989. #define PC_ENET_RESET ((ushort)0x0100) /* PC 7 !!! */
  990. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK2) to
  991. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  992. */
  993. #define SICR_ENET_MASK ((uint)0x0000ff00)
  994. #define SICR_ENET_CLKRT ((uint)0x00002E00)
  995. #endif /* CONFIG_SPD823TS */
  996. /*** SXNI855T ******************************************************/
  997. #if defined(CONFIG_SXNI855T)
  998. #ifdef CONFIG_FEC_ENET
  999. #define FEC_ENET /* use FEC for Ethernet */
  1000. #endif /* CONFIG_FEC_ETHERNET */
  1001. #endif /* CONFIG_SXNI855T */
  1002. /*** MVS1, TQM823L, TQM850L, ETX094, R360MPI ***********************/
  1003. #if (defined(CONFIG_MVS) && CONFIG_MVS < 2) || \
  1004. defined(CONFIG_R360MPI) || \
  1005. defined(CONFIG_TQM823L) || \
  1006. defined(CONFIG_TQM850L) || \
  1007. defined(CONFIG_ETX094) || \
  1008. defined(CONFIG_RRVISION)|| \
  1009. (defined(CONFIG_LANTEC) && CONFIG_LANTEC < 2)
  1010. /* Bits in parallel I/O port registers that have to be set/cleared
  1011. * to configure the pins for SCC2 use.
  1012. */
  1013. #define PROFF_ENET PROFF_SCC2
  1014. #define CPM_CR_ENET CPM_CR_CH_SCC2
  1015. #define SCC_ENET 1
  1016. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  1017. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  1018. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  1019. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  1020. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  1021. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  1022. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  1023. #if defined(CONFIG_R360MPI)
  1024. #define PC_ENET_LBK ((ushort)0x0008) /* PC 12 */
  1025. #endif /* CONFIG_R360MPI */
  1026. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  1027. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  1028. */
  1029. #define SICR_ENET_MASK ((uint)0x0000ff00)
  1030. #define SICR_ENET_CLKRT ((uint)0x00002600)
  1031. #endif /* CONFIG_MVS v1, CONFIG_TQM823L, CONFIG_TQM850L, etc. */
  1032. /*** TQM860L, TQM855L ************************************************/
  1033. #if (defined(CONFIG_TQM860L) || defined(CONFIG_TQM855L))
  1034. # ifdef CONFIG_SCC1_ENET /* use SCC for 10Mbps Ethernet */
  1035. /* Bits in parallel I/O port registers that have to be set/cleared
  1036. * to configure the pins for SCC1 use.
  1037. */
  1038. #define PROFF_ENET PROFF_SCC1
  1039. #define CPM_CR_ENET CPM_CR_CH_SCC1
  1040. #define SCC_ENET 0
  1041. #define PA_ENET_RXD ((ushort)0x0001) /* PA 15 */
  1042. #define PA_ENET_TXD ((ushort)0x0002) /* PA 14 */
  1043. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  1044. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  1045. #define PC_ENET_TENA ((ushort)0x0001) /* PC 15 */
  1046. #define PC_ENET_CLSN ((ushort)0x0010) /* PC 11 */
  1047. #define PC_ENET_RENA ((ushort)0x0020) /* PC 10 */
  1048. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  1049. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  1050. */
  1051. #define SICR_ENET_MASK ((uint)0x000000ff)
  1052. #define SICR_ENET_CLKRT ((uint)0x00000026)
  1053. # endif /* CONFIG_SCC1_ENET */
  1054. # ifdef CONFIG_FEC_ENET /* Use FEC for Fast Ethernet */
  1055. #define FEC_ENET
  1056. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  1057. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  1058. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  1059. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  1060. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  1061. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  1062. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  1063. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  1064. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  1065. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  1066. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  1067. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  1068. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  1069. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  1070. # endif /* CONFIG_FEC_ENET */
  1071. #endif /* CONFIG_TQM860L, CONFIG_TQM855L */
  1072. #if defined(CONFIG_NETVIA)
  1073. /* Bits in parallel I/O port registers that have to be set/cleared
  1074. * to configure the pins for SCC2 use.
  1075. */
  1076. #define PROFF_ENET PROFF_SCC2
  1077. #define CPM_CR_ENET CPM_CR_CH_SCC2
  1078. #define SCC_ENET 1
  1079. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  1080. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  1081. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  1082. #define PA_ENET_TCLK ((ushort)0x0800) /* PA 4 */
  1083. #define PB_ENET_PDN ((ushort)0x4000) /* PB 17 */
  1084. #define PB_ENET_TENA ((ushort)0x2000) /* PB 18 */
  1085. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  1086. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  1087. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  1088. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  1089. */
  1090. #define SICR_ENET_MASK ((uint)0x0000ff00)
  1091. #define SICR_ENET_CLKRT ((uint)0x00002f00)
  1092. #endif /* CONFIG_NETVIA */
  1093. /*********************************************************************/
  1094. /* SCC Event register as used by Ethernet.
  1095. */
  1096. #define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
  1097. #define SCCE_ENET_TXE ((ushort)0x0010) /* Transmit Error */
  1098. #define SCCE_ENET_RXF ((ushort)0x0008) /* Full frame received */
  1099. #define SCCE_ENET_BSY ((ushort)0x0004) /* All incoming buffers full */
  1100. #define SCCE_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */
  1101. #define SCCE_ENET_RXB ((ushort)0x0001) /* A buffer was received */
  1102. /* SCC Mode Register (PSMR) as used by Ethernet.
  1103. */
  1104. #define SCC_PSMR_HBC ((ushort)0x8000) /* Enable heartbeat */
  1105. #define SCC_PSMR_FC ((ushort)0x4000) /* Force collision */
  1106. #define SCC_PSMR_RSH ((ushort)0x2000) /* Receive short frames */
  1107. #define SCC_PSMR_IAM ((ushort)0x1000) /* Check individual hash */
  1108. #define SCC_PSMR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */
  1109. #define SCC_PSMR_PRO ((ushort)0x0200) /* Promiscuous mode */
  1110. #define SCC_PSMR_BRO ((ushort)0x0100) /* Catch broadcast pkts */
  1111. #define SCC_PSMR_SBT ((ushort)0x0080) /* Special backoff timer */
  1112. #define SCC_PSMR_LPB ((ushort)0x0040) /* Set Loopback mode */
  1113. #define SCC_PSMR_SIP ((ushort)0x0020) /* Sample Input Pins */
  1114. #define SCC_PSMR_LCW ((ushort)0x0010) /* Late collision window */
  1115. #define SCC_PSMR_NIB22 ((ushort)0x000a) /* Start frame search */
  1116. #define SCC_PSMR_FDE ((ushort)0x0001) /* Full duplex enable */
  1117. /* Buffer descriptor control/status used by Ethernet receive.
  1118. */
  1119. #define BD_ENET_RX_EMPTY ((ushort)0x8000)
  1120. #define BD_ENET_RX_WRAP ((ushort)0x2000)
  1121. #define BD_ENET_RX_INTR ((ushort)0x1000)
  1122. #define BD_ENET_RX_LAST ((ushort)0x0800)
  1123. #define BD_ENET_RX_FIRST ((ushort)0x0400)
  1124. #define BD_ENET_RX_MISS ((ushort)0x0100)
  1125. #define BD_ENET_RX_LG ((ushort)0x0020)
  1126. #define BD_ENET_RX_NO ((ushort)0x0010)
  1127. #define BD_ENET_RX_SH ((ushort)0x0008)
  1128. #define BD_ENET_RX_CR ((ushort)0x0004)
  1129. #define BD_ENET_RX_OV ((ushort)0x0002)
  1130. #define BD_ENET_RX_CL ((ushort)0x0001)
  1131. #define BD_ENET_RX_STATS ((ushort)0x013f) /* All status bits */
  1132. /* Buffer descriptor control/status used by Ethernet transmit.
  1133. */
  1134. #define BD_ENET_TX_READY ((ushort)0x8000)
  1135. #define BD_ENET_TX_PAD ((ushort)0x4000)
  1136. #define BD_ENET_TX_WRAP ((ushort)0x2000)
  1137. #define BD_ENET_TX_INTR ((ushort)0x1000)
  1138. #define BD_ENET_TX_LAST ((ushort)0x0800)
  1139. #define BD_ENET_TX_TC ((ushort)0x0400)
  1140. #define BD_ENET_TX_DEF ((ushort)0x0200)
  1141. #define BD_ENET_TX_HB ((ushort)0x0100)
  1142. #define BD_ENET_TX_LC ((ushort)0x0080)
  1143. #define BD_ENET_TX_RL ((ushort)0x0040)
  1144. #define BD_ENET_TX_RCMASK ((ushort)0x003c)
  1145. #define BD_ENET_TX_UN ((ushort)0x0002)
  1146. #define BD_ENET_TX_CSL ((ushort)0x0001)
  1147. #define BD_ENET_TX_STATS ((ushort)0x03ff) /* All status bits */
  1148. /* SCC as UART
  1149. */
  1150. typedef struct scc_uart {
  1151. sccp_t scc_genscc;
  1152. uint scc_res1; /* Reserved */
  1153. uint scc_res2; /* Reserved */
  1154. ushort scc_maxidl; /* Maximum idle chars */
  1155. ushort scc_idlc; /* temp idle counter */
  1156. ushort scc_brkcr; /* Break count register */
  1157. ushort scc_parec; /* receive parity error counter */
  1158. ushort scc_frmec; /* receive framing error counter */
  1159. ushort scc_nosec; /* receive noise counter */
  1160. ushort scc_brkec; /* receive break condition counter */
  1161. ushort scc_brkln; /* last received break length */
  1162. ushort scc_uaddr1; /* UART address character 1 */
  1163. ushort scc_uaddr2; /* UART address character 2 */
  1164. ushort scc_rtemp; /* Temp storage */
  1165. ushort scc_toseq; /* Transmit out of sequence char */
  1166. ushort scc_char1; /* control character 1 */
  1167. ushort scc_char2; /* control character 2 */
  1168. ushort scc_char3; /* control character 3 */
  1169. ushort scc_char4; /* control character 4 */
  1170. ushort scc_char5; /* control character 5 */
  1171. ushort scc_char6; /* control character 6 */
  1172. ushort scc_char7; /* control character 7 */
  1173. ushort scc_char8; /* control character 8 */
  1174. ushort scc_rccm; /* receive control character mask */
  1175. ushort scc_rccr; /* receive control character register */
  1176. ushort scc_rlbc; /* receive last break character */
  1177. } scc_uart_t;
  1178. /* SCC Event and Mask registers when it is used as a UART.
  1179. */
  1180. #define UART_SCCM_GLR ((ushort)0x1000)
  1181. #define UART_SCCM_GLT ((ushort)0x0800)
  1182. #define UART_SCCM_AB ((ushort)0x0200)
  1183. #define UART_SCCM_IDL ((ushort)0x0100)
  1184. #define UART_SCCM_GRA ((ushort)0x0080)
  1185. #define UART_SCCM_BRKE ((ushort)0x0040)
  1186. #define UART_SCCM_BRKS ((ushort)0x0020)
  1187. #define UART_SCCM_CCR ((ushort)0x0008)
  1188. #define UART_SCCM_BSY ((ushort)0x0004)
  1189. #define UART_SCCM_TX ((ushort)0x0002)
  1190. #define UART_SCCM_RX ((ushort)0x0001)
  1191. /* The SCC PSMR when used as a UART.
  1192. */
  1193. #define SCU_PSMR_FLC ((ushort)0x8000)
  1194. #define SCU_PSMR_SL ((ushort)0x4000)
  1195. #define SCU_PSMR_CL ((ushort)0x3000)
  1196. #define SCU_PSMR_UM ((ushort)0x0c00)
  1197. #define SCU_PSMR_FRZ ((ushort)0x0200)
  1198. #define SCU_PSMR_RZS ((ushort)0x0100)
  1199. #define SCU_PSMR_SYN ((ushort)0x0080)
  1200. #define SCU_PSMR_DRT ((ushort)0x0040)
  1201. #define SCU_PSMR_PEN ((ushort)0x0010)
  1202. #define SCU_PSMR_RPM ((ushort)0x000c)
  1203. #define SCU_PSMR_REVP ((ushort)0x0008)
  1204. #define SCU_PSMR_TPM ((ushort)0x0003)
  1205. #define SCU_PSMR_TEVP ((ushort)0x0003)
  1206. /* CPM Transparent mode SCC.
  1207. */
  1208. typedef struct scc_trans {
  1209. sccp_t st_genscc;
  1210. uint st_cpres; /* Preset CRC */
  1211. uint st_cmask; /* Constant mask for CRC */
  1212. } scc_trans_t;
  1213. #define BD_SCC_TX_LAST ((ushort)0x0800)
  1214. /* IIC parameter RAM.
  1215. */
  1216. typedef struct iic {
  1217. ushort iic_rbase; /* Rx Buffer descriptor base address */
  1218. ushort iic_tbase; /* Tx Buffer descriptor base address */
  1219. u_char iic_rfcr; /* Rx function code */
  1220. u_char iic_tfcr; /* Tx function code */
  1221. ushort iic_mrblr; /* Max receive buffer length */
  1222. uint iic_rstate; /* Internal */
  1223. uint iic_rdp; /* Internal */
  1224. ushort iic_rbptr; /* Internal */
  1225. ushort iic_rbc; /* Internal */
  1226. uint iic_rxtmp; /* Internal */
  1227. uint iic_tstate; /* Internal */
  1228. uint iic_tdp; /* Internal */
  1229. ushort iic_tbptr; /* Internal */
  1230. ushort iic_tbc; /* Internal */
  1231. uint iic_txtmp; /* Internal */
  1232. uint iic_res; /* reserved */
  1233. ushort iic_rpbase; /* Relocation pointer */
  1234. ushort iic_res2; /* reserved */
  1235. } iic_t;
  1236. /* SPI parameter RAM.
  1237. */
  1238. typedef struct spi {
  1239. ushort spi_rbase; /* Rx Buffer descriptor base address */
  1240. ushort spi_tbase; /* Tx Buffer descriptor base address */
  1241. u_char spi_rfcr; /* Rx function code */
  1242. u_char spi_tfcr; /* Tx function code */
  1243. ushort spi_mrblr; /* Max receive buffer length */
  1244. uint spi_rstate; /* Internal */
  1245. uint spi_rdp; /* Internal */
  1246. ushort spi_rbptr; /* Internal */
  1247. ushort spi_rbc; /* Internal */
  1248. uint spi_rxtmp; /* Internal */
  1249. uint spi_tstate; /* Internal */
  1250. uint spi_tdp; /* Internal */
  1251. ushort spi_tbptr; /* Internal */
  1252. ushort spi_tbc; /* Internal */
  1253. uint spi_txtmp; /* Internal */
  1254. uint spi_res;
  1255. ushort spi_rpbase; /* Relocation pointer */
  1256. ushort spi_res2;
  1257. } spi_t;
  1258. /* SPI Mode register.
  1259. */
  1260. #define SPMODE_LOOP ((ushort)0x4000) /* Loopback */
  1261. #define SPMODE_CI ((ushort)0x2000) /* Clock Invert */
  1262. #define SPMODE_CP ((ushort)0x1000) /* Clock Phase */
  1263. #define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */
  1264. #define SPMODE_REV ((ushort)0x0400) /* Reversed Data */
  1265. #define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */
  1266. #define SPMODE_EN ((ushort)0x0100) /* Enable */
  1267. #define SPMODE_LENMSK ((ushort)0x00f0) /* character length */
  1268. #define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */
  1269. #define SPMODE_LEN(x) ((((x)-1)&0xF)<<4)
  1270. #define SPMODE_PM(x) ((x) &0xF)
  1271. /* HDLC parameter RAM.
  1272. */
  1273. typedef struct hdlc_pram_s {
  1274. /*
  1275. * SCC parameter RAM
  1276. */
  1277. ushort rbase; /* Rx Buffer descriptor base address */
  1278. ushort tbase; /* Tx Buffer descriptor base address */
  1279. uchar rfcr; /* Rx function code */
  1280. uchar tfcr; /* Tx function code */
  1281. ushort mrblr; /* Rx buffer length */
  1282. ulong rstate; /* Rx internal state */
  1283. ulong rptr; /* Rx internal data pointer */
  1284. ushort rbptr; /* rb BD Pointer */
  1285. ushort rcount; /* Rx internal byte count */
  1286. ulong rtemp; /* Rx temp */
  1287. ulong tstate; /* Tx internal state */
  1288. ulong tptr; /* Tx internal data pointer */
  1289. ushort tbptr; /* Tx BD pointer */
  1290. ushort tcount; /* Tx byte count */
  1291. ulong ttemp; /* Tx temp */
  1292. ulong rcrc; /* temp receive CRC */
  1293. ulong tcrc; /* temp transmit CRC */
  1294. /*
  1295. * HDLC specific parameter RAM
  1296. */
  1297. uchar res[4]; /* reserved */
  1298. ulong c_mask; /* CRC constant */
  1299. ulong c_pres; /* CRC preset */
  1300. ushort disfc; /* discarded frame counter */
  1301. ushort crcec; /* CRC error counter */
  1302. ushort abtsc; /* abort sequence counter */
  1303. ushort nmarc; /* nonmatching address rx cnt */
  1304. ushort retrc; /* frame retransmission cnt */
  1305. ushort mflr; /* maximum frame length reg */
  1306. ushort max_cnt; /* maximum length counter */
  1307. ushort rfthr; /* received frames threshold */
  1308. ushort rfcnt; /* received frames count */
  1309. ushort hmask; /* user defined frm addr mask */
  1310. ushort haddr1; /* user defined frm address 1 */
  1311. ushort haddr2; /* user defined frm address 2 */
  1312. ushort haddr3; /* user defined frm address 3 */
  1313. ushort haddr4; /* user defined frm address 4 */
  1314. ushort tmp; /* temp */
  1315. ushort tmp_mb; /* temp */
  1316. } hdlc_pram_t;
  1317. /* CPM interrupts. There are nearly 32 interrupts generated by CPM
  1318. * channels or devices. All of these are presented to the PPC core
  1319. * as a single interrupt. The CPM interrupt handler dispatches its
  1320. * own handlers, in a similar fashion to the PPC core handler. We
  1321. * use the table as defined in the manuals (i.e. no special high
  1322. * priority and SCC1 == SCCa, etc...).
  1323. */
  1324. #define CPMVEC_NR 32
  1325. #define CPMVEC_PIO_PC15 ((ushort)0x1f)
  1326. #define CPMVEC_SCC1 ((ushort)0x1e)
  1327. #define CPMVEC_SCC2 ((ushort)0x1d)
  1328. #define CPMVEC_SCC3 ((ushort)0x1c)
  1329. #define CPMVEC_SCC4 ((ushort)0x1b)
  1330. #define CPMVEC_PIO_PC14 ((ushort)0x1a)
  1331. #define CPMVEC_TIMER1 ((ushort)0x19)
  1332. #define CPMVEC_PIO_PC13 ((ushort)0x18)
  1333. #define CPMVEC_PIO_PC12 ((ushort)0x17)
  1334. #define CPMVEC_SDMA_CB_ERR ((ushort)0x16)
  1335. #define CPMVEC_IDMA1 ((ushort)0x15)
  1336. #define CPMVEC_IDMA2 ((ushort)0x14)
  1337. #define CPMVEC_TIMER2 ((ushort)0x12)
  1338. #define CPMVEC_RISCTIMER ((ushort)0x11)
  1339. #define CPMVEC_I2C ((ushort)0x10)
  1340. #define CPMVEC_PIO_PC11 ((ushort)0x0f)
  1341. #define CPMVEC_PIO_PC10 ((ushort)0x0e)
  1342. #define CPMVEC_TIMER3 ((ushort)0x0c)
  1343. #define CPMVEC_PIO_PC9 ((ushort)0x0b)
  1344. #define CPMVEC_PIO_PC8 ((ushort)0x0a)
  1345. #define CPMVEC_PIO_PC7 ((ushort)0x09)
  1346. #define CPMVEC_TIMER4 ((ushort)0x07)
  1347. #define CPMVEC_PIO_PC6 ((ushort)0x06)
  1348. #define CPMVEC_SPI ((ushort)0x05)
  1349. #define CPMVEC_SMC1 ((ushort)0x04)
  1350. #define CPMVEC_SMC2 ((ushort)0x03)
  1351. #define CPMVEC_PIO_PC5 ((ushort)0x02)
  1352. #define CPMVEC_PIO_PC4 ((ushort)0x01)
  1353. #define CPMVEC_ERROR ((ushort)0x00)
  1354. extern void irq_install_handler(int vec, void (*handler)(void *), void *dev_id);
  1355. /* CPM interrupt configuration vector.
  1356. */
  1357. #define CICR_SCD_SCC4 ((uint)0x00c00000) /* SCC4 @ SCCd */
  1358. #define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */
  1359. #define CICR_SCB_SCC2 ((uint)0x00040000) /* SCC2 @ SCCb */
  1360. #define CICR_SCA_SCC1 ((uint)0x00000000) /* SCC1 @ SCCa */
  1361. #define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrrupt */
  1362. #define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */
  1363. #define CICR_IEN ((uint)0x00000080) /* Int. enable */
  1364. #define CICR_SPS ((uint)0x00000001) /* SCC Spread */
  1365. #endif /* __CPM_8XX__ */