source: rtems/c/src/lib/libcpu/powerpc/mpc8xx/include/mpc8xx.h @ 359e537

4.104.115
Last change on this file since 359e537 was 359e537, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/30/09 at 05:09:41

Whitespace removal.

  • Property mode set to 100644
File size: 54.4 KB
Line 
1/*
2**************************************************************************
3**************************************************************************
4**                                                                      **
5**       MOTOROLA MPC860/MPC821 PORTABLE SYSTEMS MICROPROCESSOR         **
6**                                                                      **
7**                        HARDWARE DECLARATIONS                         **
8**                                                                      **
9**                                                                      **
10**  Submitted By:                                                       **
11**                                                                      **
12**      W. Eric Norum                                                   **
13**      Saskatchewan Accelerator Laboratory                             **
14**      University of Saskatchewan                                      **
15**      107 North Road                                                  **
16**      Saskatoon, Saskatchewan, CANADA                                 **
17**      S7N 5C6                                                         **
18**                                                                      **
19**      eric@skatter.usask.ca                                           **
20**                                                                      **
21**  Modified for use with the MPC860 (original code was for MC68360)    **
22**  by                                                                  **
23**      Jay Monkman                                                     **
24**      Frasca International, Inc.                                      **
25**      906 E. Airport Rd.                                              **
26**      Urbana, IL, 61801                                               **
27**                                                                      **
28**      jmonkman@frasca.com                                             **
29**                                                                      **
30**  Modified further for use with the MPC821 by:                        **
31**      Andrew Bray <andy@chaos.org.uk>                                 **
32**                                                                      **
33**  With some corrections/additions by:                                 **
34**      Darlene A. Stewart and                                          **
35**      Charles-Antoine Gauthier                                        **
36**      Institute for Information Technology                            **
37**      National Research Council of Canada                             **
38**      Ottawa, ON  K1A 0R6                                             **
39**                                                                      **
40**      Darlene.Stewart@iit.nrc.ca                                      **
41**      charles.gauthier@iit.nrc.ca                                     **
42**                                                                      **
43**      Corrections/additions:                                          **
44**        Copyright (c) 1999, National Research Council of Canada       **
45**************************************************************************
46**************************************************************************
47*/
48#ifndef _MPC8XX_H
49#define _MPC8XX_H
50
51#ifndef ASM
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57/*
58 * Macros for accessing Special Purpose Registers (SPRs)
59 */
60#define _mtspr(_spr,_reg)   __asm__ volatile ( "mtspr %0, %1\n" : : "i" ((_spr)), "r" ((_reg)) )
61#define _mfspr(_reg,_spr)   __asm__ volatile ( "mfspr %0, %1\n" : "=r" ((_reg)) : "i" ((_spr)) )
62
63#define _isync   __asm__ volatile ("isync\n"::)
64
65/*
66 * Core Registers (SPRs)
67 */
68#define M8xx_DEC        22      /* Decrementer Register */
69#define M8xx_DER        149     /* Debug Enable Register */
70#define M8xx_ICTRL      158     /* Instruction Support Control Register */
71#define M8xx_TBL_WR     284     /* Timebase Lower Write Register */
72#define M8xx_TBU_WR     285     /* Timebase Upper Write Register */
73#define M8xx_IMMR       638     /* Internal Memory Map Register */
74
75/*
76 * Cache Control Registers (SPRs)
77 */
78#define M8xx_IC_CST     560     /* Instruction Cache Control and Status Register */
79#define M8xx_DC_CST     568     /* Data Cache Control and Status Register */
80#define M8xx_IC_ADR     561     /* Instruction Cache Address Register */
81#define M8xx_DC_ADR     569     /* Data Cache Address Register */
82#define M8xx_IC_DAT     562     /* Instruction Cache Data Port Register */
83#define M8xx_DC_DAT     570     /* Data Cache Data Port Register */
84
85/*
86 * MMU Registers (SPRs)
87 */
88/* Control Registers */
89#define M8xx_MI_CTR     784     /* IMMU Control Register */
90#define M8xx_MD_CTR     792     /* DMMU Control Register */
91/* TLB Source Registers */
92#define M8xx_MI_EPN     787     /* IMMU Effective Page Number Register (EPN) */
93#define M8xx_MD_EPN     795     /* DMMU Effective Page Number Register (EPN) */
94#define M8xx_MI_TWC     789     /* IMMU Tablewalk Control Register (TWC) */
95#define M8xx_MD_TWC     797     /* DMMU Tablewalk Control Register (TWC) */
96#define M8xx_MI_RPN     790     /* IMMU Real (physical) Page Number Register (RPN) */
97#define M8xx_MD_RPN     798     /* DMMU Real (physical) Page Number Register (RPN) */
98/* Tablewalk Assist Registers */
99#define M8xx_M_TWB      796     /* MMU Tablewalk Base Register (TWB) */
100/* Protection Registers */
101#define M8xx_M_CASID    793     /* MMU Current Address Space ID Register */
102#define M8xx_MI_AP      786     /* IMMU Access Protection Register */
103#define M8xx_MD_AP      794     /* DMMU Access Protection Register */
104/* Scratch Register */
105#define M8xx_M_TW       799     /* MMU Tablewalk Special Register */
106/* Debug Registers */
107#define M8xx_MI_CAM     816     /* IMMU CAM Entry Read Register */
108#define M8xx_MI_RAM0    817     /* IMMU RAM Entry Read Register 0 */
109#define M8xx_MI_RAM1    818     /* IMMU RAM Entry Read Register 1 */
110#define M8xx_MD_CAM     824     /* DMMU CAM Entry Read Register */
111#define M8xx_MD_RAM0    825     /* DMMU RAM Entry Read Register 0 */
112#define M8xx_MD_RAM1    826     /* DMMU RAM Entry Read Register 1 */
113
114#define M8xx_MI_CTR_GPM       (1<<31)
115#define M8xx_MI_CTR_PPM       (1<<30)
116#define M8xx_MI_CTR_CIDEF     (1<<29)
117#define M8xx_MI_CTR_RSV4I     (1<<27)
118#define M8xx_MI_CTR_PPCS      (1<<25)
119#define M8xx_MI_CTR_ITLB_INDX(x) ((x)<<8)   /* ITLB index */
120
121#define M8xx_MD_CTR_GPM       (1<<31)
122#define M8xx_MD_CTR_PPM       (1<<30)
123#define M8xx_MD_CTR_CIDEF     (1<<29)
124#define M8xx_MD_CTR_WTDEF     (1<<28)
125#define M8xx_MD_CTR_RSV4D     (1<<27)
126#define M8xx_MD_CTR_TWAM      (1<<26)
127#define M8xx_MD_CTR_PPCS      (1<<25)
128#define M8xx_MD_CTR_DTLB_INDX(x) ((x)<<8)   /* DTLB index */
129
130#define M8xx_MI_EPN_VALID     (1<<9)
131
132#define M8xx_MD_EPN_VALID     (1<<9)
133
134#define M8xx_MI_TWC_G         (1<<4)
135#define M8xx_MI_TWC_PSS       (0<<2)
136#define M8xx_MI_TWC_PS512     (1<<2)
137#define M8xx_MI_TWC_PS8       (3<<2)
138#define M8xx_MI_TWC_VALID     (1)
139
140#define M8xx_MD_TWC_G         (1<<4)
141#define M8xx_MD_TWC_PSS       (0<<2)
142#define M8xx_MD_TWC_PS512     (1<<2)
143#define M8xx_MD_TWC_PS8       (3<<2)
144#define M8xx_MD_TWC_WT        (1<<1)
145#define M8xx_MD_TWC_VALID     (1)
146
147#define M8xx_MI_RPN_F         (0xf<<4)
148#define M8xx_MI_RPN_16K       (1<<3)
149#define M8xx_MI_RPN_SHARED    (1<<2)
150#define M8xx_MI_RPN_CI        (1<<1)
151#define M8xx_MI_RPN_VALID     (1)
152
153#define M8xx_MD_RPN_CHANGE    (1<<8)
154#define M8xx_MD_RPN_F         (0xf<<4)
155#define M8xx_MD_RPN_16K       (1<<3)
156#define M8xx_MD_RPN_SHARED    (1<<2)
157#define M8xx_MD_RPN_CI        (1<<1)
158#define M8xx_MD_RPN_VALID     (1)
159
160#define M8xx_MI_AP_Kp         (1)
161
162#define M8xx_MD_AP_Kp         (1)
163
164#define M8xx_CACHE_CMD_SFWT          (0x1<<24)
165#define M8xx_CACHE_CMD_ENABLE        (0x2<<24)
166#define M8xx_CACHE_CMD_CFWT          (0x3<<24)
167#define M8xx_CACHE_CMD_DISABLE       (0x4<<24)
168#define M8xx_CACHE_CMD_STLES         (0x5<<24)
169#define M8xx_CACHE_CMD_LLCB          (0x6<<24)
170#define M8xx_CACHE_CMD_CLES          (0x7<<24)
171#define M8xx_CACHE_CMD_UNLOCK        (0x8<<24)
172#define M8xx_CACHE_CMD_UNLOCKALL     (0xa<<24)
173#define M8xx_CACHE_CMD_INVALIDATE    (0xc<<24)
174#define M8xx_CACHE_CMD_FLUSH         (0xe<<24)
175
176/*
177*************************************************************************
178*                         REGISTER SUBBLOCKS                            *
179*************************************************************************
180*/
181
182/*
183 * Memory controller registers
184 */
185typedef struct m8xxMEMCRegisters_ {
186  uint32_t          _br;
187  uint32_t          _or;    /* Used to be called 'or'; reserved ANSI C++ keyword */
188} m8xxMEMCRegisters_t;
189
190/*
191 * Serial Communications Controller registers
192 */
193typedef struct m8xxSCCRegisters_ {
194  uint32_t          gsmr_l;
195  uint32_t          gsmr_h;
196  uint16_t          psmr;
197  uint16_t          _pad0;
198  uint16_t          todr;
199  uint16_t          dsr;
200  uint16_t          scce;
201  uint16_t          _pad1;
202  uint16_t          sccm;
203  uint8_t           _pad2;
204  uint8_t           sccs;
205  uint32_t          _pad3[2];
206} m8xxSCCRegisters_t;
207
208/*
209 * Serial Management Controller registers
210 */
211typedef struct m8xxSMCRegisters_ {
212  uint16_t          _pad0;
213  uint16_t          smcmr;
214  uint16_t          _pad1;
215  uint8_t           smce;
216  uint8_t           _pad2;
217  uint16_t          _pad3;
218  uint8_t           smcm;
219  uint8_t           _pad4;
220  uint32_t          _pad5;
221} m8xxSMCRegisters_t;
222
223/*
224 * Fast Ethernet Controller registers (Only on MPC8xxT)
225 */
226typedef struct m8xxFECRegisters_ {
227  uint32_t      addr_low;
228  uint32_t      addr_high;
229  uint32_t      hash_table_high;
230  uint32_t      hash_table_low;
231  uint32_t      r_des_start;
232  uint32_t      x_des_start;
233  uint32_t      r_buf_size;
234  uint32_t      _pad0[9];
235  uint32_t      ecntrl;
236  uint32_t      ievent;
237  uint32_t      imask;
238  uint32_t      ivec;
239  uint32_t      r_des_active;
240  uint32_t      x_des_active;
241  uint32_t      _pad1[10];
242  uint32_t      mii_data;
243  uint32_t      mii_speed;
244  uint32_t      _pad2[17];
245  uint32_t      r_bound;
246  uint32_t      r_fstart;
247  uint32_t      _pad3[6];
248  uint32_t      x_fstart;
249  uint32_t      _pad4[17];
250  uint32_t      fun_code;
251  uint32_t      _pad5[3];
252  uint32_t      r_cntrl;
253  uint32_t      r_hash;
254  uint32_t      _pad6[14];
255  uint32_t      x_cntrl;
256  uint32_t      _pad7[30];
257
258} m8xxFECRegisters_t;
259
260#define M8xx_FEC_IEVENT_HBERR  (1 << 31)
261#define M8xx_FEC_IEVENT_BABR   (1 << 30)
262#define M8xx_FEC_IEVENT_BABT   (1 << 29)
263#define M8xx_FEC_IEVENT_GRA    (1 << 28)
264#define M8xx_FEC_IEVENT_TFINT  (1 << 27)
265#define M8xx_FEC_IEVENT_TXB    (1 << 26)
266#define M8xx_FEC_IEVENT_RFINT  (1 << 25)
267#define M8xx_FEC_IEVENT_RXB    (1 << 24)
268#define M8xx_FEC_IEVENT_MII    (1 << 23)
269#define M8xx_FEC_IEVENT_EBERR  (1 << 22)
270#define M8xx_FEC_IMASK_HBEEN   (1 << 31)
271#define M8xx_FEC_IMASK_BREEN   (1 << 30)
272#define M8xx_FEC_IMASK_BTEN    (1 << 29)
273#define M8xx_FEC_IMASK_GRAEN   (1 << 28)
274#define M8xx_FEC_IMASK_TFIEN   (1 << 27)
275#define M8xx_FEC_IMASK_TBIEN   (1 << 26)
276#define M8xx_FEC_IMASK_RFIEN   (1 << 25)
277#define M8xx_FEC_IMASK_RBIEN   (1 << 24)
278#define M8xx_FEC_IMASK_MIIEN   (1 << 23)
279#define M8xx_FEC_IMASK_EBERREN (1 << 22)
280
281  /*
282   * access macros to write to mii_data register
283   */
284#define M8xx_FEC_MII_DATA_ST       ( 1           << (31- 1))
285#define M8xx_FEC_MII_DATA_OP_RD    ( 2           << (31- 3))
286#define M8xx_FEC_MII_DATA_OP_WR    ( 1           << (31- 3))
287#define M8xx_FEC_MII_DATA_PHYAD(n) (((n) & 0x3f) << (31- 8))
288#define M8xx_FEC_MII_DATA_PHYRA(n) (((n) & 0x3f) << (31-13))
289#define M8xx_FEC_MII_DATA_TA       ( 2           << (31-15))
290#define M8xx_FEC_MII_DATA_WDATA(n) ((n) & 0xffff           )
291#define M8xx_FEC_MII_DATA_RDATA(reg) ((reg) & 0xffff       )
292  /*
293   * bits for FEC X_CNTRL register
294   */
295#define M8xx_FEC_X_CNTRL_FDEN       ( 1           << (31-29))
296#define M8xx_FEC_X_CNTRL_HBC        ( 1           << (31-30))
297#define M8xx_FEC_X_CNTRL_GTS        ( 1           << (31-31))
298/*
299*************************************************************************
300*                         Miscellaneous Parameters                      *
301*************************************************************************
302*/
303typedef struct m8xxMiscParms_ {
304  uint16_t          rev_num;
305  uint16_t          _res1;
306  uint32_t          _res2;
307  uint32_t          _res3;
308} m8xxMiscParms_t;
309
310/*
311*************************************************************************
312*                              RISC Timers                              *
313*************************************************************************
314*/
315typedef struct m8xxTimerParms_ {
316  uint16_t          tm_base;
317  uint16_t          _tm_ptr;
318  uint16_t          _r_tmr;
319  uint16_t          _r_tmv;
320  uint32_t          tm_cmd;
321  uint32_t          tm_cnt;
322} m8xxTimerParms_t;
323
324/*
325 * RISC Controller Configuration Register (RCCR)
326 * All other bits in this register are reserved.
327 */
328#define M8xx_RCCR_TIME          (1<<15)    /* Enable timer */
329#define M8xx_RCCR_TIMEP(x)      ((x)<<8)   /* Timer period */
330#define M8xx_RCCR_DR1M          (1<<7)     /* IDMA Rqst 1 Mode */
331#define M8xx_RCCR_DR0M          (1<<6)     /* IDMA Rqst 0 Mode */
332#define M8xx_RCCR_DRQP(x)       ((x)<<4)   /* IDMA Rqst Priority */
333#define M8xx_RCCR_EIE           (1<<3)     /* External Interrupt Enable */
334#define M8xx_RCCR_SCD           (1<<2)     /* Scheduler Configuration */
335#define M8xx_RCCR_ERAM(x)       (x)        /* Enable RAM Microcode */
336
337/*
338 * Command register
339 * Set up this register before issuing a M8xx_CR_OP_SET_TIMER command.
340 */
341#define M8xx_TM_CMD_V           (1<<31)         /* Set to enable timer */
342#define M8xx_TM_CMD_R           (1<<30)         /* Set for automatic restart */
343#define M8xx_TM_CMD_PWM         (1<<29)         /* Set for PWM operation */
344#define M8xx_TM_CMD_TIMER(x)    ((x)<<16)       /* Select timer */
345#define M8xx_TM_CMD_PERIOD(x)   (x)             /* Timer period (16 bits) */
346
347/*
348*************************************************************************
349*                               DMA Controllers                         *
350*************************************************************************
351*/
352typedef struct m8xxIDMAparms_ {
353  uint16_t          ibase;
354  uint16_t          dcmr;
355  uint32_t          _sapr;
356  uint32_t          _dapr;
357  uint16_t          ibptr;
358  uint16_t          _write_sp;
359  uint32_t          _s_byte_c;
360  uint32_t          _d_byte_c;
361  uint32_t          _s_state;
362  uint32_t          _itemp[4];
363  uint32_t          _sr_mem;
364  uint16_t          _read_sp;
365  uint16_t          _res0;
366  uint16_t          _res1;
367  uint16_t          _res2;
368  uint32_t          _d_state;
369} m8xxIDMAparms_t;
370
371
372/*
373*************************************************************************
374*                               DSP                                     *
375*************************************************************************
376*/
377typedef struct m8xxDSPparms_ {
378  uint32_t          fdbase;
379  uint32_t          _fd_ptr;
380  uint32_t          _dstate;
381  uint32_t          _pad0;
382  uint16_t          _dstatus;
383  uint16_t          _i;
384  uint16_t          _tap;
385  uint16_t          _cbase;
386  uint16_t          _pad1;
387  uint16_t          _xptr;
388  uint16_t          _pad2;
389  uint16_t          _yptr;
390  uint16_t          _m;
391  uint16_t          _pad3;
392  uint16_t          _n;
393  uint16_t          _pad4;
394  uint16_t          _k;
395  uint16_t          _pad5;
396} m8xxDSPparms_t;
397
398/*
399*************************************************************************
400*                   Serial Communication Controllers                    *
401*************************************************************************
402*/
403typedef struct m8xxSCCparms_ {
404  uint16_t          rbase;
405  uint16_t          tbase;
406  uint8_t           rfcr;
407  uint8_t           tfcr;
408  uint16_t          mrblr;
409  uint32_t          _rstate;
410  uint32_t          _pad0;
411  uint16_t          _rbptr;
412  uint16_t          _pad1;
413  uint32_t          _pad2;
414  uint32_t          _tstate;
415  uint32_t          _pad3;
416  uint16_t          _tbptr;
417  uint16_t          _pad4;
418  uint32_t          _pad5;
419  uint32_t          _rcrc;
420  uint32_t          _tcrc;
421  union {
422    struct {
423      uint32_t          _res0;
424      uint32_t          _res1;
425      uint16_t          max_idl;
426      uint16_t          _idlc;
427      uint16_t          brkcr;
428      uint16_t          parec;
429      uint16_t          frmec;
430      uint16_t          nosec;
431      uint16_t          brkec;
432      uint16_t          brkln;
433      uint16_t          uaddr[2];
434      uint16_t          _rtemp;
435      uint16_t          toseq;
436      uint16_t          character[8];
437      uint16_t          rccm;
438      uint16_t          rccr;
439      uint16_t          rlbc;
440    } uart;
441  } un;
442} m8xxSCCparms_t;
443
444typedef struct m8xxSCCENparms_ {
445  uint16_t          rbase;
446  uint16_t          tbase;
447  uint8_t           rfcr;
448  uint8_t           tfcr;
449  uint16_t          mrblr;
450  uint32_t          _rstate;
451  uint32_t          _pad0;
452  uint16_t          _rbptr;
453  uint16_t          _pad1;
454  uint32_t          _pad2;
455  uint32_t          _tstate;
456  uint32_t          _pad3;
457  uint16_t          _tbptr;
458  uint16_t          _pad4;
459  uint32_t          _pad5;
460  uint32_t          _rcrc;
461  uint32_t          _tcrc;
462  union {
463    struct {
464      uint32_t          _res0;
465      uint32_t          _res1;
466      uint16_t          max_idl;
467      uint16_t          _idlc;
468      uint16_t          brkcr;
469      uint16_t          parec;
470      uint16_t          frmec;
471      uint16_t          nosec;
472      uint16_t          brkec;
473      uint16_t          brkln;
474      uint16_t          uaddr[2];
475      uint16_t          _rtemp;
476      uint16_t          toseq;
477      uint16_t          character[8];
478      uint16_t          rccm;
479      uint16_t          rccr;
480      uint16_t          rlbc;
481    } uart;
482    struct {
483      uint32_t          c_pres;
484      uint32_t          c_mask;
485      uint32_t          crcec;
486      uint32_t          alec;
487      uint32_t          disfc;
488      uint16_t          pads;
489      uint16_t          ret_lim;
490      uint16_t          _ret_cnt;
491      uint16_t          mflr;
492      uint16_t          minflr;
493      uint16_t          maxd1;
494      uint16_t          maxd2;
495      uint16_t          _maxd;
496      uint16_t          dma_cnt;
497      uint16_t          _max_b;
498      uint16_t          gaddr1;
499      uint16_t          gaddr2;
500      uint16_t          gaddr3;
501      uint16_t          gaddr4;
502      uint32_t          _tbuf0data0;
503      uint32_t          _tbuf0data1;
504      uint32_t          _tbuf0rba0;
505      uint32_t          _tbuf0crc;
506      uint16_t          _tbuf0bcnt;
507      uint16_t          paddr_h;
508      uint16_t          paddr_m;
509      uint16_t          paddr_l;
510      uint16_t          p_per;
511      uint16_t          _rfbd_ptr;
512      uint16_t          _tfbd_ptr;
513      uint16_t          _tlbd_ptr;
514      uint32_t          _tbuf1data0;
515      uint32_t          _tbuf1data1;
516      uint32_t          _tbuf1rba0;
517      uint32_t          _tbuf1crc;
518      uint16_t          _tbuf1bcnt;
519      uint16_t          _tx_len;
520      uint16_t          iaddr1;
521      uint16_t          iaddr2;
522      uint16_t          iaddr3;
523      uint16_t          iaddr4;
524      uint16_t          _boff_cnt;
525      uint16_t          taddr_m;
526      uint16_t          taddr_l;
527      uint16_t          taddr_h;
528    } ethernet;
529  } un;
530} m8xxSCCENparms_t;
531
532/*
533 * Receive and transmit function code register bits
534 * These apply to the function code registers of all devices, not just SCC.
535 */
536#define M8xx_RFCR_BO(x)         ((x)<<3)
537#define M8xx_RFCR_MOT           (2<<3)
538#define M8xx_RFCR_DMA_SPACE(x)  (x)
539#define M8xx_TFCR_BO(x)         ((x)<<3)
540#define M8xx_TFCR_MOT           (2<<3)
541#define M8xx_TFCR_DMA_SPACE(x)  (x)
542
543/*
544 * Event and mask registers (SCCE, SCCM)
545 */
546#define M8xx_SCCE_BRKE  (1<<6)
547#define M8xx_SCCE_BRK   (1<<4)
548#define M8xx_SCCE_BSY   (1<<2)
549#define M8xx_SCCE_TX    (1<<1)
550#define M8xx_SCCE_RX    (1<<0)
551
552/*
553*************************************************************************
554*                     Serial Management Controllers                     *
555*************************************************************************
556*/
557typedef struct m8xxSMCparms_ {
558  uint16_t          rbase;
559  uint16_t          tbase;
560  uint8_t           rfcr;
561  uint8_t           tfcr;
562  uint16_t          mrblr;
563  uint32_t          _rstate;
564  uint32_t          _pad0;
565  uint16_t          _rbptr;
566  uint16_t          _pad1;
567  uint32_t          _pad2;
568  uint32_t          _tstate;
569  uint32_t          _pad3;
570  uint16_t          _tbptr;
571  uint16_t          _pad4;
572  uint32_t          _pad5;
573  union {
574    struct {
575      uint16_t          max_idl;
576      uint16_t          _idlc;
577      uint16_t          brkln;
578      uint16_t          brkec;
579      uint16_t          brkcr;
580      uint16_t          _r_mask;
581    } uart;
582    struct {
583      uint16_t          _pad0[5];
584    } transparent;
585  } un;
586} m8xxSMCparms_t;
587
588/*
589 * Mode register
590 */
591#define M8xx_SMCMR_CLEN(x)              ((x)<<11)    /* Character length */
592#define M8xx_SMCMR_2STOP                (1<<10)      /* 2 stop bits */
593#define M8xx_SMCMR_PARITY               (1<<9)       /* Enable parity */
594#define M8xx_SMCMR_EVEN                 (1<<8)       /* Even parity */
595#define M8xx_SMCMR_SM_GCI               (0<<4)       /* GCI Mode */
596#define M8xx_SMCMR_SM_UART              (2<<4)       /* UART Mode */
597#define M8xx_SMCMR_SM_TRANSPARENT       (3<<4)       /* Transparent Mode */
598#define M8xx_SMCMR_DM_LOOPBACK          (1<<2)       /* Local loopback mode */
599#define M8xx_SMCMR_DM_ECHO              (2<<2)       /* Echo mode */
600#define M8xx_SMCMR_TEN                  (1<<1)       /* Enable transmitter */
601#define M8xx_SMCMR_REN                  (1<<0)       /* Enable receiver */
602
603/*
604 * Event and mask registers (SMCE, SMCM)
605 */
606#define M8xx_SMCE_BRKE  (1<<6)
607#define M8xx_SMCE_BRK   (1<<4)
608#define M8xx_SMCE_BSY   (1<<2)
609#define M8xx_SMCE_TX    (1<<1)
610#define M8xx_SMCE_RX    (1<<0)
611
612/*
613*************************************************************************
614*                      Serial Peripheral Interface                      *
615*************************************************************************
616*/
617typedef struct m8xxSPIparms_ {
618  uint16_t          rbase;
619  uint16_t          tbase;
620  uint8_t           rfcr;
621  uint8_t           tfcr;
622  uint16_t          mrblr;
623  uint32_t          _rstate;
624  uint32_t          _pad0;
625  uint16_t          _rbptr;
626  uint16_t          _pad1;
627  uint32_t          _pad2;
628  uint32_t          _tstate;
629  uint32_t          _pad3;
630  uint16_t          _tbptr;
631  uint16_t          _pad4;
632  uint32_t          _pad5;
633} m8xxSPIparms_t;
634
635/*
636 * Mode register (SPMODE)
637 */
638#define M8xx_SPMODE_LOOP                (1<<14) /* Local loopback mode */
639#define M8xx_SPMODE_CI                  (1<<13) /* Clock invert */
640#define M8xx_SPMODE_CP                  (1<<12) /* Clock phase */
641#define M8xx_SPMODE_DIV16               (1<<11) /* Divide BRGCLK by 16 */
642#define M8xx_SPMODE_REV                 (1<<10) /* Reverse data */
643#define M8xx_SPMODE_MASTER              (1<<9)  /* SPI is master */
644#define M8xx_SPMODE_EN                  (1<<8)  /* Enable SPI */
645#define M8xx_SPMODE_CLEN(x)             ((x)<<4)        /* Character length */
646#define M8xx_SPMODE_PM(x)               (x)     /* Prescaler modulus */
647
648/*
649 * Mode register (SPCOM)
650 */
651#define M8xx_SPCOM_STR                  (1<<7)  /* Start transmit */
652
653/*
654 * Event and mask registers (SPIE, SPIM)
655 */
656#define M8xx_SPIE_MME   (1<<5)          /* Multi-master error */
657#define M8xx_SPIE_TXE   (1<<4)          /* Tx error */
658#define M8xx_SPIE_BSY   (1<<2)          /* Busy condition*/
659#define M8xx_SPIE_TXB   (1<<1)          /* Tx buffer */
660#define M8xx_SPIE_RXB   (1<<0)          /* Rx buffer */
661
662/*
663*************************************************************************
664*                 SDMA (SCC, SMC, SPI) Buffer Descriptors               *
665*************************************************************************
666*/
667typedef struct m8xxBufferDescriptor_ {
668  volatile uint16_t          status;
669  uint16_t                 length;
670  volatile void                    *buffer;
671} m8xxBufferDescriptor_t;
672
673/*
674 * Bits in receive buffer descriptor status word
675 */
676#define M8xx_BD_EMPTY           (1<<15) /* Ethernet, SCC UART, SMC UART, SPI */
677#define M8xx_BD_WRAP            (1<<13) /* Ethernet, SCC UART, SMC UART, SPI */
678#define M8xx_BD_INTERRUPT       (1<<12) /* Ethernet, SCC UART, SMC UART, SPI */
679#define M8xx_BD_LAST            (1<<11) /* Ethernet, SPI */
680#define M8xx_BD_CONTROL_CHAR    (1<<11) /* SCC UART */
681#define M8xx_BD_FIRST_IN_FRAME  (1<<10) /* Ethernet */
682#define M8xx_BD_ADDRESS         (1<<10) /* SCC UART */
683#define M8xx_BD_CONTINUOUS      (1<<9)  /* SCC UART, SMC UART, SPI */
684#define M8xx_BD_MISS            (1<<8)  /* Ethernet */
685#define M8xx_BD_IDLE            (1<<8)  /* SCC UART, SMC UART */
686#define M8xx_BD_ADDRSS_MATCH    (1<<7)  /* SCC UART */
687#define M8xx_BD_LONG            (1<<5)  /* Ethernet */
688#define M8xx_BD_BREAK           (1<<5)  /* SCC UART, SMC UART */
689#define M8xx_BD_NONALIGNED      (1<<4)  /* Ethernet */
690#define M8xx_BD_FRAMING_ERROR   (1<<4)  /* SCC UART, SMC UART */
691#define M8xx_BD_SHORT           (1<<3)  /* Ethernet */
692#define M8xx_BD_PARITY_ERROR    (1<<3)  /* SCC UART, SMC UART */
693#define M8xx_BD_CRC_ERROR       (1<<2)  /* Ethernet */
694#define M8xx_BD_OVERRUN         (1<<1)  /* Ethernet, SCC UART, SMC UART, SPI */
695#define M8xx_BD_COLLISION       (1<<0)  /* Ethernet */
696#define M8xx_BD_CARRIER_LOST    (1<<0)  /* SCC UART, SMC UART */
697#define M8xx_BD_MASTER_ERROR    (1<<0)  /* SPI */
698
699/*
700 * Bits in transmit buffer descriptor status word
701 * Many bits have the same meaning as those in receiver buffer descriptors.
702 */
703#define M8xx_BD_READY           (1<<15) /* Ethernet, SCC UART, SMC UART, SPI */
704#define M8xx_BD_PAD             (1<<14) /* Ethernet */
705#define M8xx_BD_CTS_REPORT      (1<<11) /* SCC UART */
706#define M8xx_BD_TX_CRC          (1<<10) /* Ethernet */
707#define M8xx_BD_DEFER           (1<<9)  /* Ethernet */
708#define M8xx_BD_HEARTBEAT       (1<<8)  /* Ethernet */
709#define M8xx_BD_PREAMBLE        (1<<8)  /* SCC UART, SMC UART */
710#define M8xx_BD_LATE_COLLISION  (1<<7)  /* Ethernet */
711#define M8xx_BD_NO_STOP_BIT     (1<<7)  /* SCC UART */
712#define M8xx_BD_RETRY_LIMIT     (1<<6)  /* Ethernet */
713#define M8xx_BD_RETRY_COUNT(x)  (((x)&0x3C)>>2) /* Ethernet */
714#define M8xx_BD_UNDERRUN        (1<<1)  /* Ethernet, SPI */
715#define M8xx_BD_CARRIER_LOST    (1<<0)  /* Ethernet */
716#define M8xx_BD_CTS_LOST        (1<<0)  /* SCC UART */
717
718/*
719*************************************************************************
720*                           IDMA Buffer Descriptors                     *
721*************************************************************************
722*/
723typedef struct m8xxIDMABufferDescriptor_ {
724  uint16_t          status;
725  uint8_t           dfcr;
726  uint8_t           sfcr;
727  uint32_t          length;
728  void                    *source;
729  void                    *destination;
730} m8xxIDMABufferDescriptor_t;
731
732/*
733*************************************************************************
734*       RISC Communication Processor Module Command Register (CR)       *
735*************************************************************************
736*/
737#define M8xx_CR_RST             (1<<15) /* Reset communication processor */
738#define M8xx_CR_OP_INIT_RX_TX   (0<<8)  /* SCC, SMC UART, SMC GCI, SPI */
739#define M8xx_CR_OP_INIT_RX      (1<<8)  /* SCC, SMC UART, SPI */
740#define M8xx_CR_OP_INIT_TX      (2<<8)  /* SCC, SMC UART, SPI */
741#define M8xx_CR_OP_INIT_HUNT    (3<<8)  /* SCC, SMC UART */
742#define M8xx_CR_OP_STOP_TX      (4<<8)  /* SCC, SMC UART */
743#define M8xx_CR_OP_GR_STOP_TX   (5<<8)  /* SCC */
744#define M8xx_CR_OP_INIT_IDMA    (5<<8)  /* IDMA */
745#define M8xx_CR_OP_RESTART_TX   (6<<8)  /* SCC, SMC UART */
746#define M8xx_CR_OP_CLOSE_RX_BD  (7<<8)  /* SCC, SMC UART, SPI */
747#define M8xx_CR_OP_SET_GRP_ADDR (8<<8)  /* SCC */
748#define M8xx_CR_OP_SET_TIMER    (8<<8)  /* Timer */
749#define M8xx_CR_OP_GCI_TIMEOUT  (9<<8)  /* SMC GCI */
750#define M8xx_CR_OP_RESERT_BCS   (10<<8) /* SCC */
751#define M8xx_CR_OP_GCI_ABORT    (10<<8) /* SMC GCI */
752#define M8xx_CR_OP_STOP_IDMA    (11<<8) /* IDMA */
753#define M8xx_CR_OP_START_DSP    (12<<8) /* DSP */
754#define M8xx_CR_OP_INIT_DSP     (13<<8) /* DSP */
755
756#define M8xx_CR_CHAN_SCC1       (0<<4)  /* Channel selection */
757#define M8xx_CR_CHAN_I2C        (1<<4)
758#define M8xx_CR_CHAN_IDMA1      (1<<4)
759#define M8xx_CR_CHAN_SCC2       (4<<4)
760#define M8xx_CR_CHAN_SPI        (5<<4)
761#define M8xx_CR_CHAN_IDMA2      (5<<4)
762#define M8xx_CR_CHAN_TIMER      (5<<4)
763#define M8xx_CR_CHAN_SCC3       (8<<4)
764#define M8xx_CR_CHAN_SMC1       (9<<4)
765#define M8xx_CR_CHAN_DSP1       (9<<4)
766#define M8xx_CR_CHAN_SCC4       (12<<4)
767#define M8xx_CR_CHAN_SMC2       (13<<4)
768#define M8xx_CR_CHAN_DSP2       (13<<4)
769#define M8xx_CR_FLG             (1<<0)  /* Command flag */
770
771/*
772*************************************************************************
773*                 System Protection Control Register (SYPCR)            *
774*************************************************************************
775*/
776#define M8xx_SYPCR_SWTC(x)      ((x)<<16)   /* Software watchdog timer count */
777#define M8xx_SYPCR_BMT(x)       ((x)<<8)    /* Bus monitor timing */
778#define M8xx_SYPCR_BME          (1<<7)      /* Bus monitor enable */
779#define M8xx_SYPCR_SWF          (1<<3)      /* Software watchdog freeze */
780#define M8xx_SYPCR_SWE          (1<<2)      /* Software watchdog enable */
781#define M8xx_SYPCR_SWRI         (1<<1)      /* Watchdog reset/interrupt sel. */
782#define M8xx_SYPCR_SWP          (1<<0)      /* Software watchdog prescale */
783
784/*
785*************************************************************************
786*                 PCMCIA Control Registers
787*************************************************************************
788*/
789#define M8xx_PCMCIA_POR_BSIZE_1B    (0x00 << (31-4))
790#define M8xx_PCMCIA_POR_BSIZE_2B    (0x01 << (31-4))
791#define M8xx_PCMCIA_POR_BSIZE_4B    (0x03 << (31-4))
792#define M8xx_PCMCIA_POR_BSIZE_8B    (0x02 << (31-4))
793#define M8xx_PCMCIA_POR_BSIZE_16B   (0x06 << (31-4))
794#define M8xx_PCMCIA_POR_BSIZE_32B   (0x07 << (31-4))
795#define M8xx_PCMCIA_POR_BSIZE_64B   (0x05 << (31-4))
796#define M8xx_PCMCIA_POR_BSIZE_128B  (0x04 << (31-4))
797#define M8xx_PCMCIA_POR_BSIZE_256B  (0x0C << (31-4))
798#define M8xx_PCMCIA_POR_BSIZE_512B  (0x0D << (31-4))
799#define M8xx_PCMCIA_POR_BSIZE_1KB   (0x0F << (31-4))
800#define M8xx_PCMCIA_POR_BSIZE_2KB   (0x0E << (31-4))
801#define M8xx_PCMCIA_POR_BSIZE_4KB   (0x0A << (31-4))
802#define M8xx_PCMCIA_POR_BSIZE_8KB   (0x0B << (31-4))
803#define M8xx_PCMCIA_POR_BSIZE_16KB  (0x09 << (31-4))
804#define M8xx_PCMCIA_POR_BSIZE_32KB  (0x08 << (31-4))
805#define M8xx_PCMCIA_POR_BSIZE_64KB  (0x18 << (31-4))
806#define M8xx_PCMCIA_POR_BSIZE_128KB (0x19 << (31-4))
807#define M8xx_PCMCIA_POR_BSIZE_256KB (0x1B << (31-4))
808#define M8xx_PCMCIA_POR_BSIZE_512KB (0x1A << (31-4))
809#define M8xx_PCMCIA_POR_BSIZE_1MB   (0x1E << (31-4))
810#define M8xx_PCMCIA_POR_BSIZE_2MB   (0x1F << (31-4))
811#define M8xx_PCMCIA_POR_BSIZE_4MB   (0x1D << (31-4))
812#define M8xx_PCMCIA_POR_BSIZE_8MB   (0x1C << (31-4))
813#define M8xx_PCMCIA_POR_BSIZE_16MB  (0x14 << (31-4))
814#define M8xx_PCMCIA_POR_BSIZE_32MB  (0x15 << (31-4))
815#define M8xx_PCMCIA_POR_BSIZE_64MB  (0x17 << (31-4))
816
817#define M8xx_PCMCIA_POR_PSHT(x)     (((x) & 0x0f) << (31-15))
818#define M8xx_PCMCIA_POR_PSST(x)     (((x) & 0x0f) << (31-19))
819#define M8xx_PCMCIA_POR_PSL(x)      (((x) & 0x1f) << (31-24))
820#define M8xx_PCMCIA_POR_PPS_8       ((0) << (31-19))
821#define M8xx_PCMCIA_POR_PPS_16      ((1) << (31-19))
822
823#define M8xx_PCMCIA_POR_PRS_MEM     ((0) << (31-28))
824#define M8xx_PCMCIA_POR_PRS_ATT     ((2) << (31-28))
825#define M8xx_PCMCIA_POR_PRS_IO      ((3) << (31-28))
826#define M8xx_PCMCIA_POR_PRS_DMA     ((4) << (31-28))
827#define M8xx_PCMCIA_POR_PRS_DML     ((5) << (31-28))
828
829#define M8xx_PCMCIA_POR_PSLOT_A     ((0) << (31-29))
830#define M8xx_PCMCIA_POR_PSLOT_B     ((1) << (31-29))
831
832#define M8xx_PCMCIA_POR_WP          ((1) << (31-30))
833#define M8xx_PCMCIA_POR_VALID       ((1) << (31-31))
834
835#define M8xx_PCMCIA_PGCR_CIRQLVL(x) (((x) & 0xff) << (31- 7))
836#define M8xx_PCMCIA_PGCR_CSCHLVL(x) (((x) & 0xff) << (31-15))
837#define M8xx_PCMCIA_PGCR_CDRQ_OFF    ((0) << (31-17))
838#define M8xx_PCMCIA_PGCR_CDRQ_IOIS16 ((2) << (31-17))
839#define M8xx_PCMCIA_PGCR_CDRQ_SPKR   ((3) << (31-17))
840#define M8xx_PCMCIA_PGCR_COE         ((1) << (31-24))
841#define M8xx_PCMCIA_PGCR_CRESET      ((1) << (31-25))
842
843#define M8xx_PCMCIA_PIPR_CAVS1      ((1) << (31- 0))
844#define M8xx_PCMCIA_PIPR_CAVS2      ((1) << (31- 1))
845#define M8xx_PCMCIA_PIPR_CAWP       ((1) << (31- 2))
846#define M8xx_PCMCIA_PIPR_CACD2      ((1) << (31- 3))
847#define M8xx_PCMCIA_PIPR_CACD1      ((1) << (31- 4))
848#define M8xx_PCMCIA_PIPR_CABVD2     ((1) << (31- 5))
849#define M8xx_PCMCIA_PIPR_CABVD1     ((1) << (31- 6))
850#define M8xx_PCMCIA_PIPR_CARDY      ((1) << (31- 7))
851#define M8xx_PCMCIA_PIPR_CBVS1      ((1) << (31-16))
852#define M8xx_PCMCIA_PIPR_CBVS2      ((1) << (31-17))
853#define M8xx_PCMCIA_PIPR_CBWP       ((1) << (31-18))
854#define M8xx_PCMCIA_PIPR_CBCD2      ((1) << (31-19))
855#define M8xx_PCMCIA_PIPR_CBCD1      ((1) << (31-20))
856#define M8xx_PCMCIA_PIPR_CBBVD2     ((1) << (31-21))
857#define M8xx_PCMCIA_PIPR_CBBVD1     ((1) << (31-22))
858#define M8xx_PCMCIA_PIPR_CBRDY      ((1) << (31-23))
859
860
861#define M8xx_SYPCR_BMT(x)       ((x)<<8)    /* Bus monitor timing */
862#define M8xx_SYPCR_BME          (1<<7)      /* Bus monitor enable */
863#define M8xx_SYPCR_SWF          (1<<3)      /* Software watchdog freeze */
864#define M8xx_SYPCR_SWE          (1<<2)      /* Software watchdog enable */
865#define M8xx_SYPCR_SWRI         (1<<1)      /* Watchdog reset/interrupt sel. */
866#define M8xx_SYPCR_SWP          (1<<0)      /* Software watchdog prescale */
867
868/*
869*************************************************************************
870*                        Memory Control Registers                       *
871*************************************************************************
872*/
873#define M8xx_UPM_AMX_8col       (0<<20) /* 8 column DRAM */
874#define M8xx_UPM_AMX_9col       (1<<20) /* 9 column DRAM */
875#define M8xx_UPM_AMX_10col      (2<<20) /* 10 column DRAM */
876#define M8xx_UPM_AMX_11col      (3<<20) /* 11 column DRAM */
877#define M8xx_UPM_AMX_12col      (4<<20) /* 12 column DRAM */
878#define M8xx_UPM_AMX_13col      (5<<20) /* 13 column DRAM */
879#define M8xx_MSR_PER(x)         (0x100<<(7-x)) /* Perity error bank (x) */
880#define M8xx_MSR_WPER           (1<<7)  /* Write protection error */
881#define M8xx_MPTPR_PTP(x)       ((x)<<8) /* Periodic timer prescaler */
882#define M8xx_BR_BA(x)           ((x)&0xffff8000) /* Base address */
883#define M8xx_BR_AT(x)           ((x)<<12) /* Address type */
884#define M8xx_BR_PS8             (1<<10)  /* 8 bit port */
885#define M8xx_BR_PS16            (2<<10)  /* 16 bit port */
886#define M8xx_BR_PS32            (0<<10)  /* 32 bit port */
887#define M8xx_BR_PARE            (1<<9)   /* Parity checking enable */
888#define M8xx_BR_WP              (1<<8)   /* Write protect */
889#define M8xx_BR_MS_GPCM         (0<<6)   /* GPCM */
890#define M8xx_BR_MS_UPMA         (2<<6)   /* UPM A */
891#define M8xx_BR_MS_UPMB         (3<<6)   /* UPM B */
892#define M8xx_MEMC_BR_V          (1<<0)  /* Base/Option register are valid */
893
894#define M8xx_MEMC_OR_32K        0xffff8000      /* Address range */
895#define M8xx_MEMC_OR_64K        0xffff0000
896#define M8xx_MEMC_OR_128K       0xfffe0000
897#define M8xx_MEMC_OR_256K       0xfffc0000
898#define M8xx_MEMC_OR_512K       0xfff80000
899#define M8xx_MEMC_OR_1M         0xfff00000
900#define M8xx_MEMC_OR_2M         0xffe00000
901#define M8xx_MEMC_OR_4M         0xffc00000
902#define M8xx_MEMC_OR_8M         0xff800000
903#define M8xx_MEMC_OR_16M        0xff000000
904#define M8xx_MEMC_OR_32M        0xfe000000
905#define M8xx_MEMC_OR_64M        0xfc000000
906#define M8xx_MEMC_OR_128        0xf8000000
907#define M8xx_MEMC_OR_256M       0xf0000000
908#define M8xx_MEMC_OR_512M       0xe0000000
909#define M8xx_MEMC_OR_1G         0xc0000000
910#define M8xx_MEMC_OR_2G         0x80000000
911#define M8xx_MEMC_OR_4G         0x00000000
912#define M8xx_MEMC_OR_ATM(x)     ((x)<<12)   /* Address type mask */
913#define M8xx_MEMC_OR_CSNT       (1<<11)     /* Chip select is negated early */
914#define M8xx_MEMC_OR_SAM        (1<<11)     /* Address lines are multiplexed */
915#define M8xx_MEMC_OR_ACS_NORM   (0<<9)      /* *CS asserted with addr lines */
916#define M8xx_MEMC_OR_ACS_QRTR   (2<<9)      /* *CS asserted 1/4 after addr */
917#define M8xx_MEMC_OR_ACS_HALF   (3<<9)      /* *CS asserted 1/2 after addr */
918#define M8xx_MEMC_OR_BI         (1<<8)      /* Burst inhibit */
919#define M8xx_MEMC_OR_SCY(x)     ((x)<<4)    /* Cycle length in clocks */
920#define M8xx_MEMC_OR_SETA       (1<<3)      /* *TA generated externally */
921#define M8xx_MEMC_OR_TRLX       (1<<2)      /* Relaxed timing in GPCM */
922#define M8xx_MEMC_OR_EHTR       (1<<1)      /* Extended hold time on reads */
923
924/*
925*************************************************************************
926*                         UPM Registers (MxMR)                          *
927*************************************************************************
928*/
929#define M8xx_MEMC_MMR_PTP(x)   ((x)<<24)    /* Periodic timer period */
930#define M8xx_MEMC_MMR_PTE      (1<<23)      /* Periodic timer enable */
931#define M8xx_MEMC_MMR_DSP(x)   ((x)<<17)    /* Disable timer period */
932#define M8xx_MEMC_MMR_G0CL(x)  ((x)<<13)    /* General line 0 control */
933#define M8xx_MEMC_MMR_UPWAIT   (1<<12)      /* GPL_x4 is UPWAITx */
934#define M8xx_MEMC_MMR_RLF(x)   ((x)<<8)     /* Read loop field */
935#define M8xx_MEMC_MMR_WLF(x)   ((x)<<4)     /* Write loop field */
936#define M8xx_MEMC_MMR_TLF(x)   ((x)<<0)     /* Timer loop field */
937/*
938*************************************************************************
939*                         Memory Command Register (MCR)                 *
940*************************************************************************
941*/
942#define M8xx_MEMC_MCR_WRITE     (0<<30)     /* WRITE command */
943#define M8xx_MEMC_MCR_READ      (1<<30)     /* READ command */
944#define M8xx_MEMC_MCR_RUN       (2<<30)     /* RUN command */
945#define M8xx_MEMC_MCR_UPMA      (0<<23)     /* Cmd is for UPMA */
946#define M8xx_MEMC_MCR_UPMB      (1<<23)     /* Cmd is for UPMB */
947#define M8xx_MEMC_MCR_MB(x)     ((x)<<13)   /* Memory bank when RUN cmd */
948#define M8xx_MEMC_MCR_MCLF(x)   ((x)<<8)    /* Memory command loop field */
949#define M8xx_MEMC_MCR_MAD(x)    (x)         /* Machine address */
950
951
952
953/*
954*************************************************************************
955*                         SI Mode Register (SIMODE)                     *
956*************************************************************************
957*/
958#define M8xx_SI_SMC2_BITS       0xFFFF0000      /* All SMC2 bits */
959#define M8xx_SI_SMC2_TDM        (1<<31) /* Multiplexed SMC2 */
960#define M8xx_SI_SMC2_BRG1       (0<<28) /* SMC2 clock souce */
961#define M8xx_SI_SMC2_BRG2       (1<<28)
962#define M8xx_SI_SMC2_BRG3       (2<<28)
963#define M8xx_SI_SMC2_BRG4       (3<<28)
964#define M8xx_SI_SMC2_CLK5       (0<<28)
965#define M8xx_SI_SMC2_CLK6       (1<<28)
966#define M8xx_SI_SMC2_CLK7       (2<<28)
967#define M8xx_SI_SMC2_CLK8       (3<<28)
968#define M8xx_SI_SMC1_BITS       0x0000FFFF      /* All SMC1 bits */
969#define M8xx_SI_SMC1_TDM        (1<<15) /* Multiplexed SMC1 */
970#define M8xx_SI_SMC1_BRG1       (0<<12) /* SMC1 clock souce */
971#define M8xx_SI_SMC1_BRG2       (1<<12)
972#define M8xx_SI_SMC1_BRG3       (2<<12)
973#define M8xx_SI_SMC1_BRG4       (3<<12)
974#define M8xx_SI_SMC1_CLK1       (0<<12)
975#define M8xx_SI_SMC1_CLK2       (1<<12)
976#define M8xx_SI_SMC1_CLK3       (2<<12)
977#define M8xx_SI_SMC1_CLK4       (3<<12)
978
979/*
980*************************************************************************
981*                  SDMA Configuration Register (SDCR)                   *
982*************************************************************************
983*/
984#define M8xx_SDCR_FREEZE        (2<<13) /* Freeze on next bus cycle */
985#define M8xx_SDCR_RAID_5        (1<<0)  /* Normal arbitration ID */
986
987/*
988*************************************************************************
989*                  SDMA Status Register (SDSR)                          *
990*************************************************************************
991*/
992#define M8xx_SDSR_SBER          (1<<7)  /* SDMA Channel bus error */
993#define M8xx_SDSR_DSP2          (1<<1)  /* DSP Chain 2 interrupt */
994#define M8xx_SDSR_DSP1          (1<<0)  /* DSP Chain 1 interrupt */
995
996/*
997*************************************************************************
998*                      Baud (sic) Rate Generators                       *
999*************************************************************************
1000*/
1001#define M8xx_BRG_RST            (1<<17)         /* Reset generator */
1002#define M8xx_BRG_EN             (1<<16)         /* Enable generator */
1003#define M8xx_BRG_EXTC_BRGCLK    (0<<14)         /* Source is BRGCLK */
1004#define M8xx_BRG_EXTC_CLK2      (1<<14)         /* Source is CLK2 pin */
1005#define M8xx_BRG_EXTC_CLK6      (2<<14)         /* Source is CLK6 pin */
1006#define M8xx_BRG_ATB            (1<<13)         /* Autobaud */
1007#define M8xx_BRG_115200         (21<<1)         /* Assume 40 MHz clock */
1008#define M8xx_BRG_57600          (32<<1)
1009#define M8xx_BRG_38400          (64<<1)
1010#define M8xx_BRG_19200          (129<<1)
1011#define M8xx_BRG_9600           (259<<1)
1012#define M8xx_BRG_4800           (520<<1)
1013#define M8xx_BRG_2400           (1040<<1)
1014#define M8xx_BRG_1200           (2082<<1)
1015#define M8xx_BRG_600            ((259<<1) | 1)
1016#define M8xx_BRG_300            ((520<<1) | 1)
1017#define M8xx_BRG_150            ((1040<<1) | 1)
1018#define M8xx_BRG_75             ((2080<<1) | 1)
1019
1020#define M8xx_TGCR_CAS4          (1<<15)   /* Cascade timers 3 and 4 */
1021#define M8xx_TGCR_CAS2          (1<<7)    /* Cascade timers 1 and 2 */
1022#define M8xx_TGCR_FRZ1          (1<<2)    /* Halt timer if FREEZE asserted */
1023#define M8xx_TGCR_FRZ2          (1<<6)    /* Halt timer if FREEZE asserted */
1024#define M8xx_TGCR_FRZ3          (1<<10)   /* Halt timer if FREEZE asserted */
1025#define M8xx_TGCR_FRZ4          (1<<14)   /* Halt timer if FREEZE asserted */
1026#define M8xx_TGCR_STP1          (1<<1)    /* Stop timer */
1027#define M8xx_TGCR_STP2          (1<<5)    /* Stop timer */
1028#define M8xx_TGCR_STP3          (1<<9)    /* Stop timer */
1029#define M8xx_TGCR_STP4          (1<<13)   /* Stop timer */
1030#define M8xx_TGCR_RST1          (1<<0)    /* Enable timer */
1031#define M8xx_TGCR_RST2          (1<<4)    /* Enable timer */
1032#define M8xx_TGCR_RST3          (1<<8)    /* Enable timer */
1033#define M8xx_TGCR_RST4          (1<<12)   /* Enable timer */
1034#define M8xx_TGCR_GM1           (1<<3)    /* Gate Mode 1 for TMR1 or TMR2 */
1035#define M8xx_TGCR_GM2           (1<<11)   /* Gate Mode 2 for TMR3 or TMR4 */
1036
1037#define M8xx_TMR_PS(x)          ((x)<<8)  /* Timer prescaler */
1038#define M8xx_TMR_CE_RISE        (1<<6)    /* Capture on rising edge */
1039#define M8xx_TMR_CE_FALL        (2<<6)    /* Capture on falling edge */
1040#define M8xx_TMR_CE_ANY         (3<<6)    /* Capture on any edge */
1041#define M8xx_TMR_OM_TOGGLE      (1<<5)    /* Toggle TOUTx pin */
1042#define M8xx_TMR_ORI            (1<<4)    /* Interrupt on reaching reference */
1043#define M8xx_TMR_RESTART        (1<<3)    /* Restart timer after reference */
1044#define M8xx_TMR_ICLK_INT       (1<<1)    /* Internal clock is timer source */
1045#define M8xx_TMR_ICLK_INT16     (2<<1)    /* Internal clock/16 is tmr src */
1046#define M8xx_TMR_ICLK_TIN       (3<<1)    /* TIN pin is timer source */
1047#define M8xx_TMR_TGATE          (1<<0)    /* TGATE controls timer */
1048
1049#define M8xx_PISCR_PIRQ(x)      (1<<(15-x))  /* PIT interrupt level */
1050#define M8xx_PISCR_PS           (1<<7)    /* PIT Interrupt state */
1051#define M8xx_PISCR_PIE          (1<<2)    /* PIT interrupt enable */
1052#define M8xx_PISCR_PITF         (1<<1)    /* Stop timer when freeze asserted */
1053#define M8xx_PISCR_PTE          (1<<0)    /* PIT enable */
1054
1055#define M8xx_TBSCR_TBIRQ(x)     (1<<(15-x))  /* TB interrupt level */
1056#define M8xx_TBSCR_REFA         (1<<7)    /* TB matches TBREFF0 */
1057#define M8xx_TBSCR_REFB         (1<<6)    /* TB matches TBREFF1 */
1058#define M8xx_TBSCR_REFAE        (1<<3)    /* Enable ints for REFA */
1059#define M8xx_TBSCR_REFBE        (1<<2)    /* Enable ints for REFB */
1060#define M8xx_TBSCR_TBF          (1<<1)    /* TB stops on FREEZE */
1061#define M8xx_TBSCR_TBE          (1<<0)    /* enable TB and decrementer */
1062
1063#define M8xx_SIMASK_IRM0        (1<<31)
1064#define M8xx_SIMASK_LVM0        (1<<30)
1065#define M8xx_SIMASK_IRM1        (1<<29)
1066#define M8xx_SIMASK_LVM1        (1<<28)
1067#define M8xx_SIMASK_IRM2        (1<<27)
1068#define M8xx_SIMASK_LVM2        (1<<26)
1069#define M8xx_SIMASK_IRM3        (1<<25)
1070#define M8xx_SIMASK_LVM3        (1<<24)
1071#define M8xx_SIMASK_IRM4        (1<<23)
1072#define M8xx_SIMASK_LVM4        (1<<22)
1073#define M8xx_SIMASK_IRM5        (1<<21)
1074#define M8xx_SIMASK_LVM5        (1<<20)
1075#define M8xx_SIMASK_IRM6        (1<<19)
1076#define M8xx_SIMASK_LVM6        (1<<18)
1077#define M8xx_SIMASK_IRM7        (1<<17)
1078#define M8xx_SIMASK_LVM7        (1<<16)
1079
1080#define M8xx_SIUMCR_EARB        (1<<31)
1081#define M8xx_SIUMCR_EARP0       (0<<28)
1082#define M8xx_SIUMCR_EARP1       (1<<28)
1083#define M8xx_SIUMCR_EARP2       (2<<28)
1084#define M8xx_SIUMCR_EARP3       (3<<28)
1085#define M8xx_SIUMCR_EARP4       (4<<28)
1086#define M8xx_SIUMCR_EARP5       (5<<28)
1087#define M8xx_SIUMCR_EARP6       (6<<28)
1088#define M8xx_SIUMCR_EARP7       (7<<28)
1089#define M8xx_SIUMCR_DSHW        (1<<23)
1090#define M8xx_SIUMCR_DBGC0       (0<<21)
1091#define M8xx_SIUMCR_DBGC1       (1<<21)
1092#define M8xx_SIUMCR_DBGC2       (2<<21)
1093#define M8xx_SIUMCR_DBGC3       (3<<21)
1094#define M8xx_SIUMCR_DBPC0       (0<<19)
1095#define M8xx_SIUMCR_DBPC1       (1<<19)
1096#define M8xx_SIUMCR_DBPC2       (2<<19)
1097#define M8xx_SIUMCR_DBPC3       (3<<19)
1098#define M8xx_SIUMCR_FRC         (1<<17)
1099#define M8xx_SIUMCR_DLK         (1<<16)
1100#define M8xx_SIUMCR_PNCS        (1<<15)
1101#define M8xx_SIUMCR_OPAR        (1<<14)
1102#define M8xx_SIUMCR_DPC         (1<<13)
1103#define M8xx_SIUMCR_MPRE        (1<<12)
1104#define M8xx_SIUMCR_MLRC0       (0<<10)
1105#define M8xx_SIUMCR_MLRC1       (1<<10)
1106#define M8xx_SIUMCR_MLRC2       (2<<10)
1107#define M8xx_SIUMCR_MLRC3       (3<<10)
1108#define M8xx_SIUMCR_AEME        (1<<9)
1109#define M8xx_SIUMCR_SEME        (1<<8)
1110#define M8xx_SIUMCR_BSC         (1<<7)
1111#define M8xx_SIUMCR_GB5E        (1<<6)
1112#define M8xx_SIUMCR_B2DD        (1<<5)
1113#define M8xx_SIUMCR_B3DD        (1<<4)
1114
1115/*
1116 *  Value to write to a key register to unlock the corresponding SIU register
1117 */
1118#define M8xx_UNLOCK_KEY         0x55CCAA33
1119
1120/*
1121*************************************************************************
1122*   MPC8xx INTERNAL MEMORY MAP REGISTERS (IMMR provides base address)   *
1123*************************************************************************
1124*/
1125typedef struct m8xx_ {
1126
1127  /*
1128   * SIU Block
1129   */
1130  uint32_t        siumcr;
1131  uint32_t        sypcr;
1132#if defined(mpc860)
1133  uint32_t        swt;
1134#elif defined(mpc821)
1135  uint32_t        _pad70;
1136#endif
1137  uint16_t        _pad0;
1138  uint16_t        swsr;
1139  uint32_t        sipend;
1140  uint32_t        simask;
1141  uint32_t        siel;
1142  uint32_t        sivec;
1143  uint32_t        tesr;
1144  uint32_t        _pad1[3];
1145  uint32_t        sdcr;
1146  uint8_t         _pad2[0x80-0x34];
1147
1148  /*
1149   * PCMCIA Block
1150   */
1151  uint32_t        pbr0;
1152  uint32_t        por0;
1153  uint32_t        pbr1;
1154  uint32_t        por1;
1155  uint32_t        pbr2;
1156  uint32_t        por2;
1157  uint32_t        pbr3;
1158  uint32_t        por3;
1159  uint32_t        pbr4;
1160  uint32_t        por4;
1161  uint32_t        pbr5;
1162  uint32_t        por5;
1163  uint32_t        pbr6;
1164  uint32_t        por6;
1165  uint32_t        pbr7;
1166  uint32_t        por7;
1167  uint8_t         _pad3[0xe0-0xc0];
1168  uint32_t        pgcra;
1169  uint32_t        pgcrb;
1170  uint32_t        pscr;
1171  uint32_t        _pad4;
1172  uint32_t        pipr;
1173  uint32_t        _pad5;
1174  uint32_t        per;
1175  uint32_t        _pad6;
1176
1177  /*
1178   * MEMC Block
1179   */
1180  m8xxMEMCRegisters_t   memc[8];
1181  uint8_t         _pad7[0x164-0x140];
1182  uint32_t        mar;
1183  uint32_t        mcr;
1184  uint32_t        _pad8;
1185  uint32_t        mamr;
1186  uint32_t        mbmr;
1187  uint16_t        mstat;
1188  uint16_t        mptpr;
1189  uint32_t        mdr;
1190  uint8_t         _pad9[0x200-0x180];
1191
1192  /*
1193   * System integration timers
1194   */
1195  uint16_t        tbscr;
1196  uint16_t        _pad10;
1197  uint32_t        tbreff0;
1198  uint32_t        tbreff1;
1199  uint8_t         _pad11[0x220-0x20c];
1200  uint16_t        rtcsc;
1201  uint16_t        _pad12;
1202  uint32_t        rtc;
1203  uint32_t        rtsec;
1204  uint32_t        rtcal;
1205  uint32_t        _pad13[4];
1206  uint16_t        piscr;
1207  uint16_t        _pad14;
1208  uint16_t        pitc;
1209  uint16_t        _pad_14_1;
1210  uint16_t        pitr;
1211  uint16_t        _pad_14_2;
1212  uint8_t         _pad15[0x280-0x24c];
1213
1214
1215  /*
1216   * Clocks and Reset
1217   */
1218  uint32_t        sccr;
1219  uint32_t        plprcr;
1220  uint32_t        rsr;
1221  uint8_t         _pad16[0x300-0x28c];
1222
1223
1224  /*
1225   * System integration timers keys
1226   */
1227  uint32_t        tbscrk;
1228  uint32_t        tbreff0k;
1229  uint32_t        tbreff1k;
1230  uint32_t        tbk;
1231  uint32_t        _pad17[4];
1232  uint32_t        rtcsk;
1233  uint32_t        rtck;
1234  uint32_t        rtseck;
1235  uint32_t        rtcalk;
1236  uint32_t        _pad18[4];
1237  uint32_t        piscrk;
1238  uint32_t        pitck;
1239  uint8_t         _pad19[0x380-0x348];
1240
1241  /*
1242   * Clocks and Reset Keys
1243   */
1244  uint32_t        sccrk;
1245  uint32_t        plprck;
1246  uint32_t        rsrk;
1247  uint8_t         _pad20[0x400-0x38c];
1248  uint8_t         _pad21[0x800-0x400];
1249  uint8_t         _pad22[0x860-0x800];
1250
1251
1252  /*
1253   * I2C
1254   */
1255  uint8_t         i2mod;
1256  uint8_t         _pad23[3];
1257  uint8_t         i2add;
1258  uint8_t         _pad24[3];
1259  uint8_t         i2brg;
1260  uint8_t         _pad25[3];
1261  uint8_t         i2com;
1262  uint8_t         _pad26[3];
1263  uint8_t         i2cer;
1264  uint8_t         _pad27[3];
1265  uint8_t         i2cmr;
1266  uint8_t         _pad28[0x900-0x875];
1267
1268  /*
1269   * DMA Block
1270   */
1271  uint32_t        _pad29;
1272  uint32_t        sdar;
1273  uint8_t         sdsr;
1274  uint8_t         _pad30[3];
1275  uint8_t         sdmr;
1276  uint8_t         _pad31[3];
1277  uint8_t         idsr1;
1278  uint8_t         _pad32[3];
1279  uint8_t         idmr1;
1280  uint8_t         _pad33[3];
1281  uint8_t         idsr2;
1282  uint8_t         _pad34[3];
1283  uint8_t         idmr2;
1284  uint8_t         _pad35[0x930-0x91d];
1285
1286  /*
1287   * CPM Interrupt Control Block
1288   */
1289  uint16_t        civr;
1290  uint8_t         _pad36[14];
1291  uint32_t        cicr;
1292  uint32_t        cipr;
1293  uint32_t        cimr;
1294  uint32_t        cisr;
1295
1296  /*
1297   * I/O Port Block
1298   */
1299  uint16_t        padir;
1300  uint16_t        papar;
1301  uint16_t        paodr;
1302  uint16_t        padat;
1303  uint8_t         _pad37[8];
1304  uint16_t        pcdir;
1305  uint16_t        pcpar;
1306  uint16_t        pcso;
1307  uint16_t        pcdat;
1308  uint16_t        pcint;
1309  uint8_t         _pad39[6];
1310  uint16_t        pddir;
1311  uint16_t        pdpar;
1312  uint16_t        _pad40;
1313  uint16_t        pddat;
1314  uint8_t         _pad41[8];
1315
1316  /*
1317   * CPM Timers Block
1318   */
1319  uint16_t        tgcr;
1320  uint8_t         _pad42[14];
1321  uint16_t        tmr1;
1322  uint16_t        tmr2;
1323  uint16_t        trr1;
1324  uint16_t        trr2;
1325  uint16_t        tcr1;
1326  uint16_t        tcr2;
1327  uint16_t        tcn1;
1328  uint16_t        tcn2;
1329  uint16_t        tmr3;
1330  uint16_t        tmr4;
1331  uint16_t        trr3;
1332  uint16_t        trr4;
1333  uint16_t        tcr3;
1334  uint16_t        tcr4;
1335  uint16_t        tcn3;
1336  uint16_t        tcn4;
1337  uint16_t        ter1;
1338  uint16_t        ter2;
1339  uint16_t        ter3;
1340  uint16_t        ter4;
1341  uint8_t         _pad43[8];
1342
1343  /*
1344   * CPM Block
1345   */
1346  uint16_t        cpcr;
1347  uint16_t        _pad44;
1348  uint16_t        rccr;
1349  uint8_t         _pad45;
1350  uint8_t         rmds;
1351  uint32_t        rmdr;
1352  uint16_t        rctr1;
1353  uint16_t        rctr2;
1354  uint16_t        rctr3;
1355  uint16_t        rctr4;
1356  uint16_t        _pad46;
1357  uint16_t        rter;
1358  uint16_t        _pad47;
1359  uint16_t        rtmr;
1360  uint8_t         _pad48[0x9f0-0x9dc];
1361
1362  /*
1363   * BRG Block
1364   */
1365  uint32_t        brgc1;
1366  uint32_t        brgc2;
1367  uint32_t        brgc3;
1368  uint32_t        brgc4;
1369
1370  /*
1371   * SCC Block
1372   */
1373  m8xxSCCRegisters_t    scc1;
1374  m8xxSCCRegisters_t    scc2;
1375#if defined(mpc860)
1376  m8xxSCCRegisters_t    scc3;
1377  m8xxSCCRegisters_t    scc4;
1378#elif defined(mpc821)
1379  uint8_t       _pad72[0xa80-0xa40];
1380#endif
1381
1382  /*
1383   * SMC Block
1384   */
1385  m8xxSMCRegisters_t    smc1;
1386  m8xxSMCRegisters_t    smc2;
1387
1388  /*
1389   * SPI Block
1390   */
1391  uint16_t        spmode;
1392  uint16_t        _pad49[2];
1393  uint8_t         spie;
1394  uint8_t         _pad50;
1395  uint16_t        _pad51;
1396  uint8_t         spim;
1397  uint8_t         _pad52[2];
1398  uint8_t         spcom;
1399  uint16_t        _pad53[2];
1400
1401  /*
1402   * PIP Block
1403   */
1404  uint16_t        pipc;
1405  uint16_t        _pad54;
1406  uint16_t        ptpr;
1407  uint32_t        pbdir;
1408  uint32_t        pbpar;
1409  uint16_t        _pad55;
1410  uint16_t        pbodr;
1411  uint32_t        pbdat;
1412  uint32_t        _pad56[6];
1413
1414  /*
1415   * SI Block
1416   */
1417  uint32_t        simode;
1418  uint8_t         sigmr;
1419  uint8_t         _pad57;
1420  uint8_t         sistr;
1421  uint8_t         sicmr;
1422  uint32_t        _pad58;
1423  uint32_t        sicr;
1424  uint16_t        sirp[2];
1425  uint32_t        _pad59[3];
1426  uint8_t         _pad60[0xc00-0xb00];
1427  uint8_t         siram[512];
1428#if defined(mpc860)
1429  /*
1430   * This is only used on the MPC8xxT - for the Fast Ethernet Controller (FEC)
1431   */
1432  m8xxFECRegisters_t    fec;
1433#elif defined(mpc821)
1434  uint8_t         lcdram[512];
1435#endif
1436  uint8_t         _pad62[0x2000-0x1000];
1437
1438  /*
1439   * Dual-port RAM
1440   */
1441  uint8_t         dpram0[0x200];  /* BD/DATA/UCODE */
1442  uint8_t         dpram1[0x200];  /* BD/DATA/UCODE */
1443  uint8_t         dpram2[0x400];  /* BD/DATA/UCODE */
1444  uint8_t         dpram3[0x600];  /* BD/DATA*/
1445  uint8_t         dpram4[0x200];  /* BD/DATA/UCODE */
1446  uint8_t         _pad63[0x3c00-0x3000];
1447
1448  /* When using SCC1 for ethernet, we lose the use of I2C since
1449   *  their parameters would overlap. Motorola has a microcode
1450   *  patch to move parameters around so that both can be used
1451   *  together. It is available on their web site somewhere
1452   *  under http://www.mot.com/mpc8xx. If ethernet is used on
1453   *  one (or more) of the other SCCs, then other CPM features
1454   *  will be unavailable:
1455   *    SCC2    -> lose SPI
1456   *    SCC3    -> lose SMC1
1457   *    SCC4    -> lose SMC2
1458   *  However, Ethernet only works on SCC1 on the 8xx.
1459   */
1460  m8xxSCCENparms_t      scc1p;
1461  uint8_t         _rsv1[0xCB0-0xC00-sizeof(m8xxSCCENparms_t)];
1462  m8xxMiscParms_t       miscp;
1463  uint8_t         _rsv2[0xcc0-0xCB0-sizeof(m8xxMiscParms_t)];
1464  m8xxIDMAparms_t       idma1p;
1465  uint8_t         _rsv3[0xd00-0xcc0-sizeof(m8xxIDMAparms_t)];
1466
1467  m8xxSCCparms_t        scc2p;
1468  uint8_t         _rsv4[0xD80-0xD00-sizeof(m8xxSCCparms_t)];
1469  m8xxSPIparms_t        spip;
1470  uint8_t         _rsv5[0xDB0-0xD80-sizeof(m8xxSPIparms_t)];
1471  m8xxTimerParms_t      tmp;
1472  uint8_t         _rsv6[0xDC0-0xDB0-sizeof(m8xxTimerParms_t)];
1473  m8xxIDMAparms_t       idma2p;
1474  uint8_t         _rsv7[0xE00-0xDC0-sizeof(m8xxIDMAparms_t)];
1475
1476  m8xxSCCparms_t        scc3p; /* Not available on MPC821 */
1477  uint8_t         _rsv8[0xE80-0xE00-sizeof(m8xxSCCparms_t)];
1478  m8xxSMCparms_t        smc1p;
1479  uint8_t         _rsv9[0xEC0-0xE80-sizeof(m8xxSMCparms_t)];
1480  m8xxDSPparms_t        dsp1p;
1481  uint8_t         _rsv10[0xF00-0xEC0-sizeof(m8xxDSPparms_t)];
1482
1483  m8xxSCCparms_t        scc4p; /* Not available on MPC821 */
1484  uint8_t         _rsv11[0xF80-0xF00-sizeof(m8xxSCCparms_t)];
1485  m8xxSMCparms_t        smc2p;
1486  uint8_t         _rsv12[0xFC0-0xF80-sizeof(m8xxSMCparms_t)];
1487  m8xxDSPparms_t        dsp2p;
1488  uint8_t         _rsv13[0x1000-0xFC0-sizeof(m8xxDSPparms_t)];
1489} m8xx_t;
1490
1491extern volatile m8xx_t m8xx;
1492
1493#ifdef __cplusplus
1494}
1495#endif
1496
1497#endif /* ASM */
1498
1499#endif /* _MPC8XX_H */
Note: See TracBrowser for help on using the repository browser.