commproc.h 57 KB

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