commproc.h 63 KB

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