cpm2.h 53 KB

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