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