commproc.h 57 KB

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