commproc.h 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809
  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_FADS) && defined(CONFIG_MPC86x)
  615. /*
  616. * This ENET stuff is for the MPC86xFADS/MPC8xxADS with ethernet on SCC1.
  617. */
  618. #ifdef CONFIG_SCC1_ENET
  619. #define SCC_ENET 0
  620. #define PROFF_ENET PROFF_SCC1
  621. #define CPM_CR_ENET CPM_CR_CH_SCC1
  622. #define PA_ENET_RXD ((ushort)0x0001)
  623. #define PA_ENET_TXD ((ushort)0x0002)
  624. #define PA_ENET_TCLK ((ushort)0x0100)
  625. #define PA_ENET_RCLK ((ushort)0x0200)
  626. #define PB_ENET_TENA ((uint)0x00001000)
  627. #define PC_ENET_CLSN ((ushort)0x0010)
  628. #define PC_ENET_RENA ((ushort)0x0020)
  629. #define SICR_ENET_MASK ((uint)0x000000ff)
  630. #define SICR_ENET_CLKRT ((uint)0x0000002c)
  631. #endif /* CONFIG_SCC1_ETHERNET */
  632. /*
  633. * This ENET stuff is for the MPC860TFADS/MPC86xADS/DUET with ethernet on FEC.
  634. */
  635. #ifdef CONFIG_FEC_ENET
  636. #define FEC_ENET /* Use FEC for Ethernet */
  637. #endif /* CONFIG_FEC_ENET */
  638. #endif /* CONFIG_FADS && CONFIG_MPC86x */
  639. /*** FPS850L, FPS860L ************************************************/
  640. #if defined(CONFIG_FPS850L) || defined(CONFIG_FPS860L)
  641. /* Bits in parallel I/O port registers that have to be set/cleared
  642. * to configure the pins for SCC2 use.
  643. */
  644. #define PROFF_ENET PROFF_SCC2
  645. #define CPM_CR_ENET CPM_CR_CH_SCC2
  646. #define SCC_ENET 1
  647. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  648. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  649. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  650. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  651. #define PC_ENET_TENA ((ushort)0x0002) /* PC 14 */
  652. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  653. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  654. /* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
  655. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  656. */
  657. #define SICR_ENET_MASK ((uint)0x0000ff00)
  658. #define SICR_ENET_CLKRT ((uint)0x00002600)
  659. #endif /* CONFIG_FPS850L, CONFIG_FPS860L */
  660. /*** GEN860T **********************************************************/
  661. #if defined(CONFIG_GEN860T)
  662. #undef SCC_ENET
  663. #define FEC_ENET
  664. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  665. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  666. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  667. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  668. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  669. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  670. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  671. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  672. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  673. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  674. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  675. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  676. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  677. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3-15 */
  678. #endif /* CONFIG_GEN860T */
  679. /*** GENIETV ********************************************************/
  680. #if defined(CONFIG_GENIETV)
  681. /* Ethernet is only on SCC2 */
  682. #define CONFIG_SCC2_ENET
  683. #define PROFF_ENET PROFF_SCC2
  684. #define CPM_CR_ENET CPM_CR_CH_SCC2
  685. #define SCC_ENET 1
  686. #define CPMVEC_ENET CPMVEC_SCC2
  687. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  688. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  689. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  690. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  691. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  692. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  693. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  694. #define SICR_ENET_MASK ((uint)0x0000ff00)
  695. #define SICR_ENET_CLKRT ((uint)0x00002e00)
  696. #endif /* CONFIG_GENIETV */
  697. /*** GTH ******************************************************/
  698. #ifdef CONFIG_GTH
  699. #ifdef CONFIG_FEC_ENET
  700. #define FEC_ENET /* use FEC for EThernet */
  701. #endif /* CONFIG_FEC_ETHERNET */
  702. /* This ENET stuff is for GTH 10 Mbit ( SCC ) */
  703. #define PROFF_ENET PROFF_SCC1
  704. #define CPM_CR_ENET CPM_CR_CH_SCC1
  705. #define SCC_ENET 0
  706. #define PA_ENET_RXD ((ushort)0x0001) /* PA15 */
  707. #define PA_ENET_TXD ((ushort)0x0002) /* PA14 */
  708. #define PA_ENET_TCLK ((ushort)0x0800) /* PA4 */
  709. #define PA_ENET_RCLK ((ushort)0x0400) /* PA5 */
  710. #define PB_ENET_TENA ((uint)0x00001000) /* PB19 */
  711. #define PC_ENET_CLSN ((ushort)0x0010) /* PC11 */
  712. #define PC_ENET_RENA ((ushort)0x0020) /* PC10 */
  713. /* NOTE. This is reset for 10Mbit port only */
  714. #define PC_ENET_RESET ((ushort)0x0100) /* PC 7 */
  715. #define SICR_ENET_MASK ((uint)0x000000ff)
  716. /* TCLK PA4 -->CLK4, RCLK PA5 -->CLK3 */
  717. #define SICR_ENET_CLKRT ((uint)0x00000037)
  718. #endif /* CONFIG_GTH */
  719. /*** HERMES-PRO ******************************************************/
  720. /* The HERMES-PRO uses the FEC on a MPC860T for Ethernet */
  721. #ifdef CONFIG_HERMES
  722. #define FEC_ENET /* use FEC for EThernet */
  723. #undef SCC_ENET
  724. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  725. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  726. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  727. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  728. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  729. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  730. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  731. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  732. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  733. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  734. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  735. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  736. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  737. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  738. #endif /* CONFIG_HERMES */
  739. /*** IAD210 **********************************************************/
  740. /* The IAD210 uses the FEC on a MPC860P for Ethernet */
  741. #if defined(CONFIG_IAD210)
  742. # define FEC_ENET /* use FEC for Ethernet */
  743. # undef SCC_ENET
  744. # define PD_MII_TXD1 ((ushort) 0x1000 ) /* PD 3 */
  745. # define PD_MII_TXD2 ((ushort) 0x0800 ) /* PD 4 */
  746. # define PD_MII_TXD3 ((ushort) 0x0400 ) /* PD 5 */
  747. # define PD_MII_RX_DV ((ushort) 0x0200 ) /* PD 6 */
  748. # define PD_MII_RX_ERR ((ushort) 0x0100 ) /* PD 7 */
  749. # define PD_MII_RX_CLK ((ushort) 0x0080 ) /* PD 8 */
  750. # define PD_MII_TXD0 ((ushort) 0x0040 ) /* PD 9 */
  751. # define PD_MII_RXD0 ((ushort) 0x0020 ) /* PD 10 */
  752. # define PD_MII_TX_ERR ((ushort) 0x0010 ) /* PD 11 */
  753. # define PD_MII_MDC ((ushort) 0x0008 ) /* PD 12 */
  754. # define PD_MII_RXD1 ((ushort) 0x0004 ) /* PD 13 */
  755. # define PD_MII_RXD2 ((ushort) 0x0002 ) /* PD 14 */
  756. # define PD_MII_RXD3 ((ushort) 0x0001 ) /* PD 15 */
  757. # define PD_MII_MASK ((ushort) 0x1FFF ) /* PD 3...15 */
  758. #endif /* CONFIG_IAD210 */
  759. /*** ICU862 **********************************************************/
  760. #if defined(CONFIG_ICU862)
  761. #ifdef CONFIG_FEC_ENET
  762. #define FEC_ENET /* use FEC for EThernet */
  763. #endif /* CONFIG_FEC_ETHERNET */
  764. #endif /* CONFIG_ICU862 */
  765. /*** IP860 **********************************************************/
  766. #if defined(CONFIG_IP860)
  767. /* Bits in parallel I/O port registers that have to be set/cleared
  768. * to configure the pins for SCC1 use.
  769. */
  770. #define PROFF_ENET PROFF_SCC1
  771. #define CPM_CR_ENET CPM_CR_CH_SCC1
  772. #define SCC_ENET 0
  773. #define PA_ENET_RXD ((ushort)0x0001) /* PA 15 */
  774. #define PA_ENET_TXD ((ushort)0x0002) /* PA 14 */
  775. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  776. #define PA_ENET_TCLK ((ushort)0x0100) /* PA 7 */
  777. #define PC_ENET_TENA ((ushort)0x0001) /* PC 15 */
  778. #define PC_ENET_CLSN ((ushort)0x0010) /* PC 11 */
  779. #define PC_ENET_RENA ((ushort)0x0020) /* PC 10 */
  780. #define PB_ENET_RESET (uint)0x00000008 /* PB 28 */
  781. #define PB_ENET_JABD (uint)0x00000004 /* PB 29 */
  782. /* Control bits in the SICR to route TCLK (CLK1) and RCLK (CLK2) to
  783. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  784. */
  785. #define SICR_ENET_MASK ((uint)0x000000ff)
  786. #define SICR_ENET_CLKRT ((uint)0x0000002C)
  787. #endif /* CONFIG_IP860 */
  788. /*** IVMS8 **********************************************************/
  789. /* The IVMS8 uses the FEC on a MPC860T for Ethernet */
  790. #if defined(CONFIG_IVMS8) || defined(CONFIG_IVML24)
  791. #define FEC_ENET /* use FEC for EThernet */
  792. #undef SCC_ENET
  793. #define PB_ENET_POWER ((uint)0x00010000) /* PB 15 */
  794. #define PC_ENET_RESET ((ushort)0x0010) /* PC 11 */
  795. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  796. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  797. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  798. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  799. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  800. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  801. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  802. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  803. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  804. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  805. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  806. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  807. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  808. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  809. #endif /* CONFIG_IVMS8, CONFIG_IVML24 */
  810. /*** KUP4K *********************************************************/
  811. /* The KUP4K uses the FEC on a MPC855T for Ethernet */
  812. #if defined(CONFIG_KUP4K)
  813. #define FEC_ENET /* use FEC for EThernet */
  814. #undef SCC_ENET
  815. #define PB_ENET_POWER ((uint)0x00010000) /* PB 15 */
  816. #define PC_ENET_RESET ((ushort)0x0010) /* PC 11 */
  817. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  818. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  819. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  820. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  821. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  822. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  823. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  824. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  825. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  826. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  827. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  828. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  829. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  830. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  831. #endif /* CONFIG_KUP4K */
  832. /*** LANTEC *********************************************************/
  833. #if defined(CONFIG_LANTEC) && CONFIG_LANTEC >= 2
  834. /* Bits in parallel I/O port registers that have to be set/cleared
  835. * to configure the pins for SCC2 use.
  836. */
  837. #define PROFF_ENET PROFF_SCC2
  838. #define CPM_CR_ENET CPM_CR_CH_SCC2
  839. #define SCC_ENET 1
  840. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  841. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  842. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  843. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  844. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  845. #define PC_ENET_LBK ((ushort)0x0010) /* PC 11 */
  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 (CLK2) 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)0x00002E00)
  853. #endif /* CONFIG_LANTEC v2 */
  854. /*** LWMON **********************************************************/
  855. #if defined(CONFIG_LWMON) && !defined(CONFIG_8xx_CONS_SCC2)
  856. /* Bits in parallel I/O port registers that have to be set/cleared
  857. * to configure the pins for SCC2 use.
  858. */
  859. #define PROFF_ENET PROFF_SCC2
  860. #define CPM_CR_ENET CPM_CR_CH_SCC2
  861. #define SCC_ENET 1
  862. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  863. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  864. #define PA_ENET_RCLK ((ushort)0x0800) /* PA 4 */
  865. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  866. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  867. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  868. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  869. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK4) to
  870. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  871. */
  872. #define SICR_ENET_MASK ((uint)0x0000ff00)
  873. #define SICR_ENET_CLKRT ((uint)0x00003E00)
  874. #endif /* CONFIG_LWMON */
  875. /*** NX823 ***********************************************/
  876. #if defined(CONFIG_NX823)
  877. /* Bits in parallel I/O port registers that have to be set/cleared
  878. * to configure the pins for SCC1 use.
  879. */
  880. #define PROFF_ENET PROFF_SCC2
  881. #define CPM_CR_ENET CPM_CR_CH_SCC2
  882. #define SCC_ENET 1
  883. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  884. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  885. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  886. #define PA_ENET_TCLK ((ushort)0x0800) /* PA 4 */
  887. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  888. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  889. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  890. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  891. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  892. */
  893. #define SICR_ENET_MASK ((uint)0x0000ff00)
  894. #define SICR_ENET_CLKRT ((uint)0x00002f00)
  895. #endif /* CONFIG_NX823 */
  896. /*** MBX ************************************************************/
  897. #ifdef CONFIG_MBX
  898. /* Bits in parallel I/O port registers that have to be set/cleared
  899. * to configure the pins for SCC1 use. The TCLK and RCLK seem unique
  900. * to the MBX860 board. Any two of the four available clocks could be
  901. * used, and the MPC860 cookbook manual has an example using different
  902. * clock pins.
  903. */
  904. #define PROFF_ENET PROFF_SCC1
  905. #define CPM_CR_ENET CPM_CR_CH_SCC1
  906. #define SCC_ENET 0
  907. #define PA_ENET_RXD ((ushort)0x0001)
  908. #define PA_ENET_TXD ((ushort)0x0002)
  909. #define PA_ENET_TCLK ((ushort)0x0200)
  910. #define PA_ENET_RCLK ((ushort)0x0800)
  911. #define PC_ENET_TENA ((ushort)0x0001)
  912. #define PC_ENET_CLSN ((ushort)0x0010)
  913. #define PC_ENET_RENA ((ushort)0x0020)
  914. /* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
  915. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  916. */
  917. #define SICR_ENET_MASK ((uint)0x000000ff)
  918. #define SICR_ENET_CLKRT ((uint)0x0000003d)
  919. #endif /* CONFIG_MBX */
  920. /*** MHPC ********************************************************/
  921. #if defined(CONFIG_MHPC)
  922. /* This ENET stuff is for the MHPC with ethernet on SCC2.
  923. * Note TENA is on Port B.
  924. */
  925. #define PROFF_ENET PROFF_SCC2
  926. #define CPM_CR_ENET CPM_CR_CH_SCC2
  927. #define SCC_ENET 1
  928. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  929. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  930. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  931. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  932. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  933. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  934. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  935. #define SICR_ENET_MASK ((uint)0x0000ff00)
  936. #define SICR_ENET_CLKRT ((uint)0x00002e00) /* RCLK-CLK2, TCLK-CLK3 */
  937. #endif /* CONFIG_MHPC */
  938. /*** NETVIA *******************************************************/
  939. /* SinoVee Microsystems SC8xx series FEL8xx-AT,SC823,SC850,SC855T,SC860T */
  940. #if ( defined CONFIG_SVM_SC8xx )
  941. # ifndef CONFIG_FEC_ENET
  942. #define PROFF_ENET PROFF_SCC2
  943. #define CPM_CR_ENET CPM_CR_CH_SCC2
  944. #define SCC_ENET 1
  945. /* Bits in parallel I/O port registers that have to be set/cleared
  946. * * * * to configure the pins for SCC2 use.
  947. * * * */
  948. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  949. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  950. #define PA_ENET_RCLK ((ushort)0x0400) /* PA 5 */
  951. #define PA_ENET_TCLK ((ushort)0x0800) /* PA 4 */
  952. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  953. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  954. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  955. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  956. * * * * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  957. * * * */
  958. #define SICR_ENET_MASK ((uint)0x0000ff00)
  959. #define SICR_ENET_CLKRT ((uint)0x00003700)
  960. # else /* Use FEC for Fast Ethernet */
  961. #undef SCC_ENET
  962. #define FEC_ENET
  963. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  964. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  965. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  966. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  967. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  968. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  969. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  970. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  971. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  972. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  973. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  974. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  975. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  976. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  977. # endif /* CONFIG_FEC_ENET */
  978. #endif /* CONFIG_SVM_SC8xx */
  979. #if defined(CONFIG_NETVIA)
  980. /* Bits in parallel I/O port registers that have to be set/cleared
  981. * to configure the pins for SCC2 use.
  982. */
  983. #define PROFF_ENET PROFF_SCC2
  984. #define CPM_CR_ENET CPM_CR_CH_SCC2
  985. #define SCC_ENET 1
  986. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  987. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  988. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  989. #define PA_ENET_TCLK ((ushort)0x0800) /* PA 4 */
  990. #if !defined(CONFIG_NETVIA_VERSION) || CONFIG_NETVIA_VERSION == 1
  991. # define PB_ENET_PDN ((ushort)0x4000) /* PB 17 */
  992. #elif CONFIG_NETVIA_VERSION >= 2
  993. # define PC_ENET_PDN ((ushort)0x0008) /* PC 12 */
  994. #endif
  995. #define PB_ENET_TENA ((ushort)0x2000) /* PB 18 */
  996. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  997. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  998. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  999. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  1000. */
  1001. #define SICR_ENET_MASK ((uint)0x0000ff00)
  1002. #define SICR_ENET_CLKRT ((uint)0x00002f00)
  1003. #endif /* CONFIG_NETVIA */
  1004. /*** QS850/QS823 ***************************************************/
  1005. #if defined(CONFIG_QS850) || defined(CONFIG_QS823)
  1006. #undef FEC_ENET /* Don't use FEC for EThernet */
  1007. #define PROFF_ENET PROFF_SCC2
  1008. #define CPM_CR_ENET CPM_CR_CH_SCC2
  1009. #define SCC_ENET 1
  1010. #define PA_ENET_RXD ((ushort)0x0004) /* RXD on PA13 (Pin D9) */
  1011. #define PA_ENET_TXD ((ushort)0x0008) /* TXD on PA12 (Pin D7) */
  1012. #define PC_ENET_RENA ((ushort)0x0080) /* RENA on PC8 (Pin D12) */
  1013. #define PC_ENET_CLSN ((ushort)0x0040) /* CLSN on PC9 (Pin C12) */
  1014. #define PA_ENET_TCLK ((ushort)0x0200) /* TCLK on PA6 (Pin D8) */
  1015. #define PA_ENET_RCLK ((ushort)0x0800) /* RCLK on PA4 (Pin D10) */
  1016. #define PB_ENET_TENA ((uint)0x00002000) /* TENA on PB18 (Pin D11) */
  1017. #define PC_ENET_LBK ((ushort)0x0010) /* Loopback control on PC11 (Pin B14) */
  1018. #define PC_ENET_LI ((ushort)0x0020) /* Link Integrity control PC10 (A15) */
  1019. #define PC_ENET_SQE ((ushort)0x0100) /* SQE Disable control PC7 (B15) */
  1020. /* SCC2 TXCLK from CLK2
  1021. * SCC2 RXCLK from CLK4
  1022. * SCC2 Connected to NMSI */
  1023. #define SICR_ENET_MASK ((uint)0x00007F00)
  1024. #define SICR_ENET_CLKRT ((uint)0x00003D00)
  1025. #endif /* CONFIG_QS850/QS823 */
  1026. /*** QS860T ***************************************************/
  1027. #ifdef CONFIG_QS860T
  1028. #ifdef CONFIG_FEC_ENET
  1029. #define FEC_ENET /* use FEC for EThernet */
  1030. #endif /* CONFIG_FEC_ETHERNET */
  1031. /* This ENET stuff is for GTH 10 Mbit ( SCC ) */
  1032. #define PROFF_ENET PROFF_SCC1
  1033. #define CPM_CR_ENET CPM_CR_CH_SCC1
  1034. #define SCC_ENET 0
  1035. #define PA_ENET_RXD ((ushort)0x0001) /* PA15 */
  1036. #define PA_ENET_TXD ((ushort)0x0002) /* PA14 */
  1037. #define PA_ENET_TCLK ((ushort)0x0800) /* PA4 */
  1038. #define PA_ENET_RCLK ((ushort)0x0200) /* PA6 */
  1039. #define PB_ENET_TENA ((uint)0x00001000) /* PB19 */
  1040. #define PC_ENET_CLSN ((ushort)0x0010) /* PC11 */
  1041. #define PC_ENET_RENA ((ushort)0x0020) /* PC10 */
  1042. #define SICR_ENET_MASK ((uint)0x000000ff)
  1043. /* RCLK PA4 -->CLK4, TCLK PA6 -->CLK2 */
  1044. #define SICR_ENET_CLKRT ((uint)0x0000003D)
  1045. #endif /* CONFIG_QS860T */
  1046. /*** RPXCLASSIC *****************************************************/
  1047. #ifdef CONFIG_RPXCLASSIC
  1048. #ifdef CONFIG_FEC_ENET
  1049. # define FEC_ENET /* use FEC for EThernet */
  1050. # undef SCC_ENET
  1051. #else /* ! CONFIG_FEC_ENET */
  1052. /* Bits in parallel I/O port registers that have to be set/cleared
  1053. * to configure the pins for SCC1 use.
  1054. */
  1055. #define PROFF_ENET PROFF_SCC1
  1056. #define CPM_CR_ENET CPM_CR_CH_SCC1
  1057. #define SCC_ENET 0
  1058. #define PA_ENET_RXD ((ushort)0x0001)
  1059. #define PA_ENET_TXD ((ushort)0x0002)
  1060. #define PA_ENET_TCLK ((ushort)0x0200)
  1061. #define PA_ENET_RCLK ((ushort)0x0800)
  1062. #define PB_ENET_TENA ((uint)0x00001000)
  1063. #define PC_ENET_CLSN ((ushort)0x0010)
  1064. #define PC_ENET_RENA ((ushort)0x0020)
  1065. /* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
  1066. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  1067. */
  1068. #define SICR_ENET_MASK ((uint)0x000000ff)
  1069. #define SICR_ENET_CLKRT ((uint)0x0000003d)
  1070. #endif /* CONFIG_FEC_ENET */
  1071. #endif /* CONFIG_RPXCLASSIC */
  1072. /*** RPXLITE ********************************************************/
  1073. #ifdef CONFIG_RPXLITE
  1074. /* This ENET stuff is for the MPC850 with ethernet on SCC2. Some of
  1075. * this may be unique to the RPX-Lite configuration.
  1076. * Note TENA is on Port B.
  1077. */
  1078. #define PROFF_ENET PROFF_SCC2
  1079. #define CPM_CR_ENET CPM_CR_CH_SCC2
  1080. #define SCC_ENET 1
  1081. #define PA_ENET_RXD ((ushort)0x0004)
  1082. #define PA_ENET_TXD ((ushort)0x0008)
  1083. #define PA_ENET_TCLK ((ushort)0x0200)
  1084. #define PA_ENET_RCLK ((ushort)0x0800)
  1085. #if defined(CONFIG_RMU)
  1086. #define PC_ENET_TENA ((uint)0x00000002) /* PC14 */
  1087. #else
  1088. #define PB_ENET_TENA ((uint)0x00002000)
  1089. #endif
  1090. #define PC_ENET_CLSN ((ushort)0x0040)
  1091. #define PC_ENET_RENA ((ushort)0x0080)
  1092. #define SICR_ENET_MASK ((uint)0x0000ff00)
  1093. #define SICR_ENET_CLKRT ((uint)0x00003d00)
  1094. #endif /* CONFIG_RPXLITE */
  1095. /*** SM850 *********************************************************/
  1096. /* The SM850 Service Module uses SCC2 for IrDA and SCC3 for Ethernet */
  1097. #ifdef CONFIG_SM850
  1098. #define PROFF_ENET PROFF_SCC3 /* Ethernet on SCC3 */
  1099. #define CPM_CR_ENET CPM_CR_CH_SCC3
  1100. #define SCC_ENET 2
  1101. #define PB_ENET_RXD ((uint)0x00000004) /* PB 29 */
  1102. #define PB_ENET_TXD ((uint)0x00000002) /* PB 30 */
  1103. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  1104. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  1105. #define PC_ENET_LBK ((ushort)0x0008) /* PC 12 */
  1106. #define PC_ENET_TENA ((ushort)0x0004) /* PC 13 */
  1107. #define PC_ENET_RENA ((ushort)0x0800) /* PC 4 */
  1108. #define PC_ENET_CLSN ((ushort)0x0400) /* PC 5 */
  1109. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  1110. * SCC3. Also, make sure GR3 (bit 8) and SC3 (bit 9) are zero.
  1111. */
  1112. #define SICR_ENET_MASK ((uint)0x00FF0000)
  1113. #define SICR_ENET_CLKRT ((uint)0x00260000)
  1114. #endif /* CONFIG_SM850 */
  1115. /*** SPD823TS ******************************************************/
  1116. #ifdef CONFIG_SPD823TS
  1117. /* Bits in parallel I/O port registers that have to be set/cleared
  1118. * to configure the pins for SCC2 use.
  1119. */
  1120. #define PROFF_ENET PROFF_SCC2 /* Ethernet on SCC2 */
  1121. #define CPM_CR_ENET CPM_CR_CH_SCC2
  1122. #define SCC_ENET 1
  1123. #define PA_ENET_MDC ((ushort)0x0001) /* PA 15 !!! */
  1124. #define PA_ENET_MDIO ((ushort)0x0002) /* PA 14 !!! */
  1125. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  1126. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  1127. #define PA_ENET_RCLK ((ushort)0x0200) /* PA 6 */
  1128. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  1129. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  1130. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  1131. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  1132. #define PC_ENET_RESET ((ushort)0x0100) /* PC 7 !!! */
  1133. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK2) to
  1134. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  1135. */
  1136. #define SICR_ENET_MASK ((uint)0x0000ff00)
  1137. #define SICR_ENET_CLKRT ((uint)0x00002E00)
  1138. #endif /* CONFIG_SPD823TS */
  1139. /*** SXNI855T ******************************************************/
  1140. #if defined(CONFIG_SXNI855T)
  1141. #ifdef CONFIG_FEC_ENET
  1142. #define FEC_ENET /* use FEC for Ethernet */
  1143. #endif /* CONFIG_FEC_ETHERNET */
  1144. #endif /* CONFIG_SXNI855T */
  1145. /*** MVS1, TQM823L/M, TQM850L/M, ETX094, R360MPI *******************/
  1146. #if (defined(CONFIG_MVS) && CONFIG_MVS < 2) || \
  1147. defined(CONFIG_R360MPI) || defined(CONFIG_RBC823) || \
  1148. defined(CONFIG_TQM823L) || defined(CONFIG_TQM823M) || \
  1149. defined(CONFIG_TQM850L) || defined(CONFIG_TQM850M) || \
  1150. defined(CONFIG_ETX094) || defined(CONFIG_RRVISION)|| \
  1151. (defined(CONFIG_LANTEC) && CONFIG_LANTEC < 2)
  1152. /* Bits in parallel I/O port registers that have to be set/cleared
  1153. * to configure the pins for SCC2 use.
  1154. */
  1155. #define PROFF_ENET PROFF_SCC2
  1156. #define CPM_CR_ENET CPM_CR_CH_SCC2
  1157. #define SCC_ENET 1
  1158. #define PA_ENET_RXD ((ushort)0x0004) /* PA 13 */
  1159. #define PA_ENET_TXD ((ushort)0x0008) /* PA 12 */
  1160. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  1161. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  1162. #define PB_ENET_TENA ((uint)0x00002000) /* PB 18 */
  1163. #define PC_ENET_CLSN ((ushort)0x0040) /* PC 9 */
  1164. #define PC_ENET_RENA ((ushort)0x0080) /* PC 8 */
  1165. #if defined(CONFIG_R360MPI)
  1166. #define PC_ENET_LBK ((ushort)0x0008) /* PC 12 */
  1167. #endif /* CONFIG_R360MPI */
  1168. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  1169. * SCC2. Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
  1170. */
  1171. #define SICR_ENET_MASK ((uint)0x0000ff00)
  1172. #define SICR_ENET_CLKRT ((uint)0x00002600)
  1173. #endif /* CONFIG_MVS v1, CONFIG_TQM823L/M, CONFIG_TQM850L/M, etc. */
  1174. /*** TQM855L/M, TQM860L/M, TQM862L/M, TQM866L/M *********************/
  1175. #if defined(CONFIG_TQM855L) || defined(CONFIG_TQM855M) || \
  1176. defined(CONFIG_TQM860L) || defined(CONFIG_TQM860M) || \
  1177. defined(CONFIG_TQM862L) || defined(CONFIG_TQM862M) || \
  1178. defined(CONFIG_TQM866L) || defined(CONFIG_TQM866M)
  1179. # ifdef CONFIG_SCC1_ENET /* use SCC for 10Mbps Ethernet */
  1180. /* Bits in parallel I/O port registers that have to be set/cleared
  1181. * to configure the pins for SCC1 use.
  1182. */
  1183. #define PROFF_ENET PROFF_SCC1
  1184. #define CPM_CR_ENET CPM_CR_CH_SCC1
  1185. #define SCC_ENET 0
  1186. #define PA_ENET_RXD ((ushort)0x0001) /* PA 15 */
  1187. #define PA_ENET_TXD ((ushort)0x0002) /* PA 14 */
  1188. #define PA_ENET_RCLK ((ushort)0x0100) /* PA 7 */
  1189. #define PA_ENET_TCLK ((ushort)0x0400) /* PA 5 */
  1190. #define PC_ENET_TENA ((ushort)0x0001) /* PC 15 */
  1191. #define PC_ENET_CLSN ((ushort)0x0010) /* PC 11 */
  1192. #define PC_ENET_RENA ((ushort)0x0020) /* PC 10 */
  1193. /* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
  1194. * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
  1195. */
  1196. #define SICR_ENET_MASK ((uint)0x000000ff)
  1197. #define SICR_ENET_CLKRT ((uint)0x00000026)
  1198. # endif /* CONFIG_SCC1_ENET */
  1199. # ifdef CONFIG_FEC_ENET /* Use FEC for Fast Ethernet */
  1200. #define FEC_ENET
  1201. #define PD_MII_TXD1 ((ushort)0x1000) /* PD 3 */
  1202. #define PD_MII_TXD2 ((ushort)0x0800) /* PD 4 */
  1203. #define PD_MII_TXD3 ((ushort)0x0400) /* PD 5 */
  1204. #define PD_MII_RX_DV ((ushort)0x0200) /* PD 6 */
  1205. #define PD_MII_RX_ERR ((ushort)0x0100) /* PD 7 */
  1206. #define PD_MII_RX_CLK ((ushort)0x0080) /* PD 8 */
  1207. #define PD_MII_TXD0 ((ushort)0x0040) /* PD 9 */
  1208. #define PD_MII_RXD0 ((ushort)0x0020) /* PD 10 */
  1209. #define PD_MII_TX_ERR ((ushort)0x0010) /* PD 11 */
  1210. #define PD_MII_MDC ((ushort)0x0008) /* PD 12 */
  1211. #define PD_MII_RXD1 ((ushort)0x0004) /* PD 13 */
  1212. #define PD_MII_RXD2 ((ushort)0x0002) /* PD 14 */
  1213. #define PD_MII_RXD3 ((ushort)0x0001) /* PD 15 */
  1214. #define PD_MII_MASK ((ushort)0x1FFF) /* PD 3...15 */
  1215. # endif /* CONFIG_FEC_ENET */
  1216. #endif /* CONFIG_TQM855L/M, TQM860L/M, TQM862L/M */
  1217. /*** V37 **********************************************************/
  1218. #ifdef CONFIG_V37
  1219. /* This ENET stuff is for the MPC823 with ethernet on SCC2. Some of
  1220. * this may be unique to the Marel V37 configuration.
  1221. * Note TENA is on Port B.
  1222. */
  1223. #define PROFF_ENET PROFF_SCC2
  1224. #define CPM_CR_ENET CPM_CR_CH_SCC2
  1225. #define SCC_ENET 1
  1226. #define PA_ENET_RXD ((ushort)0x0004)
  1227. #define PA_ENET_TXD ((ushort)0x0008)
  1228. #define PA_ENET_TCLK ((ushort)0x0400)
  1229. #define PA_ENET_RCLK ((ushort)0x0200)
  1230. #define PB_ENET_TENA ((uint)0x00002000)
  1231. #define PC_ENET_CLSN ((ushort)0x0040)
  1232. #define PC_ENET_RENA ((ushort)0x0080)
  1233. #define SICR_ENET_MASK ((uint)0x0000ff00)
  1234. #define SICR_ENET_CLKRT ((uint)0x00002e00)
  1235. #endif /* CONFIG_V37 */
  1236. /*********************************************************************/
  1237. /* SCC Event register as used by Ethernet.
  1238. */
  1239. #define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
  1240. #define SCCE_ENET_TXE ((ushort)0x0010) /* Transmit Error */
  1241. #define SCCE_ENET_RXF ((ushort)0x0008) /* Full frame received */
  1242. #define SCCE_ENET_BSY ((ushort)0x0004) /* All incoming buffers full */
  1243. #define SCCE_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */
  1244. #define SCCE_ENET_RXB ((ushort)0x0001) /* A buffer was received */
  1245. /* SCC Mode Register (PSMR) as used by Ethernet.
  1246. */
  1247. #define SCC_PSMR_HBC ((ushort)0x8000) /* Enable heartbeat */
  1248. #define SCC_PSMR_FC ((ushort)0x4000) /* Force collision */
  1249. #define SCC_PSMR_RSH ((ushort)0x2000) /* Receive short frames */
  1250. #define SCC_PSMR_IAM ((ushort)0x1000) /* Check individual hash */
  1251. #define SCC_PSMR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */
  1252. #define SCC_PSMR_PRO ((ushort)0x0200) /* Promiscuous mode */
  1253. #define SCC_PSMR_BRO ((ushort)0x0100) /* Catch broadcast pkts */
  1254. #define SCC_PSMR_SBT ((ushort)0x0080) /* Special backoff timer */
  1255. #define SCC_PSMR_LPB ((ushort)0x0040) /* Set Loopback mode */
  1256. #define SCC_PSMR_SIP ((ushort)0x0020) /* Sample Input Pins */
  1257. #define SCC_PSMR_LCW ((ushort)0x0010) /* Late collision window */
  1258. #define SCC_PSMR_NIB22 ((ushort)0x000a) /* Start frame search */
  1259. #define SCC_PSMR_FDE ((ushort)0x0001) /* Full duplex enable */
  1260. /* Buffer descriptor control/status used by Ethernet receive.
  1261. */
  1262. #define BD_ENET_RX_EMPTY ((ushort)0x8000)
  1263. #define BD_ENET_RX_WRAP ((ushort)0x2000)
  1264. #define BD_ENET_RX_INTR ((ushort)0x1000)
  1265. #define BD_ENET_RX_LAST ((ushort)0x0800)
  1266. #define BD_ENET_RX_FIRST ((ushort)0x0400)
  1267. #define BD_ENET_RX_MISS ((ushort)0x0100)
  1268. #define BD_ENET_RX_LG ((ushort)0x0020)
  1269. #define BD_ENET_RX_NO ((ushort)0x0010)
  1270. #define BD_ENET_RX_SH ((ushort)0x0008)
  1271. #define BD_ENET_RX_CR ((ushort)0x0004)
  1272. #define BD_ENET_RX_OV ((ushort)0x0002)
  1273. #define BD_ENET_RX_CL ((ushort)0x0001)
  1274. #define BD_ENET_RX_STATS ((ushort)0x013f) /* All status bits */
  1275. /* Buffer descriptor control/status used by Ethernet transmit.
  1276. */
  1277. #define BD_ENET_TX_READY ((ushort)0x8000)
  1278. #define BD_ENET_TX_PAD ((ushort)0x4000)
  1279. #define BD_ENET_TX_WRAP ((ushort)0x2000)
  1280. #define BD_ENET_TX_INTR ((ushort)0x1000)
  1281. #define BD_ENET_TX_LAST ((ushort)0x0800)
  1282. #define BD_ENET_TX_TC ((ushort)0x0400)
  1283. #define BD_ENET_TX_DEF ((ushort)0x0200)
  1284. #define BD_ENET_TX_HB ((ushort)0x0100)
  1285. #define BD_ENET_TX_LC ((ushort)0x0080)
  1286. #define BD_ENET_TX_RL ((ushort)0x0040)
  1287. #define BD_ENET_TX_RCMASK ((ushort)0x003c)
  1288. #define BD_ENET_TX_UN ((ushort)0x0002)
  1289. #define BD_ENET_TX_CSL ((ushort)0x0001)
  1290. #define BD_ENET_TX_STATS ((ushort)0x03ff) /* All status bits */
  1291. /* SCC as UART
  1292. */
  1293. typedef struct scc_uart {
  1294. sccp_t scc_genscc;
  1295. uint scc_res1; /* Reserved */
  1296. uint scc_res2; /* Reserved */
  1297. ushort scc_maxidl; /* Maximum idle chars */
  1298. ushort scc_idlc; /* temp idle counter */
  1299. ushort scc_brkcr; /* Break count register */
  1300. ushort scc_parec; /* receive parity error counter */
  1301. ushort scc_frmec; /* receive framing error counter */
  1302. ushort scc_nosec; /* receive noise counter */
  1303. ushort scc_brkec; /* receive break condition counter */
  1304. ushort scc_brkln; /* last received break length */
  1305. ushort scc_uaddr1; /* UART address character 1 */
  1306. ushort scc_uaddr2; /* UART address character 2 */
  1307. ushort scc_rtemp; /* Temp storage */
  1308. ushort scc_toseq; /* Transmit out of sequence char */
  1309. ushort scc_char1; /* control character 1 */
  1310. ushort scc_char2; /* control character 2 */
  1311. ushort scc_char3; /* control character 3 */
  1312. ushort scc_char4; /* control character 4 */
  1313. ushort scc_char5; /* control character 5 */
  1314. ushort scc_char6; /* control character 6 */
  1315. ushort scc_char7; /* control character 7 */
  1316. ushort scc_char8; /* control character 8 */
  1317. ushort scc_rccm; /* receive control character mask */
  1318. ushort scc_rccr; /* receive control character register */
  1319. ushort scc_rlbc; /* receive last break character */
  1320. } scc_uart_t;
  1321. /* SCC Event and Mask registers when it is used as a UART.
  1322. */
  1323. #define UART_SCCM_GLR ((ushort)0x1000)
  1324. #define UART_SCCM_GLT ((ushort)0x0800)
  1325. #define UART_SCCM_AB ((ushort)0x0200)
  1326. #define UART_SCCM_IDL ((ushort)0x0100)
  1327. #define UART_SCCM_GRA ((ushort)0x0080)
  1328. #define UART_SCCM_BRKE ((ushort)0x0040)
  1329. #define UART_SCCM_BRKS ((ushort)0x0020)
  1330. #define UART_SCCM_CCR ((ushort)0x0008)
  1331. #define UART_SCCM_BSY ((ushort)0x0004)
  1332. #define UART_SCCM_TX ((ushort)0x0002)
  1333. #define UART_SCCM_RX ((ushort)0x0001)
  1334. /* The SCC PSMR when used as a UART.
  1335. */
  1336. #define SCU_PSMR_FLC ((ushort)0x8000)
  1337. #define SCU_PSMR_SL ((ushort)0x4000)
  1338. #define SCU_PSMR_CL ((ushort)0x3000)
  1339. #define SCU_PSMR_UM ((ushort)0x0c00)
  1340. #define SCU_PSMR_FRZ ((ushort)0x0200)
  1341. #define SCU_PSMR_RZS ((ushort)0x0100)
  1342. #define SCU_PSMR_SYN ((ushort)0x0080)
  1343. #define SCU_PSMR_DRT ((ushort)0x0040)
  1344. #define SCU_PSMR_PEN ((ushort)0x0010)
  1345. #define SCU_PSMR_RPM ((ushort)0x000c)
  1346. #define SCU_PSMR_REVP ((ushort)0x0008)
  1347. #define SCU_PSMR_TPM ((ushort)0x0003)
  1348. #define SCU_PSMR_TEVP ((ushort)0x0003)
  1349. /* CPM Transparent mode SCC.
  1350. */
  1351. typedef struct scc_trans {
  1352. sccp_t st_genscc;
  1353. uint st_cpres; /* Preset CRC */
  1354. uint st_cmask; /* Constant mask for CRC */
  1355. } scc_trans_t;
  1356. #define BD_SCC_TX_LAST ((ushort)0x0800)
  1357. /* IIC parameter RAM.
  1358. */
  1359. typedef struct iic {
  1360. ushort iic_rbase; /* Rx Buffer descriptor base address */
  1361. ushort iic_tbase; /* Tx Buffer descriptor base address */
  1362. u_char iic_rfcr; /* Rx function code */
  1363. u_char iic_tfcr; /* Tx function code */
  1364. ushort iic_mrblr; /* Max receive buffer length */
  1365. uint iic_rstate; /* Internal */
  1366. uint iic_rdp; /* Internal */
  1367. ushort iic_rbptr; /* Internal */
  1368. ushort iic_rbc; /* Internal */
  1369. uint iic_rxtmp; /* Internal */
  1370. uint iic_tstate; /* Internal */
  1371. uint iic_tdp; /* Internal */
  1372. ushort iic_tbptr; /* Internal */
  1373. ushort iic_tbc; /* Internal */
  1374. uint iic_txtmp; /* Internal */
  1375. uint iic_res; /* reserved */
  1376. ushort iic_rpbase; /* Relocation pointer */
  1377. ushort iic_res2; /* reserved */
  1378. } iic_t;
  1379. /* SPI parameter RAM.
  1380. */
  1381. typedef struct spi {
  1382. ushort spi_rbase; /* Rx Buffer descriptor base address */
  1383. ushort spi_tbase; /* Tx Buffer descriptor base address */
  1384. u_char spi_rfcr; /* Rx function code */
  1385. u_char spi_tfcr; /* Tx function code */
  1386. ushort spi_mrblr; /* Max receive buffer length */
  1387. uint spi_rstate; /* Internal */
  1388. uint spi_rdp; /* Internal */
  1389. ushort spi_rbptr; /* Internal */
  1390. ushort spi_rbc; /* Internal */
  1391. uint spi_rxtmp; /* Internal */
  1392. uint spi_tstate; /* Internal */
  1393. uint spi_tdp; /* Internal */
  1394. ushort spi_tbptr; /* Internal */
  1395. ushort spi_tbc; /* Internal */
  1396. uint spi_txtmp; /* Internal */
  1397. uint spi_res;
  1398. ushort spi_rpbase; /* Relocation pointer */
  1399. ushort spi_res2;
  1400. } spi_t;
  1401. /* SPI Mode register.
  1402. */
  1403. #define SPMODE_LOOP ((ushort)0x4000) /* Loopback */
  1404. #define SPMODE_CI ((ushort)0x2000) /* Clock Invert */
  1405. #define SPMODE_CP ((ushort)0x1000) /* Clock Phase */
  1406. #define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */
  1407. #define SPMODE_REV ((ushort)0x0400) /* Reversed Data */
  1408. #define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */
  1409. #define SPMODE_EN ((ushort)0x0100) /* Enable */
  1410. #define SPMODE_LENMSK ((ushort)0x00f0) /* character length */
  1411. #define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */
  1412. #define SPMODE_LEN(x) ((((x)-1)&0xF)<<4)
  1413. #define SPMODE_PM(x) ((x) &0xF)
  1414. /* HDLC parameter RAM.
  1415. */
  1416. typedef struct hdlc_pram_s {
  1417. /*
  1418. * SCC parameter RAM
  1419. */
  1420. ushort rbase; /* Rx Buffer descriptor base address */
  1421. ushort tbase; /* Tx Buffer descriptor base address */
  1422. uchar rfcr; /* Rx function code */
  1423. uchar tfcr; /* Tx function code */
  1424. ushort mrblr; /* Rx buffer length */
  1425. ulong rstate; /* Rx internal state */
  1426. ulong rptr; /* Rx internal data pointer */
  1427. ushort rbptr; /* rb BD Pointer */
  1428. ushort rcount; /* Rx internal byte count */
  1429. ulong rtemp; /* Rx temp */
  1430. ulong tstate; /* Tx internal state */
  1431. ulong tptr; /* Tx internal data pointer */
  1432. ushort tbptr; /* Tx BD pointer */
  1433. ushort tcount; /* Tx byte count */
  1434. ulong ttemp; /* Tx temp */
  1435. ulong rcrc; /* temp receive CRC */
  1436. ulong tcrc; /* temp transmit CRC */
  1437. /*
  1438. * HDLC specific parameter RAM
  1439. */
  1440. uchar res[4]; /* reserved */
  1441. ulong c_mask; /* CRC constant */
  1442. ulong c_pres; /* CRC preset */
  1443. ushort disfc; /* discarded frame counter */
  1444. ushort crcec; /* CRC error counter */
  1445. ushort abtsc; /* abort sequence counter */
  1446. ushort nmarc; /* nonmatching address rx cnt */
  1447. ushort retrc; /* frame retransmission cnt */
  1448. ushort mflr; /* maximum frame length reg */
  1449. ushort max_cnt; /* maximum length counter */
  1450. ushort rfthr; /* received frames threshold */
  1451. ushort rfcnt; /* received frames count */
  1452. ushort hmask; /* user defined frm addr mask */
  1453. ushort haddr1; /* user defined frm address 1 */
  1454. ushort haddr2; /* user defined frm address 2 */
  1455. ushort haddr3; /* user defined frm address 3 */
  1456. ushort haddr4; /* user defined frm address 4 */
  1457. ushort tmp; /* temp */
  1458. ushort tmp_mb; /* temp */
  1459. } hdlc_pram_t;
  1460. /* CPM interrupts. There are nearly 32 interrupts generated by CPM
  1461. * channels or devices. All of these are presented to the PPC core
  1462. * as a single interrupt. The CPM interrupt handler dispatches its
  1463. * own handlers, in a similar fashion to the PPC core handler. We
  1464. * use the table as defined in the manuals (i.e. no special high
  1465. * priority and SCC1 == SCCa, etc...).
  1466. */
  1467. #define CPMVEC_NR 32
  1468. #define CPMVEC_OFFSET 0x00010000
  1469. #define CPMVEC_PIO_PC15 ((ushort)0x1f | CPMVEC_OFFSET)
  1470. #define CPMVEC_SCC1 ((ushort)0x1e | CPMVEC_OFFSET)
  1471. #define CPMVEC_SCC2 ((ushort)0x1d | CPMVEC_OFFSET)
  1472. #define CPMVEC_SCC3 ((ushort)0x1c | CPMVEC_OFFSET)
  1473. #define CPMVEC_SCC4 ((ushort)0x1b | CPMVEC_OFFSET)
  1474. #define CPMVEC_PIO_PC14 ((ushort)0x1a | CPMVEC_OFFSET)
  1475. #define CPMVEC_TIMER1 ((ushort)0x19 | CPMVEC_OFFSET)
  1476. #define CPMVEC_PIO_PC13 ((ushort)0x18 | CPMVEC_OFFSET)
  1477. #define CPMVEC_PIO_PC12 ((ushort)0x17 | CPMVEC_OFFSET)
  1478. #define CPMVEC_SDMA_CB_ERR ((ushort)0x16 | CPMVEC_OFFSET)
  1479. #define CPMVEC_IDMA1 ((ushort)0x15 | CPMVEC_OFFSET)
  1480. #define CPMVEC_IDMA2 ((ushort)0x14 | CPMVEC_OFFSET)
  1481. #define CPMVEC_TIMER2 ((ushort)0x12 | CPMVEC_OFFSET)
  1482. #define CPMVEC_RISCTIMER ((ushort)0x11 | CPMVEC_OFFSET)
  1483. #define CPMVEC_I2C ((ushort)0x10 | CPMVEC_OFFSET)
  1484. #define CPMVEC_PIO_PC11 ((ushort)0x0f | CPMVEC_OFFSET)
  1485. #define CPMVEC_PIO_PC10 ((ushort)0x0e | CPMVEC_OFFSET)
  1486. #define CPMVEC_TIMER3 ((ushort)0x0c | CPMVEC_OFFSET)
  1487. #define CPMVEC_PIO_PC9 ((ushort)0x0b | CPMVEC_OFFSET)
  1488. #define CPMVEC_PIO_PC8 ((ushort)0x0a | CPMVEC_OFFSET)
  1489. #define CPMVEC_PIO_PC7 ((ushort)0x09 | CPMVEC_OFFSET)
  1490. #define CPMVEC_TIMER4 ((ushort)0x07 | CPMVEC_OFFSET)
  1491. #define CPMVEC_PIO_PC6 ((ushort)0x06 | CPMVEC_OFFSET)
  1492. #define CPMVEC_SPI ((ushort)0x05 | CPMVEC_OFFSET)
  1493. #define CPMVEC_SMC1 ((ushort)0x04 | CPMVEC_OFFSET)
  1494. #define CPMVEC_SMC2 ((ushort)0x03 | CPMVEC_OFFSET)
  1495. #define CPMVEC_PIO_PC5 ((ushort)0x02 | CPMVEC_OFFSET)
  1496. #define CPMVEC_PIO_PC4 ((ushort)0x01 | CPMVEC_OFFSET)
  1497. #define CPMVEC_ERROR ((ushort)0x00 | CPMVEC_OFFSET)
  1498. extern void irq_install_handler(int vec, void (*handler)(void *), void *dev_id);
  1499. /* CPM interrupt configuration vector.
  1500. */
  1501. #define CICR_SCD_SCC4 ((uint)0x00c00000) /* SCC4 @ SCCd */
  1502. #define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */
  1503. #define CICR_SCB_SCC2 ((uint)0x00040000) /* SCC2 @ SCCb */
  1504. #define CICR_SCA_SCC1 ((uint)0x00000000) /* SCC1 @ SCCa */
  1505. #define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrrupt */
  1506. #define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */
  1507. #define CICR_IEN ((uint)0x00000080) /* Int. enable */
  1508. #define CICR_SPS ((uint)0x00000001) /* SCC Spread */
  1509. #endif /* __CPM_8XX__ */