commproc.h 54 KB

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