commproc.h 62 KB

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