cpm2.h 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200
  1. /*
  2. * Communication Processor Module v2.
  3. *
  4. * This file contains structures and information for the communication
  5. * processor channels found in the dual port RAM or parameter RAM.
  6. * All CPM control and status is available through the CPM2 internal
  7. * memory map. See immap_cpm2.h for details.
  8. */
  9. #ifdef __KERNEL__
  10. #ifndef __CPM2__
  11. #define __CPM2__
  12. #include <asm/immap_cpm2.h>
  13. #include <asm/cpm.h>
  14. #include <sysdev/fsl_soc.h>
  15. #ifdef CONFIG_PPC_85xx
  16. #define CPM_MAP_ADDR (get_immrbase() + 0x80000)
  17. #endif
  18. /* CPM Command register.
  19. */
  20. #define CPM_CR_RST ((uint)0x80000000)
  21. #define CPM_CR_PAGE ((uint)0x7c000000)
  22. #define CPM_CR_SBLOCK ((uint)0x03e00000)
  23. #define CPM_CR_FLG ((uint)0x00010000)
  24. #define CPM_CR_MCN ((uint)0x00003fc0)
  25. #define CPM_CR_OPCODE ((uint)0x0000000f)
  26. /* Device sub-block and page codes.
  27. */
  28. #define CPM_CR_SCC1_SBLOCK (0x04)
  29. #define CPM_CR_SCC2_SBLOCK (0x05)
  30. #define CPM_CR_SCC3_SBLOCK (0x06)
  31. #define CPM_CR_SCC4_SBLOCK (0x07)
  32. #define CPM_CR_SMC1_SBLOCK (0x08)
  33. #define CPM_CR_SMC2_SBLOCK (0x09)
  34. #define CPM_CR_SPI_SBLOCK (0x0a)
  35. #define CPM_CR_I2C_SBLOCK (0x0b)
  36. #define CPM_CR_TIMER_SBLOCK (0x0f)
  37. #define CPM_CR_RAND_SBLOCK (0x0e)
  38. #define CPM_CR_FCC1_SBLOCK (0x10)
  39. #define CPM_CR_FCC2_SBLOCK (0x11)
  40. #define CPM_CR_FCC3_SBLOCK (0x12)
  41. #define CPM_CR_IDMA1_SBLOCK (0x14)
  42. #define CPM_CR_IDMA2_SBLOCK (0x15)
  43. #define CPM_CR_IDMA3_SBLOCK (0x16)
  44. #define CPM_CR_IDMA4_SBLOCK (0x17)
  45. #define CPM_CR_MCC1_SBLOCK (0x1c)
  46. #define CPM_CR_FCC_SBLOCK(x) (x + 0x10)
  47. #define CPM_CR_SCC1_PAGE (0x00)
  48. #define CPM_CR_SCC2_PAGE (0x01)
  49. #define CPM_CR_SCC3_PAGE (0x02)
  50. #define CPM_CR_SCC4_PAGE (0x03)
  51. #define CPM_CR_SMC1_PAGE (0x07)
  52. #define CPM_CR_SMC2_PAGE (0x08)
  53. #define CPM_CR_SPI_PAGE (0x09)
  54. #define CPM_CR_I2C_PAGE (0x0a)
  55. #define CPM_CR_TIMER_PAGE (0x0a)
  56. #define CPM_CR_RAND_PAGE (0x0a)
  57. #define CPM_CR_FCC1_PAGE (0x04)
  58. #define CPM_CR_FCC2_PAGE (0x05)
  59. #define CPM_CR_FCC3_PAGE (0x06)
  60. #define CPM_CR_IDMA1_PAGE (0x07)
  61. #define CPM_CR_IDMA2_PAGE (0x08)
  62. #define CPM_CR_IDMA3_PAGE (0x09)
  63. #define CPM_CR_IDMA4_PAGE (0x0a)
  64. #define CPM_CR_MCC1_PAGE (0x07)
  65. #define CPM_CR_MCC2_PAGE (0x08)
  66. #define CPM_CR_FCC_PAGE(x) (x + 0x04)
  67. /* CPM2-specific opcodes (see cpm.h for common opcodes)
  68. */
  69. #define CPM_CR_START_IDMA ((ushort)0x0009)
  70. #define mk_cr_cmd(PG, SBC, MCN, OP) \
  71. ((PG << 26) | (SBC << 21) | (MCN << 6) | OP)
  72. /* The number of pages of host memory we allocate for CPM. This is
  73. * done early in kernel initialization to get physically contiguous
  74. * pages.
  75. */
  76. #define NUM_CPM_HOST_PAGES 2
  77. /* Export the base address of the communication processor registers
  78. * and dual port ram.
  79. */
  80. extern cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor */
  81. #define cpm_dpalloc cpm_muram_alloc
  82. #define cpm_dpfree cpm_muram_free
  83. #define cpm_dpram_addr cpm_muram_addr
  84. extern void cpm2_reset(void);
  85. /* Baud rate generators.
  86. */
  87. #define CPM_BRG_RST ((uint)0x00020000)
  88. #define CPM_BRG_EN ((uint)0x00010000)
  89. #define CPM_BRG_EXTC_INT ((uint)0x00000000)
  90. #define CPM_BRG_EXTC_CLK3_9 ((uint)0x00004000)
  91. #define CPM_BRG_EXTC_CLK5_15 ((uint)0x00008000)
  92. #define CPM_BRG_ATB ((uint)0x00002000)
  93. #define CPM_BRG_CD_MASK ((uint)0x00001ffe)
  94. #define CPM_BRG_DIV16 ((uint)0x00000001)
  95. #define CPM2_BRG_INT_CLK (get_brgfreq())
  96. #define CPM2_BRG_UART_CLK (CPM2_BRG_INT_CLK/16)
  97. extern void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src);
  98. /* This function is used by UARTS, or anything else that uses a 16x
  99. * oversampled clock.
  100. */
  101. static inline void cpm_setbrg(uint brg, uint rate)
  102. {
  103. __cpm2_setbrg(brg, rate, CPM2_BRG_UART_CLK, 0, CPM_BRG_EXTC_INT);
  104. }
  105. /* This function is used to set high speed synchronous baud rate
  106. * clocks.
  107. */
  108. static inline void cpm2_fastbrg(uint brg, uint rate, int div16)
  109. {
  110. __cpm2_setbrg(brg, rate, CPM2_BRG_INT_CLK, div16, CPM_BRG_EXTC_INT);
  111. }
  112. /* Function code bits, usually generic to devices.
  113. */
  114. #define CPMFCR_GBL ((u_char)0x20) /* Set memory snooping */
  115. #define CPMFCR_EB ((u_char)0x10) /* Set big endian byte order */
  116. #define CPMFCR_TC2 ((u_char)0x04) /* Transfer code 2 value */
  117. #define CPMFCR_DTB ((u_char)0x02) /* Use local bus for data when set */
  118. #define CPMFCR_BDB ((u_char)0x01) /* Use local bus for BD when set */
  119. /* Parameter RAM offsets from the base.
  120. */
  121. #define PROFF_SCC1 ((uint)0x8000)
  122. #define PROFF_SCC2 ((uint)0x8100)
  123. #define PROFF_SCC3 ((uint)0x8200)
  124. #define PROFF_SCC4 ((uint)0x8300)
  125. #define PROFF_FCC1 ((uint)0x8400)
  126. #define PROFF_FCC2 ((uint)0x8500)
  127. #define PROFF_FCC3 ((uint)0x8600)
  128. #define PROFF_MCC1 ((uint)0x8700)
  129. #define PROFF_SMC1_BASE ((uint)0x87fc)
  130. #define PROFF_IDMA1_BASE ((uint)0x87fe)
  131. #define PROFF_MCC2 ((uint)0x8800)
  132. #define PROFF_SMC2_BASE ((uint)0x88fc)
  133. #define PROFF_IDMA2_BASE ((uint)0x88fe)
  134. #define PROFF_SPI_BASE ((uint)0x89fc)
  135. #define PROFF_IDMA3_BASE ((uint)0x89fe)
  136. #define PROFF_TIMERS ((uint)0x8ae0)
  137. #define PROFF_REVNUM ((uint)0x8af0)
  138. #define PROFF_RAND ((uint)0x8af8)
  139. #define PROFF_I2C_BASE ((uint)0x8afc)
  140. #define PROFF_IDMA4_BASE ((uint)0x8afe)
  141. #define PROFF_SCC_SIZE ((uint)0x100)
  142. #define PROFF_FCC_SIZE ((uint)0x100)
  143. #define PROFF_SMC_SIZE ((uint)64)
  144. /* The SMCs are relocated to any of the first eight DPRAM pages.
  145. * We will fix these at the first locations of DPRAM, until we
  146. * get some microcode patches :-).
  147. * The parameter ram space for the SMCs is fifty-some bytes, and
  148. * they are required to start on a 64 byte boundary.
  149. */
  150. #define PROFF_SMC1 (0)
  151. #define PROFF_SMC2 (64)
  152. /* Define enough so I can at least use the serial port as a UART.
  153. */
  154. typedef struct smc_uart {
  155. ushort smc_rbase; /* Rx Buffer descriptor base address */
  156. ushort smc_tbase; /* Tx Buffer descriptor base address */
  157. u_char smc_rfcr; /* Rx function code */
  158. u_char smc_tfcr; /* Tx function code */
  159. ushort smc_mrblr; /* Max receive buffer length */
  160. uint smc_rstate; /* Internal */
  161. uint smc_idp; /* Internal */
  162. ushort smc_rbptr; /* Internal */
  163. ushort smc_ibc; /* Internal */
  164. uint smc_rxtmp; /* Internal */
  165. uint smc_tstate; /* Internal */
  166. uint smc_tdp; /* Internal */
  167. ushort smc_tbptr; /* Internal */
  168. ushort smc_tbc; /* Internal */
  169. uint smc_txtmp; /* Internal */
  170. ushort smc_maxidl; /* Maximum idle characters */
  171. ushort smc_tmpidl; /* Temporary idle counter */
  172. ushort smc_brklen; /* Last received break length */
  173. ushort smc_brkec; /* rcv'd break condition counter */
  174. ushort smc_brkcr; /* xmt break count register */
  175. ushort smc_rmask; /* Temporary bit mask */
  176. uint smc_stmp; /* SDMA Temp */
  177. } smc_uart_t;
  178. /* SMC uart mode register (Internal memory map).
  179. */
  180. #define SMCMR_REN ((ushort)0x0001)
  181. #define SMCMR_TEN ((ushort)0x0002)
  182. #define SMCMR_DM ((ushort)0x000c)
  183. #define SMCMR_SM_GCI ((ushort)0x0000)
  184. #define SMCMR_SM_UART ((ushort)0x0020)
  185. #define SMCMR_SM_TRANS ((ushort)0x0030)
  186. #define SMCMR_SM_MASK ((ushort)0x0030)
  187. #define SMCMR_PM_EVEN ((ushort)0x0100) /* Even parity, else odd */
  188. #define SMCMR_REVD SMCMR_PM_EVEN
  189. #define SMCMR_PEN ((ushort)0x0200) /* Parity enable */
  190. #define SMCMR_BS SMCMR_PEN
  191. #define SMCMR_SL ((ushort)0x0400) /* Two stops, else one */
  192. #define SMCR_CLEN_MASK ((ushort)0x7800) /* Character length */
  193. #define smcr_mk_clen(C) (((C) << 11) & SMCR_CLEN_MASK)
  194. /* SMC Event and Mask register.
  195. */
  196. #define SMCM_BRKE ((unsigned char)0x40) /* When in UART Mode */
  197. #define SMCM_BRK ((unsigned char)0x10) /* When in UART Mode */
  198. #define SMCM_TXE ((unsigned char)0x10)
  199. #define SMCM_BSY ((unsigned char)0x04)
  200. #define SMCM_TX ((unsigned char)0x02)
  201. #define SMCM_RX ((unsigned char)0x01)
  202. /* SCCs.
  203. */
  204. #define SCC_GSMRH_IRP ((uint)0x00040000)
  205. #define SCC_GSMRH_GDE ((uint)0x00010000)
  206. #define SCC_GSMRH_TCRC_CCITT ((uint)0x00008000)
  207. #define SCC_GSMRH_TCRC_BISYNC ((uint)0x00004000)
  208. #define SCC_GSMRH_TCRC_HDLC ((uint)0x00000000)
  209. #define SCC_GSMRH_REVD ((uint)0x00002000)
  210. #define SCC_GSMRH_TRX ((uint)0x00001000)
  211. #define SCC_GSMRH_TTX ((uint)0x00000800)
  212. #define SCC_GSMRH_CDP ((uint)0x00000400)
  213. #define SCC_GSMRH_CTSP ((uint)0x00000200)
  214. #define SCC_GSMRH_CDS ((uint)0x00000100)
  215. #define SCC_GSMRH_CTSS ((uint)0x00000080)
  216. #define SCC_GSMRH_TFL ((uint)0x00000040)
  217. #define SCC_GSMRH_RFW ((uint)0x00000020)
  218. #define SCC_GSMRH_TXSY ((uint)0x00000010)
  219. #define SCC_GSMRH_SYNL16 ((uint)0x0000000c)
  220. #define SCC_GSMRH_SYNL8 ((uint)0x00000008)
  221. #define SCC_GSMRH_SYNL4 ((uint)0x00000004)
  222. #define SCC_GSMRH_RTSM ((uint)0x00000002)
  223. #define SCC_GSMRH_RSYN ((uint)0x00000001)
  224. #define SCC_GSMRL_SIR ((uint)0x80000000) /* SCC2 only */
  225. #define SCC_GSMRL_EDGE_NONE ((uint)0x60000000)
  226. #define SCC_GSMRL_EDGE_NEG ((uint)0x40000000)
  227. #define SCC_GSMRL_EDGE_POS ((uint)0x20000000)
  228. #define SCC_GSMRL_EDGE_BOTH ((uint)0x00000000)
  229. #define SCC_GSMRL_TCI ((uint)0x10000000)
  230. #define SCC_GSMRL_TSNC_3 ((uint)0x0c000000)
  231. #define SCC_GSMRL_TSNC_4 ((uint)0x08000000)
  232. #define SCC_GSMRL_TSNC_14 ((uint)0x04000000)
  233. #define SCC_GSMRL_TSNC_INF ((uint)0x00000000)
  234. #define SCC_GSMRL_RINV ((uint)0x02000000)
  235. #define SCC_GSMRL_TINV ((uint)0x01000000)
  236. #define SCC_GSMRL_TPL_128 ((uint)0x00c00000)
  237. #define SCC_GSMRL_TPL_64 ((uint)0x00a00000)
  238. #define SCC_GSMRL_TPL_48 ((uint)0x00800000)
  239. #define SCC_GSMRL_TPL_32 ((uint)0x00600000)
  240. #define SCC_GSMRL_TPL_16 ((uint)0x00400000)
  241. #define SCC_GSMRL_TPL_8 ((uint)0x00200000)
  242. #define SCC_GSMRL_TPL_NONE ((uint)0x00000000)
  243. #define SCC_GSMRL_TPP_ALL1 ((uint)0x00180000)
  244. #define SCC_GSMRL_TPP_01 ((uint)0x00100000)
  245. #define SCC_GSMRL_TPP_10 ((uint)0x00080000)
  246. #define SCC_GSMRL_TPP_ZEROS ((uint)0x00000000)
  247. #define SCC_GSMRL_TEND ((uint)0x00040000)
  248. #define SCC_GSMRL_TDCR_32 ((uint)0x00030000)
  249. #define SCC_GSMRL_TDCR_16 ((uint)0x00020000)
  250. #define SCC_GSMRL_TDCR_8 ((uint)0x00010000)
  251. #define SCC_GSMRL_TDCR_1 ((uint)0x00000000)
  252. #define SCC_GSMRL_RDCR_32 ((uint)0x0000c000)
  253. #define SCC_GSMRL_RDCR_16 ((uint)0x00008000)
  254. #define SCC_GSMRL_RDCR_8 ((uint)0x00004000)
  255. #define SCC_GSMRL_RDCR_1 ((uint)0x00000000)
  256. #define SCC_GSMRL_RENC_DFMAN ((uint)0x00003000)
  257. #define SCC_GSMRL_RENC_MANCH ((uint)0x00002000)
  258. #define SCC_GSMRL_RENC_FM0 ((uint)0x00001000)
  259. #define SCC_GSMRL_RENC_NRZI ((uint)0x00000800)
  260. #define SCC_GSMRL_RENC_NRZ ((uint)0x00000000)
  261. #define SCC_GSMRL_TENC_DFMAN ((uint)0x00000600)
  262. #define SCC_GSMRL_TENC_MANCH ((uint)0x00000400)
  263. #define SCC_GSMRL_TENC_FM0 ((uint)0x00000200)
  264. #define SCC_GSMRL_TENC_NRZI ((uint)0x00000100)
  265. #define SCC_GSMRL_TENC_NRZ ((uint)0x00000000)
  266. #define SCC_GSMRL_DIAG_LE ((uint)0x000000c0) /* Loop and echo */
  267. #define SCC_GSMRL_DIAG_ECHO ((uint)0x00000080)
  268. #define SCC_GSMRL_DIAG_LOOP ((uint)0x00000040)
  269. #define SCC_GSMRL_DIAG_NORM ((uint)0x00000000)
  270. #define SCC_GSMRL_ENR ((uint)0x00000020)
  271. #define SCC_GSMRL_ENT ((uint)0x00000010)
  272. #define SCC_GSMRL_MODE_ENET ((uint)0x0000000c)
  273. #define SCC_GSMRL_MODE_DDCMP ((uint)0x00000009)
  274. #define SCC_GSMRL_MODE_BISYNC ((uint)0x00000008)
  275. #define SCC_GSMRL_MODE_V14 ((uint)0x00000007)
  276. #define SCC_GSMRL_MODE_AHDLC ((uint)0x00000006)
  277. #define SCC_GSMRL_MODE_PROFIBUS ((uint)0x00000005)
  278. #define SCC_GSMRL_MODE_UART ((uint)0x00000004)
  279. #define SCC_GSMRL_MODE_SS7 ((uint)0x00000003)
  280. #define SCC_GSMRL_MODE_ATALK ((uint)0x00000002)
  281. #define SCC_GSMRL_MODE_HDLC ((uint)0x00000000)
  282. #define SCC_TODR_TOD ((ushort)0x8000)
  283. /* SCC Event and Mask register.
  284. */
  285. #define SCCM_TXE ((unsigned char)0x10)
  286. #define SCCM_BSY ((unsigned char)0x04)
  287. #define SCCM_TX ((unsigned char)0x02)
  288. #define SCCM_RX ((unsigned char)0x01)
  289. typedef struct scc_param {
  290. ushort scc_rbase; /* Rx Buffer descriptor base address */
  291. ushort scc_tbase; /* Tx Buffer descriptor base address */
  292. u_char scc_rfcr; /* Rx function code */
  293. u_char scc_tfcr; /* Tx function code */
  294. ushort scc_mrblr; /* Max receive buffer length */
  295. uint scc_rstate; /* Internal */
  296. uint scc_idp; /* Internal */
  297. ushort scc_rbptr; /* Internal */
  298. ushort scc_ibc; /* Internal */
  299. uint scc_rxtmp; /* Internal */
  300. uint scc_tstate; /* Internal */
  301. uint scc_tdp; /* Internal */
  302. ushort scc_tbptr; /* Internal */
  303. ushort scc_tbc; /* Internal */
  304. uint scc_txtmp; /* Internal */
  305. uint scc_rcrc; /* Internal */
  306. uint scc_tcrc; /* Internal */
  307. } sccp_t;
  308. /* Function code bits.
  309. */
  310. #define SCC_EB ((u_char) 0x10) /* Set big endian byte order */
  311. #define SCC_GBL ((u_char) 0x20) /* Snooping enabled */
  312. /* CPM Ethernet through SCC1.
  313. */
  314. typedef struct scc_enet {
  315. sccp_t sen_genscc;
  316. uint sen_cpres; /* Preset CRC */
  317. uint sen_cmask; /* Constant mask for CRC */
  318. uint sen_crcec; /* CRC Error counter */
  319. uint sen_alec; /* alignment error counter */
  320. uint sen_disfc; /* discard frame counter */
  321. ushort sen_pads; /* Tx short frame pad character */
  322. ushort sen_retlim; /* Retry limit threshold */
  323. ushort sen_retcnt; /* Retry limit counter */
  324. ushort sen_maxflr; /* maximum frame length register */
  325. ushort sen_minflr; /* minimum frame length register */
  326. ushort sen_maxd1; /* maximum DMA1 length */
  327. ushort sen_maxd2; /* maximum DMA2 length */
  328. ushort sen_maxd; /* Rx max DMA */
  329. ushort sen_dmacnt; /* Rx DMA counter */
  330. ushort sen_maxb; /* Max BD byte count */
  331. ushort sen_gaddr1; /* Group address filter */
  332. ushort sen_gaddr2;
  333. ushort sen_gaddr3;
  334. ushort sen_gaddr4;
  335. uint sen_tbuf0data0; /* Save area 0 - current frame */
  336. uint sen_tbuf0data1; /* Save area 1 - current frame */
  337. uint sen_tbuf0rba; /* Internal */
  338. uint sen_tbuf0crc; /* Internal */
  339. ushort sen_tbuf0bcnt; /* Internal */
  340. ushort sen_paddrh; /* physical address (MSB) */
  341. ushort sen_paddrm;
  342. ushort sen_paddrl; /* physical address (LSB) */
  343. ushort sen_pper; /* persistence */
  344. ushort sen_rfbdptr; /* Rx first BD pointer */
  345. ushort sen_tfbdptr; /* Tx first BD pointer */
  346. ushort sen_tlbdptr; /* Tx last BD pointer */
  347. uint sen_tbuf1data0; /* Save area 0 - current frame */
  348. uint sen_tbuf1data1; /* Save area 1 - current frame */
  349. uint sen_tbuf1rba; /* Internal */
  350. uint sen_tbuf1crc; /* Internal */
  351. ushort sen_tbuf1bcnt; /* Internal */
  352. ushort sen_txlen; /* Tx Frame length counter */
  353. ushort sen_iaddr1; /* Individual address filter */
  354. ushort sen_iaddr2;
  355. ushort sen_iaddr3;
  356. ushort sen_iaddr4;
  357. ushort sen_boffcnt; /* Backoff counter */
  358. /* NOTE: Some versions of the manual have the following items
  359. * incorrectly documented. Below is the proper order.
  360. */
  361. ushort sen_taddrh; /* temp address (MSB) */
  362. ushort sen_taddrm;
  363. ushort sen_taddrl; /* temp address (LSB) */
  364. } scc_enet_t;
  365. /* SCC Event register as used by Ethernet.
  366. */
  367. #define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
  368. #define SCCE_ENET_TXE ((ushort)0x0010) /* Transmit Error */
  369. #define SCCE_ENET_RXF ((ushort)0x0008) /* Full frame received */
  370. #define SCCE_ENET_BSY ((ushort)0x0004) /* All incoming buffers full */
  371. #define SCCE_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */
  372. #define SCCE_ENET_RXB ((ushort)0x0001) /* A buffer was received */
  373. /* SCC Mode Register (PSMR) as used by Ethernet.
  374. */
  375. #define SCC_PSMR_HBC ((ushort)0x8000) /* Enable heartbeat */
  376. #define SCC_PSMR_FC ((ushort)0x4000) /* Force collision */
  377. #define SCC_PSMR_RSH ((ushort)0x2000) /* Receive short frames */
  378. #define SCC_PSMR_IAM ((ushort)0x1000) /* Check individual hash */
  379. #define SCC_PSMR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */
  380. #define SCC_PSMR_PRO ((ushort)0x0200) /* Promiscuous mode */
  381. #define SCC_PSMR_BRO ((ushort)0x0100) /* Catch broadcast pkts */
  382. #define SCC_PSMR_SBT ((ushort)0x0080) /* Special backoff timer */
  383. #define SCC_PSMR_LPB ((ushort)0x0040) /* Set Loopback mode */
  384. #define SCC_PSMR_SIP ((ushort)0x0020) /* Sample Input Pins */
  385. #define SCC_PSMR_LCW ((ushort)0x0010) /* Late collision window */
  386. #define SCC_PSMR_NIB22 ((ushort)0x000a) /* Start frame search */
  387. #define SCC_PSMR_FDE ((ushort)0x0001) /* Full duplex enable */
  388. /* SCC as UART
  389. */
  390. typedef struct scc_uart {
  391. sccp_t scc_genscc;
  392. uint scc_res1; /* Reserved */
  393. uint scc_res2; /* Reserved */
  394. ushort scc_maxidl; /* Maximum idle chars */
  395. ushort scc_idlc; /* temp idle counter */
  396. ushort scc_brkcr; /* Break count register */
  397. ushort scc_parec; /* receive parity error counter */
  398. ushort scc_frmec; /* receive framing error counter */
  399. ushort scc_nosec; /* receive noise counter */
  400. ushort scc_brkec; /* receive break condition counter */
  401. ushort scc_brkln; /* last received break length */
  402. ushort scc_uaddr1; /* UART address character 1 */
  403. ushort scc_uaddr2; /* UART address character 2 */
  404. ushort scc_rtemp; /* Temp storage */
  405. ushort scc_toseq; /* Transmit out of sequence char */
  406. ushort scc_char1; /* control character 1 */
  407. ushort scc_char2; /* control character 2 */
  408. ushort scc_char3; /* control character 3 */
  409. ushort scc_char4; /* control character 4 */
  410. ushort scc_char5; /* control character 5 */
  411. ushort scc_char6; /* control character 6 */
  412. ushort scc_char7; /* control character 7 */
  413. ushort scc_char8; /* control character 8 */
  414. ushort scc_rccm; /* receive control character mask */
  415. ushort scc_rccr; /* receive control character register */
  416. ushort scc_rlbc; /* receive last break character */
  417. } scc_uart_t;
  418. /* SCC Event and Mask registers when it is used as a UART.
  419. */
  420. #define UART_SCCM_GLR ((ushort)0x1000)
  421. #define UART_SCCM_GLT ((ushort)0x0800)
  422. #define UART_SCCM_AB ((ushort)0x0200)
  423. #define UART_SCCM_IDL ((ushort)0x0100)
  424. #define UART_SCCM_GRA ((ushort)0x0080)
  425. #define UART_SCCM_BRKE ((ushort)0x0040)
  426. #define UART_SCCM_BRKS ((ushort)0x0020)
  427. #define UART_SCCM_CCR ((ushort)0x0008)
  428. #define UART_SCCM_BSY ((ushort)0x0004)
  429. #define UART_SCCM_TX ((ushort)0x0002)
  430. #define UART_SCCM_RX ((ushort)0x0001)
  431. /* The SCC PSMR when used as a UART.
  432. */
  433. #define SCU_PSMR_FLC ((ushort)0x8000)
  434. #define SCU_PSMR_SL ((ushort)0x4000)
  435. #define SCU_PSMR_CL ((ushort)0x3000)
  436. #define SCU_PSMR_UM ((ushort)0x0c00)
  437. #define SCU_PSMR_FRZ ((ushort)0x0200)
  438. #define SCU_PSMR_RZS ((ushort)0x0100)
  439. #define SCU_PSMR_SYN ((ushort)0x0080)
  440. #define SCU_PSMR_DRT ((ushort)0x0040)
  441. #define SCU_PSMR_PEN ((ushort)0x0010)
  442. #define SCU_PSMR_RPM ((ushort)0x000c)
  443. #define SCU_PSMR_REVP ((ushort)0x0008)
  444. #define SCU_PSMR_TPM ((ushort)0x0003)
  445. #define SCU_PSMR_TEVP ((ushort)0x0002)
  446. /* CPM Transparent mode SCC.
  447. */
  448. typedef struct scc_trans {
  449. sccp_t st_genscc;
  450. uint st_cpres; /* Preset CRC */
  451. uint st_cmask; /* Constant mask for CRC */
  452. } scc_trans_t;
  453. /* How about some FCCs.....
  454. */
  455. #define FCC_GFMR_DIAG_NORM ((uint)0x00000000)
  456. #define FCC_GFMR_DIAG_LE ((uint)0x40000000)
  457. #define FCC_GFMR_DIAG_AE ((uint)0x80000000)
  458. #define FCC_GFMR_DIAG_ALE ((uint)0xc0000000)
  459. #define FCC_GFMR_TCI ((uint)0x20000000)
  460. #define FCC_GFMR_TRX ((uint)0x10000000)
  461. #define FCC_GFMR_TTX ((uint)0x08000000)
  462. #define FCC_GFMR_TTX ((uint)0x08000000)
  463. #define FCC_GFMR_CDP ((uint)0x04000000)
  464. #define FCC_GFMR_CTSP ((uint)0x02000000)
  465. #define FCC_GFMR_CDS ((uint)0x01000000)
  466. #define FCC_GFMR_CTSS ((uint)0x00800000)
  467. #define FCC_GFMR_SYNL_NONE ((uint)0x00000000)
  468. #define FCC_GFMR_SYNL_AUTO ((uint)0x00004000)
  469. #define FCC_GFMR_SYNL_8 ((uint)0x00008000)
  470. #define FCC_GFMR_SYNL_16 ((uint)0x0000c000)
  471. #define FCC_GFMR_RTSM ((uint)0x00002000)
  472. #define FCC_GFMR_RENC_NRZ ((uint)0x00000000)
  473. #define FCC_GFMR_RENC_NRZI ((uint)0x00000800)
  474. #define FCC_GFMR_REVD ((uint)0x00000400)
  475. #define FCC_GFMR_TENC_NRZ ((uint)0x00000000)
  476. #define FCC_GFMR_TENC_NRZI ((uint)0x00000100)
  477. #define FCC_GFMR_TCRC_16 ((uint)0x00000000)
  478. #define FCC_GFMR_TCRC_32 ((uint)0x00000080)
  479. #define FCC_GFMR_ENR ((uint)0x00000020)
  480. #define FCC_GFMR_ENT ((uint)0x00000010)
  481. #define FCC_GFMR_MODE_ENET ((uint)0x0000000c)
  482. #define FCC_GFMR_MODE_ATM ((uint)0x0000000a)
  483. #define FCC_GFMR_MODE_HDLC ((uint)0x00000000)
  484. /* Generic FCC parameter ram.
  485. */
  486. typedef struct fcc_param {
  487. ushort fcc_riptr; /* Rx Internal temp pointer */
  488. ushort fcc_tiptr; /* Tx Internal temp pointer */
  489. ushort fcc_res1;
  490. ushort fcc_mrblr; /* Max receive buffer length, mod 32 bytes */
  491. uint fcc_rstate; /* Upper byte is Func code, must be set */
  492. uint fcc_rbase; /* Receive BD base */
  493. ushort fcc_rbdstat; /* RxBD status */
  494. ushort fcc_rbdlen; /* RxBD down counter */
  495. uint fcc_rdptr; /* RxBD internal data pointer */
  496. uint fcc_tstate; /* Upper byte is Func code, must be set */
  497. uint fcc_tbase; /* Transmit BD base */
  498. ushort fcc_tbdstat; /* TxBD status */
  499. ushort fcc_tbdlen; /* TxBD down counter */
  500. uint fcc_tdptr; /* TxBD internal data pointer */
  501. uint fcc_rbptr; /* Rx BD Internal buf pointer */
  502. uint fcc_tbptr; /* Tx BD Internal buf pointer */
  503. uint fcc_rcrc; /* Rx temp CRC */
  504. uint fcc_res2;
  505. uint fcc_tcrc; /* Tx temp CRC */
  506. } fccp_t;
  507. /* Ethernet controller through FCC.
  508. */
  509. typedef struct fcc_enet {
  510. fccp_t fen_genfcc;
  511. uint fen_statbuf; /* Internal status buffer */
  512. uint fen_camptr; /* CAM address */
  513. uint fen_cmask; /* Constant mask for CRC */
  514. uint fen_cpres; /* Preset CRC */
  515. uint fen_crcec; /* CRC Error counter */
  516. uint fen_alec; /* alignment error counter */
  517. uint fen_disfc; /* discard frame counter */
  518. ushort fen_retlim; /* Retry limit */
  519. ushort fen_retcnt; /* Retry counter */
  520. ushort fen_pper; /* Persistence */
  521. ushort fen_boffcnt; /* backoff counter */
  522. uint fen_gaddrh; /* Group address filter, high 32-bits */
  523. uint fen_gaddrl; /* Group address filter, low 32-bits */
  524. ushort fen_tfcstat; /* out of sequence TxBD */
  525. ushort fen_tfclen;
  526. uint fen_tfcptr;
  527. ushort fen_mflr; /* Maximum frame length (1518) */
  528. ushort fen_paddrh; /* MAC address */
  529. ushort fen_paddrm;
  530. ushort fen_paddrl;
  531. ushort fen_ibdcount; /* Internal BD counter */
  532. ushort fen_ibdstart; /* Internal BD start pointer */
  533. ushort fen_ibdend; /* Internal BD end pointer */
  534. ushort fen_txlen; /* Internal Tx frame length counter */
  535. uint fen_ibdbase[8]; /* Internal use */
  536. uint fen_iaddrh; /* Individual address filter */
  537. uint fen_iaddrl;
  538. ushort fen_minflr; /* Minimum frame length (64) */
  539. ushort fen_taddrh; /* Filter transfer MAC address */
  540. ushort fen_taddrm;
  541. ushort fen_taddrl;
  542. ushort fen_padptr; /* Pointer to pad byte buffer */
  543. ushort fen_cftype; /* control frame type */
  544. ushort fen_cfrange; /* control frame range */
  545. ushort fen_maxb; /* maximum BD count */
  546. ushort fen_maxd1; /* Max DMA1 length (1520) */
  547. ushort fen_maxd2; /* Max DMA2 length (1520) */
  548. ushort fen_maxd; /* internal max DMA count */
  549. ushort fen_dmacnt; /* internal DMA counter */
  550. uint fen_octc; /* Total octect counter */
  551. uint fen_colc; /* Total collision counter */
  552. uint fen_broc; /* Total broadcast packet counter */
  553. uint fen_mulc; /* Total multicast packet count */
  554. uint fen_uspc; /* Total packets < 64 bytes */
  555. uint fen_frgc; /* Total packets < 64 bytes with errors */
  556. uint fen_ospc; /* Total packets > 1518 */
  557. uint fen_jbrc; /* Total packets > 1518 with errors */
  558. uint fen_p64c; /* Total packets == 64 bytes */
  559. uint fen_p65c; /* Total packets 64 < bytes <= 127 */
  560. uint fen_p128c; /* Total packets 127 < bytes <= 255 */
  561. uint fen_p256c; /* Total packets 256 < bytes <= 511 */
  562. uint fen_p512c; /* Total packets 512 < bytes <= 1023 */
  563. uint fen_p1024c; /* Total packets 1024 < bytes <= 1518 */
  564. uint fen_cambuf; /* Internal CAM buffer poiner */
  565. ushort fen_rfthr; /* Received frames threshold */
  566. ushort fen_rfcnt; /* Received frames count */
  567. } fcc_enet_t;
  568. /* FCC Event/Mask register as used by Ethernet.
  569. */
  570. #define FCC_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
  571. #define FCC_ENET_RXC ((ushort)0x0040) /* Control Frame Received */
  572. #define FCC_ENET_TXC ((ushort)0x0020) /* Out of seq. Tx sent */
  573. #define FCC_ENET_TXE ((ushort)0x0010) /* Transmit Error */
  574. #define FCC_ENET_RXF ((ushort)0x0008) /* Full frame received */
  575. #define FCC_ENET_BSY ((ushort)0x0004) /* Busy. Rx Frame dropped */
  576. #define FCC_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */
  577. #define FCC_ENET_RXB ((ushort)0x0001) /* A buffer was received */
  578. /* FCC Mode Register (FPSMR) as used by Ethernet.
  579. */
  580. #define FCC_PSMR_HBC ((uint)0x80000000) /* Enable heartbeat */
  581. #define FCC_PSMR_FC ((uint)0x40000000) /* Force Collision */
  582. #define FCC_PSMR_SBT ((uint)0x20000000) /* Stop backoff timer */
  583. #define FCC_PSMR_LPB ((uint)0x10000000) /* Local protect. 1 = FDX */
  584. #define FCC_PSMR_LCW ((uint)0x08000000) /* Late collision select */
  585. #define FCC_PSMR_FDE ((uint)0x04000000) /* Full Duplex Enable */
  586. #define FCC_PSMR_MON ((uint)0x02000000) /* RMON Enable */
  587. #define FCC_PSMR_PRO ((uint)0x00400000) /* Promiscuous Enable */
  588. #define FCC_PSMR_FCE ((uint)0x00200000) /* Flow Control Enable */
  589. #define FCC_PSMR_RSH ((uint)0x00100000) /* Receive Short Frames */
  590. #define FCC_PSMR_CAM ((uint)0x00000400) /* CAM enable */
  591. #define FCC_PSMR_BRO ((uint)0x00000200) /* Broadcast pkt discard */
  592. #define FCC_PSMR_ENCRC ((uint)0x00000080) /* Use 32-bit CRC */
  593. /* IIC parameter RAM.
  594. */
  595. typedef struct iic {
  596. ushort iic_rbase; /* Rx Buffer descriptor base address */
  597. ushort iic_tbase; /* Tx Buffer descriptor base address */
  598. u_char iic_rfcr; /* Rx function code */
  599. u_char iic_tfcr; /* Tx function code */
  600. ushort iic_mrblr; /* Max receive buffer length */
  601. uint iic_rstate; /* Internal */
  602. uint iic_rdp; /* Internal */
  603. ushort iic_rbptr; /* Internal */
  604. ushort iic_rbc; /* Internal */
  605. uint iic_rxtmp; /* Internal */
  606. uint iic_tstate; /* Internal */
  607. uint iic_tdp; /* Internal */
  608. ushort iic_tbptr; /* Internal */
  609. ushort iic_tbc; /* Internal */
  610. uint iic_txtmp; /* Internal */
  611. } iic_t;
  612. /* SPI parameter RAM.
  613. */
  614. typedef struct spi {
  615. ushort spi_rbase; /* Rx Buffer descriptor base address */
  616. ushort spi_tbase; /* Tx Buffer descriptor base address */
  617. u_char spi_rfcr; /* Rx function code */
  618. u_char spi_tfcr; /* Tx function code */
  619. ushort spi_mrblr; /* Max receive buffer length */
  620. uint spi_rstate; /* Internal */
  621. uint spi_rdp; /* Internal */
  622. ushort spi_rbptr; /* Internal */
  623. ushort spi_rbc; /* Internal */
  624. uint spi_rxtmp; /* Internal */
  625. uint spi_tstate; /* Internal */
  626. uint spi_tdp; /* Internal */
  627. ushort spi_tbptr; /* Internal */
  628. ushort spi_tbc; /* Internal */
  629. uint spi_txtmp; /* Internal */
  630. uint spi_res; /* Tx temp. */
  631. uint spi_res1[4]; /* SDMA temp. */
  632. } spi_t;
  633. /* SPI Mode register.
  634. */
  635. #define SPMODE_LOOP ((ushort)0x4000) /* Loopback */
  636. #define SPMODE_CI ((ushort)0x2000) /* Clock Invert */
  637. #define SPMODE_CP ((ushort)0x1000) /* Clock Phase */
  638. #define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */
  639. #define SPMODE_REV ((ushort)0x0400) /* Reversed Data */
  640. #define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */
  641. #define SPMODE_EN ((ushort)0x0100) /* Enable */
  642. #define SPMODE_LENMSK ((ushort)0x00f0) /* character length */
  643. #define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */
  644. #define SPMODE_LEN(x) ((((x)-1)&0xF)<<4)
  645. #define SPMODE_PM(x) ((x) &0xF)
  646. #define SPI_EB ((u_char)0x10) /* big endian byte order */
  647. /* IDMA parameter RAM
  648. */
  649. typedef struct idma {
  650. ushort ibase; /* IDMA buffer descriptor table base address */
  651. ushort dcm; /* DMA channel mode */
  652. ushort ibdptr; /* IDMA current buffer descriptor pointer */
  653. ushort dpr_buf; /* IDMA transfer buffer base address */
  654. ushort buf_inv; /* internal buffer inventory */
  655. ushort ss_max; /* steady-state maximum transfer size */
  656. ushort dpr_in_ptr; /* write pointer inside the internal buffer */
  657. ushort sts; /* source transfer size */
  658. ushort dpr_out_ptr; /* read pointer inside the internal buffer */
  659. ushort seob; /* source end of burst */
  660. ushort deob; /* destination end of burst */
  661. ushort dts; /* destination transfer size */
  662. ushort ret_add; /* return address when working in ERM=1 mode */
  663. ushort res0; /* reserved */
  664. uint bd_cnt; /* internal byte count */
  665. uint s_ptr; /* source internal data pointer */
  666. uint d_ptr; /* destination internal data pointer */
  667. uint istate; /* internal state */
  668. u_char res1[20]; /* pad to 64-byte length */
  669. } idma_t;
  670. /* DMA channel mode bit fields
  671. */
  672. #define IDMA_DCM_FB ((ushort)0x8000) /* fly-by mode */
  673. #define IDMA_DCM_LP ((ushort)0x4000) /* low priority */
  674. #define IDMA_DCM_TC2 ((ushort)0x0400) /* value driven on TC[2] */
  675. #define IDMA_DCM_DMA_WRAP_MASK ((ushort)0x01c0) /* mask for DMA wrap */
  676. #define IDMA_DCM_DMA_WRAP_64 ((ushort)0x0000) /* 64-byte DMA xfer buffer */
  677. #define IDMA_DCM_DMA_WRAP_128 ((ushort)0x0040) /* 128-byte DMA xfer buffer */
  678. #define IDMA_DCM_DMA_WRAP_256 ((ushort)0x0080) /* 256-byte DMA xfer buffer */
  679. #define IDMA_DCM_DMA_WRAP_512 ((ushort)0x00c0) /* 512-byte DMA xfer buffer */
  680. #define IDMA_DCM_DMA_WRAP_1024 ((ushort)0x0100) /* 1024-byte DMA xfer buffer */
  681. #define IDMA_DCM_DMA_WRAP_2048 ((ushort)0x0140) /* 2048-byte DMA xfer buffer */
  682. #define IDMA_DCM_SINC ((ushort)0x0020) /* source inc addr */
  683. #define IDMA_DCM_DINC ((ushort)0x0010) /* destination inc addr */
  684. #define IDMA_DCM_ERM ((ushort)0x0008) /* external request mode */
  685. #define IDMA_DCM_DT ((ushort)0x0004) /* DONE treatment */
  686. #define IDMA_DCM_SD_MASK ((ushort)0x0003) /* mask for SD bit field */
  687. #define IDMA_DCM_SD_MEM2MEM ((ushort)0x0000) /* memory-to-memory xfer */
  688. #define IDMA_DCM_SD_PER2MEM ((ushort)0x0002) /* peripheral-to-memory xfer */
  689. #define IDMA_DCM_SD_MEM2PER ((ushort)0x0001) /* memory-to-peripheral xfer */
  690. /* IDMA Buffer Descriptors
  691. */
  692. typedef struct idma_bd {
  693. uint flags;
  694. uint len; /* data length */
  695. uint src; /* source data buffer pointer */
  696. uint dst; /* destination data buffer pointer */
  697. } idma_bd_t;
  698. /* IDMA buffer descriptor flag bit fields
  699. */
  700. #define IDMA_BD_V ((uint)0x80000000) /* valid */
  701. #define IDMA_BD_W ((uint)0x20000000) /* wrap */
  702. #define IDMA_BD_I ((uint)0x10000000) /* interrupt */
  703. #define IDMA_BD_L ((uint)0x08000000) /* last */
  704. #define IDMA_BD_CM ((uint)0x02000000) /* continuous mode */
  705. #define IDMA_BD_SDN ((uint)0x00400000) /* source done */
  706. #define IDMA_BD_DDN ((uint)0x00200000) /* destination done */
  707. #define IDMA_BD_DGBL ((uint)0x00100000) /* destination global */
  708. #define IDMA_BD_DBO_LE ((uint)0x00040000) /* little-end dest byte order */
  709. #define IDMA_BD_DBO_BE ((uint)0x00080000) /* big-end dest byte order */
  710. #define IDMA_BD_DDTB ((uint)0x00010000) /* destination data bus */
  711. #define IDMA_BD_SGBL ((uint)0x00002000) /* source global */
  712. #define IDMA_BD_SBO_LE ((uint)0x00000800) /* little-end src byte order */
  713. #define IDMA_BD_SBO_BE ((uint)0x00001000) /* big-end src byte order */
  714. #define IDMA_BD_SDTB ((uint)0x00000200) /* source data bus */
  715. /* per-channel IDMA registers
  716. */
  717. typedef struct im_idma {
  718. u_char idsr; /* IDMAn event status register */
  719. u_char res0[3];
  720. u_char idmr; /* IDMAn event mask register */
  721. u_char res1[3];
  722. } im_idma_t;
  723. /* IDMA event register bit fields
  724. */
  725. #define IDMA_EVENT_SC ((unsigned char)0x08) /* stop completed */
  726. #define IDMA_EVENT_OB ((unsigned char)0x04) /* out of buffers */
  727. #define IDMA_EVENT_EDN ((unsigned char)0x02) /* external DONE asserted */
  728. #define IDMA_EVENT_BC ((unsigned char)0x01) /* buffer descriptor complete */
  729. /* RISC Controller Configuration Register (RCCR) bit fields
  730. */
  731. #define RCCR_TIME ((uint)0x80000000) /* timer enable */
  732. #define RCCR_TIMEP_MASK ((uint)0x3f000000) /* mask for timer period bit field */
  733. #define RCCR_DR0M ((uint)0x00800000) /* IDMA0 request mode */
  734. #define RCCR_DR1M ((uint)0x00400000) /* IDMA1 request mode */
  735. #define RCCR_DR2M ((uint)0x00000080) /* IDMA2 request mode */
  736. #define RCCR_DR3M ((uint)0x00000040) /* IDMA3 request mode */
  737. #define RCCR_DR0QP_MASK ((uint)0x00300000) /* mask for IDMA0 req priority */
  738. #define RCCR_DR0QP_HIGH ((uint)0x00000000) /* IDMA0 has high req priority */
  739. #define RCCR_DR0QP_MED ((uint)0x00100000) /* IDMA0 has medium req priority */
  740. #define RCCR_DR0QP_LOW ((uint)0x00200000) /* IDMA0 has low req priority */
  741. #define RCCR_DR1QP_MASK ((uint)0x00030000) /* mask for IDMA1 req priority */
  742. #define RCCR_DR1QP_HIGH ((uint)0x00000000) /* IDMA1 has high req priority */
  743. #define RCCR_DR1QP_MED ((uint)0x00010000) /* IDMA1 has medium req priority */
  744. #define RCCR_DR1QP_LOW ((uint)0x00020000) /* IDMA1 has low req priority */
  745. #define RCCR_DR2QP_MASK ((uint)0x00000030) /* mask for IDMA2 req priority */
  746. #define RCCR_DR2QP_HIGH ((uint)0x00000000) /* IDMA2 has high req priority */
  747. #define RCCR_DR2QP_MED ((uint)0x00000010) /* IDMA2 has medium req priority */
  748. #define RCCR_DR2QP_LOW ((uint)0x00000020) /* IDMA2 has low req priority */
  749. #define RCCR_DR3QP_MASK ((uint)0x00000003) /* mask for IDMA3 req priority */
  750. #define RCCR_DR3QP_HIGH ((uint)0x00000000) /* IDMA3 has high req priority */
  751. #define RCCR_DR3QP_MED ((uint)0x00000001) /* IDMA3 has medium req priority */
  752. #define RCCR_DR3QP_LOW ((uint)0x00000002) /* IDMA3 has low req priority */
  753. #define RCCR_EIE ((uint)0x00080000) /* external interrupt enable */
  754. #define RCCR_SCD ((uint)0x00040000) /* scheduler configuration */
  755. #define RCCR_ERAM_MASK ((uint)0x0000e000) /* mask for enable RAM microcode */
  756. #define RCCR_ERAM_0KB ((uint)0x00000000) /* use 0KB of dpram for microcode */
  757. #define RCCR_ERAM_2KB ((uint)0x00002000) /* use 2KB of dpram for microcode */
  758. #define RCCR_ERAM_4KB ((uint)0x00004000) /* use 4KB of dpram for microcode */
  759. #define RCCR_ERAM_6KB ((uint)0x00006000) /* use 6KB of dpram for microcode */
  760. #define RCCR_ERAM_8KB ((uint)0x00008000) /* use 8KB of dpram for microcode */
  761. #define RCCR_ERAM_10KB ((uint)0x0000a000) /* use 10KB of dpram for microcode */
  762. #define RCCR_ERAM_12KB ((uint)0x0000c000) /* use 12KB of dpram for microcode */
  763. #define RCCR_EDM0 ((uint)0x00000800) /* DREQ0 edge detect mode */
  764. #define RCCR_EDM1 ((uint)0x00000400) /* DREQ1 edge detect mode */
  765. #define RCCR_EDM2 ((uint)0x00000200) /* DREQ2 edge detect mode */
  766. #define RCCR_EDM3 ((uint)0x00000100) /* DREQ3 edge detect mode */
  767. #define RCCR_DEM01 ((uint)0x00000008) /* DONE0/DONE1 edge detect mode */
  768. #define RCCR_DEM23 ((uint)0x00000004) /* DONE2/DONE3 edge detect mode */
  769. /*-----------------------------------------------------------------------
  770. * CMXFCR - CMX FCC Clock Route Register
  771. */
  772. #define CMXFCR_FC1 0x40000000 /* FCC1 connection */
  773. #define CMXFCR_RF1CS_MSK 0x38000000 /* Receive FCC1 Clock Source Mask */
  774. #define CMXFCR_TF1CS_MSK 0x07000000 /* Transmit FCC1 Clock Source Mask */
  775. #define CMXFCR_FC2 0x00400000 /* FCC2 connection */
  776. #define CMXFCR_RF2CS_MSK 0x00380000 /* Receive FCC2 Clock Source Mask */
  777. #define CMXFCR_TF2CS_MSK 0x00070000 /* Transmit FCC2 Clock Source Mask */
  778. #define CMXFCR_FC3 0x00004000 /* FCC3 connection */
  779. #define CMXFCR_RF3CS_MSK 0x00003800 /* Receive FCC3 Clock Source Mask */
  780. #define CMXFCR_TF3CS_MSK 0x00000700 /* Transmit FCC3 Clock Source Mask */
  781. #define CMXFCR_RF1CS_BRG5 0x00000000 /* Receive FCC1 Clock Source is BRG5 */
  782. #define CMXFCR_RF1CS_BRG6 0x08000000 /* Receive FCC1 Clock Source is BRG6 */
  783. #define CMXFCR_RF1CS_BRG7 0x10000000 /* Receive FCC1 Clock Source is BRG7 */
  784. #define CMXFCR_RF1CS_BRG8 0x18000000 /* Receive FCC1 Clock Source is BRG8 */
  785. #define CMXFCR_RF1CS_CLK9 0x20000000 /* Receive FCC1 Clock Source is CLK9 */
  786. #define CMXFCR_RF1CS_CLK10 0x28000000 /* Receive FCC1 Clock Source is CLK10 */
  787. #define CMXFCR_RF1CS_CLK11 0x30000000 /* Receive FCC1 Clock Source is CLK11 */
  788. #define CMXFCR_RF1CS_CLK12 0x38000000 /* Receive FCC1 Clock Source is CLK12 */
  789. #define CMXFCR_TF1CS_BRG5 0x00000000 /* Transmit FCC1 Clock Source is BRG5 */
  790. #define CMXFCR_TF1CS_BRG6 0x01000000 /* Transmit FCC1 Clock Source is BRG6 */
  791. #define CMXFCR_TF1CS_BRG7 0x02000000 /* Transmit FCC1 Clock Source is BRG7 */
  792. #define CMXFCR_TF1CS_BRG8 0x03000000 /* Transmit FCC1 Clock Source is BRG8 */
  793. #define CMXFCR_TF1CS_CLK9 0x04000000 /* Transmit FCC1 Clock Source is CLK9 */
  794. #define CMXFCR_TF1CS_CLK10 0x05000000 /* Transmit FCC1 Clock Source is CLK10 */
  795. #define CMXFCR_TF1CS_CLK11 0x06000000 /* Transmit FCC1 Clock Source is CLK11 */
  796. #define CMXFCR_TF1CS_CLK12 0x07000000 /* Transmit FCC1 Clock Source is CLK12 */
  797. #define CMXFCR_RF2CS_BRG5 0x00000000 /* Receive FCC2 Clock Source is BRG5 */
  798. #define CMXFCR_RF2CS_BRG6 0x00080000 /* Receive FCC2 Clock Source is BRG6 */
  799. #define CMXFCR_RF2CS_BRG7 0x00100000 /* Receive FCC2 Clock Source is BRG7 */
  800. #define CMXFCR_RF2CS_BRG8 0x00180000 /* Receive FCC2 Clock Source is BRG8 */
  801. #define CMXFCR_RF2CS_CLK13 0x00200000 /* Receive FCC2 Clock Source is CLK13 */
  802. #define CMXFCR_RF2CS_CLK14 0x00280000 /* Receive FCC2 Clock Source is CLK14 */
  803. #define CMXFCR_RF2CS_CLK15 0x00300000 /* Receive FCC2 Clock Source is CLK15 */
  804. #define CMXFCR_RF2CS_CLK16 0x00380000 /* Receive FCC2 Clock Source is CLK16 */
  805. #define CMXFCR_TF2CS_BRG5 0x00000000 /* Transmit FCC2 Clock Source is BRG5 */
  806. #define CMXFCR_TF2CS_BRG6 0x00010000 /* Transmit FCC2 Clock Source is BRG6 */
  807. #define CMXFCR_TF2CS_BRG7 0x00020000 /* Transmit FCC2 Clock Source is BRG7 */
  808. #define CMXFCR_TF2CS_BRG8 0x00030000 /* Transmit FCC2 Clock Source is BRG8 */
  809. #define CMXFCR_TF2CS_CLK13 0x00040000 /* Transmit FCC2 Clock Source is CLK13 */
  810. #define CMXFCR_TF2CS_CLK14 0x00050000 /* Transmit FCC2 Clock Source is CLK14 */
  811. #define CMXFCR_TF2CS_CLK15 0x00060000 /* Transmit FCC2 Clock Source is CLK15 */
  812. #define CMXFCR_TF2CS_CLK16 0x00070000 /* Transmit FCC2 Clock Source is CLK16 */
  813. #define CMXFCR_RF3CS_BRG5 0x00000000 /* Receive FCC3 Clock Source is BRG5 */
  814. #define CMXFCR_RF3CS_BRG6 0x00000800 /* Receive FCC3 Clock Source is BRG6 */
  815. #define CMXFCR_RF3CS_BRG7 0x00001000 /* Receive FCC3 Clock Source is BRG7 */
  816. #define CMXFCR_RF3CS_BRG8 0x00001800 /* Receive FCC3 Clock Source is BRG8 */
  817. #define CMXFCR_RF3CS_CLK13 0x00002000 /* Receive FCC3 Clock Source is CLK13 */
  818. #define CMXFCR_RF3CS_CLK14 0x00002800 /* Receive FCC3 Clock Source is CLK14 */
  819. #define CMXFCR_RF3CS_CLK15 0x00003000 /* Receive FCC3 Clock Source is CLK15 */
  820. #define CMXFCR_RF3CS_CLK16 0x00003800 /* Receive FCC3 Clock Source is CLK16 */
  821. #define CMXFCR_TF3CS_BRG5 0x00000000 /* Transmit FCC3 Clock Source is BRG5 */
  822. #define CMXFCR_TF3CS_BRG6 0x00000100 /* Transmit FCC3 Clock Source is BRG6 */
  823. #define CMXFCR_TF3CS_BRG7 0x00000200 /* Transmit FCC3 Clock Source is BRG7 */
  824. #define CMXFCR_TF3CS_BRG8 0x00000300 /* Transmit FCC3 Clock Source is BRG8 */
  825. #define CMXFCR_TF3CS_CLK13 0x00000400 /* Transmit FCC3 Clock Source is CLK13 */
  826. #define CMXFCR_TF3CS_CLK14 0x00000500 /* Transmit FCC3 Clock Source is CLK14 */
  827. #define CMXFCR_TF3CS_CLK15 0x00000600 /* Transmit FCC3 Clock Source is CLK15 */
  828. #define CMXFCR_TF3CS_CLK16 0x00000700 /* Transmit FCC3 Clock Source is CLK16 */
  829. /*-----------------------------------------------------------------------
  830. * CMXSCR - CMX SCC Clock Route Register
  831. */
  832. #define CMXSCR_GR1 0x80000000 /* Grant Support of SCC1 */
  833. #define CMXSCR_SC1 0x40000000 /* SCC1 connection */
  834. #define CMXSCR_RS1CS_MSK 0x38000000 /* Receive SCC1 Clock Source Mask */
  835. #define CMXSCR_TS1CS_MSK 0x07000000 /* Transmit SCC1 Clock Source Mask */
  836. #define CMXSCR_GR2 0x00800000 /* Grant Support of SCC2 */
  837. #define CMXSCR_SC2 0x00400000 /* SCC2 connection */
  838. #define CMXSCR_RS2CS_MSK 0x00380000 /* Receive SCC2 Clock Source Mask */
  839. #define CMXSCR_TS2CS_MSK 0x00070000 /* Transmit SCC2 Clock Source Mask */
  840. #define CMXSCR_GR3 0x00008000 /* Grant Support of SCC3 */
  841. #define CMXSCR_SC3 0x00004000 /* SCC3 connection */
  842. #define CMXSCR_RS3CS_MSK 0x00003800 /* Receive SCC3 Clock Source Mask */
  843. #define CMXSCR_TS3CS_MSK 0x00000700 /* Transmit SCC3 Clock Source Mask */
  844. #define CMXSCR_GR4 0x00000080 /* Grant Support of SCC4 */
  845. #define CMXSCR_SC4 0x00000040 /* SCC4 connection */
  846. #define CMXSCR_RS4CS_MSK 0x00000038 /* Receive SCC4 Clock Source Mask */
  847. #define CMXSCR_TS4CS_MSK 0x00000007 /* Transmit SCC4 Clock Source Mask */
  848. #define CMXSCR_RS1CS_BRG1 0x00000000 /* SCC1 Rx Clock Source is BRG1 */
  849. #define CMXSCR_RS1CS_BRG2 0x08000000 /* SCC1 Rx Clock Source is BRG2 */
  850. #define CMXSCR_RS1CS_BRG3 0x10000000 /* SCC1 Rx Clock Source is BRG3 */
  851. #define CMXSCR_RS1CS_BRG4 0x18000000 /* SCC1 Rx Clock Source is BRG4 */
  852. #define CMXSCR_RS1CS_CLK11 0x20000000 /* SCC1 Rx Clock Source is CLK11 */
  853. #define CMXSCR_RS1CS_CLK12 0x28000000 /* SCC1 Rx Clock Source is CLK12 */
  854. #define CMXSCR_RS1CS_CLK3 0x30000000 /* SCC1 Rx Clock Source is CLK3 */
  855. #define CMXSCR_RS1CS_CLK4 0x38000000 /* SCC1 Rx Clock Source is CLK4 */
  856. #define CMXSCR_TS1CS_BRG1 0x00000000 /* SCC1 Tx Clock Source is BRG1 */
  857. #define CMXSCR_TS1CS_BRG2 0x01000000 /* SCC1 Tx Clock Source is BRG2 */
  858. #define CMXSCR_TS1CS_BRG3 0x02000000 /* SCC1 Tx Clock Source is BRG3 */
  859. #define CMXSCR_TS1CS_BRG4 0x03000000 /* SCC1 Tx Clock Source is BRG4 */
  860. #define CMXSCR_TS1CS_CLK11 0x04000000 /* SCC1 Tx Clock Source is CLK11 */
  861. #define CMXSCR_TS1CS_CLK12 0x05000000 /* SCC1 Tx Clock Source is CLK12 */
  862. #define CMXSCR_TS1CS_CLK3 0x06000000 /* SCC1 Tx Clock Source is CLK3 */
  863. #define CMXSCR_TS1CS_CLK4 0x07000000 /* SCC1 Tx Clock Source is CLK4 */
  864. #define CMXSCR_RS2CS_BRG1 0x00000000 /* SCC2 Rx Clock Source is BRG1 */
  865. #define CMXSCR_RS2CS_BRG2 0x00080000 /* SCC2 Rx Clock Source is BRG2 */
  866. #define CMXSCR_RS2CS_BRG3 0x00100000 /* SCC2 Rx Clock Source is BRG3 */
  867. #define CMXSCR_RS2CS_BRG4 0x00180000 /* SCC2 Rx Clock Source is BRG4 */
  868. #define CMXSCR_RS2CS_CLK11 0x00200000 /* SCC2 Rx Clock Source is CLK11 */
  869. #define CMXSCR_RS2CS_CLK12 0x00280000 /* SCC2 Rx Clock Source is CLK12 */
  870. #define CMXSCR_RS2CS_CLK3 0x00300000 /* SCC2 Rx Clock Source is CLK3 */
  871. #define CMXSCR_RS2CS_CLK4 0x00380000 /* SCC2 Rx Clock Source is CLK4 */
  872. #define CMXSCR_TS2CS_BRG1 0x00000000 /* SCC2 Tx Clock Source is BRG1 */
  873. #define CMXSCR_TS2CS_BRG2 0x00010000 /* SCC2 Tx Clock Source is BRG2 */
  874. #define CMXSCR_TS2CS_BRG3 0x00020000 /* SCC2 Tx Clock Source is BRG3 */
  875. #define CMXSCR_TS2CS_BRG4 0x00030000 /* SCC2 Tx Clock Source is BRG4 */
  876. #define CMXSCR_TS2CS_CLK11 0x00040000 /* SCC2 Tx Clock Source is CLK11 */
  877. #define CMXSCR_TS2CS_CLK12 0x00050000 /* SCC2 Tx Clock Source is CLK12 */
  878. #define CMXSCR_TS2CS_CLK3 0x00060000 /* SCC2 Tx Clock Source is CLK3 */
  879. #define CMXSCR_TS2CS_CLK4 0x00070000 /* SCC2 Tx Clock Source is CLK4 */
  880. #define CMXSCR_RS3CS_BRG1 0x00000000 /* SCC3 Rx Clock Source is BRG1 */
  881. #define CMXSCR_RS3CS_BRG2 0x00000800 /* SCC3 Rx Clock Source is BRG2 */
  882. #define CMXSCR_RS3CS_BRG3 0x00001000 /* SCC3 Rx Clock Source is BRG3 */
  883. #define CMXSCR_RS3CS_BRG4 0x00001800 /* SCC3 Rx Clock Source is BRG4 */
  884. #define CMXSCR_RS3CS_CLK5 0x00002000 /* SCC3 Rx Clock Source is CLK5 */
  885. #define CMXSCR_RS3CS_CLK6 0x00002800 /* SCC3 Rx Clock Source is CLK6 */
  886. #define CMXSCR_RS3CS_CLK7 0x00003000 /* SCC3 Rx Clock Source is CLK7 */
  887. #define CMXSCR_RS3CS_CLK8 0x00003800 /* SCC3 Rx Clock Source is CLK8 */
  888. #define CMXSCR_TS3CS_BRG1 0x00000000 /* SCC3 Tx Clock Source is BRG1 */
  889. #define CMXSCR_TS3CS_BRG2 0x00000100 /* SCC3 Tx Clock Source is BRG2 */
  890. #define CMXSCR_TS3CS_BRG3 0x00000200 /* SCC3 Tx Clock Source is BRG3 */
  891. #define CMXSCR_TS3CS_BRG4 0x00000300 /* SCC3 Tx Clock Source is BRG4 */
  892. #define CMXSCR_TS3CS_CLK5 0x00000400 /* SCC3 Tx Clock Source is CLK5 */
  893. #define CMXSCR_TS3CS_CLK6 0x00000500 /* SCC3 Tx Clock Source is CLK6 */
  894. #define CMXSCR_TS3CS_CLK7 0x00000600 /* SCC3 Tx Clock Source is CLK7 */
  895. #define CMXSCR_TS3CS_CLK8 0x00000700 /* SCC3 Tx Clock Source is CLK8 */
  896. #define CMXSCR_RS4CS_BRG1 0x00000000 /* SCC4 Rx Clock Source is BRG1 */
  897. #define CMXSCR_RS4CS_BRG2 0x00000008 /* SCC4 Rx Clock Source is BRG2 */
  898. #define CMXSCR_RS4CS_BRG3 0x00000010 /* SCC4 Rx Clock Source is BRG3 */
  899. #define CMXSCR_RS4CS_BRG4 0x00000018 /* SCC4 Rx Clock Source is BRG4 */
  900. #define CMXSCR_RS4CS_CLK5 0x00000020 /* SCC4 Rx Clock Source is CLK5 */
  901. #define CMXSCR_RS4CS_CLK6 0x00000028 /* SCC4 Rx Clock Source is CLK6 */
  902. #define CMXSCR_RS4CS_CLK7 0x00000030 /* SCC4 Rx Clock Source is CLK7 */
  903. #define CMXSCR_RS4CS_CLK8 0x00000038 /* SCC4 Rx Clock Source is CLK8 */
  904. #define CMXSCR_TS4CS_BRG1 0x00000000 /* SCC4 Tx Clock Source is BRG1 */
  905. #define CMXSCR_TS4CS_BRG2 0x00000001 /* SCC4 Tx Clock Source is BRG2 */
  906. #define CMXSCR_TS4CS_BRG3 0x00000002 /* SCC4 Tx Clock Source is BRG3 */
  907. #define CMXSCR_TS4CS_BRG4 0x00000003 /* SCC4 Tx Clock Source is BRG4 */
  908. #define CMXSCR_TS4CS_CLK5 0x00000004 /* SCC4 Tx Clock Source is CLK5 */
  909. #define CMXSCR_TS4CS_CLK6 0x00000005 /* SCC4 Tx Clock Source is CLK6 */
  910. #define CMXSCR_TS4CS_CLK7 0x00000006 /* SCC4 Tx Clock Source is CLK7 */
  911. #define CMXSCR_TS4CS_CLK8 0x00000007 /* SCC4 Tx Clock Source is CLK8 */
  912. /*-----------------------------------------------------------------------
  913. * SIUMCR - SIU Module Configuration Register 4-31
  914. */
  915. #define SIUMCR_BBD 0x80000000 /* Bus Busy Disable */
  916. #define SIUMCR_ESE 0x40000000 /* External Snoop Enable */
  917. #define SIUMCR_PBSE 0x20000000 /* Parity Byte Select Enable */
  918. #define SIUMCR_CDIS 0x10000000 /* Core Disable */
  919. #define SIUMCR_DPPC00 0x00000000 /* Data Parity Pins Configuration*/
  920. #define SIUMCR_DPPC01 0x04000000 /* - " - */
  921. #define SIUMCR_DPPC10 0x08000000 /* - " - */
  922. #define SIUMCR_DPPC11 0x0c000000 /* - " - */
  923. #define SIUMCR_L2CPC00 0x00000000 /* L2 Cache Pins Configuration */
  924. #define SIUMCR_L2CPC01 0x01000000 /* - " - */
  925. #define SIUMCR_L2CPC10 0x02000000 /* - " - */
  926. #define SIUMCR_L2CPC11 0x03000000 /* - " - */
  927. #define SIUMCR_LBPC00 0x00000000 /* Local Bus Pins Configuration */
  928. #define SIUMCR_LBPC01 0x00400000 /* - " - */
  929. #define SIUMCR_LBPC10 0x00800000 /* - " - */
  930. #define SIUMCR_LBPC11 0x00c00000 /* - " - */
  931. #define SIUMCR_APPC00 0x00000000 /* Address Parity Pins Configuration*/
  932. #define SIUMCR_APPC01 0x00100000 /* - " - */
  933. #define SIUMCR_APPC10 0x00200000 /* - " - */
  934. #define SIUMCR_APPC11 0x00300000 /* - " - */
  935. #define SIUMCR_CS10PC00 0x00000000 /* CS10 Pin Configuration */
  936. #define SIUMCR_CS10PC01 0x00040000 /* - " - */
  937. #define SIUMCR_CS10PC10 0x00080000 /* - " - */
  938. #define SIUMCR_CS10PC11 0x000c0000 /* - " - */
  939. #define SIUMCR_BCTLC00 0x00000000 /* Buffer Control Configuration */
  940. #define SIUMCR_BCTLC01 0x00010000 /* - " - */
  941. #define SIUMCR_BCTLC10 0x00020000 /* - " - */
  942. #define SIUMCR_BCTLC11 0x00030000 /* - " - */
  943. #define SIUMCR_MMR00 0x00000000 /* Mask Masters Requests */
  944. #define SIUMCR_MMR01 0x00004000 /* - " - */
  945. #define SIUMCR_MMR10 0x00008000 /* - " - */
  946. #define SIUMCR_MMR11 0x0000c000 /* - " - */
  947. #define SIUMCR_LPBSE 0x00002000 /* LocalBus Parity Byte Select Enable*/
  948. /*-----------------------------------------------------------------------
  949. * SCCR - System Clock Control Register 9-8
  950. */
  951. #define SCCR_PCI_MODE 0x00000100 /* PCI Mode */
  952. #define SCCR_PCI_MODCK 0x00000080 /* Value of PCI_MODCK pin */
  953. #define SCCR_PCIDF_MSK 0x00000078 /* PCI division factor */
  954. #define SCCR_PCIDF_SHIFT 3
  955. #ifndef CPM_IMMR_OFFSET
  956. #define CPM_IMMR_OFFSET 0x101a8
  957. #endif
  958. #define FCC_PSMR_RMII ((uint)0x00020000) /* Use RMII interface */
  959. /* FCC iop & clock configuration. BSP code is responsible to define Fx_RXCLK & Fx_TXCLK
  960. * in order to use clock-computing stuff below for the FCC x
  961. */
  962. /* Automatically generates register configurations */
  963. #define PC_CLK(x) ((uint)(1<<(x-1))) /* FCC CLK I/O ports */
  964. #define CMXFCR_RF1CS(x) ((uint)((x-5)<<27)) /* FCC1 Receive Clock Source */
  965. #define CMXFCR_TF1CS(x) ((uint)((x-5)<<24)) /* FCC1 Transmit Clock Source */
  966. #define CMXFCR_RF2CS(x) ((uint)((x-9)<<19)) /* FCC2 Receive Clock Source */
  967. #define CMXFCR_TF2CS(x) ((uint)((x-9)<<16)) /* FCC2 Transmit Clock Source */
  968. #define CMXFCR_RF3CS(x) ((uint)((x-9)<<11)) /* FCC3 Receive Clock Source */
  969. #define CMXFCR_TF3CS(x) ((uint)((x-9)<<8)) /* FCC3 Transmit Clock Source */
  970. #define PC_F1RXCLK PC_CLK(F1_RXCLK)
  971. #define PC_F1TXCLK PC_CLK(F1_TXCLK)
  972. #define CMX1_CLK_ROUTE (CMXFCR_RF1CS(F1_RXCLK) | CMXFCR_TF1CS(F1_TXCLK))
  973. #define CMX1_CLK_MASK ((uint)0xff000000)
  974. #define PC_F2RXCLK PC_CLK(F2_RXCLK)
  975. #define PC_F2TXCLK PC_CLK(F2_TXCLK)
  976. #define CMX2_CLK_ROUTE (CMXFCR_RF2CS(F2_RXCLK) | CMXFCR_TF2CS(F2_TXCLK))
  977. #define CMX2_CLK_MASK ((uint)0x00ff0000)
  978. #define PC_F3RXCLK PC_CLK(F3_RXCLK)
  979. #define PC_F3TXCLK PC_CLK(F3_TXCLK)
  980. #define CMX3_CLK_ROUTE (CMXFCR_RF3CS(F3_RXCLK) | CMXFCR_TF3CS(F3_TXCLK))
  981. #define CMX3_CLK_MASK ((uint)0x0000ff00)
  982. #define CPMUX_CLK_MASK (CMX3_CLK_MASK | CMX2_CLK_MASK)
  983. #define CPMUX_CLK_ROUTE (CMX3_CLK_ROUTE | CMX2_CLK_ROUTE)
  984. #define CLK_TRX (PC_F3TXCLK | PC_F3RXCLK | PC_F2TXCLK | PC_F2RXCLK)
  985. /* I/O Pin assignment for FCC1. I don't yet know the best way to do this,
  986. * but there is little variation among the choices.
  987. */
  988. #define PA1_COL 0x00000001U
  989. #define PA1_CRS 0x00000002U
  990. #define PA1_TXER 0x00000004U
  991. #define PA1_TXEN 0x00000008U
  992. #define PA1_RXDV 0x00000010U
  993. #define PA1_RXER 0x00000020U
  994. #define PA1_TXDAT 0x00003c00U
  995. #define PA1_RXDAT 0x0003c000U
  996. #define PA1_PSORA0 (PA1_RXDAT | PA1_TXDAT)
  997. #define PA1_PSORA1 (PA1_COL | PA1_CRS | PA1_TXER | PA1_TXEN | \
  998. PA1_RXDV | PA1_RXER)
  999. #define PA1_DIRA0 (PA1_RXDAT | PA1_CRS | PA1_COL | PA1_RXER | PA1_RXDV)
  1000. #define PA1_DIRA1 (PA1_TXDAT | PA1_TXEN | PA1_TXER)
  1001. /* I/O Pin assignment for FCC2. I don't yet know the best way to do this,
  1002. * but there is little variation among the choices.
  1003. */
  1004. #define PB2_TXER 0x00000001U
  1005. #define PB2_RXDV 0x00000002U
  1006. #define PB2_TXEN 0x00000004U
  1007. #define PB2_RXER 0x00000008U
  1008. #define PB2_COL 0x00000010U
  1009. #define PB2_CRS 0x00000020U
  1010. #define PB2_TXDAT 0x000003c0U
  1011. #define PB2_RXDAT 0x00003c00U
  1012. #define PB2_PSORB0 (PB2_RXDAT | PB2_TXDAT | PB2_CRS | PB2_COL | \
  1013. PB2_RXER | PB2_RXDV | PB2_TXER)
  1014. #define PB2_PSORB1 (PB2_TXEN)
  1015. #define PB2_DIRB0 (PB2_RXDAT | PB2_CRS | PB2_COL | PB2_RXER | PB2_RXDV)
  1016. #define PB2_DIRB1 (PB2_TXDAT | PB2_TXEN | PB2_TXER)
  1017. /* I/O Pin assignment for FCC3. I don't yet know the best way to do this,
  1018. * but there is little variation among the choices.
  1019. */
  1020. #define PB3_RXDV 0x00004000U
  1021. #define PB3_RXER 0x00008000U
  1022. #define PB3_TXER 0x00010000U
  1023. #define PB3_TXEN 0x00020000U
  1024. #define PB3_COL 0x00040000U
  1025. #define PB3_CRS 0x00080000U
  1026. #define PB3_TXDAT 0x0f000000U
  1027. #define PC3_TXDAT 0x00000010U
  1028. #define PB3_RXDAT 0x00f00000U
  1029. #define PB3_PSORB0 (PB3_RXDAT | PB3_TXDAT | PB3_CRS | PB3_COL | \
  1030. PB3_RXER | PB3_RXDV | PB3_TXER | PB3_TXEN)
  1031. #define PB3_PSORB1 0
  1032. #define PB3_DIRB0 (PB3_RXDAT | PB3_CRS | PB3_COL | PB3_RXER | PB3_RXDV)
  1033. #define PB3_DIRB1 (PB3_TXDAT | PB3_TXEN | PB3_TXER)
  1034. #define PC3_DIRC1 (PC3_TXDAT)
  1035. /* Handy macro to specify mem for FCCs*/
  1036. #define FCC_MEM_OFFSET(x) (CPM_FCC_SPECIAL_BASE + (x*128))
  1037. #define FCC1_MEM_OFFSET FCC_MEM_OFFSET(0)
  1038. #define FCC2_MEM_OFFSET FCC_MEM_OFFSET(1)
  1039. #define FCC3_MEM_OFFSET FCC_MEM_OFFSET(2)
  1040. /* Clocks and GRG's */
  1041. enum cpm_clk_dir {
  1042. CPM_CLK_RX,
  1043. CPM_CLK_TX,
  1044. CPM_CLK_RTX
  1045. };
  1046. enum cpm_clk_target {
  1047. CPM_CLK_SCC1,
  1048. CPM_CLK_SCC2,
  1049. CPM_CLK_SCC3,
  1050. CPM_CLK_SCC4,
  1051. CPM_CLK_FCC1,
  1052. CPM_CLK_FCC2,
  1053. CPM_CLK_FCC3,
  1054. CPM_CLK_SMC1,
  1055. CPM_CLK_SMC2,
  1056. };
  1057. enum cpm_clk {
  1058. CPM_CLK_NONE = 0,
  1059. CPM_BRG1, /* Baud Rate Generator 1 */
  1060. CPM_BRG2, /* Baud Rate Generator 2 */
  1061. CPM_BRG3, /* Baud Rate Generator 3 */
  1062. CPM_BRG4, /* Baud Rate Generator 4 */
  1063. CPM_BRG5, /* Baud Rate Generator 5 */
  1064. CPM_BRG6, /* Baud Rate Generator 6 */
  1065. CPM_BRG7, /* Baud Rate Generator 7 */
  1066. CPM_BRG8, /* Baud Rate Generator 8 */
  1067. CPM_CLK1, /* Clock 1 */
  1068. CPM_CLK2, /* Clock 2 */
  1069. CPM_CLK3, /* Clock 3 */
  1070. CPM_CLK4, /* Clock 4 */
  1071. CPM_CLK5, /* Clock 5 */
  1072. CPM_CLK6, /* Clock 6 */
  1073. CPM_CLK7, /* Clock 7 */
  1074. CPM_CLK8, /* Clock 8 */
  1075. CPM_CLK9, /* Clock 9 */
  1076. CPM_CLK10, /* Clock 10 */
  1077. CPM_CLK11, /* Clock 11 */
  1078. CPM_CLK12, /* Clock 12 */
  1079. CPM_CLK13, /* Clock 13 */
  1080. CPM_CLK14, /* Clock 14 */
  1081. CPM_CLK15, /* Clock 15 */
  1082. CPM_CLK16, /* Clock 16 */
  1083. CPM_CLK17, /* Clock 17 */
  1084. CPM_CLK18, /* Clock 18 */
  1085. CPM_CLK19, /* Clock 19 */
  1086. CPM_CLK20, /* Clock 20 */
  1087. CPM_CLK_DUMMY
  1088. };
  1089. extern int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode);
  1090. extern int cpm2_smc_clk_setup(enum cpm_clk_target target, int clock);
  1091. #define CPM_PIN_INPUT 0
  1092. #define CPM_PIN_OUTPUT 1
  1093. #define CPM_PIN_PRIMARY 0
  1094. #define CPM_PIN_SECONDARY 2
  1095. #define CPM_PIN_GPIO 4
  1096. #define CPM_PIN_OPENDRAIN 8
  1097. void cpm2_set_pin(int port, int pin, int flags);
  1098. #endif /* __CPM2__ */
  1099. #endif /* __KERNEL__ */