1
2
3
4
5
6
7
8
9#ifdef __KERNEL__
10#ifndef __CPM2__
11#define __CPM2__
12
13#include <asm/immap_cpm2.h>
14#include <asm/cpm.h>
15#include <sysdev/fsl_soc.h>
16
17#ifdef CONFIG_PPC_85xx
18#define CPM_MAP_ADDR (get_immrbase() + 0x80000)
19#endif
20
21
22
23#define CPM_CR_RST ((uint)0x80000000)
24#define CPM_CR_PAGE ((uint)0x7c000000)
25#define CPM_CR_SBLOCK ((uint)0x03e00000)
26#define CPM_CR_FLG ((uint)0x00010000)
27#define CPM_CR_MCN ((uint)0x00003fc0)
28#define CPM_CR_OPCODE ((uint)0x0000000f)
29
30
31
32#define CPM_CR_SCC1_SBLOCK (0x04)
33#define CPM_CR_SCC2_SBLOCK (0x05)
34#define CPM_CR_SCC3_SBLOCK (0x06)
35#define CPM_CR_SCC4_SBLOCK (0x07)
36#define CPM_CR_SMC1_SBLOCK (0x08)
37#define CPM_CR_SMC2_SBLOCK (0x09)
38#define CPM_CR_SPI_SBLOCK (0x0a)
39#define CPM_CR_I2C_SBLOCK (0x0b)
40#define CPM_CR_TIMER_SBLOCK (0x0f)
41#define CPM_CR_RAND_SBLOCK (0x0e)
42#define CPM_CR_FCC1_SBLOCK (0x10)
43#define CPM_CR_FCC2_SBLOCK (0x11)
44#define CPM_CR_FCC3_SBLOCK (0x12)
45#define CPM_CR_IDMA1_SBLOCK (0x14)
46#define CPM_CR_IDMA2_SBLOCK (0x15)
47#define CPM_CR_IDMA3_SBLOCK (0x16)
48#define CPM_CR_IDMA4_SBLOCK (0x17)
49#define CPM_CR_MCC1_SBLOCK (0x1c)
50
51#define CPM_CR_FCC_SBLOCK(x) (x + 0x10)
52
53#define CPM_CR_SCC1_PAGE (0x00)
54#define CPM_CR_SCC2_PAGE (0x01)
55#define CPM_CR_SCC3_PAGE (0x02)
56#define CPM_CR_SCC4_PAGE (0x03)
57#define CPM_CR_SMC1_PAGE (0x07)
58#define CPM_CR_SMC2_PAGE (0x08)
59#define CPM_CR_SPI_PAGE (0x09)
60#define CPM_CR_I2C_PAGE (0x0a)
61#define CPM_CR_TIMER_PAGE (0x0a)
62#define CPM_CR_RAND_PAGE (0x0a)
63#define CPM_CR_FCC1_PAGE (0x04)
64#define CPM_CR_FCC2_PAGE (0x05)
65#define CPM_CR_FCC3_PAGE (0x06)
66#define CPM_CR_IDMA1_PAGE (0x07)
67#define CPM_CR_IDMA2_PAGE (0x08)
68#define CPM_CR_IDMA3_PAGE (0x09)
69#define CPM_CR_IDMA4_PAGE (0x0a)
70#define CPM_CR_MCC1_PAGE (0x07)
71#define CPM_CR_MCC2_PAGE (0x08)
72
73#define CPM_CR_FCC_PAGE(x) (x + 0x04)
74
75
76
77#define CPM_CR_START_IDMA ((ushort)0x0009)
78
79#define mk_cr_cmd(PG, SBC, MCN, OP) \
80 ((PG << 26) | (SBC << 21) | (MCN << 6) | OP)
81
82
83
84
85
86#define NUM_CPM_HOST_PAGES 2
87
88
89
90
91extern cpm_cpm2_t __iomem *cpmp;
92
93#define cpm_dpalloc cpm_muram_alloc
94#define cpm_dpfree cpm_muram_free
95#define cpm_dpram_addr cpm_muram_addr
96
97extern void cpm2_reset(void);
98
99
100
101#define CPM_BRG_RST ((uint)0x00020000)
102#define CPM_BRG_EN ((uint)0x00010000)
103#define CPM_BRG_EXTC_INT ((uint)0x00000000)
104#define CPM_BRG_EXTC_CLK3_9 ((uint)0x00004000)
105#define CPM_BRG_EXTC_CLK5_15 ((uint)0x00008000)
106#define CPM_BRG_ATB ((uint)0x00002000)
107#define CPM_BRG_CD_MASK ((uint)0x00001ffe)
108#define CPM_BRG_DIV16 ((uint)0x00000001)
109
110#define CPM2_BRG_INT_CLK (get_brgfreq())
111#define CPM2_BRG_UART_CLK (CPM2_BRG_INT_CLK/16)
112
113extern void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src);
114
115
116
117
118static inline void cpm_setbrg(uint brg, uint rate)
119{
120 __cpm2_setbrg(brg, rate, CPM2_BRG_UART_CLK, 0, CPM_BRG_EXTC_INT);
121}
122
123
124
125
126static inline void cpm2_fastbrg(uint brg, uint rate, int div16)
127{
128 __cpm2_setbrg(brg, rate, CPM2_BRG_INT_CLK, div16, CPM_BRG_EXTC_INT);
129}
130
131
132
133#define CPMFCR_GBL ((u_char)0x20)
134#define CPMFCR_EB ((u_char)0x10)
135#define CPMFCR_TC2 ((u_char)0x04)
136#define CPMFCR_DTB ((u_char)0x02)
137#define CPMFCR_BDB ((u_char)0x01)
138
139
140
141#define PROFF_SCC1 ((uint)0x8000)
142#define PROFF_SCC2 ((uint)0x8100)
143#define PROFF_SCC3 ((uint)0x8200)
144#define PROFF_SCC4 ((uint)0x8300)
145#define PROFF_FCC1 ((uint)0x8400)
146#define PROFF_FCC2 ((uint)0x8500)
147#define PROFF_FCC3 ((uint)0x8600)
148#define PROFF_MCC1 ((uint)0x8700)
149#define PROFF_SMC1_BASE ((uint)0x87fc)
150#define PROFF_IDMA1_BASE ((uint)0x87fe)
151#define PROFF_MCC2 ((uint)0x8800)
152#define PROFF_SMC2_BASE ((uint)0x88fc)
153#define PROFF_IDMA2_BASE ((uint)0x88fe)
154#define PROFF_SPI_BASE ((uint)0x89fc)
155#define PROFF_IDMA3_BASE ((uint)0x89fe)
156#define PROFF_TIMERS ((uint)0x8ae0)
157#define PROFF_REVNUM ((uint)0x8af0)
158#define PROFF_RAND ((uint)0x8af8)
159#define PROFF_I2C_BASE ((uint)0x8afc)
160#define PROFF_IDMA4_BASE ((uint)0x8afe)
161
162#define PROFF_SCC_SIZE ((uint)0x100)
163#define PROFF_FCC_SIZE ((uint)0x100)
164#define PROFF_SMC_SIZE ((uint)64)
165
166
167
168
169
170
171
172#define PROFF_SMC1 (0)
173#define PROFF_SMC2 (64)
174
175
176
177
178typedef struct smc_uart {
179 ushort smc_rbase;
180 ushort smc_tbase;
181 u_char smc_rfcr;
182 u_char smc_tfcr;
183 ushort smc_mrblr;
184 uint smc_rstate;
185 uint smc_idp;
186 ushort smc_rbptr;
187 ushort smc_ibc;
188 uint smc_rxtmp;
189 uint smc_tstate;
190 uint smc_tdp;
191 ushort smc_tbptr;
192 ushort smc_tbc;
193 uint smc_txtmp;
194 ushort smc_maxidl;
195 ushort smc_tmpidl;
196 ushort smc_brklen;
197 ushort smc_brkec;
198 ushort smc_brkcr;
199 ushort smc_rmask;
200 uint smc_stmp;
201} smc_uart_t;
202
203
204
205#define SMCMR_REN ((ushort)0x0001)
206#define SMCMR_TEN ((ushort)0x0002)
207#define SMCMR_DM ((ushort)0x000c)
208#define SMCMR_SM_GCI ((ushort)0x0000)
209#define SMCMR_SM_UART ((ushort)0x0020)
210#define SMCMR_SM_TRANS ((ushort)0x0030)
211#define SMCMR_SM_MASK ((ushort)0x0030)
212#define SMCMR_PM_EVEN ((ushort)0x0100)
213#define SMCMR_REVD SMCMR_PM_EVEN
214#define SMCMR_PEN ((ushort)0x0200)
215#define SMCMR_BS SMCMR_PEN
216#define SMCMR_SL ((ushort)0x0400)
217#define SMCR_CLEN_MASK ((ushort)0x7800)
218#define smcr_mk_clen(C) (((C) << 11) & SMCR_CLEN_MASK)
219
220
221
222#define SMCM_BRKE ((unsigned char)0x40)
223#define SMCM_BRK ((unsigned char)0x10)
224#define SMCM_TXE ((unsigned char)0x10)
225#define SMCM_BSY ((unsigned char)0x04)
226#define SMCM_TX ((unsigned char)0x02)
227#define SMCM_RX ((unsigned char)0x01)
228
229
230
231#define SCC_GSMRH_IRP ((uint)0x00040000)
232#define SCC_GSMRH_GDE ((uint)0x00010000)
233#define SCC_GSMRH_TCRC_CCITT ((uint)0x00008000)
234#define SCC_GSMRH_TCRC_BISYNC ((uint)0x00004000)
235#define SCC_GSMRH_TCRC_HDLC ((uint)0x00000000)
236#define SCC_GSMRH_REVD ((uint)0x00002000)
237#define SCC_GSMRH_TRX ((uint)0x00001000)
238#define SCC_GSMRH_TTX ((uint)0x00000800)
239#define SCC_GSMRH_CDP ((uint)0x00000400)
240#define SCC_GSMRH_CTSP ((uint)0x00000200)
241#define SCC_GSMRH_CDS ((uint)0x00000100)
242#define SCC_GSMRH_CTSS ((uint)0x00000080)
243#define SCC_GSMRH_TFL ((uint)0x00000040)
244#define SCC_GSMRH_RFW ((uint)0x00000020)
245#define SCC_GSMRH_TXSY ((uint)0x00000010)
246#define SCC_GSMRH_SYNL16 ((uint)0x0000000c)
247#define SCC_GSMRH_SYNL8 ((uint)0x00000008)
248#define SCC_GSMRH_SYNL4 ((uint)0x00000004)
249#define SCC_GSMRH_RTSM ((uint)0x00000002)
250#define SCC_GSMRH_RSYN ((uint)0x00000001)
251
252#define SCC_GSMRL_SIR ((uint)0x80000000)
253#define SCC_GSMRL_EDGE_NONE ((uint)0x60000000)
254#define SCC_GSMRL_EDGE_NEG ((uint)0x40000000)
255#define SCC_GSMRL_EDGE_POS ((uint)0x20000000)
256#define SCC_GSMRL_EDGE_BOTH ((uint)0x00000000)
257#define SCC_GSMRL_TCI ((uint)0x10000000)
258#define SCC_GSMRL_TSNC_3 ((uint)0x0c000000)
259#define SCC_GSMRL_TSNC_4 ((uint)0x08000000)
260#define SCC_GSMRL_TSNC_14 ((uint)0x04000000)
261#define SCC_GSMRL_TSNC_INF ((uint)0x00000000)
262#define SCC_GSMRL_RINV ((uint)0x02000000)
263#define SCC_GSMRL_TINV ((uint)0x01000000)
264#define SCC_GSMRL_TPL_128 ((uint)0x00c00000)
265#define SCC_GSMRL_TPL_64 ((uint)0x00a00000)
266#define SCC_GSMRL_TPL_48 ((uint)0x00800000)
267#define SCC_GSMRL_TPL_32 ((uint)0x00600000)
268#define SCC_GSMRL_TPL_16 ((uint)0x00400000)
269#define SCC_GSMRL_TPL_8 ((uint)0x00200000)
270#define SCC_GSMRL_TPL_NONE ((uint)0x00000000)
271#define SCC_GSMRL_TPP_ALL1 ((uint)0x00180000)
272#define SCC_GSMRL_TPP_01 ((uint)0x00100000)
273#define SCC_GSMRL_TPP_10 ((uint)0x00080000)
274#define SCC_GSMRL_TPP_ZEROS ((uint)0x00000000)
275#define SCC_GSMRL_TEND ((uint)0x00040000)
276#define SCC_GSMRL_TDCR_32 ((uint)0x00030000)
277#define SCC_GSMRL_TDCR_16 ((uint)0x00020000)
278#define SCC_GSMRL_TDCR_8 ((uint)0x00010000)
279#define SCC_GSMRL_TDCR_1 ((uint)0x00000000)
280#define SCC_GSMRL_RDCR_32 ((uint)0x0000c000)
281#define SCC_GSMRL_RDCR_16 ((uint)0x00008000)
282#define SCC_GSMRL_RDCR_8 ((uint)0x00004000)
283#define SCC_GSMRL_RDCR_1 ((uint)0x00000000)
284#define SCC_GSMRL_RENC_DFMAN ((uint)0x00003000)
285#define SCC_GSMRL_RENC_MANCH ((uint)0x00002000)
286#define SCC_GSMRL_RENC_FM0 ((uint)0x00001000)
287#define SCC_GSMRL_RENC_NRZI ((uint)0x00000800)
288#define SCC_GSMRL_RENC_NRZ ((uint)0x00000000)
289#define SCC_GSMRL_TENC_DFMAN ((uint)0x00000600)
290#define SCC_GSMRL_TENC_MANCH ((uint)0x00000400)
291#define SCC_GSMRL_TENC_FM0 ((uint)0x00000200)
292#define SCC_GSMRL_TENC_NRZI ((uint)0x00000100)
293#define SCC_GSMRL_TENC_NRZ ((uint)0x00000000)
294#define SCC_GSMRL_DIAG_LE ((uint)0x000000c0)
295#define SCC_GSMRL_DIAG_ECHO ((uint)0x00000080)
296#define SCC_GSMRL_DIAG_LOOP ((uint)0x00000040)
297#define SCC_GSMRL_DIAG_NORM ((uint)0x00000000)
298#define SCC_GSMRL_ENR ((uint)0x00000020)
299#define SCC_GSMRL_ENT ((uint)0x00000010)
300#define SCC_GSMRL_MODE_ENET ((uint)0x0000000c)
301#define SCC_GSMRL_MODE_DDCMP ((uint)0x00000009)
302#define SCC_GSMRL_MODE_BISYNC ((uint)0x00000008)
303#define SCC_GSMRL_MODE_V14 ((uint)0x00000007)
304#define SCC_GSMRL_MODE_AHDLC ((uint)0x00000006)
305#define SCC_GSMRL_MODE_PROFIBUS ((uint)0x00000005)
306#define SCC_GSMRL_MODE_UART ((uint)0x00000004)
307#define SCC_GSMRL_MODE_SS7 ((uint)0x00000003)
308#define SCC_GSMRL_MODE_ATALK ((uint)0x00000002)
309#define SCC_GSMRL_MODE_HDLC ((uint)0x00000000)
310
311#define SCC_TODR_TOD ((ushort)0x8000)
312
313
314
315#define SCCM_TXE ((unsigned char)0x10)
316#define SCCM_BSY ((unsigned char)0x04)
317#define SCCM_TX ((unsigned char)0x02)
318#define SCCM_RX ((unsigned char)0x01)
319
320typedef struct scc_param {
321 ushort scc_rbase;
322 ushort scc_tbase;
323 u_char scc_rfcr;
324 u_char scc_tfcr;
325 ushort scc_mrblr;
326 uint scc_rstate;
327 uint scc_idp;
328 ushort scc_rbptr;
329 ushort scc_ibc;
330 uint scc_rxtmp;
331 uint scc_tstate;
332 uint scc_tdp;
333 ushort scc_tbptr;
334 ushort scc_tbc;
335 uint scc_txtmp;
336 uint scc_rcrc;
337 uint scc_tcrc;
338} sccp_t;
339
340
341
342#define SCC_EB ((u_char) 0x10)
343#define SCC_GBL ((u_char) 0x20)
344
345
346
347typedef struct scc_enet {
348 sccp_t sen_genscc;
349 uint sen_cpres;
350 uint sen_cmask;
351 uint sen_crcec;
352 uint sen_alec;
353 uint sen_disfc;
354 ushort sen_pads;
355 ushort sen_retlim;
356 ushort sen_retcnt;
357 ushort sen_maxflr;
358 ushort sen_minflr;
359 ushort sen_maxd1;
360 ushort sen_maxd2;
361 ushort sen_maxd;
362 ushort sen_dmacnt;
363 ushort sen_maxb;
364 ushort sen_gaddr1;
365 ushort sen_gaddr2;
366 ushort sen_gaddr3;
367 ushort sen_gaddr4;
368 uint sen_tbuf0data0;
369 uint sen_tbuf0data1;
370 uint sen_tbuf0rba;
371 uint sen_tbuf0crc;
372 ushort sen_tbuf0bcnt;
373 ushort sen_paddrh;
374 ushort sen_paddrm;
375 ushort sen_paddrl;
376 ushort sen_pper;
377 ushort sen_rfbdptr;
378 ushort sen_tfbdptr;
379 ushort sen_tlbdptr;
380 uint sen_tbuf1data0;
381 uint sen_tbuf1data1;
382 uint sen_tbuf1rba;
383 uint sen_tbuf1crc;
384 ushort sen_tbuf1bcnt;
385 ushort sen_txlen;
386 ushort sen_iaddr1;
387 ushort sen_iaddr2;
388 ushort sen_iaddr3;
389 ushort sen_iaddr4;
390 ushort sen_boffcnt;
391
392
393
394
395 ushort sen_taddrh;
396 ushort sen_taddrm;
397 ushort sen_taddrl;
398} scc_enet_t;
399
400
401
402
403#define SCCE_ENET_GRA ((ushort)0x0080)
404#define SCCE_ENET_TXE ((ushort)0x0010)
405#define SCCE_ENET_RXF ((ushort)0x0008)
406#define SCCE_ENET_BSY ((ushort)0x0004)
407#define SCCE_ENET_TXB ((ushort)0x0002)
408#define SCCE_ENET_RXB ((ushort)0x0001)
409
410
411
412#define SCC_PSMR_HBC ((ushort)0x8000)
413#define SCC_PSMR_FC ((ushort)0x4000)
414#define SCC_PSMR_RSH ((ushort)0x2000)
415#define SCC_PSMR_IAM ((ushort)0x1000)
416#define SCC_PSMR_ENCRC ((ushort)0x0800)
417#define SCC_PSMR_PRO ((ushort)0x0200)
418#define SCC_PSMR_BRO ((ushort)0x0100)
419#define SCC_PSMR_SBT ((ushort)0x0080)
420#define SCC_PSMR_LPB ((ushort)0x0040)
421#define SCC_PSMR_SIP ((ushort)0x0020)
422#define SCC_PSMR_LCW ((ushort)0x0010)
423#define SCC_PSMR_NIB22 ((ushort)0x000a)
424#define SCC_PSMR_FDE ((ushort)0x0001)
425
426
427
428typedef struct scc_uart {
429 sccp_t scc_genscc;
430 uint scc_res1;
431 uint scc_res2;
432 ushort scc_maxidl;
433 ushort scc_idlc;
434 ushort scc_brkcr;
435 ushort scc_parec;
436 ushort scc_frmec;
437 ushort scc_nosec;
438 ushort scc_brkec;
439 ushort scc_brkln;
440 ushort scc_uaddr1;
441 ushort scc_uaddr2;
442 ushort scc_rtemp;
443 ushort scc_toseq;
444 ushort scc_char1;
445 ushort scc_char2;
446 ushort scc_char3;
447 ushort scc_char4;
448 ushort scc_char5;
449 ushort scc_char6;
450 ushort scc_char7;
451 ushort scc_char8;
452 ushort scc_rccm;
453 ushort scc_rccr;
454 ushort scc_rlbc;
455} scc_uart_t;
456
457
458
459#define UART_SCCM_GLR ((ushort)0x1000)
460#define UART_SCCM_GLT ((ushort)0x0800)
461#define UART_SCCM_AB ((ushort)0x0200)
462#define UART_SCCM_IDL ((ushort)0x0100)
463#define UART_SCCM_GRA ((ushort)0x0080)
464#define UART_SCCM_BRKE ((ushort)0x0040)
465#define UART_SCCM_BRKS ((ushort)0x0020)
466#define UART_SCCM_CCR ((ushort)0x0008)
467#define UART_SCCM_BSY ((ushort)0x0004)
468#define UART_SCCM_TX ((ushort)0x0002)
469#define UART_SCCM_RX ((ushort)0x0001)
470
471
472
473#define SCU_PSMR_FLC ((ushort)0x8000)
474#define SCU_PSMR_SL ((ushort)0x4000)
475#define SCU_PSMR_CL ((ushort)0x3000)
476#define SCU_PSMR_UM ((ushort)0x0c00)
477#define SCU_PSMR_FRZ ((ushort)0x0200)
478#define SCU_PSMR_RZS ((ushort)0x0100)
479#define SCU_PSMR_SYN ((ushort)0x0080)
480#define SCU_PSMR_DRT ((ushort)0x0040)
481#define SCU_PSMR_PEN ((ushort)0x0010)
482#define SCU_PSMR_RPM ((ushort)0x000c)
483#define SCU_PSMR_REVP ((ushort)0x0008)
484#define SCU_PSMR_TPM ((ushort)0x0003)
485#define SCU_PSMR_TEVP ((ushort)0x0002)
486
487
488
489typedef struct scc_trans {
490 sccp_t st_genscc;
491 uint st_cpres;
492 uint st_cmask;
493} scc_trans_t;
494
495
496
497#define FCC_GFMR_DIAG_NORM ((uint)0x00000000)
498#define FCC_GFMR_DIAG_LE ((uint)0x40000000)
499#define FCC_GFMR_DIAG_AE ((uint)0x80000000)
500#define FCC_GFMR_DIAG_ALE ((uint)0xc0000000)
501#define FCC_GFMR_TCI ((uint)0x20000000)
502#define FCC_GFMR_TRX ((uint)0x10000000)
503#define FCC_GFMR_TTX ((uint)0x08000000)
504#define FCC_GFMR_TTX ((uint)0x08000000)
505#define FCC_GFMR_CDP ((uint)0x04000000)
506#define FCC_GFMR_CTSP ((uint)0x02000000)
507#define FCC_GFMR_CDS ((uint)0x01000000)
508#define FCC_GFMR_CTSS ((uint)0x00800000)
509#define FCC_GFMR_SYNL_NONE ((uint)0x00000000)
510#define FCC_GFMR_SYNL_AUTO ((uint)0x00004000)
511#define FCC_GFMR_SYNL_8 ((uint)0x00008000)
512#define FCC_GFMR_SYNL_16 ((uint)0x0000c000)
513#define FCC_GFMR_RTSM ((uint)0x00002000)
514#define FCC_GFMR_RENC_NRZ ((uint)0x00000000)
515#define FCC_GFMR_RENC_NRZI ((uint)0x00000800)
516#define FCC_GFMR_REVD ((uint)0x00000400)
517#define FCC_GFMR_TENC_NRZ ((uint)0x00000000)
518#define FCC_GFMR_TENC_NRZI ((uint)0x00000100)
519#define FCC_GFMR_TCRC_16 ((uint)0x00000000)
520#define FCC_GFMR_TCRC_32 ((uint)0x00000080)
521#define FCC_GFMR_ENR ((uint)0x00000020)
522#define FCC_GFMR_ENT ((uint)0x00000010)
523#define FCC_GFMR_MODE_ENET ((uint)0x0000000c)
524#define FCC_GFMR_MODE_ATM ((uint)0x0000000a)
525#define FCC_GFMR_MODE_HDLC ((uint)0x00000000)
526
527
528
529typedef struct fcc_param {
530 ushort fcc_riptr;
531 ushort fcc_tiptr;
532 ushort fcc_res1;
533 ushort fcc_mrblr;
534 uint fcc_rstate;
535 uint fcc_rbase;
536 ushort fcc_rbdstat;
537 ushort fcc_rbdlen;
538 uint fcc_rdptr;
539 uint fcc_tstate;
540 uint fcc_tbase;
541 ushort fcc_tbdstat;
542 ushort fcc_tbdlen;
543 uint fcc_tdptr;
544 uint fcc_rbptr;
545 uint fcc_tbptr;
546 uint fcc_rcrc;
547 uint fcc_res2;
548 uint fcc_tcrc;
549} fccp_t;
550
551
552
553
554typedef struct fcc_enet {
555 fccp_t fen_genfcc;
556 uint fen_statbuf;
557 uint fen_camptr;
558 uint fen_cmask;
559 uint fen_cpres;
560 uint fen_crcec;
561 uint fen_alec;
562 uint fen_disfc;
563 ushort fen_retlim;
564 ushort fen_retcnt;
565 ushort fen_pper;
566 ushort fen_boffcnt;
567 uint fen_gaddrh;
568 uint fen_gaddrl;
569 ushort fen_tfcstat;
570 ushort fen_tfclen;
571 uint fen_tfcptr;
572 ushort fen_mflr;
573 ushort fen_paddrh;
574 ushort fen_paddrm;
575 ushort fen_paddrl;
576 ushort fen_ibdcount;
577 ushort fen_ibdstart;
578 ushort fen_ibdend;
579 ushort fen_txlen;
580 uint fen_ibdbase[8];
581 uint fen_iaddrh;
582 uint fen_iaddrl;
583 ushort fen_minflr;
584 ushort fen_taddrh;
585 ushort fen_taddrm;
586 ushort fen_taddrl;
587 ushort fen_padptr;
588 ushort fen_cftype;
589 ushort fen_cfrange;
590 ushort fen_maxb;
591 ushort fen_maxd1;
592 ushort fen_maxd2;
593 ushort fen_maxd;
594 ushort fen_dmacnt;
595 uint fen_octc;
596 uint fen_colc;
597 uint fen_broc;
598 uint fen_mulc;
599 uint fen_uspc;
600 uint fen_frgc;
601 uint fen_ospc;
602 uint fen_jbrc;
603 uint fen_p64c;
604 uint fen_p65c;
605 uint fen_p128c;
606 uint fen_p256c;
607 uint fen_p512c;
608 uint fen_p1024c;
609 uint fen_cambuf;
610 ushort fen_rfthr;
611 ushort fen_rfcnt;
612} fcc_enet_t;
613
614
615
616#define FCC_ENET_GRA ((ushort)0x0080)
617#define FCC_ENET_RXC ((ushort)0x0040)
618#define FCC_ENET_TXC ((ushort)0x0020)
619#define FCC_ENET_TXE ((ushort)0x0010)
620#define FCC_ENET_RXF ((ushort)0x0008)
621#define FCC_ENET_BSY ((ushort)0x0004)
622#define FCC_ENET_TXB ((ushort)0x0002)
623#define FCC_ENET_RXB ((ushort)0x0001)
624
625
626
627#define FCC_PSMR_HBC ((uint)0x80000000)
628#define FCC_PSMR_FC ((uint)0x40000000)
629#define FCC_PSMR_SBT ((uint)0x20000000)
630#define FCC_PSMR_LPB ((uint)0x10000000)
631#define FCC_PSMR_LCW ((uint)0x08000000)
632#define FCC_PSMR_FDE ((uint)0x04000000)
633#define FCC_PSMR_MON ((uint)0x02000000)
634#define FCC_PSMR_PRO ((uint)0x00400000)
635#define FCC_PSMR_FCE ((uint)0x00200000)
636#define FCC_PSMR_RSH ((uint)0x00100000)
637#define FCC_PSMR_CAM ((uint)0x00000400)
638#define FCC_PSMR_BRO ((uint)0x00000200)
639#define FCC_PSMR_ENCRC ((uint)0x00000080)
640
641
642
643typedef struct iic {
644 ushort iic_rbase;
645 ushort iic_tbase;
646 u_char iic_rfcr;
647 u_char iic_tfcr;
648 ushort iic_mrblr;
649 uint iic_rstate;
650 uint iic_rdp;
651 ushort iic_rbptr;
652 ushort iic_rbc;
653 uint iic_rxtmp;
654 uint iic_tstate;
655 uint iic_tdp;
656 ushort iic_tbptr;
657 ushort iic_tbc;
658 uint iic_txtmp;
659} iic_t;
660
661
662
663typedef struct spi {
664 ushort spi_rbase;
665 ushort spi_tbase;
666 u_char spi_rfcr;
667 u_char spi_tfcr;
668 ushort spi_mrblr;
669 uint spi_rstate;
670 uint spi_rdp;
671 ushort spi_rbptr;
672 ushort spi_rbc;
673 uint spi_rxtmp;
674 uint spi_tstate;
675 uint spi_tdp;
676 ushort spi_tbptr;
677 ushort spi_tbc;
678 uint spi_txtmp;
679 uint spi_res;
680 uint spi_res1[4];
681} spi_t;
682
683
684
685#define SPMODE_LOOP ((ushort)0x4000)
686#define SPMODE_CI ((ushort)0x2000)
687#define SPMODE_CP ((ushort)0x1000)
688#define SPMODE_DIV16 ((ushort)0x0800)
689#define SPMODE_REV ((ushort)0x0400)
690#define SPMODE_MSTR ((ushort)0x0200)
691#define SPMODE_EN ((ushort)0x0100)
692#define SPMODE_LENMSK ((ushort)0x00f0)
693#define SPMODE_PMMSK ((ushort)0x000f)
694
695#define SPMODE_LEN(x) ((((x)-1)&0xF)<<4)
696#define SPMODE_PM(x) ((x) &0xF)
697
698#define SPI_EB ((u_char)0x10)
699
700
701
702typedef struct idma {
703 ushort ibase;
704 ushort dcm;
705 ushort ibdptr;
706 ushort dpr_buf;
707 ushort buf_inv;
708 ushort ss_max;
709 ushort dpr_in_ptr;
710 ushort sts;
711 ushort dpr_out_ptr;
712 ushort seob;
713 ushort deob;
714 ushort dts;
715 ushort ret_add;
716 ushort res0;
717 uint bd_cnt;
718 uint s_ptr;
719 uint d_ptr;
720 uint istate;
721 u_char res1[20];
722} idma_t;
723
724
725
726#define IDMA_DCM_FB ((ushort)0x8000)
727#define IDMA_DCM_LP ((ushort)0x4000)
728#define IDMA_DCM_TC2 ((ushort)0x0400)
729#define IDMA_DCM_DMA_WRAP_MASK ((ushort)0x01c0)
730#define IDMA_DCM_DMA_WRAP_64 ((ushort)0x0000)
731#define IDMA_DCM_DMA_WRAP_128 ((ushort)0x0040)
732#define IDMA_DCM_DMA_WRAP_256 ((ushort)0x0080)
733#define IDMA_DCM_DMA_WRAP_512 ((ushort)0x00c0)
734#define IDMA_DCM_DMA_WRAP_1024 ((ushort)0x0100)
735#define IDMA_DCM_DMA_WRAP_2048 ((ushort)0x0140)
736#define IDMA_DCM_SINC ((ushort)0x0020)
737#define IDMA_DCM_DINC ((ushort)0x0010)
738#define IDMA_DCM_ERM ((ushort)0x0008)
739#define IDMA_DCM_DT ((ushort)0x0004)
740#define IDMA_DCM_SD_MASK ((ushort)0x0003)
741#define IDMA_DCM_SD_MEM2MEM ((ushort)0x0000)
742#define IDMA_DCM_SD_PER2MEM ((ushort)0x0002)
743#define IDMA_DCM_SD_MEM2PER ((ushort)0x0001)
744
745
746
747typedef struct idma_bd {
748 uint flags;
749 uint len;
750 uint src;
751 uint dst;
752} idma_bd_t;
753
754
755
756#define IDMA_BD_V ((uint)0x80000000)
757#define IDMA_BD_W ((uint)0x20000000)
758#define IDMA_BD_I ((uint)0x10000000)
759#define IDMA_BD_L ((uint)0x08000000)
760#define IDMA_BD_CM ((uint)0x02000000)
761#define IDMA_BD_SDN ((uint)0x00400000)
762#define IDMA_BD_DDN ((uint)0x00200000)
763#define IDMA_BD_DGBL ((uint)0x00100000)
764#define IDMA_BD_DBO_LE ((uint)0x00040000)
765#define IDMA_BD_DBO_BE ((uint)0x00080000)
766#define IDMA_BD_DDTB ((uint)0x00010000)
767#define IDMA_BD_SGBL ((uint)0x00002000)
768#define IDMA_BD_SBO_LE ((uint)0x00000800)
769#define IDMA_BD_SBO_BE ((uint)0x00001000)
770#define IDMA_BD_SDTB ((uint)0x00000200)
771
772
773
774typedef struct im_idma {
775 u_char idsr;
776 u_char res0[3];
777 u_char idmr;
778 u_char res1[3];
779} im_idma_t;
780
781
782
783#define IDMA_EVENT_SC ((unsigned char)0x08)
784#define IDMA_EVENT_OB ((unsigned char)0x04)
785#define IDMA_EVENT_EDN ((unsigned char)0x02)
786#define IDMA_EVENT_BC ((unsigned char)0x01)
787
788
789
790#define RCCR_TIME ((uint)0x80000000)
791#define RCCR_TIMEP_MASK ((uint)0x3f000000)
792#define RCCR_DR0M ((uint)0x00800000)
793#define RCCR_DR1M ((uint)0x00400000)
794#define RCCR_DR2M ((uint)0x00000080)
795#define RCCR_DR3M ((uint)0x00000040)
796#define RCCR_DR0QP_MASK ((uint)0x00300000)
797#define RCCR_DR0QP_HIGH ((uint)0x00000000)
798#define RCCR_DR0QP_MED ((uint)0x00100000)
799#define RCCR_DR0QP_LOW ((uint)0x00200000)
800#define RCCR_DR1QP_MASK ((uint)0x00030000)
801#define RCCR_DR1QP_HIGH ((uint)0x00000000)
802#define RCCR_DR1QP_MED ((uint)0x00010000)
803#define RCCR_DR1QP_LOW ((uint)0x00020000)
804#define RCCR_DR2QP_MASK ((uint)0x00000030)
805#define RCCR_DR2QP_HIGH ((uint)0x00000000)
806#define RCCR_DR2QP_MED ((uint)0x00000010)
807#define RCCR_DR2QP_LOW ((uint)0x00000020)
808#define RCCR_DR3QP_MASK ((uint)0x00000003)
809#define RCCR_DR3QP_HIGH ((uint)0x00000000)
810#define RCCR_DR3QP_MED ((uint)0x00000001)
811#define RCCR_DR3QP_LOW ((uint)0x00000002)
812#define RCCR_EIE ((uint)0x00080000)
813#define RCCR_SCD ((uint)0x00040000)
814#define RCCR_ERAM_MASK ((uint)0x0000e000)
815#define RCCR_ERAM_0KB ((uint)0x00000000)
816#define RCCR_ERAM_2KB ((uint)0x00002000)
817#define RCCR_ERAM_4KB ((uint)0x00004000)
818#define RCCR_ERAM_6KB ((uint)0x00006000)
819#define RCCR_ERAM_8KB ((uint)0x00008000)
820#define RCCR_ERAM_10KB ((uint)0x0000a000)
821#define RCCR_ERAM_12KB ((uint)0x0000c000)
822#define RCCR_EDM0 ((uint)0x00000800)
823#define RCCR_EDM1 ((uint)0x00000400)
824#define RCCR_EDM2 ((uint)0x00000200)
825#define RCCR_EDM3 ((uint)0x00000100)
826#define RCCR_DEM01 ((uint)0x00000008)
827#define RCCR_DEM23 ((uint)0x00000004)
828
829
830
831
832#define CMXFCR_FC1 0x40000000
833#define CMXFCR_RF1CS_MSK 0x38000000
834#define CMXFCR_TF1CS_MSK 0x07000000
835#define CMXFCR_FC2 0x00400000
836#define CMXFCR_RF2CS_MSK 0x00380000
837#define CMXFCR_TF2CS_MSK 0x00070000
838#define CMXFCR_FC3 0x00004000
839#define CMXFCR_RF3CS_MSK 0x00003800
840#define CMXFCR_TF3CS_MSK 0x00000700
841
842#define CMXFCR_RF1CS_BRG5 0x00000000
843#define CMXFCR_RF1CS_BRG6 0x08000000
844#define CMXFCR_RF1CS_BRG7 0x10000000
845#define CMXFCR_RF1CS_BRG8 0x18000000
846#define CMXFCR_RF1CS_CLK9 0x20000000
847#define CMXFCR_RF1CS_CLK10 0x28000000
848#define CMXFCR_RF1CS_CLK11 0x30000000
849#define CMXFCR_RF1CS_CLK12 0x38000000
850
851#define CMXFCR_TF1CS_BRG5 0x00000000
852#define CMXFCR_TF1CS_BRG6 0x01000000
853#define CMXFCR_TF1CS_BRG7 0x02000000
854#define CMXFCR_TF1CS_BRG8 0x03000000
855#define CMXFCR_TF1CS_CLK9 0x04000000
856#define CMXFCR_TF1CS_CLK10 0x05000000
857#define CMXFCR_TF1CS_CLK11 0x06000000
858#define CMXFCR_TF1CS_CLK12 0x07000000
859
860#define CMXFCR_RF2CS_BRG5 0x00000000
861#define CMXFCR_RF2CS_BRG6 0x00080000
862#define CMXFCR_RF2CS_BRG7 0x00100000
863#define CMXFCR_RF2CS_BRG8 0x00180000
864#define CMXFCR_RF2CS_CLK13 0x00200000
865#define CMXFCR_RF2CS_CLK14 0x00280000
866#define CMXFCR_RF2CS_CLK15 0x00300000
867#define CMXFCR_RF2CS_CLK16 0x00380000
868
869#define CMXFCR_TF2CS_BRG5 0x00000000
870#define CMXFCR_TF2CS_BRG6 0x00010000
871#define CMXFCR_TF2CS_BRG7 0x00020000
872#define CMXFCR_TF2CS_BRG8 0x00030000
873#define CMXFCR_TF2CS_CLK13 0x00040000
874#define CMXFCR_TF2CS_CLK14 0x00050000
875#define CMXFCR_TF2CS_CLK15 0x00060000
876#define CMXFCR_TF2CS_CLK16 0x00070000
877
878#define CMXFCR_RF3CS_BRG5 0x00000000
879#define CMXFCR_RF3CS_BRG6 0x00000800
880#define CMXFCR_RF3CS_BRG7 0x00001000
881#define CMXFCR_RF3CS_BRG8 0x00001800
882#define CMXFCR_RF3CS_CLK13 0x00002000
883#define CMXFCR_RF3CS_CLK14 0x00002800
884#define CMXFCR_RF3CS_CLK15 0x00003000
885#define CMXFCR_RF3CS_CLK16 0x00003800
886
887#define CMXFCR_TF3CS_BRG5 0x00000000
888#define CMXFCR_TF3CS_BRG6 0x00000100
889#define CMXFCR_TF3CS_BRG7 0x00000200
890#define CMXFCR_TF3CS_BRG8 0x00000300
891#define CMXFCR_TF3CS_CLK13 0x00000400
892#define CMXFCR_TF3CS_CLK14 0x00000500
893#define CMXFCR_TF3CS_CLK15 0x00000600
894#define CMXFCR_TF3CS_CLK16 0x00000700
895
896
897
898
899#define CMXSCR_GR1 0x80000000
900#define CMXSCR_SC1 0x40000000
901#define CMXSCR_RS1CS_MSK 0x38000000
902#define CMXSCR_TS1CS_MSK 0x07000000
903#define CMXSCR_GR2 0x00800000
904#define CMXSCR_SC2 0x00400000
905#define CMXSCR_RS2CS_MSK 0x00380000
906#define CMXSCR_TS2CS_MSK 0x00070000
907#define CMXSCR_GR3 0x00008000
908#define CMXSCR_SC3 0x00004000
909#define CMXSCR_RS3CS_MSK 0x00003800
910#define CMXSCR_TS3CS_MSK 0x00000700
911#define CMXSCR_GR4 0x00000080
912#define CMXSCR_SC4 0x00000040
913#define CMXSCR_RS4CS_MSK 0x00000038
914#define CMXSCR_TS4CS_MSK 0x00000007
915
916#define CMXSCR_RS1CS_BRG1 0x00000000
917#define CMXSCR_RS1CS_BRG2 0x08000000
918#define CMXSCR_RS1CS_BRG3 0x10000000
919#define CMXSCR_RS1CS_BRG4 0x18000000
920#define CMXSCR_RS1CS_CLK11 0x20000000
921#define CMXSCR_RS1CS_CLK12 0x28000000
922#define CMXSCR_RS1CS_CLK3 0x30000000
923#define CMXSCR_RS1CS_CLK4 0x38000000
924
925#define CMXSCR_TS1CS_BRG1 0x00000000
926#define CMXSCR_TS1CS_BRG2 0x01000000
927#define CMXSCR_TS1CS_BRG3 0x02000000
928#define CMXSCR_TS1CS_BRG4 0x03000000
929#define CMXSCR_TS1CS_CLK11 0x04000000
930#define CMXSCR_TS1CS_CLK12 0x05000000
931#define CMXSCR_TS1CS_CLK3 0x06000000
932#define CMXSCR_TS1CS_CLK4 0x07000000
933
934#define CMXSCR_RS2CS_BRG1 0x00000000
935#define CMXSCR_RS2CS_BRG2 0x00080000
936#define CMXSCR_RS2CS_BRG3 0x00100000
937#define CMXSCR_RS2CS_BRG4 0x00180000
938#define CMXSCR_RS2CS_CLK11 0x00200000
939#define CMXSCR_RS2CS_CLK12 0x00280000
940#define CMXSCR_RS2CS_CLK3 0x00300000
941#define CMXSCR_RS2CS_CLK4 0x00380000
942
943#define CMXSCR_TS2CS_BRG1 0x00000000
944#define CMXSCR_TS2CS_BRG2 0x00010000
945#define CMXSCR_TS2CS_BRG3 0x00020000
946#define CMXSCR_TS2CS_BRG4 0x00030000
947#define CMXSCR_TS2CS_CLK11 0x00040000
948#define CMXSCR_TS2CS_CLK12 0x00050000
949#define CMXSCR_TS2CS_CLK3 0x00060000
950#define CMXSCR_TS2CS_CLK4 0x00070000
951
952#define CMXSCR_RS3CS_BRG1 0x00000000
953#define CMXSCR_RS3CS_BRG2 0x00000800
954#define CMXSCR_RS3CS_BRG3 0x00001000
955#define CMXSCR_RS3CS_BRG4 0x00001800
956#define CMXSCR_RS3CS_CLK5 0x00002000
957#define CMXSCR_RS3CS_CLK6 0x00002800
958#define CMXSCR_RS3CS_CLK7 0x00003000
959#define CMXSCR_RS3CS_CLK8 0x00003800
960
961#define CMXSCR_TS3CS_BRG1 0x00000000
962#define CMXSCR_TS3CS_BRG2 0x00000100
963#define CMXSCR_TS3CS_BRG3 0x00000200
964#define CMXSCR_TS3CS_BRG4 0x00000300
965#define CMXSCR_TS3CS_CLK5 0x00000400
966#define CMXSCR_TS3CS_CLK6 0x00000500
967#define CMXSCR_TS3CS_CLK7 0x00000600
968#define CMXSCR_TS3CS_CLK8 0x00000700
969
970#define CMXSCR_RS4CS_BRG1 0x00000000
971#define CMXSCR_RS4CS_BRG2 0x00000008
972#define CMXSCR_RS4CS_BRG3 0x00000010
973#define CMXSCR_RS4CS_BRG4 0x00000018
974#define CMXSCR_RS4CS_CLK5 0x00000020
975#define CMXSCR_RS4CS_CLK6 0x00000028
976#define CMXSCR_RS4CS_CLK7 0x00000030
977#define CMXSCR_RS4CS_CLK8 0x00000038
978
979#define CMXSCR_TS4CS_BRG1 0x00000000
980#define CMXSCR_TS4CS_BRG2 0x00000001
981#define CMXSCR_TS4CS_BRG3 0x00000002
982#define CMXSCR_TS4CS_BRG4 0x00000003
983#define CMXSCR_TS4CS_CLK5 0x00000004
984#define CMXSCR_TS4CS_CLK6 0x00000005
985#define CMXSCR_TS4CS_CLK7 0x00000006
986#define CMXSCR_TS4CS_CLK8 0x00000007
987
988
989
990
991#define SIUMCR_BBD 0x80000000
992#define SIUMCR_ESE 0x40000000
993#define SIUMCR_PBSE 0x20000000
994#define SIUMCR_CDIS 0x10000000
995#define SIUMCR_DPPC00 0x00000000
996#define SIUMCR_DPPC01 0x04000000
997#define SIUMCR_DPPC10 0x08000000
998#define SIUMCR_DPPC11 0x0c000000
999#define SIUMCR_L2CPC00 0x00000000
1000#define SIUMCR_L2CPC01 0x01000000
1001#define SIUMCR_L2CPC10 0x02000000
1002#define SIUMCR_L2CPC11 0x03000000
1003#define SIUMCR_LBPC00 0x00000000
1004#define SIUMCR_LBPC01 0x00400000
1005#define SIUMCR_LBPC10 0x00800000
1006#define SIUMCR_LBPC11 0x00c00000
1007#define SIUMCR_APPC00 0x00000000
1008#define SIUMCR_APPC01 0x00100000
1009#define SIUMCR_APPC10 0x00200000
1010#define SIUMCR_APPC11 0x00300000
1011#define SIUMCR_CS10PC00 0x00000000
1012#define SIUMCR_CS10PC01 0x00040000
1013#define SIUMCR_CS10PC10 0x00080000
1014#define SIUMCR_CS10PC11 0x000c0000
1015#define SIUMCR_BCTLC00 0x00000000
1016#define SIUMCR_BCTLC01 0x00010000
1017#define SIUMCR_BCTLC10 0x00020000
1018#define SIUMCR_BCTLC11 0x00030000
1019#define SIUMCR_MMR00 0x00000000
1020#define SIUMCR_MMR01 0x00004000
1021#define SIUMCR_MMR10 0x00008000
1022#define SIUMCR_MMR11 0x0000c000
1023#define SIUMCR_LPBSE 0x00002000
1024
1025
1026
1027
1028#define SCCR_PCI_MODE 0x00000100
1029#define SCCR_PCI_MODCK 0x00000080
1030#define SCCR_PCIDF_MSK 0x00000078
1031#define SCCR_PCIDF_SHIFT 3
1032
1033#ifndef CPM_IMMR_OFFSET
1034#define CPM_IMMR_OFFSET 0x101a8
1035#endif
1036
1037#define FCC_PSMR_RMII ((uint)0x00020000)
1038
1039
1040
1041
1042
1043
1044#define PC_CLK(x) ((uint)(1<<(x-1)))
1045
1046#define CMXFCR_RF1CS(x) ((uint)((x-5)<<27))
1047#define CMXFCR_TF1CS(x) ((uint)((x-5)<<24))
1048#define CMXFCR_RF2CS(x) ((uint)((x-9)<<19))
1049#define CMXFCR_TF2CS(x) ((uint)((x-9)<<16))
1050#define CMXFCR_RF3CS(x) ((uint)((x-9)<<11))
1051#define CMXFCR_TF3CS(x) ((uint)((x-9)<<8))
1052
1053#define PC_F1RXCLK PC_CLK(F1_RXCLK)
1054#define PC_F1TXCLK PC_CLK(F1_TXCLK)
1055#define CMX1_CLK_ROUTE (CMXFCR_RF1CS(F1_RXCLK) | CMXFCR_TF1CS(F1_TXCLK))
1056#define CMX1_CLK_MASK ((uint)0xff000000)
1057
1058#define PC_F2RXCLK PC_CLK(F2_RXCLK)
1059#define PC_F2TXCLK PC_CLK(F2_TXCLK)
1060#define CMX2_CLK_ROUTE (CMXFCR_RF2CS(F2_RXCLK) | CMXFCR_TF2CS(F2_TXCLK))
1061#define CMX2_CLK_MASK ((uint)0x00ff0000)
1062
1063#define PC_F3RXCLK PC_CLK(F3_RXCLK)
1064#define PC_F3TXCLK PC_CLK(F3_TXCLK)
1065#define CMX3_CLK_ROUTE (CMXFCR_RF3CS(F3_RXCLK) | CMXFCR_TF3CS(F3_TXCLK))
1066#define CMX3_CLK_MASK ((uint)0x0000ff00)
1067
1068#define CPMUX_CLK_MASK (CMX3_CLK_MASK | CMX2_CLK_MASK)
1069#define CPMUX_CLK_ROUTE (CMX3_CLK_ROUTE | CMX2_CLK_ROUTE)
1070
1071#define CLK_TRX (PC_F3TXCLK | PC_F3RXCLK | PC_F2TXCLK | PC_F2RXCLK)
1072
1073
1074
1075
1076#define PA1_COL 0x00000001U
1077#define PA1_CRS 0x00000002U
1078#define PA1_TXER 0x00000004U
1079#define PA1_TXEN 0x00000008U
1080#define PA1_RXDV 0x00000010U
1081#define PA1_RXER 0x00000020U
1082#define PA1_TXDAT 0x00003c00U
1083#define PA1_RXDAT 0x0003c000U
1084#define PA1_PSORA0 (PA1_RXDAT | PA1_TXDAT)
1085#define PA1_PSORA1 (PA1_COL | PA1_CRS | PA1_TXER | PA1_TXEN | \
1086 PA1_RXDV | PA1_RXER)
1087#define PA1_DIRA0 (PA1_RXDAT | PA1_CRS | PA1_COL | PA1_RXER | PA1_RXDV)
1088#define PA1_DIRA1 (PA1_TXDAT | PA1_TXEN | PA1_TXER)
1089
1090
1091
1092
1093
1094#define PB2_TXER 0x00000001U
1095#define PB2_RXDV 0x00000002U
1096#define PB2_TXEN 0x00000004U
1097#define PB2_RXER 0x00000008U
1098#define PB2_COL 0x00000010U
1099#define PB2_CRS 0x00000020U
1100#define PB2_TXDAT 0x000003c0U
1101#define PB2_RXDAT 0x00003c00U
1102#define PB2_PSORB0 (PB2_RXDAT | PB2_TXDAT | PB2_CRS | PB2_COL | \
1103 PB2_RXER | PB2_RXDV | PB2_TXER)
1104#define PB2_PSORB1 (PB2_TXEN)
1105#define PB2_DIRB0 (PB2_RXDAT | PB2_CRS | PB2_COL | PB2_RXER | PB2_RXDV)
1106#define PB2_DIRB1 (PB2_TXDAT | PB2_TXEN | PB2_TXER)
1107
1108
1109
1110
1111
1112#define PB3_RXDV 0x00004000U
1113#define PB3_RXER 0x00008000U
1114#define PB3_TXER 0x00010000U
1115#define PB3_TXEN 0x00020000U
1116#define PB3_COL 0x00040000U
1117#define PB3_CRS 0x00080000U
1118#define PB3_TXDAT 0x0f000000U
1119#define PC3_TXDAT 0x00000010U
1120#define PB3_RXDAT 0x00f00000U
1121#define PB3_PSORB0 (PB3_RXDAT | PB3_TXDAT | PB3_CRS | PB3_COL | \
1122 PB3_RXER | PB3_RXDV | PB3_TXER | PB3_TXEN)
1123#define PB3_PSORB1 0
1124#define PB3_DIRB0 (PB3_RXDAT | PB3_CRS | PB3_COL | PB3_RXER | PB3_RXDV)
1125#define PB3_DIRB1 (PB3_TXDAT | PB3_TXEN | PB3_TXER)
1126#define PC3_DIRC1 (PC3_TXDAT)
1127
1128
1129#define FCC_MEM_OFFSET(x) (CPM_FCC_SPECIAL_BASE + (x*128))
1130#define FCC1_MEM_OFFSET FCC_MEM_OFFSET(0)
1131#define FCC2_MEM_OFFSET FCC_MEM_OFFSET(1)
1132#define FCC3_MEM_OFFSET FCC_MEM_OFFSET(2)
1133
1134
1135
1136enum cpm_clk_dir {
1137 CPM_CLK_RX,
1138 CPM_CLK_TX,
1139 CPM_CLK_RTX
1140};
1141
1142enum cpm_clk_target {
1143 CPM_CLK_SCC1,
1144 CPM_CLK_SCC2,
1145 CPM_CLK_SCC3,
1146 CPM_CLK_SCC4,
1147 CPM_CLK_FCC1,
1148 CPM_CLK_FCC2,
1149 CPM_CLK_FCC3,
1150 CPM_CLK_SMC1,
1151 CPM_CLK_SMC2,
1152};
1153
1154enum cpm_clk {
1155 CPM_CLK_NONE = 0,
1156 CPM_BRG1,
1157 CPM_BRG2,
1158 CPM_BRG3,
1159 CPM_BRG4,
1160 CPM_BRG5,
1161 CPM_BRG6,
1162 CPM_BRG7,
1163 CPM_BRG8,
1164 CPM_CLK1,
1165 CPM_CLK2,
1166 CPM_CLK3,
1167 CPM_CLK4,
1168 CPM_CLK5,
1169 CPM_CLK6,
1170 CPM_CLK7,
1171 CPM_CLK8,
1172 CPM_CLK9,
1173 CPM_CLK10,
1174 CPM_CLK11,
1175 CPM_CLK12,
1176 CPM_CLK13,
1177 CPM_CLK14,
1178 CPM_CLK15,
1179 CPM_CLK16,
1180 CPM_CLK17,
1181 CPM_CLK18,
1182 CPM_CLK19,
1183 CPM_CLK20,
1184 CPM_CLK_DUMMY
1185};
1186
1187extern int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode);
1188extern int cpm2_smc_clk_setup(enum cpm_clk_target target, int clock);
1189
1190#define CPM_PIN_INPUT 0
1191#define CPM_PIN_OUTPUT 1
1192#define CPM_PIN_PRIMARY 0
1193#define CPM_PIN_SECONDARY 2
1194#define CPM_PIN_GPIO 4
1195#define CPM_PIN_OPENDRAIN 8
1196
1197void cpm2_set_pin(int port, int pin, int flags);
1198
1199#endif
1200#endif
1201