xref: /openbmc/u-boot/include/linux/immap_qe.h (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
238d67a4eSZhao Qiang /*
338d67a4eSZhao Qiang  * QUICC Engine (QE) Internal Memory Map.
438d67a4eSZhao Qiang  * The Internal Memory Map for devices with QE on them. This
538d67a4eSZhao Qiang  * is the superset of all QE devices (8360, etc.).
638d67a4eSZhao Qiang  *
738d67a4eSZhao Qiang  * Copyright (c) 2006-2009, 2011 Freescale Semiconductor, Inc.
838d67a4eSZhao Qiang  * Author: Shlomi Gridih <gridish@freescale.com>
938d67a4eSZhao Qiang  */
1038d67a4eSZhao Qiang 
1138d67a4eSZhao Qiang #ifndef __IMMAP_QE_H__
1238d67a4eSZhao Qiang #define __IMMAP_QE_H__
1338d67a4eSZhao Qiang 
1438d67a4eSZhao Qiang #ifdef CONFIG_MPC83xx
1538d67a4eSZhao Qiang #if defined(CONFIG_MPC8360)
1638d67a4eSZhao Qiang #define QE_MURAM_SIZE		0xc000UL
1738d67a4eSZhao Qiang #define MAX_QE_RISC		2
1838d67a4eSZhao Qiang #define QE_NUM_OF_SNUM		28
1938d67a4eSZhao Qiang #elif defined(CONFIG_MPC832x) || defined(CONFIG_MPC8309)
2038d67a4eSZhao Qiang #define QE_MURAM_SIZE		0x4000UL
2138d67a4eSZhao Qiang #define MAX_QE_RISC		1
2238d67a4eSZhao Qiang #define QE_NUM_OF_SNUM		28
2338d67a4eSZhao Qiang #endif
2438d67a4eSZhao Qiang #endif
2538d67a4eSZhao Qiang 
2673fb5838SYork Sun #ifdef CONFIG_ARCH_LS1021A
27ae42eb03SZhao Qiang #define QE_MURAM_SIZE          0x6000UL
28ae42eb03SZhao Qiang #define MAX_QE_RISC            1
29ae42eb03SZhao Qiang #define QE_NUM_OF_SNUM         28
30ae42eb03SZhao Qiang #endif
31ae42eb03SZhao Qiang 
32ae42eb03SZhao Qiang #ifdef CONFIG_PPC
33ae42eb03SZhao Qiang #define QE_IMMR_OFFSET		0x00140000
34ae42eb03SZhao Qiang #else
35ae42eb03SZhao Qiang #define QE_IMMR_OFFSET		0x01400000
36ae42eb03SZhao Qiang #endif
37ae42eb03SZhao Qiang 
3838d67a4eSZhao Qiang /* QE I-RAM */
3938d67a4eSZhao Qiang typedef struct qe_iram {
4038d67a4eSZhao Qiang 	u32 iadd;		/* I-RAM Address Register */
4138d67a4eSZhao Qiang 	u32 idata;		/* I-RAM Data Register    */
4238d67a4eSZhao Qiang 	u8 res0[0x4];
4338d67a4eSZhao Qiang 	u32 iready;
4438d67a4eSZhao Qiang 	u8 res1[0x70];
4538d67a4eSZhao Qiang } __attribute__ ((packed)) qe_iram_t;
4638d67a4eSZhao Qiang 
4738d67a4eSZhao Qiang /* QE Interrupt Controller */
4838d67a4eSZhao Qiang typedef struct qe_ic {
4938d67a4eSZhao Qiang 	u32 qicr;
5038d67a4eSZhao Qiang 	u32 qivec;
5138d67a4eSZhao Qiang 	u32 qripnr;
5238d67a4eSZhao Qiang 	u32 qipnr;
5338d67a4eSZhao Qiang 	u32 qipxcc;
5438d67a4eSZhao Qiang 	u32 qipycc;
5538d67a4eSZhao Qiang 	u32 qipwcc;
5638d67a4eSZhao Qiang 	u32 qipzcc;
5738d67a4eSZhao Qiang 	u32 qimr;
5838d67a4eSZhao Qiang 	u32 qrimr;
5938d67a4eSZhao Qiang 	u32 qicnr;
6038d67a4eSZhao Qiang 	u8 res0[0x4];
6138d67a4eSZhao Qiang 	u32 qiprta;
6238d67a4eSZhao Qiang 	u32 qiprtb;
6338d67a4eSZhao Qiang 	u8 res1[0x4];
6438d67a4eSZhao Qiang 	u32 qricr;
6538d67a4eSZhao Qiang 	u8 res2[0x20];
6638d67a4eSZhao Qiang 	u32 qhivec;
6738d67a4eSZhao Qiang 	u8 res3[0x1C];
6838d67a4eSZhao Qiang } __attribute__ ((packed)) qe_ic_t;
6938d67a4eSZhao Qiang 
7038d67a4eSZhao Qiang /* Communications Processor */
7138d67a4eSZhao Qiang typedef struct cp_qe {
7238d67a4eSZhao Qiang 	u32 cecr;		/* QE command register */
7338d67a4eSZhao Qiang 	u32 ceccr;		/* QE controller configuration register */
7438d67a4eSZhao Qiang 	u32 cecdr;		/* QE command data register */
7538d67a4eSZhao Qiang 	u8 res0[0xA];
7638d67a4eSZhao Qiang 	u16 ceter;		/* QE timer event register */
7738d67a4eSZhao Qiang 	u8 res1[0x2];
7838d67a4eSZhao Qiang 	u16 cetmr;		/* QE timers mask register */
7938d67a4eSZhao Qiang 	u32 cetscr;		/* QE time-stamp timer control register */
8038d67a4eSZhao Qiang 	u32 cetsr1;		/* QE time-stamp register 1 */
8138d67a4eSZhao Qiang 	u32 cetsr2;		/* QE time-stamp register 2 */
8238d67a4eSZhao Qiang 	u8 res2[0x8];
8338d67a4eSZhao Qiang 	u32 cevter;		/* QE virtual tasks event register */
8438d67a4eSZhao Qiang 	u32 cevtmr;		/* QE virtual tasks mask register */
8538d67a4eSZhao Qiang 	u16 cercr;		/* QE RAM control register */
8638d67a4eSZhao Qiang 	u8 res3[0x2];
8738d67a4eSZhao Qiang 	u8 res4[0x24];
8838d67a4eSZhao Qiang 	u16 ceexe1;		/* QE external request 1 event register */
8938d67a4eSZhao Qiang 	u8 res5[0x2];
9038d67a4eSZhao Qiang 	u16 ceexm1;		/* QE external request 1 mask register */
9138d67a4eSZhao Qiang 	u8 res6[0x2];
9238d67a4eSZhao Qiang 	u16 ceexe2;		/* QE external request 2 event register */
9338d67a4eSZhao Qiang 	u8 res7[0x2];
9438d67a4eSZhao Qiang 	u16 ceexm2;		/* QE external request 2 mask register */
9538d67a4eSZhao Qiang 	u8 res8[0x2];
9638d67a4eSZhao Qiang 	u16 ceexe3;		/* QE external request 3 event register */
9738d67a4eSZhao Qiang 	u8 res9[0x2];
9838d67a4eSZhao Qiang 	u16 ceexm3;		/* QE external request 3 mask register */
9938d67a4eSZhao Qiang 	u8 res10[0x2];
10038d67a4eSZhao Qiang 	u16 ceexe4;		/* QE external request 4 event register */
10138d67a4eSZhao Qiang 	u8 res11[0x2];
10238d67a4eSZhao Qiang 	u16 ceexm4;		/* QE external request 4 mask register */
10338d67a4eSZhao Qiang 	u8 res12[0x2];
10438d67a4eSZhao Qiang 	u8 res13[0x280];
10538d67a4eSZhao Qiang } __attribute__ ((packed)) cp_qe_t;
10638d67a4eSZhao Qiang 
10738d67a4eSZhao Qiang /* QE Multiplexer */
10838d67a4eSZhao Qiang typedef struct qe_mux {
10938d67a4eSZhao Qiang 	u32 cmxgcr;		/* CMX general clock route register    */
11038d67a4eSZhao Qiang 	u32 cmxsi1cr_l;		/* CMX SI1 clock route low register    */
11138d67a4eSZhao Qiang 	u32 cmxsi1cr_h;		/* CMX SI1 clock route high register   */
11238d67a4eSZhao Qiang 	u32 cmxsi1syr;		/* CMX SI1 SYNC route register         */
11338d67a4eSZhao Qiang 	u32 cmxucr1;		/* CMX UCC1, UCC3 clock route register */
11438d67a4eSZhao Qiang 	u32 cmxucr2;		/* CMX UCC5, UCC7 clock route register */
11538d67a4eSZhao Qiang 	u32 cmxucr3;		/* CMX UCC2, UCC4 clock route register */
11638d67a4eSZhao Qiang 	u32 cmxucr4;		/* CMX UCC6, UCC8 clock route register */
11738d67a4eSZhao Qiang 	u32 cmxupcr;		/* CMX UPC clock route register        */
11838d67a4eSZhao Qiang 	u8 res0[0x1C];
11938d67a4eSZhao Qiang } __attribute__ ((packed)) qe_mux_t;
12038d67a4eSZhao Qiang 
12138d67a4eSZhao Qiang /* QE Timers */
12238d67a4eSZhao Qiang typedef struct qe_timers {
12338d67a4eSZhao Qiang 	u8 gtcfr1;		/* Timer 1 2 global configuration register */
12438d67a4eSZhao Qiang 	u8 res0[0x3];
12538d67a4eSZhao Qiang 	u8 gtcfr2;		/* Timer 3 4 global configuration register */
12638d67a4eSZhao Qiang 	u8 res1[0xB];
12738d67a4eSZhao Qiang 	u16 gtmdr1;		/* Timer 1 mode register */
12838d67a4eSZhao Qiang 	u16 gtmdr2;		/* Timer 2 mode register */
12938d67a4eSZhao Qiang 	u16 gtrfr1;		/* Timer 1 reference register */
13038d67a4eSZhao Qiang 	u16 gtrfr2;		/* Timer 2 reference register */
13138d67a4eSZhao Qiang 	u16 gtcpr1;		/* Timer 1 capture register */
13238d67a4eSZhao Qiang 	u16 gtcpr2;		/* Timer 2 capture register */
13338d67a4eSZhao Qiang 	u16 gtcnr1;		/* Timer 1 counter */
13438d67a4eSZhao Qiang 	u16 gtcnr2;		/* Timer 2 counter */
13538d67a4eSZhao Qiang 	u16 gtmdr3;		/* Timer 3 mode register */
13638d67a4eSZhao Qiang 	u16 gtmdr4;		/* Timer 4 mode register */
13738d67a4eSZhao Qiang 	u16 gtrfr3;		/* Timer 3 reference register */
13838d67a4eSZhao Qiang 	u16 gtrfr4;		/* Timer 4 reference register */
13938d67a4eSZhao Qiang 	u16 gtcpr3;		/* Timer 3 capture register */
14038d67a4eSZhao Qiang 	u16 gtcpr4;		/* Timer 4 capture register */
14138d67a4eSZhao Qiang 	u16 gtcnr3;		/* Timer 3 counter */
14238d67a4eSZhao Qiang 	u16 gtcnr4;		/* Timer 4 counter */
14338d67a4eSZhao Qiang 	u16 gtevr1;		/* Timer 1 event register */
14438d67a4eSZhao Qiang 	u16 gtevr2;		/* Timer 2 event register */
14538d67a4eSZhao Qiang 	u16 gtevr3;		/* Timer 3 event register */
14638d67a4eSZhao Qiang 	u16 gtevr4;		/* Timer 4 event register */
14738d67a4eSZhao Qiang 	u16 gtps;		/* Timer 1 prescale register */
14838d67a4eSZhao Qiang 	u8 res2[0x46];
14938d67a4eSZhao Qiang } __attribute__ ((packed)) qe_timers_t;
15038d67a4eSZhao Qiang 
15138d67a4eSZhao Qiang /* BRG */
15238d67a4eSZhao Qiang typedef struct qe_brg {
15338d67a4eSZhao Qiang 	u32 brgc1;		/* BRG1 configuration register  */
15438d67a4eSZhao Qiang 	u32 brgc2;		/* BRG2 configuration register  */
15538d67a4eSZhao Qiang 	u32 brgc3;		/* BRG3 configuration register  */
15638d67a4eSZhao Qiang 	u32 brgc4;		/* BRG4 configuration register  */
15738d67a4eSZhao Qiang 	u32 brgc5;		/* BRG5 configuration register  */
15838d67a4eSZhao Qiang 	u32 brgc6;		/* BRG6 configuration register  */
15938d67a4eSZhao Qiang 	u32 brgc7;		/* BRG7 configuration register  */
16038d67a4eSZhao Qiang 	u32 brgc8;		/* BRG8 configuration register  */
16138d67a4eSZhao Qiang 	u32 brgc9;		/* BRG9 configuration register  */
16238d67a4eSZhao Qiang 	u32 brgc10;		/* BRG10 configuration register */
16338d67a4eSZhao Qiang 	u32 brgc11;		/* BRG11 configuration register */
16438d67a4eSZhao Qiang 	u32 brgc12;		/* BRG12 configuration register */
16538d67a4eSZhao Qiang 	u32 brgc13;		/* BRG13 configuration register */
16638d67a4eSZhao Qiang 	u32 brgc14;		/* BRG14 configuration register */
16738d67a4eSZhao Qiang 	u32 brgc15;		/* BRG15 configuration register */
16838d67a4eSZhao Qiang 	u32 brgc16;		/* BRG16 configuration register */
16938d67a4eSZhao Qiang 	u8 res0[0x40];
17038d67a4eSZhao Qiang } __attribute__ ((packed)) qe_brg_t;
17138d67a4eSZhao Qiang 
17238d67a4eSZhao Qiang /* SPI */
17338d67a4eSZhao Qiang typedef struct spi {
17438d67a4eSZhao Qiang 	u8 res0[0x20];
17538d67a4eSZhao Qiang 	u32 spmode;		/* SPI mode register */
17638d67a4eSZhao Qiang 	u8 res1[0x2];
17738d67a4eSZhao Qiang 	u8 spie;		/* SPI event register */
17838d67a4eSZhao Qiang 	u8 res2[0x1];
17938d67a4eSZhao Qiang 	u8 res3[0x2];
18038d67a4eSZhao Qiang 	u8 spim;		/* SPI mask register */
18138d67a4eSZhao Qiang 	u8 res4[0x1];
18238d67a4eSZhao Qiang 	u8 res5[0x1];
18338d67a4eSZhao Qiang 	u8 spcom;		/* SPI command register  */
18438d67a4eSZhao Qiang 	u8 res6[0x2];
18538d67a4eSZhao Qiang 	u32 spitd;		/* SPI transmit data register (cpu mode) */
18638d67a4eSZhao Qiang 	u32 spird;		/* SPI receive data register (cpu mode) */
18738d67a4eSZhao Qiang 	u8 res7[0x8];
18838d67a4eSZhao Qiang } __attribute__ ((packed)) spi_t;
18938d67a4eSZhao Qiang 
19038d67a4eSZhao Qiang /* SI */
19138d67a4eSZhao Qiang typedef struct si1 {
19238d67a4eSZhao Qiang 	u16 siamr1;		/* SI1 TDMA mode register */
19338d67a4eSZhao Qiang 	u16 sibmr1;		/* SI1 TDMB mode register */
19438d67a4eSZhao Qiang 	u16 sicmr1;		/* SI1 TDMC mode register */
19538d67a4eSZhao Qiang 	u16 sidmr1;		/* SI1 TDMD mode register */
19638d67a4eSZhao Qiang 	u8 siglmr1_h;		/* SI1 global mode register high */
19738d67a4eSZhao Qiang 	u8 res0[0x1];
19838d67a4eSZhao Qiang 	u8 sicmdr1_h;		/* SI1 command register high */
19938d67a4eSZhao Qiang 	u8 res2[0x1];
20038d67a4eSZhao Qiang 	u8 sistr1_h;		/* SI1 status register high */
20138d67a4eSZhao Qiang 	u8 res3[0x1];
20238d67a4eSZhao Qiang 	u16 sirsr1_h;		/* SI1 RAM shadow address register high */
20338d67a4eSZhao Qiang 	u8 sitarc1;		/* SI1 RAM counter Tx TDMA */
20438d67a4eSZhao Qiang 	u8 sitbrc1;		/* SI1 RAM counter Tx TDMB */
20538d67a4eSZhao Qiang 	u8 sitcrc1;		/* SI1 RAM counter Tx TDMC */
20638d67a4eSZhao Qiang 	u8 sitdrc1;		/* SI1 RAM counter Tx TDMD */
20738d67a4eSZhao Qiang 	u8 sirarc1;		/* SI1 RAM counter Rx TDMA */
20838d67a4eSZhao Qiang 	u8 sirbrc1;		/* SI1 RAM counter Rx TDMB */
20938d67a4eSZhao Qiang 	u8 sircrc1;		/* SI1 RAM counter Rx TDMC */
21038d67a4eSZhao Qiang 	u8 sirdrc1;		/* SI1 RAM counter Rx TDMD */
21138d67a4eSZhao Qiang 	u8 res4[0x8];
21238d67a4eSZhao Qiang 	u16 siemr1;		/* SI1 TDME mode register 16 bits */
21338d67a4eSZhao Qiang 	u16 sifmr1;		/* SI1 TDMF mode register 16 bits */
21438d67a4eSZhao Qiang 	u16 sigmr1;		/* SI1 TDMG mode register 16 bits */
21538d67a4eSZhao Qiang 	u16 sihmr1;		/* SI1 TDMH mode register 16 bits */
21638d67a4eSZhao Qiang 	u8 siglmg1_l;		/* SI1 global mode register low 8 bits */
21738d67a4eSZhao Qiang 	u8 res5[0x1];
21838d67a4eSZhao Qiang 	u8 sicmdr1_l;		/* SI1 command register low 8 bits */
21938d67a4eSZhao Qiang 	u8 res6[0x1];
22038d67a4eSZhao Qiang 	u8 sistr1_l;		/* SI1 status register low 8 bits */
22138d67a4eSZhao Qiang 	u8 res7[0x1];
22238d67a4eSZhao Qiang 	u16 sirsr1_l;		/* SI1 RAM shadow address register low 16 bits */
22338d67a4eSZhao Qiang 	u8 siterc1;		/* SI1 RAM counter Tx TDME 8 bits */
22438d67a4eSZhao Qiang 	u8 sitfrc1;		/* SI1 RAM counter Tx TDMF 8 bits */
22538d67a4eSZhao Qiang 	u8 sitgrc1;		/* SI1 RAM counter Tx TDMG 8 bits */
22638d67a4eSZhao Qiang 	u8 sithrc1;		/* SI1 RAM counter Tx TDMH 8 bits */
22738d67a4eSZhao Qiang 	u8 sirerc1;		/* SI1 RAM counter Rx TDME 8 bits */
22838d67a4eSZhao Qiang 	u8 sirfrc1;		/* SI1 RAM counter Rx TDMF 8 bits */
22938d67a4eSZhao Qiang 	u8 sirgrc1;		/* SI1 RAM counter Rx TDMG 8 bits */
23038d67a4eSZhao Qiang 	u8 sirhrc1;		/* SI1 RAM counter Rx TDMH 8 bits */
23138d67a4eSZhao Qiang 	u8 res8[0x8];
23238d67a4eSZhao Qiang 	u32 siml1;		/* SI1 multiframe limit register */
23338d67a4eSZhao Qiang 	u8 siedm1;		/* SI1 extended diagnostic mode register */
23438d67a4eSZhao Qiang 	u8 res9[0xBB];
23538d67a4eSZhao Qiang } __attribute__ ((packed)) si1_t;
23638d67a4eSZhao Qiang 
23738d67a4eSZhao Qiang /* SI Routing Tables */
23838d67a4eSZhao Qiang typedef struct sir {
23938d67a4eSZhao Qiang 	u8 tx[0x400];
24038d67a4eSZhao Qiang 	u8 rx[0x400];
24138d67a4eSZhao Qiang 	u8 res0[0x800];
24238d67a4eSZhao Qiang } __attribute__ ((packed)) sir_t;
24338d67a4eSZhao Qiang 
24438d67a4eSZhao Qiang /* USB Controller.  */
24538d67a4eSZhao Qiang typedef struct usb_ctlr {
24638d67a4eSZhao Qiang 	u8 usb_usmod;
24738d67a4eSZhao Qiang 	u8 usb_usadr;
24838d67a4eSZhao Qiang 	u8 usb_uscom;
24938d67a4eSZhao Qiang 	u8 res1[1];
25038d67a4eSZhao Qiang 	u16 usb_usep1;
25138d67a4eSZhao Qiang 	u16 usb_usep2;
25238d67a4eSZhao Qiang 	u16 usb_usep3;
25338d67a4eSZhao Qiang 	u16 usb_usep4;
25438d67a4eSZhao Qiang 	u8 res2[4];
25538d67a4eSZhao Qiang 	u16 usb_usber;
25638d67a4eSZhao Qiang 	u8 res3[2];
25738d67a4eSZhao Qiang 	u16 usb_usbmr;
25838d67a4eSZhao Qiang 	u8 res4[1];
25938d67a4eSZhao Qiang 	u8 usb_usbs;
26038d67a4eSZhao Qiang 	u16 usb_ussft;
26138d67a4eSZhao Qiang 	u8 res5[2];
26238d67a4eSZhao Qiang 	u16 usb_usfrn;
26338d67a4eSZhao Qiang 	u8 res6[0x22];
26438d67a4eSZhao Qiang } __attribute__ ((packed)) usb_t;
26538d67a4eSZhao Qiang 
26638d67a4eSZhao Qiang /* MCC */
26738d67a4eSZhao Qiang typedef struct mcc {
26838d67a4eSZhao Qiang 	u32 mcce;		/* MCC event register */
26938d67a4eSZhao Qiang 	u32 mccm;		/* MCC mask register */
27038d67a4eSZhao Qiang 	u32 mccf;		/* MCC configuration register */
27138d67a4eSZhao Qiang 	u32 merl;		/* MCC emergency request level register */
27238d67a4eSZhao Qiang 	u8 res0[0xF0];
27338d67a4eSZhao Qiang } __attribute__ ((packed)) mcc_t;
27438d67a4eSZhao Qiang 
27538d67a4eSZhao Qiang /* QE UCC Slow */
27638d67a4eSZhao Qiang typedef struct ucc_slow {
27738d67a4eSZhao Qiang 	u32 gumr_l;		/* UCCx general mode register (low) */
27838d67a4eSZhao Qiang 	u32 gumr_h;		/* UCCx general mode register (high) */
27938d67a4eSZhao Qiang 	u16 upsmr;		/* UCCx protocol-specific mode register */
28038d67a4eSZhao Qiang 	u8 res0[0x2];
28138d67a4eSZhao Qiang 	u16 utodr;		/* UCCx transmit on demand register */
28238d67a4eSZhao Qiang 	u16 udsr;		/* UCCx data synchronization register */
28338d67a4eSZhao Qiang 	u16 ucce;		/* UCCx event register */
28438d67a4eSZhao Qiang 	u8 res1[0x2];
28538d67a4eSZhao Qiang 	u16 uccm;		/* UCCx mask register */
28638d67a4eSZhao Qiang 	u8 res2[0x1];
28738d67a4eSZhao Qiang 	u8 uccs;		/* UCCx status register */
28838d67a4eSZhao Qiang 	u8 res3[0x24];
28938d67a4eSZhao Qiang 	u16 utpt;
29038d67a4eSZhao Qiang 	u8 guemr;		/* UCC general extended mode register */
29138d67a4eSZhao Qiang 	u8 res4[0x200 - 0x091];
29238d67a4eSZhao Qiang } __attribute__ ((packed)) ucc_slow_t;
29338d67a4eSZhao Qiang 
29438d67a4eSZhao Qiang typedef struct ucc_mii_mng {
29538d67a4eSZhao Qiang 	u32 miimcfg;		/* MII management configuration reg    */
29638d67a4eSZhao Qiang 	u32 miimcom;		/* MII management command reg          */
29738d67a4eSZhao Qiang 	u32 miimadd;		/* MII management address reg          */
29838d67a4eSZhao Qiang 	u32 miimcon;		/* MII management control reg          */
29938d67a4eSZhao Qiang 	u32 miimstat;		/* MII management status reg           */
30038d67a4eSZhao Qiang 	u32 miimind;		/* MII management indication reg       */
30138d67a4eSZhao Qiang 	u32 ifctl;		/* interface control reg               */
30238d67a4eSZhao Qiang 	u32 ifstat;		/* interface statux reg                */
30338d67a4eSZhao Qiang } __attribute__ ((packed))uec_mii_t;
30438d67a4eSZhao Qiang 
30538d67a4eSZhao Qiang typedef struct ucc_ethernet {
30638d67a4eSZhao Qiang 	u32 maccfg1;		/* mac configuration reg. 1            */
30738d67a4eSZhao Qiang 	u32 maccfg2;		/* mac configuration reg. 2            */
30838d67a4eSZhao Qiang 	u32 ipgifg;		/* interframe gap reg.                 */
30938d67a4eSZhao Qiang 	u32 hafdup;		/* half-duplex reg.                    */
31038d67a4eSZhao Qiang 	u8 res1[0x10];
31138d67a4eSZhao Qiang 	u32 miimcfg;		/* MII management configuration reg    */
31238d67a4eSZhao Qiang 	u32 miimcom;		/* MII management command reg          */
31338d67a4eSZhao Qiang 	u32 miimadd;		/* MII management address reg          */
31438d67a4eSZhao Qiang 	u32 miimcon;		/* MII management control reg          */
31538d67a4eSZhao Qiang 	u32 miimstat;		/* MII management status reg           */
31638d67a4eSZhao Qiang 	u32 miimind;		/* MII management indication reg       */
31738d67a4eSZhao Qiang 	u32 ifctl;		/* interface control reg               */
31838d67a4eSZhao Qiang 	u32 ifstat;		/* interface statux reg                */
31938d67a4eSZhao Qiang 	u32 macstnaddr1;	/* mac station address part 1 reg      */
32038d67a4eSZhao Qiang 	u32 macstnaddr2;	/* mac station address part 2 reg      */
32138d67a4eSZhao Qiang 	u8 res2[0x8];
32238d67a4eSZhao Qiang 	u32 uempr;		/* UCC Ethernet Mac parameter reg      */
32338d67a4eSZhao Qiang 	u32 utbipar;		/* UCC tbi address reg                 */
32438d67a4eSZhao Qiang 	u16 uescr;		/* UCC Ethernet statistics control reg */
32538d67a4eSZhao Qiang 	u8 res3[0x180 - 0x15A];
32638d67a4eSZhao Qiang 	u32 tx64;		/* Total number of frames (including bad
32738d67a4eSZhao Qiang 				 * frames) transmitted that were exactly
32838d67a4eSZhao Qiang 				 * of the minimal length (64 for un tagged,
32938d67a4eSZhao Qiang 				 * 68 for tagged, or with length exactly
33038d67a4eSZhao Qiang 				 * equal to the parameter MINLength */
33138d67a4eSZhao Qiang 	u32 tx127;		/* Total number of frames (including bad
33238d67a4eSZhao Qiang 				 * frames) transmitted that were between
33338d67a4eSZhao Qiang 				 * MINLength (Including FCS length==4)
33438d67a4eSZhao Qiang 				 * and 127 octets */
33538d67a4eSZhao Qiang 	u32 tx255;		/* Total number of frames (including bad
33638d67a4eSZhao Qiang 				 * frames) transmitted that were between
33738d67a4eSZhao Qiang 				 * 128 (Including FCS length==4) and 255
33838d67a4eSZhao Qiang 				 * octets */
33938d67a4eSZhao Qiang 	u32 rx64;		/* Total number of frames received including
34038d67a4eSZhao Qiang 				 * bad frames that were exactly of the
34138d67a4eSZhao Qiang 				 * mninimal length (64 bytes) */
34238d67a4eSZhao Qiang 	u32 rx127;		/* Total number of frames (including bad
34338d67a4eSZhao Qiang 				 * frames) received that were between
34438d67a4eSZhao Qiang 				 * MINLength (Including FCS length==4)
34538d67a4eSZhao Qiang 				 * and 127 octets */
34638d67a4eSZhao Qiang 	u32 rx255;		/* Total number of frames (including
34738d67a4eSZhao Qiang 				 * bad frames) received that were between
34838d67a4eSZhao Qiang 				 * 128 (Including FCS length==4) and 255
34938d67a4eSZhao Qiang 				 * octets */
35038d67a4eSZhao Qiang 	u32 txok;		/* Total number of octets residing in frames
35138d67a4eSZhao Qiang 				 * that where involved in succesfull
35238d67a4eSZhao Qiang 				 * transmission */
35338d67a4eSZhao Qiang 	u16 txcf;		/* Total number of PAUSE control frames
35438d67a4eSZhao Qiang 				 *  transmitted by this MAC */
35538d67a4eSZhao Qiang 	u8 res4[0x2];
35638d67a4eSZhao Qiang 	u32 tmca;		/* Total number of frames that were transmitted
35738d67a4eSZhao Qiang 				 * succesfully with the group address bit set
35838d67a4eSZhao Qiang 				 * that are not broadcast frames */
35938d67a4eSZhao Qiang 	u32 tbca;		/* Total number of frames transmitted
36038d67a4eSZhao Qiang 				 * succesfully that had destination address
36138d67a4eSZhao Qiang 				 * field equal to the broadcast address */
36238d67a4eSZhao Qiang 	u32 rxfok;		/* Total number of frames received OK */
36338d67a4eSZhao Qiang 	u32 rxbok;		/* Total number of octets received OK */
36438d67a4eSZhao Qiang 	u32 rbyt;		/* Total number of octets received including
36538d67a4eSZhao Qiang 				 * octets in bad frames. Must be implemented
36638d67a4eSZhao Qiang 				 * in HW because it includes octets in frames
36738d67a4eSZhao Qiang 				 * that never even reach the UCC */
36838d67a4eSZhao Qiang 	u32 rmca;		/* Total number of frames that were received
36938d67a4eSZhao Qiang 				 * succesfully with the group address bit set
37038d67a4eSZhao Qiang 				 * that are not broadcast frames */
37138d67a4eSZhao Qiang 	u32 rbca;		/* Total number of frames received succesfully
37238d67a4eSZhao Qiang 				 * that had destination address equal to the
37338d67a4eSZhao Qiang 				 * broadcast address */
37438d67a4eSZhao Qiang 	u32 scar;		/* Statistics carry register */
37538d67a4eSZhao Qiang 	u32 scam;		/* Statistics caryy mask register */
37638d67a4eSZhao Qiang 	u8 res5[0x200 - 0x1c4];
37738d67a4eSZhao Qiang } __attribute__ ((packed)) uec_t;
37838d67a4eSZhao Qiang 
37938d67a4eSZhao Qiang /* QE UCC Fast */
38038d67a4eSZhao Qiang typedef struct ucc_fast {
38138d67a4eSZhao Qiang 	u32 gumr;		/* UCCx general mode register */
38238d67a4eSZhao Qiang 	u32 upsmr;		/* UCCx protocol-specific mode register  */
38338d67a4eSZhao Qiang 	u16 utodr;		/* UCCx transmit on demand register  */
38438d67a4eSZhao Qiang 	u8 res0[0x2];
38538d67a4eSZhao Qiang 	u16 udsr;		/* UCCx data synchronization register  */
38638d67a4eSZhao Qiang 	u8 res1[0x2];
38738d67a4eSZhao Qiang 	u32 ucce;		/* UCCx event register */
38838d67a4eSZhao Qiang 	u32 uccm;		/* UCCx mask register.  */
38938d67a4eSZhao Qiang 	u8 uccs;		/* UCCx status register */
39038d67a4eSZhao Qiang 	u8 res2[0x7];
39138d67a4eSZhao Qiang 	u32 urfb;		/* UCC receive FIFO base */
39238d67a4eSZhao Qiang 	u16 urfs;		/* UCC receive FIFO size */
39338d67a4eSZhao Qiang 	u8 res3[0x2];
39438d67a4eSZhao Qiang 	u16 urfet;		/* UCC receive FIFO emergency threshold */
39538d67a4eSZhao Qiang 	u16 urfset;		/* UCC receive FIFO special emergency
39638d67a4eSZhao Qiang 				 * threshold */
39738d67a4eSZhao Qiang 	u32 utfb;		/* UCC transmit FIFO base */
39838d67a4eSZhao Qiang 	u16 utfs;		/* UCC transmit FIFO size */
39938d67a4eSZhao Qiang 	u8 res4[0x2];
40038d67a4eSZhao Qiang 	u16 utfet;		/* UCC transmit FIFO emergency threshold */
40138d67a4eSZhao Qiang 	u8 res5[0x2];
40238d67a4eSZhao Qiang 	u16 utftt;		/* UCC transmit FIFO transmit threshold */
40338d67a4eSZhao Qiang 	u8 res6[0x2];
40438d67a4eSZhao Qiang 	u16 utpt;		/* UCC transmit polling timer */
40538d67a4eSZhao Qiang 	u8 res7[0x2];
40638d67a4eSZhao Qiang 	u32 urtry;		/* UCC retry counter register */
40738d67a4eSZhao Qiang 	u8 res8[0x4C];
40838d67a4eSZhao Qiang 	u8 guemr;		/* UCC general extended mode register */
40938d67a4eSZhao Qiang 	u8 res9[0x100 - 0x091];
41038d67a4eSZhao Qiang 	uec_t ucc_eth;
41138d67a4eSZhao Qiang } __attribute__ ((packed)) ucc_fast_t;
41238d67a4eSZhao Qiang 
41338d67a4eSZhao Qiang /* QE UCC */
41438d67a4eSZhao Qiang typedef struct ucc_common {
41538d67a4eSZhao Qiang 	u8 res1[0x90];
41638d67a4eSZhao Qiang 	u8 guemr;
41738d67a4eSZhao Qiang 	u8 res2[0x200 - 0x091];
41838d67a4eSZhao Qiang } __attribute__ ((packed)) ucc_common_t;
41938d67a4eSZhao Qiang 
42038d67a4eSZhao Qiang typedef struct ucc {
42138d67a4eSZhao Qiang 	union {
42238d67a4eSZhao Qiang 		ucc_slow_t slow;
42338d67a4eSZhao Qiang 		ucc_fast_t fast;
42438d67a4eSZhao Qiang 		ucc_common_t common;
42538d67a4eSZhao Qiang 	};
42638d67a4eSZhao Qiang } __attribute__ ((packed)) ucc_t;
42738d67a4eSZhao Qiang 
42838d67a4eSZhao Qiang /* MultiPHY UTOPIA POS Controllers (UPC) */
42938d67a4eSZhao Qiang typedef struct upc {
43038d67a4eSZhao Qiang 	u32 upgcr;		/* UTOPIA/POS general configuration register */
43138d67a4eSZhao Qiang 	u32 uplpa;		/* UTOPIA/POS last PHY address */
43238d67a4eSZhao Qiang 	u32 uphec;		/* ATM HEC register */
43338d67a4eSZhao Qiang 	u32 upuc;		/* UTOPIA/POS UCC configuration */
43438d67a4eSZhao Qiang 	u32 updc1;		/* UTOPIA/POS device 1 configuration */
43538d67a4eSZhao Qiang 	u32 updc2;		/* UTOPIA/POS device 2 configuration  */
43638d67a4eSZhao Qiang 	u32 updc3;		/* UTOPIA/POS device 3 configuration */
43738d67a4eSZhao Qiang 	u32 updc4;		/* UTOPIA/POS device 4 configuration  */
43838d67a4eSZhao Qiang 	u32 upstpa;		/* UTOPIA/POS STPA threshold  */
43938d67a4eSZhao Qiang 	u8 res0[0xC];
44038d67a4eSZhao Qiang 	u32 updrs1_h;		/* UTOPIA/POS device 1 rate select  */
44138d67a4eSZhao Qiang 	u32 updrs1_l;		/* UTOPIA/POS device 1 rate select  */
44238d67a4eSZhao Qiang 	u32 updrs2_h;		/* UTOPIA/POS device 2 rate select  */
44338d67a4eSZhao Qiang 	u32 updrs2_l;		/* UTOPIA/POS device 2 rate select */
44438d67a4eSZhao Qiang 	u32 updrs3_h;		/* UTOPIA/POS device 3 rate select */
44538d67a4eSZhao Qiang 	u32 updrs3_l;		/* UTOPIA/POS device 3 rate select */
44638d67a4eSZhao Qiang 	u32 updrs4_h;		/* UTOPIA/POS device 4 rate select */
44738d67a4eSZhao Qiang 	u32 updrs4_l;		/* UTOPIA/POS device 4 rate select */
44838d67a4eSZhao Qiang 	u32 updrp1;		/* UTOPIA/POS device 1 receive priority low  */
44938d67a4eSZhao Qiang 	u32 updrp2;		/* UTOPIA/POS device 2 receive priority low  */
45038d67a4eSZhao Qiang 	u32 updrp3;		/* UTOPIA/POS device 3 receive priority low  */
45138d67a4eSZhao Qiang 	u32 updrp4;		/* UTOPIA/POS device 4 receive priority low  */
45238d67a4eSZhao Qiang 	u32 upde1;		/* UTOPIA/POS device 1 event */
45338d67a4eSZhao Qiang 	u32 upde2;		/* UTOPIA/POS device 2 event */
45438d67a4eSZhao Qiang 	u32 upde3;		/* UTOPIA/POS device 3 event */
45538d67a4eSZhao Qiang 	u32 upde4;		/* UTOPIA/POS device 4 event */
45638d67a4eSZhao Qiang 	u16 uprp1;
45738d67a4eSZhao Qiang 	u16 uprp2;
45838d67a4eSZhao Qiang 	u16 uprp3;
45938d67a4eSZhao Qiang 	u16 uprp4;
46038d67a4eSZhao Qiang 	u8 res1[0x8];
46138d67a4eSZhao Qiang 	u16 uptirr1_0;		/* Device 1 transmit internal rate 0 */
46238d67a4eSZhao Qiang 	u16 uptirr1_1;		/* Device 1 transmit internal rate 1 */
46338d67a4eSZhao Qiang 	u16 uptirr1_2;		/* Device 1 transmit internal rate 2 */
46438d67a4eSZhao Qiang 	u16 uptirr1_3;		/* Device 1 transmit internal rate 3 */
46538d67a4eSZhao Qiang 	u16 uptirr2_0;		/* Device 2 transmit internal rate 0 */
46638d67a4eSZhao Qiang 	u16 uptirr2_1;		/* Device 2 transmit internal rate 1 */
46738d67a4eSZhao Qiang 	u16 uptirr2_2;		/* Device 2 transmit internal rate 2 */
46838d67a4eSZhao Qiang 	u16 uptirr2_3;		/* Device 2 transmit internal rate 3 */
46938d67a4eSZhao Qiang 	u16 uptirr3_0;		/* Device 3 transmit internal rate 0 */
47038d67a4eSZhao Qiang 	u16 uptirr3_1;		/* Device 3 transmit internal rate 1 */
47138d67a4eSZhao Qiang 	u16 uptirr3_2;		/* Device 3 transmit internal rate 2 */
47238d67a4eSZhao Qiang 	u16 uptirr3_3;		/* Device 3 transmit internal rate 3 */
47338d67a4eSZhao Qiang 	u16 uptirr4_0;		/* Device 4 transmit internal rate 0 */
47438d67a4eSZhao Qiang 	u16 uptirr4_1;		/* Device 4 transmit internal rate 1 */
47538d67a4eSZhao Qiang 	u16 uptirr4_2;		/* Device 4 transmit internal rate 2 */
47638d67a4eSZhao Qiang 	u16 uptirr4_3;		/* Device 4 transmit internal rate 3 */
47738d67a4eSZhao Qiang 	u32 uper1;		/* Device 1 port enable register */
47838d67a4eSZhao Qiang 	u32 uper2;		/* Device 2 port enable register */
47938d67a4eSZhao Qiang 	u32 uper3;		/* Device 3 port enable register */
48038d67a4eSZhao Qiang 	u32 uper4;		/* Device 4 port enable register */
48138d67a4eSZhao Qiang 	u8 res2[0x150];
48238d67a4eSZhao Qiang } __attribute__ ((packed)) upc_t;
48338d67a4eSZhao Qiang 
48438d67a4eSZhao Qiang /* SDMA */
48538d67a4eSZhao Qiang typedef struct sdma {
48638d67a4eSZhao Qiang 	u32 sdsr;		/* Serial DMA status register */
48738d67a4eSZhao Qiang 	u32 sdmr;		/* Serial DMA mode register */
48838d67a4eSZhao Qiang 	u32 sdtr1;		/* SDMA system bus threshold register */
48938d67a4eSZhao Qiang 	u32 sdtr2;		/* SDMA secondary bus threshold register */
49038d67a4eSZhao Qiang 	u32 sdhy1;		/* SDMA system bus hysteresis register */
49138d67a4eSZhao Qiang 	u32 sdhy2;		/* SDMA secondary bus hysteresis register */
49238d67a4eSZhao Qiang 	u32 sdta1;		/* SDMA system bus address register */
49338d67a4eSZhao Qiang 	u32 sdta2;		/* SDMA secondary bus address register */
49438d67a4eSZhao Qiang 	u32 sdtm1;		/* SDMA system bus MSNUM register */
49538d67a4eSZhao Qiang 	u32 sdtm2;		/* SDMA secondary bus MSNUM register */
49638d67a4eSZhao Qiang 	u8 res0[0x10];
49738d67a4eSZhao Qiang 	u32 sdaqr;		/* SDMA address bus qualify register */
49838d67a4eSZhao Qiang 	u32 sdaqmr;		/* SDMA address bus qualify mask register */
49938d67a4eSZhao Qiang 	u8 res1[0x4];
50038d67a4eSZhao Qiang 	u32 sdwbcr;		/* SDMA CAM entries base register */
50138d67a4eSZhao Qiang 	u8 res2[0x38];
50238d67a4eSZhao Qiang } __attribute__ ((packed)) sdma_t;
50338d67a4eSZhao Qiang 
50438d67a4eSZhao Qiang /* Debug Space */
50538d67a4eSZhao Qiang typedef struct dbg {
50638d67a4eSZhao Qiang 	u32 bpdcr;		/* Breakpoint debug command register */
50738d67a4eSZhao Qiang 	u32 bpdsr;		/* Breakpoint debug status register */
50838d67a4eSZhao Qiang 	u32 bpdmr;		/* Breakpoint debug mask register */
50938d67a4eSZhao Qiang 	u32 bprmrr0;		/* Breakpoint request mode risc register 0 */
51038d67a4eSZhao Qiang 	u32 bprmrr1;		/* Breakpoint request mode risc register 1 */
51138d67a4eSZhao Qiang 	u8 res0[0x8];
51238d67a4eSZhao Qiang 	u32 bprmtr0;		/* Breakpoint request mode trb register 0 */
51338d67a4eSZhao Qiang 	u32 bprmtr1;		/* Breakpoint request mode trb register 1 */
51438d67a4eSZhao Qiang 	u8 res1[0x8];
51538d67a4eSZhao Qiang 	u32 bprmir;		/* Breakpoint request mode immediate register */
51638d67a4eSZhao Qiang 	u32 bprmsr;		/* Breakpoint request mode serial register */
51738d67a4eSZhao Qiang 	u32 bpemr;		/* Breakpoint exit mode register */
51838d67a4eSZhao Qiang 	u8 res2[0x48];
51938d67a4eSZhao Qiang } __attribute__ ((packed)) dbg_t;
52038d67a4eSZhao Qiang 
52138d67a4eSZhao Qiang /*
52238d67a4eSZhao Qiang  * RISC Special Registers (Trap and Breakpoint).  These are described in
52338d67a4eSZhao Qiang  * the QE Developer's Handbook.
52438d67a4eSZhao Qiang */
52538d67a4eSZhao Qiang typedef struct rsp {
52638d67a4eSZhao Qiang 	u32 tibcr[16];	/* Trap/instruction breakpoint control regs */
52738d67a4eSZhao Qiang 	u8 res0[64];
52838d67a4eSZhao Qiang 	u32 ibcr0;
52938d67a4eSZhao Qiang 	u32 ibs0;
53038d67a4eSZhao Qiang 	u32 ibcnr0;
53138d67a4eSZhao Qiang 	u8 res1[4];
53238d67a4eSZhao Qiang 	u32 ibcr1;
53338d67a4eSZhao Qiang 	u32 ibs1;
53438d67a4eSZhao Qiang 	u32 ibcnr1;
53538d67a4eSZhao Qiang 	u32 npcr;
53638d67a4eSZhao Qiang 	u32 dbcr;
53738d67a4eSZhao Qiang 	u32 dbar;
53838d67a4eSZhao Qiang 	u32 dbamr;
53938d67a4eSZhao Qiang 	u32 dbsr;
54038d67a4eSZhao Qiang 	u32 dbcnr;
54138d67a4eSZhao Qiang 	u8 res2[12];
54238d67a4eSZhao Qiang 	u32 dbdr_h;
54338d67a4eSZhao Qiang 	u32 dbdr_l;
54438d67a4eSZhao Qiang 	u32 dbdmr_h;
54538d67a4eSZhao Qiang 	u32 dbdmr_l;
54638d67a4eSZhao Qiang 	u32 bsr;
54738d67a4eSZhao Qiang 	u32 bor;
54838d67a4eSZhao Qiang 	u32 bior;
54938d67a4eSZhao Qiang 	u8 res3[4];
55038d67a4eSZhao Qiang 	u32 iatr[4];
55138d67a4eSZhao Qiang 	u32 eccr;		/* Exception control configuration register */
55238d67a4eSZhao Qiang 	u32 eicr;
55338d67a4eSZhao Qiang 	u8 res4[0x100-0xf8];
55438d67a4eSZhao Qiang } __attribute__ ((packed)) rsp_t;
55538d67a4eSZhao Qiang 
55638d67a4eSZhao Qiang typedef struct qe_immap {
55738d67a4eSZhao Qiang 	qe_iram_t iram;		/* I-RAM */
55838d67a4eSZhao Qiang 	qe_ic_t ic;		/* Interrupt Controller */
55938d67a4eSZhao Qiang 	cp_qe_t cp;		/* Communications Processor */
56038d67a4eSZhao Qiang 	qe_mux_t qmx;		/* QE Multiplexer */
56138d67a4eSZhao Qiang 	qe_timers_t qet;	/* QE Timers */
56238d67a4eSZhao Qiang 	spi_t spi[0x2];		/* spi  */
56338d67a4eSZhao Qiang 	mcc_t mcc;		/* mcc */
56438d67a4eSZhao Qiang 	qe_brg_t brg;		/* brg */
56538d67a4eSZhao Qiang 	usb_t usb;		/* USB */
56638d67a4eSZhao Qiang 	si1_t si1;		/* SI */
56738d67a4eSZhao Qiang 	u8 res11[0x800];
56838d67a4eSZhao Qiang 	sir_t sir;		/* SI Routing Tables  */
56938d67a4eSZhao Qiang 	ucc_t ucc1;		/* ucc1 */
57038d67a4eSZhao Qiang 	ucc_t ucc3;		/* ucc3 */
57138d67a4eSZhao Qiang 	ucc_t ucc5;		/* ucc5 */
57238d67a4eSZhao Qiang 	ucc_t ucc7;		/* ucc7 */
57338d67a4eSZhao Qiang 	u8 res12[0x600];
57438d67a4eSZhao Qiang 	upc_t upc1;		/* MultiPHY UTOPIA POS Controller 1 */
57538d67a4eSZhao Qiang 	ucc_t ucc2;		/* ucc2 */
57638d67a4eSZhao Qiang 	ucc_t ucc4;		/* ucc4 */
57738d67a4eSZhao Qiang 	ucc_t ucc6;		/* ucc6 */
57838d67a4eSZhao Qiang 	ucc_t ucc8;		/* ucc8 */
57938d67a4eSZhao Qiang 	u8 res13[0x600];
58038d67a4eSZhao Qiang 	upc_t upc2;		/* MultiPHY UTOPIA POS Controller 2 */
58138d67a4eSZhao Qiang 	sdma_t sdma;		/* SDMA */
58238d67a4eSZhao Qiang 	dbg_t dbg;		/* Debug Space */
58338d67a4eSZhao Qiang 	rsp_t rsp[0x2];		/* RISC Special Registers
58438d67a4eSZhao Qiang 				 * (Trap and Breakpoint) */
58538d67a4eSZhao Qiang 	u8 res14[0x300];
58638d67a4eSZhao Qiang 	u8 res15[0x3A00];
58738d67a4eSZhao Qiang 	u8 res16[0x8000];	/* 0x108000 -  0x110000 */
58838d67a4eSZhao Qiang 	u8 muram[QE_MURAM_SIZE];
58938d67a4eSZhao Qiang } __attribute__ ((packed)) qe_map_t;
59038d67a4eSZhao Qiang 
59138d67a4eSZhao Qiang extern qe_map_t *qe_immr;
59238d67a4eSZhao Qiang 
59338d67a4eSZhao Qiang #endif				/* __IMMAP_QE_H__ */
594