commproc.h 62 KB

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