cpm2.h 50 KB

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