162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Communication Processor Module v2.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * This file contains structures and information for the communication
662306a36Sopenharmony_ci * processor channels found in the dual port RAM or parameter RAM.
762306a36Sopenharmony_ci * All CPM control and status is available through the CPM2 internal
862306a36Sopenharmony_ci * memory map.  See immap_cpm2.h for details.
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci#ifdef __KERNEL__
1162306a36Sopenharmony_ci#ifndef __CPM2__
1262306a36Sopenharmony_ci#define __CPM2__
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#include <asm/immap_cpm2.h>
1562306a36Sopenharmony_ci#include <asm/cpm.h>
1662306a36Sopenharmony_ci#include <sysdev/fsl_soc.h>
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci/* CPM Command register.
1962306a36Sopenharmony_ci*/
2062306a36Sopenharmony_ci#define CPM_CR_RST	((uint)0x80000000)
2162306a36Sopenharmony_ci#define CPM_CR_PAGE	((uint)0x7c000000)
2262306a36Sopenharmony_ci#define CPM_CR_SBLOCK	((uint)0x03e00000)
2362306a36Sopenharmony_ci#define CPM_CR_FLG	((uint)0x00010000)
2462306a36Sopenharmony_ci#define CPM_CR_MCN	((uint)0x00003fc0)
2562306a36Sopenharmony_ci#define CPM_CR_OPCODE	((uint)0x0000000f)
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/* Device sub-block and page codes.
2862306a36Sopenharmony_ci*/
2962306a36Sopenharmony_ci#define CPM_CR_SCC1_SBLOCK	(0x04)
3062306a36Sopenharmony_ci#define CPM_CR_SCC2_SBLOCK	(0x05)
3162306a36Sopenharmony_ci#define CPM_CR_SCC3_SBLOCK	(0x06)
3262306a36Sopenharmony_ci#define CPM_CR_SCC4_SBLOCK	(0x07)
3362306a36Sopenharmony_ci#define CPM_CR_SMC1_SBLOCK	(0x08)
3462306a36Sopenharmony_ci#define CPM_CR_SMC2_SBLOCK	(0x09)
3562306a36Sopenharmony_ci#define CPM_CR_SPI_SBLOCK	(0x0a)
3662306a36Sopenharmony_ci#define CPM_CR_I2C_SBLOCK	(0x0b)
3762306a36Sopenharmony_ci#define CPM_CR_TIMER_SBLOCK	(0x0f)
3862306a36Sopenharmony_ci#define CPM_CR_RAND_SBLOCK	(0x0e)
3962306a36Sopenharmony_ci#define CPM_CR_FCC1_SBLOCK	(0x10)
4062306a36Sopenharmony_ci#define CPM_CR_FCC2_SBLOCK	(0x11)
4162306a36Sopenharmony_ci#define CPM_CR_FCC3_SBLOCK	(0x12)
4262306a36Sopenharmony_ci#define CPM_CR_IDMA1_SBLOCK	(0x14)
4362306a36Sopenharmony_ci#define CPM_CR_IDMA2_SBLOCK	(0x15)
4462306a36Sopenharmony_ci#define CPM_CR_IDMA3_SBLOCK	(0x16)
4562306a36Sopenharmony_ci#define CPM_CR_IDMA4_SBLOCK	(0x17)
4662306a36Sopenharmony_ci#define CPM_CR_MCC1_SBLOCK	(0x1c)
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#define CPM_CR_FCC_SBLOCK(x)	(x + 0x10)
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#define CPM_CR_SCC1_PAGE	(0x00)
5162306a36Sopenharmony_ci#define CPM_CR_SCC2_PAGE	(0x01)
5262306a36Sopenharmony_ci#define CPM_CR_SCC3_PAGE	(0x02)
5362306a36Sopenharmony_ci#define CPM_CR_SCC4_PAGE	(0x03)
5462306a36Sopenharmony_ci#define CPM_CR_SMC1_PAGE	(0x07)
5562306a36Sopenharmony_ci#define CPM_CR_SMC2_PAGE	(0x08)
5662306a36Sopenharmony_ci#define CPM_CR_SPI_PAGE		(0x09)
5762306a36Sopenharmony_ci#define CPM_CR_I2C_PAGE		(0x0a)
5862306a36Sopenharmony_ci#define CPM_CR_TIMER_PAGE	(0x0a)
5962306a36Sopenharmony_ci#define CPM_CR_RAND_PAGE	(0x0a)
6062306a36Sopenharmony_ci#define CPM_CR_FCC1_PAGE	(0x04)
6162306a36Sopenharmony_ci#define CPM_CR_FCC2_PAGE	(0x05)
6262306a36Sopenharmony_ci#define CPM_CR_FCC3_PAGE	(0x06)
6362306a36Sopenharmony_ci#define CPM_CR_IDMA1_PAGE	(0x07)
6462306a36Sopenharmony_ci#define CPM_CR_IDMA2_PAGE	(0x08)
6562306a36Sopenharmony_ci#define CPM_CR_IDMA3_PAGE	(0x09)
6662306a36Sopenharmony_ci#define CPM_CR_IDMA4_PAGE	(0x0a)
6762306a36Sopenharmony_ci#define CPM_CR_MCC1_PAGE	(0x07)
6862306a36Sopenharmony_ci#define CPM_CR_MCC2_PAGE	(0x08)
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#define CPM_CR_FCC_PAGE(x)	(x + 0x04)
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci/* CPM2-specific opcodes (see cpm.h for common opcodes)
7362306a36Sopenharmony_ci*/
7462306a36Sopenharmony_ci#define CPM_CR_START_IDMA	((ushort)0x0009)
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci#define mk_cr_cmd(PG, SBC, MCN, OP) \
7762306a36Sopenharmony_ci	((PG << 26) | (SBC << 21) | (MCN << 6) | OP)
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci/* The number of pages of host memory we allocate for CPM.  This is
8062306a36Sopenharmony_ci * done early in kernel initialization to get physically contiguous
8162306a36Sopenharmony_ci * pages.
8262306a36Sopenharmony_ci */
8362306a36Sopenharmony_ci#define NUM_CPM_HOST_PAGES	2
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci/* Export the base address of the communication processor registers
8662306a36Sopenharmony_ci * and dual port ram.
8762306a36Sopenharmony_ci */
8862306a36Sopenharmony_ciextern cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor */
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci#define cpm_dpalloc cpm_muram_alloc
9162306a36Sopenharmony_ci#define cpm_dpfree cpm_muram_free
9262306a36Sopenharmony_ci#define cpm_dpram_addr cpm_muram_addr
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ciextern void cpm2_reset(void);
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci/* Baud rate generators.
9762306a36Sopenharmony_ci*/
9862306a36Sopenharmony_ci#define CPM_BRG_RST		((uint)0x00020000)
9962306a36Sopenharmony_ci#define CPM_BRG_EN		((uint)0x00010000)
10062306a36Sopenharmony_ci#define CPM_BRG_EXTC_INT	((uint)0x00000000)
10162306a36Sopenharmony_ci#define CPM_BRG_EXTC_CLK3_9	((uint)0x00004000)
10262306a36Sopenharmony_ci#define CPM_BRG_EXTC_CLK5_15	((uint)0x00008000)
10362306a36Sopenharmony_ci#define CPM_BRG_ATB		((uint)0x00002000)
10462306a36Sopenharmony_ci#define CPM_BRG_CD_MASK		((uint)0x00001ffe)
10562306a36Sopenharmony_ci#define CPM_BRG_DIV16		((uint)0x00000001)
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci#define CPM2_BRG_INT_CLK	(get_brgfreq())
10862306a36Sopenharmony_ci#define CPM2_BRG_UART_CLK	(CPM2_BRG_INT_CLK/16)
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ciextern void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src);
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci/* This function is used by UARTS, or anything else that uses a 16x
11362306a36Sopenharmony_ci * oversampled clock.
11462306a36Sopenharmony_ci */
11562306a36Sopenharmony_cistatic inline void cpm_setbrg(uint brg, uint rate)
11662306a36Sopenharmony_ci{
11762306a36Sopenharmony_ci	__cpm2_setbrg(brg, rate, CPM2_BRG_UART_CLK, 0, CPM_BRG_EXTC_INT);
11862306a36Sopenharmony_ci}
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci/* This function is used to set high speed synchronous baud rate
12162306a36Sopenharmony_ci * clocks.
12262306a36Sopenharmony_ci */
12362306a36Sopenharmony_cistatic inline void cpm2_fastbrg(uint brg, uint rate, int div16)
12462306a36Sopenharmony_ci{
12562306a36Sopenharmony_ci	__cpm2_setbrg(brg, rate, CPM2_BRG_INT_CLK, div16, CPM_BRG_EXTC_INT);
12662306a36Sopenharmony_ci}
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci/* Parameter RAM offsets from the base.
12962306a36Sopenharmony_ci*/
13062306a36Sopenharmony_ci#define PROFF_SCC1		((uint)0x8000)
13162306a36Sopenharmony_ci#define PROFF_SCC2		((uint)0x8100)
13262306a36Sopenharmony_ci#define PROFF_SCC3		((uint)0x8200)
13362306a36Sopenharmony_ci#define PROFF_SCC4		((uint)0x8300)
13462306a36Sopenharmony_ci#define PROFF_FCC1		((uint)0x8400)
13562306a36Sopenharmony_ci#define PROFF_FCC2		((uint)0x8500)
13662306a36Sopenharmony_ci#define PROFF_FCC3		((uint)0x8600)
13762306a36Sopenharmony_ci#define PROFF_MCC1		((uint)0x8700)
13862306a36Sopenharmony_ci#define PROFF_SMC1_BASE		((uint)0x87fc)
13962306a36Sopenharmony_ci#define PROFF_IDMA1_BASE	((uint)0x87fe)
14062306a36Sopenharmony_ci#define PROFF_MCC2		((uint)0x8800)
14162306a36Sopenharmony_ci#define PROFF_SMC2_BASE		((uint)0x88fc)
14262306a36Sopenharmony_ci#define PROFF_IDMA2_BASE	((uint)0x88fe)
14362306a36Sopenharmony_ci#define PROFF_SPI_BASE		((uint)0x89fc)
14462306a36Sopenharmony_ci#define PROFF_IDMA3_BASE	((uint)0x89fe)
14562306a36Sopenharmony_ci#define PROFF_TIMERS		((uint)0x8ae0)
14662306a36Sopenharmony_ci#define PROFF_REVNUM		((uint)0x8af0)
14762306a36Sopenharmony_ci#define PROFF_RAND		((uint)0x8af8)
14862306a36Sopenharmony_ci#define PROFF_I2C_BASE		((uint)0x8afc)
14962306a36Sopenharmony_ci#define PROFF_IDMA4_BASE	((uint)0x8afe)
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ci#define PROFF_SCC_SIZE		((uint)0x100)
15262306a36Sopenharmony_ci#define PROFF_FCC_SIZE		((uint)0x100)
15362306a36Sopenharmony_ci#define PROFF_SMC_SIZE		((uint)64)
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci/* The SMCs are relocated to any of the first eight DPRAM pages.
15662306a36Sopenharmony_ci * We will fix these at the first locations of DPRAM, until we
15762306a36Sopenharmony_ci * get some microcode patches :-).
15862306a36Sopenharmony_ci * The parameter ram space for the SMCs is fifty-some bytes, and
15962306a36Sopenharmony_ci * they are required to start on a 64 byte boundary.
16062306a36Sopenharmony_ci */
16162306a36Sopenharmony_ci#define PROFF_SMC1	(0)
16262306a36Sopenharmony_ci#define PROFF_SMC2	(64)
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ci/* Define enough so I can at least use the serial port as a UART.
16662306a36Sopenharmony_ci */
16762306a36Sopenharmony_citypedef struct smc_uart {
16862306a36Sopenharmony_ci	ushort	smc_rbase;	/* Rx Buffer descriptor base address */
16962306a36Sopenharmony_ci	ushort	smc_tbase;	/* Tx Buffer descriptor base address */
17062306a36Sopenharmony_ci	u_char	smc_rfcr;	/* Rx function code */
17162306a36Sopenharmony_ci	u_char	smc_tfcr;	/* Tx function code */
17262306a36Sopenharmony_ci	ushort	smc_mrblr;	/* Max receive buffer length */
17362306a36Sopenharmony_ci	uint	smc_rstate;	/* Internal */
17462306a36Sopenharmony_ci	uint	smc_idp;	/* Internal */
17562306a36Sopenharmony_ci	ushort	smc_rbptr;	/* Internal */
17662306a36Sopenharmony_ci	ushort	smc_ibc;	/* Internal */
17762306a36Sopenharmony_ci	uint	smc_rxtmp;	/* Internal */
17862306a36Sopenharmony_ci	uint	smc_tstate;	/* Internal */
17962306a36Sopenharmony_ci	uint	smc_tdp;	/* Internal */
18062306a36Sopenharmony_ci	ushort	smc_tbptr;	/* Internal */
18162306a36Sopenharmony_ci	ushort	smc_tbc;	/* Internal */
18262306a36Sopenharmony_ci	uint	smc_txtmp;	/* Internal */
18362306a36Sopenharmony_ci	ushort	smc_maxidl;	/* Maximum idle characters */
18462306a36Sopenharmony_ci	ushort	smc_tmpidl;	/* Temporary idle counter */
18562306a36Sopenharmony_ci	ushort	smc_brklen;	/* Last received break length */
18662306a36Sopenharmony_ci	ushort	smc_brkec;	/* rcv'd break condition counter */
18762306a36Sopenharmony_ci	ushort	smc_brkcr;	/* xmt break count register */
18862306a36Sopenharmony_ci	ushort	smc_rmask;	/* Temporary bit mask */
18962306a36Sopenharmony_ci	uint	smc_stmp;	/* SDMA Temp */
19062306a36Sopenharmony_ci} smc_uart_t;
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci/* SMC uart mode register (Internal memory map).
19362306a36Sopenharmony_ci*/
19462306a36Sopenharmony_ci#define SMCMR_REN	((ushort)0x0001)
19562306a36Sopenharmony_ci#define SMCMR_TEN	((ushort)0x0002)
19662306a36Sopenharmony_ci#define SMCMR_DM	((ushort)0x000c)
19762306a36Sopenharmony_ci#define SMCMR_SM_GCI	((ushort)0x0000)
19862306a36Sopenharmony_ci#define SMCMR_SM_UART	((ushort)0x0020)
19962306a36Sopenharmony_ci#define SMCMR_SM_TRANS	((ushort)0x0030)
20062306a36Sopenharmony_ci#define SMCMR_SM_MASK	((ushort)0x0030)
20162306a36Sopenharmony_ci#define SMCMR_PM_EVEN	((ushort)0x0100)	/* Even parity, else odd */
20262306a36Sopenharmony_ci#define SMCMR_REVD	SMCMR_PM_EVEN
20362306a36Sopenharmony_ci#define SMCMR_PEN	((ushort)0x0200)	/* Parity enable */
20462306a36Sopenharmony_ci#define SMCMR_BS	SMCMR_PEN
20562306a36Sopenharmony_ci#define SMCMR_SL	((ushort)0x0400)	/* Two stops, else one */
20662306a36Sopenharmony_ci#define SMCR_CLEN_MASK	((ushort)0x7800)	/* Character length */
20762306a36Sopenharmony_ci#define smcr_mk_clen(C)	(((C) << 11) & SMCR_CLEN_MASK)
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ci/* SMC Event and Mask register.
21062306a36Sopenharmony_ci*/
21162306a36Sopenharmony_ci#define SMCM_BRKE       ((unsigned char)0x40)   /* When in UART Mode */
21262306a36Sopenharmony_ci#define SMCM_BRK        ((unsigned char)0x10)   /* When in UART Mode */
21362306a36Sopenharmony_ci#define SMCM_TXE	((unsigned char)0x10)
21462306a36Sopenharmony_ci#define SMCM_BSY	((unsigned char)0x04)
21562306a36Sopenharmony_ci#define SMCM_TX		((unsigned char)0x02)
21662306a36Sopenharmony_ci#define SMCM_RX		((unsigned char)0x01)
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci/* SCCs.
21962306a36Sopenharmony_ci*/
22062306a36Sopenharmony_ci#define SCC_GSMRH_IRP		((uint)0x00040000)
22162306a36Sopenharmony_ci#define SCC_GSMRH_GDE		((uint)0x00010000)
22262306a36Sopenharmony_ci#define SCC_GSMRH_TCRC_CCITT	((uint)0x00008000)
22362306a36Sopenharmony_ci#define SCC_GSMRH_TCRC_BISYNC	((uint)0x00004000)
22462306a36Sopenharmony_ci#define SCC_GSMRH_TCRC_HDLC	((uint)0x00000000)
22562306a36Sopenharmony_ci#define SCC_GSMRH_REVD		((uint)0x00002000)
22662306a36Sopenharmony_ci#define SCC_GSMRH_TRX		((uint)0x00001000)
22762306a36Sopenharmony_ci#define SCC_GSMRH_TTX		((uint)0x00000800)
22862306a36Sopenharmony_ci#define SCC_GSMRH_CDP		((uint)0x00000400)
22962306a36Sopenharmony_ci#define SCC_GSMRH_CTSP		((uint)0x00000200)
23062306a36Sopenharmony_ci#define SCC_GSMRH_CDS		((uint)0x00000100)
23162306a36Sopenharmony_ci#define SCC_GSMRH_CTSS		((uint)0x00000080)
23262306a36Sopenharmony_ci#define SCC_GSMRH_TFL		((uint)0x00000040)
23362306a36Sopenharmony_ci#define SCC_GSMRH_RFW		((uint)0x00000020)
23462306a36Sopenharmony_ci#define SCC_GSMRH_TXSY		((uint)0x00000010)
23562306a36Sopenharmony_ci#define SCC_GSMRH_SYNL16	((uint)0x0000000c)
23662306a36Sopenharmony_ci#define SCC_GSMRH_SYNL8		((uint)0x00000008)
23762306a36Sopenharmony_ci#define SCC_GSMRH_SYNL4		((uint)0x00000004)
23862306a36Sopenharmony_ci#define SCC_GSMRH_RTSM		((uint)0x00000002)
23962306a36Sopenharmony_ci#define SCC_GSMRH_RSYN		((uint)0x00000001)
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ci#define SCC_GSMRL_SIR		((uint)0x80000000)	/* SCC2 only */
24262306a36Sopenharmony_ci#define SCC_GSMRL_EDGE_NONE	((uint)0x60000000)
24362306a36Sopenharmony_ci#define SCC_GSMRL_EDGE_NEG	((uint)0x40000000)
24462306a36Sopenharmony_ci#define SCC_GSMRL_EDGE_POS	((uint)0x20000000)
24562306a36Sopenharmony_ci#define SCC_GSMRL_EDGE_BOTH	((uint)0x00000000)
24662306a36Sopenharmony_ci#define SCC_GSMRL_TCI		((uint)0x10000000)
24762306a36Sopenharmony_ci#define SCC_GSMRL_TSNC_3	((uint)0x0c000000)
24862306a36Sopenharmony_ci#define SCC_GSMRL_TSNC_4	((uint)0x08000000)
24962306a36Sopenharmony_ci#define SCC_GSMRL_TSNC_14	((uint)0x04000000)
25062306a36Sopenharmony_ci#define SCC_GSMRL_TSNC_INF	((uint)0x00000000)
25162306a36Sopenharmony_ci#define SCC_GSMRL_RINV		((uint)0x02000000)
25262306a36Sopenharmony_ci#define SCC_GSMRL_TINV		((uint)0x01000000)
25362306a36Sopenharmony_ci#define SCC_GSMRL_TPL_128	((uint)0x00c00000)
25462306a36Sopenharmony_ci#define SCC_GSMRL_TPL_64	((uint)0x00a00000)
25562306a36Sopenharmony_ci#define SCC_GSMRL_TPL_48	((uint)0x00800000)
25662306a36Sopenharmony_ci#define SCC_GSMRL_TPL_32	((uint)0x00600000)
25762306a36Sopenharmony_ci#define SCC_GSMRL_TPL_16	((uint)0x00400000)
25862306a36Sopenharmony_ci#define SCC_GSMRL_TPL_8		((uint)0x00200000)
25962306a36Sopenharmony_ci#define SCC_GSMRL_TPL_NONE	((uint)0x00000000)
26062306a36Sopenharmony_ci#define SCC_GSMRL_TPP_ALL1	((uint)0x00180000)
26162306a36Sopenharmony_ci#define SCC_GSMRL_TPP_01	((uint)0x00100000)
26262306a36Sopenharmony_ci#define SCC_GSMRL_TPP_10	((uint)0x00080000)
26362306a36Sopenharmony_ci#define SCC_GSMRL_TPP_ZEROS	((uint)0x00000000)
26462306a36Sopenharmony_ci#define SCC_GSMRL_TEND		((uint)0x00040000)
26562306a36Sopenharmony_ci#define SCC_GSMRL_TDCR_32	((uint)0x00030000)
26662306a36Sopenharmony_ci#define SCC_GSMRL_TDCR_16	((uint)0x00020000)
26762306a36Sopenharmony_ci#define SCC_GSMRL_TDCR_8	((uint)0x00010000)
26862306a36Sopenharmony_ci#define SCC_GSMRL_TDCR_1	((uint)0x00000000)
26962306a36Sopenharmony_ci#define SCC_GSMRL_RDCR_32	((uint)0x0000c000)
27062306a36Sopenharmony_ci#define SCC_GSMRL_RDCR_16	((uint)0x00008000)
27162306a36Sopenharmony_ci#define SCC_GSMRL_RDCR_8	((uint)0x00004000)
27262306a36Sopenharmony_ci#define SCC_GSMRL_RDCR_1	((uint)0x00000000)
27362306a36Sopenharmony_ci#define SCC_GSMRL_RENC_DFMAN	((uint)0x00003000)
27462306a36Sopenharmony_ci#define SCC_GSMRL_RENC_MANCH	((uint)0x00002000)
27562306a36Sopenharmony_ci#define SCC_GSMRL_RENC_FM0	((uint)0x00001000)
27662306a36Sopenharmony_ci#define SCC_GSMRL_RENC_NRZI	((uint)0x00000800)
27762306a36Sopenharmony_ci#define SCC_GSMRL_RENC_NRZ	((uint)0x00000000)
27862306a36Sopenharmony_ci#define SCC_GSMRL_TENC_DFMAN	((uint)0x00000600)
27962306a36Sopenharmony_ci#define SCC_GSMRL_TENC_MANCH	((uint)0x00000400)
28062306a36Sopenharmony_ci#define SCC_GSMRL_TENC_FM0	((uint)0x00000200)
28162306a36Sopenharmony_ci#define SCC_GSMRL_TENC_NRZI	((uint)0x00000100)
28262306a36Sopenharmony_ci#define SCC_GSMRL_TENC_NRZ	((uint)0x00000000)
28362306a36Sopenharmony_ci#define SCC_GSMRL_DIAG_LE	((uint)0x000000c0)	/* Loop and echo */
28462306a36Sopenharmony_ci#define SCC_GSMRL_DIAG_ECHO	((uint)0x00000080)
28562306a36Sopenharmony_ci#define SCC_GSMRL_DIAG_LOOP	((uint)0x00000040)
28662306a36Sopenharmony_ci#define SCC_GSMRL_DIAG_NORM	((uint)0x00000000)
28762306a36Sopenharmony_ci#define SCC_GSMRL_ENR		((uint)0x00000020)
28862306a36Sopenharmony_ci#define SCC_GSMRL_ENT		((uint)0x00000010)
28962306a36Sopenharmony_ci#define SCC_GSMRL_MODE_ENET	((uint)0x0000000c)
29062306a36Sopenharmony_ci#define SCC_GSMRL_MODE_DDCMP	((uint)0x00000009)
29162306a36Sopenharmony_ci#define SCC_GSMRL_MODE_BISYNC	((uint)0x00000008)
29262306a36Sopenharmony_ci#define SCC_GSMRL_MODE_V14	((uint)0x00000007)
29362306a36Sopenharmony_ci#define SCC_GSMRL_MODE_AHDLC	((uint)0x00000006)
29462306a36Sopenharmony_ci#define SCC_GSMRL_MODE_PROFIBUS	((uint)0x00000005)
29562306a36Sopenharmony_ci#define SCC_GSMRL_MODE_UART	((uint)0x00000004)
29662306a36Sopenharmony_ci#define SCC_GSMRL_MODE_SS7	((uint)0x00000003)
29762306a36Sopenharmony_ci#define SCC_GSMRL_MODE_ATALK	((uint)0x00000002)
29862306a36Sopenharmony_ci#define SCC_GSMRL_MODE_HDLC	((uint)0x00000000)
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_ci#define SCC_TODR_TOD		((ushort)0x8000)
30162306a36Sopenharmony_ci
30262306a36Sopenharmony_ci/* SCC Event and Mask register.
30362306a36Sopenharmony_ci*/
30462306a36Sopenharmony_ci#define SCCM_TXE	((unsigned char)0x10)
30562306a36Sopenharmony_ci#define SCCM_BSY	((unsigned char)0x04)
30662306a36Sopenharmony_ci#define SCCM_TX		((unsigned char)0x02)
30762306a36Sopenharmony_ci#define SCCM_RX		((unsigned char)0x01)
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_citypedef struct scc_param {
31062306a36Sopenharmony_ci	ushort	scc_rbase;	/* Rx Buffer descriptor base address */
31162306a36Sopenharmony_ci	ushort	scc_tbase;	/* Tx Buffer descriptor base address */
31262306a36Sopenharmony_ci	u_char	scc_rfcr;	/* Rx function code */
31362306a36Sopenharmony_ci	u_char	scc_tfcr;	/* Tx function code */
31462306a36Sopenharmony_ci	ushort	scc_mrblr;	/* Max receive buffer length */
31562306a36Sopenharmony_ci	uint	scc_rstate;	/* Internal */
31662306a36Sopenharmony_ci	uint	scc_idp;	/* Internal */
31762306a36Sopenharmony_ci	ushort	scc_rbptr;	/* Internal */
31862306a36Sopenharmony_ci	ushort	scc_ibc;	/* Internal */
31962306a36Sopenharmony_ci	uint	scc_rxtmp;	/* Internal */
32062306a36Sopenharmony_ci	uint	scc_tstate;	/* Internal */
32162306a36Sopenharmony_ci	uint	scc_tdp;	/* Internal */
32262306a36Sopenharmony_ci	ushort	scc_tbptr;	/* Internal */
32362306a36Sopenharmony_ci	ushort	scc_tbc;	/* Internal */
32462306a36Sopenharmony_ci	uint	scc_txtmp;	/* Internal */
32562306a36Sopenharmony_ci	uint	scc_rcrc;	/* Internal */
32662306a36Sopenharmony_ci	uint	scc_tcrc;	/* Internal */
32762306a36Sopenharmony_ci} sccp_t;
32862306a36Sopenharmony_ci
32962306a36Sopenharmony_ci/* Function code bits.
33062306a36Sopenharmony_ci*/
33162306a36Sopenharmony_ci#define SCC_EB	((u_char) 0x10)	/* Set big endian byte order */
33262306a36Sopenharmony_ci#define SCC_GBL	((u_char) 0x20) /* Snooping enabled */
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ci/* CPM Ethernet through SCC1.
33562306a36Sopenharmony_ci */
33662306a36Sopenharmony_citypedef struct scc_enet {
33762306a36Sopenharmony_ci	sccp_t	sen_genscc;
33862306a36Sopenharmony_ci	uint	sen_cpres;	/* Preset CRC */
33962306a36Sopenharmony_ci	uint	sen_cmask;	/* Constant mask for CRC */
34062306a36Sopenharmony_ci	uint	sen_crcec;	/* CRC Error counter */
34162306a36Sopenharmony_ci	uint	sen_alec;	/* alignment error counter */
34262306a36Sopenharmony_ci	uint	sen_disfc;	/* discard frame counter */
34362306a36Sopenharmony_ci	ushort	sen_pads;	/* Tx short frame pad character */
34462306a36Sopenharmony_ci	ushort	sen_retlim;	/* Retry limit threshold */
34562306a36Sopenharmony_ci	ushort	sen_retcnt;	/* Retry limit counter */
34662306a36Sopenharmony_ci	ushort	sen_maxflr;	/* maximum frame length register */
34762306a36Sopenharmony_ci	ushort	sen_minflr;	/* minimum frame length register */
34862306a36Sopenharmony_ci	ushort	sen_maxd1;	/* maximum DMA1 length */
34962306a36Sopenharmony_ci	ushort	sen_maxd2;	/* maximum DMA2 length */
35062306a36Sopenharmony_ci	ushort	sen_maxd;	/* Rx max DMA */
35162306a36Sopenharmony_ci	ushort	sen_dmacnt;	/* Rx DMA counter */
35262306a36Sopenharmony_ci	ushort	sen_maxb;	/* Max BD byte count */
35362306a36Sopenharmony_ci	ushort	sen_gaddr1;	/* Group address filter */
35462306a36Sopenharmony_ci	ushort	sen_gaddr2;
35562306a36Sopenharmony_ci	ushort	sen_gaddr3;
35662306a36Sopenharmony_ci	ushort	sen_gaddr4;
35762306a36Sopenharmony_ci	uint	sen_tbuf0data0;	/* Save area 0 - current frame */
35862306a36Sopenharmony_ci	uint	sen_tbuf0data1;	/* Save area 1 - current frame */
35962306a36Sopenharmony_ci	uint	sen_tbuf0rba;	/* Internal */
36062306a36Sopenharmony_ci	uint	sen_tbuf0crc;	/* Internal */
36162306a36Sopenharmony_ci	ushort	sen_tbuf0bcnt;	/* Internal */
36262306a36Sopenharmony_ci	ushort	sen_paddrh;	/* physical address (MSB) */
36362306a36Sopenharmony_ci	ushort	sen_paddrm;
36462306a36Sopenharmony_ci	ushort	sen_paddrl;	/* physical address (LSB) */
36562306a36Sopenharmony_ci	ushort	sen_pper;	/* persistence */
36662306a36Sopenharmony_ci	ushort	sen_rfbdptr;	/* Rx first BD pointer */
36762306a36Sopenharmony_ci	ushort	sen_tfbdptr;	/* Tx first BD pointer */
36862306a36Sopenharmony_ci	ushort	sen_tlbdptr;	/* Tx last BD pointer */
36962306a36Sopenharmony_ci	uint	sen_tbuf1data0;	/* Save area 0 - current frame */
37062306a36Sopenharmony_ci	uint	sen_tbuf1data1;	/* Save area 1 - current frame */
37162306a36Sopenharmony_ci	uint	sen_tbuf1rba;	/* Internal */
37262306a36Sopenharmony_ci	uint	sen_tbuf1crc;	/* Internal */
37362306a36Sopenharmony_ci	ushort	sen_tbuf1bcnt;	/* Internal */
37462306a36Sopenharmony_ci	ushort	sen_txlen;	/* Tx Frame length counter */
37562306a36Sopenharmony_ci	ushort	sen_iaddr1;	/* Individual address filter */
37662306a36Sopenharmony_ci	ushort	sen_iaddr2;
37762306a36Sopenharmony_ci	ushort	sen_iaddr3;
37862306a36Sopenharmony_ci	ushort	sen_iaddr4;
37962306a36Sopenharmony_ci	ushort	sen_boffcnt;	/* Backoff counter */
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ci	/* NOTE: Some versions of the manual have the following items
38262306a36Sopenharmony_ci	 * incorrectly documented.  Below is the proper order.
38362306a36Sopenharmony_ci	 */
38462306a36Sopenharmony_ci	ushort	sen_taddrh;	/* temp address (MSB) */
38562306a36Sopenharmony_ci	ushort	sen_taddrm;
38662306a36Sopenharmony_ci	ushort	sen_taddrl;	/* temp address (LSB) */
38762306a36Sopenharmony_ci} scc_enet_t;
38862306a36Sopenharmony_ci
38962306a36Sopenharmony_ci
39062306a36Sopenharmony_ci/* SCC Event register as used by Ethernet.
39162306a36Sopenharmony_ci*/
39262306a36Sopenharmony_ci#define SCCE_ENET_GRA	((ushort)0x0080)	/* Graceful stop complete */
39362306a36Sopenharmony_ci#define SCCE_ENET_TXE	((ushort)0x0010)	/* Transmit Error */
39462306a36Sopenharmony_ci#define SCCE_ENET_RXF	((ushort)0x0008)	/* Full frame received */
39562306a36Sopenharmony_ci#define SCCE_ENET_BSY	((ushort)0x0004)	/* All incoming buffers full */
39662306a36Sopenharmony_ci#define SCCE_ENET_TXB	((ushort)0x0002)	/* A buffer was transmitted */
39762306a36Sopenharmony_ci#define SCCE_ENET_RXB	((ushort)0x0001)	/* A buffer was received */
39862306a36Sopenharmony_ci
39962306a36Sopenharmony_ci/* SCC Mode Register (PSMR) as used by Ethernet.
40062306a36Sopenharmony_ci*/
40162306a36Sopenharmony_ci#define SCC_PSMR_HBC	((ushort)0x8000)	/* Enable heartbeat */
40262306a36Sopenharmony_ci#define SCC_PSMR_FC	((ushort)0x4000)	/* Force collision */
40362306a36Sopenharmony_ci#define SCC_PSMR_RSH	((ushort)0x2000)	/* Receive short frames */
40462306a36Sopenharmony_ci#define SCC_PSMR_IAM	((ushort)0x1000)	/* Check individual hash */
40562306a36Sopenharmony_ci#define SCC_PSMR_ENCRC	((ushort)0x0800)	/* Ethernet CRC mode */
40662306a36Sopenharmony_ci#define SCC_PSMR_PRO	((ushort)0x0200)	/* Promiscuous mode */
40762306a36Sopenharmony_ci#define SCC_PSMR_BRO	((ushort)0x0100)	/* Catch broadcast pkts */
40862306a36Sopenharmony_ci#define SCC_PSMR_SBT	((ushort)0x0080)	/* Special backoff timer */
40962306a36Sopenharmony_ci#define SCC_PSMR_LPB	((ushort)0x0040)	/* Set Loopback mode */
41062306a36Sopenharmony_ci#define SCC_PSMR_SIP	((ushort)0x0020)	/* Sample Input Pins */
41162306a36Sopenharmony_ci#define SCC_PSMR_LCW	((ushort)0x0010)	/* Late collision window */
41262306a36Sopenharmony_ci#define SCC_PSMR_NIB22	((ushort)0x000a)	/* Start frame search */
41362306a36Sopenharmony_ci#define SCC_PSMR_FDE	((ushort)0x0001)	/* Full duplex enable */
41462306a36Sopenharmony_ci
41562306a36Sopenharmony_ci/* SCC as UART
41662306a36Sopenharmony_ci*/
41762306a36Sopenharmony_citypedef struct scc_uart {
41862306a36Sopenharmony_ci	sccp_t	scc_genscc;
41962306a36Sopenharmony_ci	uint	scc_res1;	/* Reserved */
42062306a36Sopenharmony_ci	uint	scc_res2;	/* Reserved */
42162306a36Sopenharmony_ci	ushort	scc_maxidl;	/* Maximum idle chars */
42262306a36Sopenharmony_ci	ushort	scc_idlc;	/* temp idle counter */
42362306a36Sopenharmony_ci	ushort	scc_brkcr;	/* Break count register */
42462306a36Sopenharmony_ci	ushort	scc_parec;	/* receive parity error counter */
42562306a36Sopenharmony_ci	ushort	scc_frmec;	/* receive framing error counter */
42662306a36Sopenharmony_ci	ushort	scc_nosec;	/* receive noise counter */
42762306a36Sopenharmony_ci	ushort	scc_brkec;	/* receive break condition counter */
42862306a36Sopenharmony_ci	ushort	scc_brkln;	/* last received break length */
42962306a36Sopenharmony_ci	ushort	scc_uaddr1;	/* UART address character 1 */
43062306a36Sopenharmony_ci	ushort	scc_uaddr2;	/* UART address character 2 */
43162306a36Sopenharmony_ci	ushort	scc_rtemp;	/* Temp storage */
43262306a36Sopenharmony_ci	ushort	scc_toseq;	/* Transmit out of sequence char */
43362306a36Sopenharmony_ci	ushort	scc_char1;	/* control character 1 */
43462306a36Sopenharmony_ci	ushort	scc_char2;	/* control character 2 */
43562306a36Sopenharmony_ci	ushort	scc_char3;	/* control character 3 */
43662306a36Sopenharmony_ci	ushort	scc_char4;	/* control character 4 */
43762306a36Sopenharmony_ci	ushort	scc_char5;	/* control character 5 */
43862306a36Sopenharmony_ci	ushort	scc_char6;	/* control character 6 */
43962306a36Sopenharmony_ci	ushort	scc_char7;	/* control character 7 */
44062306a36Sopenharmony_ci	ushort	scc_char8;	/* control character 8 */
44162306a36Sopenharmony_ci	ushort	scc_rccm;	/* receive control character mask */
44262306a36Sopenharmony_ci	ushort	scc_rccr;	/* receive control character register */
44362306a36Sopenharmony_ci	ushort	scc_rlbc;	/* receive last break character */
44462306a36Sopenharmony_ci} scc_uart_t;
44562306a36Sopenharmony_ci
44662306a36Sopenharmony_ci/* SCC Event and Mask registers when it is used as a UART.
44762306a36Sopenharmony_ci*/
44862306a36Sopenharmony_ci#define UART_SCCM_GLR		((ushort)0x1000)
44962306a36Sopenharmony_ci#define UART_SCCM_GLT		((ushort)0x0800)
45062306a36Sopenharmony_ci#define UART_SCCM_AB		((ushort)0x0200)
45162306a36Sopenharmony_ci#define UART_SCCM_IDL		((ushort)0x0100)
45262306a36Sopenharmony_ci#define UART_SCCM_GRA		((ushort)0x0080)
45362306a36Sopenharmony_ci#define UART_SCCM_BRKE		((ushort)0x0040)
45462306a36Sopenharmony_ci#define UART_SCCM_BRKS		((ushort)0x0020)
45562306a36Sopenharmony_ci#define UART_SCCM_CCR		((ushort)0x0008)
45662306a36Sopenharmony_ci#define UART_SCCM_BSY		((ushort)0x0004)
45762306a36Sopenharmony_ci#define UART_SCCM_TX		((ushort)0x0002)
45862306a36Sopenharmony_ci#define UART_SCCM_RX		((ushort)0x0001)
45962306a36Sopenharmony_ci
46062306a36Sopenharmony_ci/* The SCC PSMR when used as a UART.
46162306a36Sopenharmony_ci*/
46262306a36Sopenharmony_ci#define SCU_PSMR_FLC		((ushort)0x8000)
46362306a36Sopenharmony_ci#define SCU_PSMR_SL		((ushort)0x4000)
46462306a36Sopenharmony_ci#define SCU_PSMR_CL		((ushort)0x3000)
46562306a36Sopenharmony_ci#define SCU_PSMR_UM		((ushort)0x0c00)
46662306a36Sopenharmony_ci#define SCU_PSMR_FRZ		((ushort)0x0200)
46762306a36Sopenharmony_ci#define SCU_PSMR_RZS		((ushort)0x0100)
46862306a36Sopenharmony_ci#define SCU_PSMR_SYN		((ushort)0x0080)
46962306a36Sopenharmony_ci#define SCU_PSMR_DRT		((ushort)0x0040)
47062306a36Sopenharmony_ci#define SCU_PSMR_PEN		((ushort)0x0010)
47162306a36Sopenharmony_ci#define SCU_PSMR_RPM		((ushort)0x000c)
47262306a36Sopenharmony_ci#define SCU_PSMR_REVP		((ushort)0x0008)
47362306a36Sopenharmony_ci#define SCU_PSMR_TPM		((ushort)0x0003)
47462306a36Sopenharmony_ci#define SCU_PSMR_TEVP		((ushort)0x0002)
47562306a36Sopenharmony_ci
47662306a36Sopenharmony_ci/* CPM Transparent mode SCC.
47762306a36Sopenharmony_ci */
47862306a36Sopenharmony_citypedef struct scc_trans {
47962306a36Sopenharmony_ci	sccp_t	st_genscc;
48062306a36Sopenharmony_ci	uint	st_cpres;	/* Preset CRC */
48162306a36Sopenharmony_ci	uint	st_cmask;	/* Constant mask for CRC */
48262306a36Sopenharmony_ci} scc_trans_t;
48362306a36Sopenharmony_ci
48462306a36Sopenharmony_ci/* How about some FCCs.....
48562306a36Sopenharmony_ci*/
48662306a36Sopenharmony_ci#define FCC_GFMR_DIAG_NORM	((uint)0x00000000)
48762306a36Sopenharmony_ci#define FCC_GFMR_DIAG_LE	((uint)0x40000000)
48862306a36Sopenharmony_ci#define FCC_GFMR_DIAG_AE	((uint)0x80000000)
48962306a36Sopenharmony_ci#define FCC_GFMR_DIAG_ALE	((uint)0xc0000000)
49062306a36Sopenharmony_ci#define FCC_GFMR_TCI		((uint)0x20000000)
49162306a36Sopenharmony_ci#define FCC_GFMR_TRX		((uint)0x10000000)
49262306a36Sopenharmony_ci#define FCC_GFMR_TTX		((uint)0x08000000)
49362306a36Sopenharmony_ci#define FCC_GFMR_CDP		((uint)0x04000000)
49462306a36Sopenharmony_ci#define FCC_GFMR_CTSP		((uint)0x02000000)
49562306a36Sopenharmony_ci#define FCC_GFMR_CDS		((uint)0x01000000)
49662306a36Sopenharmony_ci#define FCC_GFMR_CTSS		((uint)0x00800000)
49762306a36Sopenharmony_ci#define FCC_GFMR_SYNL_NONE	((uint)0x00000000)
49862306a36Sopenharmony_ci#define FCC_GFMR_SYNL_AUTO	((uint)0x00004000)
49962306a36Sopenharmony_ci#define FCC_GFMR_SYNL_8		((uint)0x00008000)
50062306a36Sopenharmony_ci#define FCC_GFMR_SYNL_16	((uint)0x0000c000)
50162306a36Sopenharmony_ci#define FCC_GFMR_RTSM		((uint)0x00002000)
50262306a36Sopenharmony_ci#define FCC_GFMR_RENC_NRZ	((uint)0x00000000)
50362306a36Sopenharmony_ci#define FCC_GFMR_RENC_NRZI	((uint)0x00000800)
50462306a36Sopenharmony_ci#define FCC_GFMR_REVD		((uint)0x00000400)
50562306a36Sopenharmony_ci#define FCC_GFMR_TENC_NRZ	((uint)0x00000000)
50662306a36Sopenharmony_ci#define FCC_GFMR_TENC_NRZI	((uint)0x00000100)
50762306a36Sopenharmony_ci#define FCC_GFMR_TCRC_16	((uint)0x00000000)
50862306a36Sopenharmony_ci#define FCC_GFMR_TCRC_32	((uint)0x00000080)
50962306a36Sopenharmony_ci#define FCC_GFMR_ENR		((uint)0x00000020)
51062306a36Sopenharmony_ci#define FCC_GFMR_ENT		((uint)0x00000010)
51162306a36Sopenharmony_ci#define FCC_GFMR_MODE_ENET	((uint)0x0000000c)
51262306a36Sopenharmony_ci#define FCC_GFMR_MODE_ATM	((uint)0x0000000a)
51362306a36Sopenharmony_ci#define FCC_GFMR_MODE_HDLC	((uint)0x00000000)
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_ci/* Generic FCC parameter ram.
51662306a36Sopenharmony_ci*/
51762306a36Sopenharmony_citypedef struct fcc_param {
51862306a36Sopenharmony_ci	ushort	fcc_riptr;	/* Rx Internal temp pointer */
51962306a36Sopenharmony_ci	ushort	fcc_tiptr;	/* Tx Internal temp pointer */
52062306a36Sopenharmony_ci	ushort	fcc_res1;
52162306a36Sopenharmony_ci	ushort	fcc_mrblr;	/* Max receive buffer length, mod 32 bytes */
52262306a36Sopenharmony_ci	uint	fcc_rstate;	/* Upper byte is Func code, must be set */
52362306a36Sopenharmony_ci	uint	fcc_rbase;	/* Receive BD base */
52462306a36Sopenharmony_ci	ushort	fcc_rbdstat;	/* RxBD status */
52562306a36Sopenharmony_ci	ushort	fcc_rbdlen;	/* RxBD down counter */
52662306a36Sopenharmony_ci	uint	fcc_rdptr;	/* RxBD internal data pointer */
52762306a36Sopenharmony_ci	uint	fcc_tstate;	/* Upper byte is Func code, must be set */
52862306a36Sopenharmony_ci	uint	fcc_tbase;	/* Transmit BD base */
52962306a36Sopenharmony_ci	ushort	fcc_tbdstat;	/* TxBD status */
53062306a36Sopenharmony_ci	ushort	fcc_tbdlen;	/* TxBD down counter */
53162306a36Sopenharmony_ci	uint	fcc_tdptr;	/* TxBD internal data pointer */
53262306a36Sopenharmony_ci	uint	fcc_rbptr;	/* Rx BD Internal buf pointer */
53362306a36Sopenharmony_ci	uint	fcc_tbptr;	/* Tx BD Internal buf pointer */
53462306a36Sopenharmony_ci	uint	fcc_rcrc;	/* Rx temp CRC */
53562306a36Sopenharmony_ci	uint	fcc_res2;
53662306a36Sopenharmony_ci	uint	fcc_tcrc;	/* Tx temp CRC */
53762306a36Sopenharmony_ci} fccp_t;
53862306a36Sopenharmony_ci
53962306a36Sopenharmony_ci
54062306a36Sopenharmony_ci/* Ethernet controller through FCC.
54162306a36Sopenharmony_ci*/
54262306a36Sopenharmony_citypedef struct fcc_enet {
54362306a36Sopenharmony_ci	fccp_t	fen_genfcc;
54462306a36Sopenharmony_ci	uint	fen_statbuf;	/* Internal status buffer */
54562306a36Sopenharmony_ci	uint	fen_camptr;	/* CAM address */
54662306a36Sopenharmony_ci	uint	fen_cmask;	/* Constant mask for CRC */
54762306a36Sopenharmony_ci	uint	fen_cpres;	/* Preset CRC */
54862306a36Sopenharmony_ci	uint	fen_crcec;	/* CRC Error counter */
54962306a36Sopenharmony_ci	uint	fen_alec;	/* alignment error counter */
55062306a36Sopenharmony_ci	uint	fen_disfc;	/* discard frame counter */
55162306a36Sopenharmony_ci	ushort	fen_retlim;	/* Retry limit */
55262306a36Sopenharmony_ci	ushort	fen_retcnt;	/* Retry counter */
55362306a36Sopenharmony_ci	ushort	fen_pper;	/* Persistence */
55462306a36Sopenharmony_ci	ushort	fen_boffcnt;	/* backoff counter */
55562306a36Sopenharmony_ci	uint	fen_gaddrh;	/* Group address filter, high 32-bits */
55662306a36Sopenharmony_ci	uint	fen_gaddrl;	/* Group address filter, low 32-bits */
55762306a36Sopenharmony_ci	ushort	fen_tfcstat;	/* out of sequence TxBD */
55862306a36Sopenharmony_ci	ushort	fen_tfclen;
55962306a36Sopenharmony_ci	uint	fen_tfcptr;
56062306a36Sopenharmony_ci	ushort	fen_mflr;	/* Maximum frame length (1518) */
56162306a36Sopenharmony_ci	ushort	fen_paddrh;	/* MAC address */
56262306a36Sopenharmony_ci	ushort	fen_paddrm;
56362306a36Sopenharmony_ci	ushort	fen_paddrl;
56462306a36Sopenharmony_ci	ushort	fen_ibdcount;	/* Internal BD counter */
56562306a36Sopenharmony_ci	ushort	fen_ibdstart;	/* Internal BD start pointer */
56662306a36Sopenharmony_ci	ushort	fen_ibdend;	/* Internal BD end pointer */
56762306a36Sopenharmony_ci	ushort	fen_txlen;	/* Internal Tx frame length counter */
56862306a36Sopenharmony_ci	uint	fen_ibdbase[8]; /* Internal use */
56962306a36Sopenharmony_ci	uint	fen_iaddrh;	/* Individual address filter */
57062306a36Sopenharmony_ci	uint	fen_iaddrl;
57162306a36Sopenharmony_ci	ushort	fen_minflr;	/* Minimum frame length (64) */
57262306a36Sopenharmony_ci	ushort	fen_taddrh;	/* Filter transfer MAC address */
57362306a36Sopenharmony_ci	ushort	fen_taddrm;
57462306a36Sopenharmony_ci	ushort	fen_taddrl;
57562306a36Sopenharmony_ci	ushort	fen_padptr;	/* Pointer to pad byte buffer */
57662306a36Sopenharmony_ci	ushort	fen_cftype;	/* control frame type */
57762306a36Sopenharmony_ci	ushort	fen_cfrange;	/* control frame range */
57862306a36Sopenharmony_ci	ushort	fen_maxb;	/* maximum BD count */
57962306a36Sopenharmony_ci	ushort	fen_maxd1;	/* Max DMA1 length (1520) */
58062306a36Sopenharmony_ci	ushort	fen_maxd2;	/* Max DMA2 length (1520) */
58162306a36Sopenharmony_ci	ushort	fen_maxd;	/* internal max DMA count */
58262306a36Sopenharmony_ci	ushort	fen_dmacnt;	/* internal DMA counter */
58362306a36Sopenharmony_ci	uint	fen_octc;	/* Total octect counter */
58462306a36Sopenharmony_ci	uint	fen_colc;	/* Total collision counter */
58562306a36Sopenharmony_ci	uint	fen_broc;	/* Total broadcast packet counter */
58662306a36Sopenharmony_ci	uint	fen_mulc;	/* Total multicast packet count */
58762306a36Sopenharmony_ci	uint	fen_uspc;	/* Total packets < 64 bytes */
58862306a36Sopenharmony_ci	uint	fen_frgc;	/* Total packets < 64 bytes with errors */
58962306a36Sopenharmony_ci	uint	fen_ospc;	/* Total packets > 1518 */
59062306a36Sopenharmony_ci	uint	fen_jbrc;	/* Total packets > 1518 with errors */
59162306a36Sopenharmony_ci	uint	fen_p64c;	/* Total packets == 64 bytes */
59262306a36Sopenharmony_ci	uint	fen_p65c;	/* Total packets 64 < bytes <= 127 */
59362306a36Sopenharmony_ci	uint	fen_p128c;	/* Total packets 127 < bytes <= 255 */
59462306a36Sopenharmony_ci	uint	fen_p256c;	/* Total packets 256 < bytes <= 511 */
59562306a36Sopenharmony_ci	uint	fen_p512c;	/* Total packets 512 < bytes <= 1023 */
59662306a36Sopenharmony_ci	uint	fen_p1024c;	/* Total packets 1024 < bytes <= 1518 */
59762306a36Sopenharmony_ci	uint	fen_cambuf;	/* Internal CAM buffer pointer */
59862306a36Sopenharmony_ci	ushort	fen_rfthr;	/* Received frames threshold */
59962306a36Sopenharmony_ci	ushort	fen_rfcnt;	/* Received frames count */
60062306a36Sopenharmony_ci} fcc_enet_t;
60162306a36Sopenharmony_ci
60262306a36Sopenharmony_ci/* FCC Event/Mask register as used by Ethernet.
60362306a36Sopenharmony_ci*/
60462306a36Sopenharmony_ci#define FCC_ENET_GRA	((ushort)0x0080)	/* Graceful stop complete */
60562306a36Sopenharmony_ci#define FCC_ENET_RXC	((ushort)0x0040)	/* Control Frame Received */
60662306a36Sopenharmony_ci#define FCC_ENET_TXC	((ushort)0x0020)	/* Out of seq. Tx sent */
60762306a36Sopenharmony_ci#define FCC_ENET_TXE	((ushort)0x0010)	/* Transmit Error */
60862306a36Sopenharmony_ci#define FCC_ENET_RXF	((ushort)0x0008)	/* Full frame received */
60962306a36Sopenharmony_ci#define FCC_ENET_BSY	((ushort)0x0004)	/* Busy.  Rx Frame dropped */
61062306a36Sopenharmony_ci#define FCC_ENET_TXB	((ushort)0x0002)	/* A buffer was transmitted */
61162306a36Sopenharmony_ci#define FCC_ENET_RXB	((ushort)0x0001)	/* A buffer was received */
61262306a36Sopenharmony_ci
61362306a36Sopenharmony_ci/* FCC Mode Register (FPSMR) as used by Ethernet.
61462306a36Sopenharmony_ci*/
61562306a36Sopenharmony_ci#define FCC_PSMR_HBC	((uint)0x80000000)	/* Enable heartbeat */
61662306a36Sopenharmony_ci#define FCC_PSMR_FC	((uint)0x40000000)	/* Force Collision */
61762306a36Sopenharmony_ci#define FCC_PSMR_SBT	((uint)0x20000000)	/* Stop backoff timer */
61862306a36Sopenharmony_ci#define FCC_PSMR_LPB	((uint)0x10000000)	/* Local protect. 1 = FDX */
61962306a36Sopenharmony_ci#define FCC_PSMR_LCW	((uint)0x08000000)	/* Late collision select */
62062306a36Sopenharmony_ci#define FCC_PSMR_FDE	((uint)0x04000000)	/* Full Duplex Enable */
62162306a36Sopenharmony_ci#define FCC_PSMR_MON	((uint)0x02000000)	/* RMON Enable */
62262306a36Sopenharmony_ci#define FCC_PSMR_PRO	((uint)0x00400000)	/* Promiscuous Enable */
62362306a36Sopenharmony_ci#define FCC_PSMR_FCE	((uint)0x00200000)	/* Flow Control Enable */
62462306a36Sopenharmony_ci#define FCC_PSMR_RSH	((uint)0x00100000)	/* Receive Short Frames */
62562306a36Sopenharmony_ci#define FCC_PSMR_CAM	((uint)0x00000400)	/* CAM enable */
62662306a36Sopenharmony_ci#define FCC_PSMR_BRO	((uint)0x00000200)	/* Broadcast pkt discard */
62762306a36Sopenharmony_ci#define FCC_PSMR_ENCRC	((uint)0x00000080)	/* Use 32-bit CRC */
62862306a36Sopenharmony_ci
62962306a36Sopenharmony_ci/* IIC parameter RAM.
63062306a36Sopenharmony_ci*/
63162306a36Sopenharmony_citypedef struct iic {
63262306a36Sopenharmony_ci	ushort	iic_rbase;	/* Rx Buffer descriptor base address */
63362306a36Sopenharmony_ci	ushort	iic_tbase;	/* Tx Buffer descriptor base address */
63462306a36Sopenharmony_ci	u_char	iic_rfcr;	/* Rx function code */
63562306a36Sopenharmony_ci	u_char	iic_tfcr;	/* Tx function code */
63662306a36Sopenharmony_ci	ushort	iic_mrblr;	/* Max receive buffer length */
63762306a36Sopenharmony_ci	uint	iic_rstate;	/* Internal */
63862306a36Sopenharmony_ci	uint	iic_rdp;	/* Internal */
63962306a36Sopenharmony_ci	ushort	iic_rbptr;	/* Internal */
64062306a36Sopenharmony_ci	ushort	iic_rbc;	/* Internal */
64162306a36Sopenharmony_ci	uint	iic_rxtmp;	/* Internal */
64262306a36Sopenharmony_ci	uint	iic_tstate;	/* Internal */
64362306a36Sopenharmony_ci	uint	iic_tdp;	/* Internal */
64462306a36Sopenharmony_ci	ushort	iic_tbptr;	/* Internal */
64562306a36Sopenharmony_ci	ushort	iic_tbc;	/* Internal */
64662306a36Sopenharmony_ci	uint	iic_txtmp;	/* Internal */
64762306a36Sopenharmony_ci} iic_t;
64862306a36Sopenharmony_ci
64962306a36Sopenharmony_ci/* IDMA parameter RAM
65062306a36Sopenharmony_ci*/
65162306a36Sopenharmony_citypedef struct idma {
65262306a36Sopenharmony_ci	ushort ibase;		/* IDMA buffer descriptor table base address */
65362306a36Sopenharmony_ci	ushort dcm;		/* DMA channel mode */
65462306a36Sopenharmony_ci	ushort ibdptr;		/* IDMA current buffer descriptor pointer */
65562306a36Sopenharmony_ci	ushort dpr_buf;		/* IDMA transfer buffer base address */
65662306a36Sopenharmony_ci	ushort buf_inv;		/* internal buffer inventory */
65762306a36Sopenharmony_ci	ushort ss_max;		/* steady-state maximum transfer size */
65862306a36Sopenharmony_ci	ushort dpr_in_ptr;	/* write pointer inside the internal buffer */
65962306a36Sopenharmony_ci	ushort sts;		/* source transfer size */
66062306a36Sopenharmony_ci	ushort dpr_out_ptr;	/* read pointer inside the internal buffer */
66162306a36Sopenharmony_ci	ushort seob;		/* source end of burst */
66262306a36Sopenharmony_ci	ushort deob;		/* destination end of burst */
66362306a36Sopenharmony_ci	ushort dts;		/* destination transfer size */
66462306a36Sopenharmony_ci	ushort ret_add;		/* return address when working in ERM=1 mode */
66562306a36Sopenharmony_ci	ushort res0;		/* reserved */
66662306a36Sopenharmony_ci	uint   bd_cnt;		/* internal byte count */
66762306a36Sopenharmony_ci	uint   s_ptr;		/* source internal data pointer */
66862306a36Sopenharmony_ci	uint   d_ptr;		/* destination internal data pointer */
66962306a36Sopenharmony_ci	uint   istate;		/* internal state */
67062306a36Sopenharmony_ci	u_char res1[20];	/* pad to 64-byte length */
67162306a36Sopenharmony_ci} idma_t;
67262306a36Sopenharmony_ci
67362306a36Sopenharmony_ci/* DMA channel mode bit fields
67462306a36Sopenharmony_ci*/
67562306a36Sopenharmony_ci#define IDMA_DCM_FB		((ushort)0x8000) /* fly-by mode */
67662306a36Sopenharmony_ci#define IDMA_DCM_LP		((ushort)0x4000) /* low priority */
67762306a36Sopenharmony_ci#define IDMA_DCM_TC2		((ushort)0x0400) /* value driven on TC[2] */
67862306a36Sopenharmony_ci#define IDMA_DCM_DMA_WRAP_MASK	((ushort)0x01c0) /* mask for DMA wrap */
67962306a36Sopenharmony_ci#define IDMA_DCM_DMA_WRAP_64	((ushort)0x0000) /* 64-byte DMA xfer buffer */
68062306a36Sopenharmony_ci#define IDMA_DCM_DMA_WRAP_128	((ushort)0x0040) /* 128-byte DMA xfer buffer */
68162306a36Sopenharmony_ci#define IDMA_DCM_DMA_WRAP_256	((ushort)0x0080) /* 256-byte DMA xfer buffer */
68262306a36Sopenharmony_ci#define IDMA_DCM_DMA_WRAP_512	((ushort)0x00c0) /* 512-byte DMA xfer buffer */
68362306a36Sopenharmony_ci#define IDMA_DCM_DMA_WRAP_1024	((ushort)0x0100) /* 1024-byte DMA xfer buffer */
68462306a36Sopenharmony_ci#define IDMA_DCM_DMA_WRAP_2048	((ushort)0x0140) /* 2048-byte DMA xfer buffer */
68562306a36Sopenharmony_ci#define IDMA_DCM_SINC		((ushort)0x0020) /* source inc addr */
68662306a36Sopenharmony_ci#define IDMA_DCM_DINC		((ushort)0x0010) /* destination inc addr */
68762306a36Sopenharmony_ci#define IDMA_DCM_ERM		((ushort)0x0008) /* external request mode */
68862306a36Sopenharmony_ci#define IDMA_DCM_DT		((ushort)0x0004) /* DONE treatment */
68962306a36Sopenharmony_ci#define IDMA_DCM_SD_MASK	((ushort)0x0003) /* mask for SD bit field */
69062306a36Sopenharmony_ci#define IDMA_DCM_SD_MEM2MEM	((ushort)0x0000) /* memory-to-memory xfer */
69162306a36Sopenharmony_ci#define IDMA_DCM_SD_PER2MEM	((ushort)0x0002) /* peripheral-to-memory xfer */
69262306a36Sopenharmony_ci#define IDMA_DCM_SD_MEM2PER	((ushort)0x0001) /* memory-to-peripheral xfer */
69362306a36Sopenharmony_ci
69462306a36Sopenharmony_ci/* IDMA Buffer Descriptors
69562306a36Sopenharmony_ci*/
69662306a36Sopenharmony_citypedef struct idma_bd {
69762306a36Sopenharmony_ci	uint flags;
69862306a36Sopenharmony_ci	uint len;	/* data length */
69962306a36Sopenharmony_ci	uint src;	/* source data buffer pointer */
70062306a36Sopenharmony_ci	uint dst;	/* destination data buffer pointer */
70162306a36Sopenharmony_ci} idma_bd_t;
70262306a36Sopenharmony_ci
70362306a36Sopenharmony_ci/* IDMA buffer descriptor flag bit fields
70462306a36Sopenharmony_ci*/
70562306a36Sopenharmony_ci#define IDMA_BD_V	((uint)0x80000000)	/* valid */
70662306a36Sopenharmony_ci#define IDMA_BD_W	((uint)0x20000000)	/* wrap */
70762306a36Sopenharmony_ci#define IDMA_BD_I	((uint)0x10000000)	/* interrupt */
70862306a36Sopenharmony_ci#define IDMA_BD_L	((uint)0x08000000)	/* last */
70962306a36Sopenharmony_ci#define IDMA_BD_CM	((uint)0x02000000)	/* continuous mode */
71062306a36Sopenharmony_ci#define IDMA_BD_SDN	((uint)0x00400000)	/* source done */
71162306a36Sopenharmony_ci#define IDMA_BD_DDN	((uint)0x00200000)	/* destination done */
71262306a36Sopenharmony_ci#define IDMA_BD_DGBL	((uint)0x00100000)	/* destination global */
71362306a36Sopenharmony_ci#define IDMA_BD_DBO_LE	((uint)0x00040000)	/* little-end dest byte order */
71462306a36Sopenharmony_ci#define IDMA_BD_DBO_BE	((uint)0x00080000)	/* big-end dest byte order */
71562306a36Sopenharmony_ci#define IDMA_BD_DDTB	((uint)0x00010000)	/* destination data bus */
71662306a36Sopenharmony_ci#define IDMA_BD_SGBL	((uint)0x00002000)	/* source global */
71762306a36Sopenharmony_ci#define IDMA_BD_SBO_LE	((uint)0x00000800)	/* little-end src byte order */
71862306a36Sopenharmony_ci#define IDMA_BD_SBO_BE	((uint)0x00001000)	/* big-end src byte order */
71962306a36Sopenharmony_ci#define IDMA_BD_SDTB	((uint)0x00000200)	/* source data bus */
72062306a36Sopenharmony_ci
72162306a36Sopenharmony_ci/* per-channel IDMA registers
72262306a36Sopenharmony_ci*/
72362306a36Sopenharmony_citypedef struct im_idma {
72462306a36Sopenharmony_ci	u_char idsr;			/* IDMAn event status register */
72562306a36Sopenharmony_ci	u_char res0[3];
72662306a36Sopenharmony_ci	u_char idmr;			/* IDMAn event mask register */
72762306a36Sopenharmony_ci	u_char res1[3];
72862306a36Sopenharmony_ci} im_idma_t;
72962306a36Sopenharmony_ci
73062306a36Sopenharmony_ci/* IDMA event register bit fields
73162306a36Sopenharmony_ci*/
73262306a36Sopenharmony_ci#define IDMA_EVENT_SC	((unsigned char)0x08)	/* stop completed */
73362306a36Sopenharmony_ci#define IDMA_EVENT_OB	((unsigned char)0x04)	/* out of buffers */
73462306a36Sopenharmony_ci#define IDMA_EVENT_EDN	((unsigned char)0x02)	/* external DONE asserted */
73562306a36Sopenharmony_ci#define IDMA_EVENT_BC	((unsigned char)0x01)	/* buffer descriptor complete */
73662306a36Sopenharmony_ci
73762306a36Sopenharmony_ci/* RISC Controller Configuration Register (RCCR) bit fields
73862306a36Sopenharmony_ci*/
73962306a36Sopenharmony_ci#define RCCR_TIME	((uint)0x80000000) /* timer enable */
74062306a36Sopenharmony_ci#define RCCR_TIMEP_MASK	((uint)0x3f000000) /* mask for timer period bit field */
74162306a36Sopenharmony_ci#define RCCR_DR0M	((uint)0x00800000) /* IDMA0 request mode */
74262306a36Sopenharmony_ci#define RCCR_DR1M	((uint)0x00400000) /* IDMA1 request mode */
74362306a36Sopenharmony_ci#define RCCR_DR2M	((uint)0x00000080) /* IDMA2 request mode */
74462306a36Sopenharmony_ci#define RCCR_DR3M	((uint)0x00000040) /* IDMA3 request mode */
74562306a36Sopenharmony_ci#define RCCR_DR0QP_MASK	((uint)0x00300000) /* mask for IDMA0 req priority */
74662306a36Sopenharmony_ci#define RCCR_DR0QP_HIGH ((uint)0x00000000) /* IDMA0 has high req priority */
74762306a36Sopenharmony_ci#define RCCR_DR0QP_MED	((uint)0x00100000) /* IDMA0 has medium req priority */
74862306a36Sopenharmony_ci#define RCCR_DR0QP_LOW	((uint)0x00200000) /* IDMA0 has low req priority */
74962306a36Sopenharmony_ci#define RCCR_DR1QP_MASK	((uint)0x00030000) /* mask for IDMA1 req priority */
75062306a36Sopenharmony_ci#define RCCR_DR1QP_HIGH ((uint)0x00000000) /* IDMA1 has high req priority */
75162306a36Sopenharmony_ci#define RCCR_DR1QP_MED	((uint)0x00010000) /* IDMA1 has medium req priority */
75262306a36Sopenharmony_ci#define RCCR_DR1QP_LOW	((uint)0x00020000) /* IDMA1 has low req priority */
75362306a36Sopenharmony_ci#define RCCR_DR2QP_MASK	((uint)0x00000030) /* mask for IDMA2 req priority */
75462306a36Sopenharmony_ci#define RCCR_DR2QP_HIGH ((uint)0x00000000) /* IDMA2 has high req priority */
75562306a36Sopenharmony_ci#define RCCR_DR2QP_MED	((uint)0x00000010) /* IDMA2 has medium req priority */
75662306a36Sopenharmony_ci#define RCCR_DR2QP_LOW	((uint)0x00000020) /* IDMA2 has low req priority */
75762306a36Sopenharmony_ci#define RCCR_DR3QP_MASK	((uint)0x00000003) /* mask for IDMA3 req priority */
75862306a36Sopenharmony_ci#define RCCR_DR3QP_HIGH ((uint)0x00000000) /* IDMA3 has high req priority */
75962306a36Sopenharmony_ci#define RCCR_DR3QP_MED	((uint)0x00000001) /* IDMA3 has medium req priority */
76062306a36Sopenharmony_ci#define RCCR_DR3QP_LOW	((uint)0x00000002) /* IDMA3 has low req priority */
76162306a36Sopenharmony_ci#define RCCR_EIE	((uint)0x00080000) /* external interrupt enable */
76262306a36Sopenharmony_ci#define RCCR_SCD	((uint)0x00040000) /* scheduler configuration */
76362306a36Sopenharmony_ci#define RCCR_ERAM_MASK	((uint)0x0000e000) /* mask for enable RAM microcode */
76462306a36Sopenharmony_ci#define RCCR_ERAM_0KB	((uint)0x00000000) /* use 0KB of dpram for microcode */
76562306a36Sopenharmony_ci#define RCCR_ERAM_2KB	((uint)0x00002000) /* use 2KB of dpram for microcode */
76662306a36Sopenharmony_ci#define RCCR_ERAM_4KB	((uint)0x00004000) /* use 4KB of dpram for microcode */
76762306a36Sopenharmony_ci#define RCCR_ERAM_6KB	((uint)0x00006000) /* use 6KB of dpram for microcode */
76862306a36Sopenharmony_ci#define RCCR_ERAM_8KB	((uint)0x00008000) /* use 8KB of dpram for microcode */
76962306a36Sopenharmony_ci#define RCCR_ERAM_10KB	((uint)0x0000a000) /* use 10KB of dpram for microcode */
77062306a36Sopenharmony_ci#define RCCR_ERAM_12KB	((uint)0x0000c000) /* use 12KB of dpram for microcode */
77162306a36Sopenharmony_ci#define RCCR_EDM0	((uint)0x00000800) /* DREQ0 edge detect mode */
77262306a36Sopenharmony_ci#define RCCR_EDM1	((uint)0x00000400) /* DREQ1 edge detect mode */
77362306a36Sopenharmony_ci#define RCCR_EDM2	((uint)0x00000200) /* DREQ2 edge detect mode */
77462306a36Sopenharmony_ci#define RCCR_EDM3	((uint)0x00000100) /* DREQ3 edge detect mode */
77562306a36Sopenharmony_ci#define RCCR_DEM01	((uint)0x00000008) /* DONE0/DONE1 edge detect mode */
77662306a36Sopenharmony_ci#define RCCR_DEM23	((uint)0x00000004) /* DONE2/DONE3 edge detect mode */
77762306a36Sopenharmony_ci
77862306a36Sopenharmony_ci/*-----------------------------------------------------------------------
77962306a36Sopenharmony_ci * CMXFCR - CMX FCC Clock Route Register
78062306a36Sopenharmony_ci */
78162306a36Sopenharmony_ci#define CMXFCR_FC1         0x40000000   /* FCC1 connection              */
78262306a36Sopenharmony_ci#define CMXFCR_RF1CS_MSK   0x38000000   /* Receive FCC1 Clock Source Mask */
78362306a36Sopenharmony_ci#define CMXFCR_TF1CS_MSK   0x07000000   /* Transmit FCC1 Clock Source Mask */
78462306a36Sopenharmony_ci#define CMXFCR_FC2         0x00400000   /* FCC2 connection              */
78562306a36Sopenharmony_ci#define CMXFCR_RF2CS_MSK   0x00380000   /* Receive FCC2 Clock Source Mask */
78662306a36Sopenharmony_ci#define CMXFCR_TF2CS_MSK   0x00070000   /* Transmit FCC2 Clock Source Mask */
78762306a36Sopenharmony_ci#define CMXFCR_FC3         0x00004000   /* FCC3 connection              */
78862306a36Sopenharmony_ci#define CMXFCR_RF3CS_MSK   0x00003800   /* Receive FCC3 Clock Source Mask */
78962306a36Sopenharmony_ci#define CMXFCR_TF3CS_MSK   0x00000700   /* Transmit FCC3 Clock Source Mask */
79062306a36Sopenharmony_ci
79162306a36Sopenharmony_ci#define CMXFCR_RF1CS_BRG5  0x00000000   /* Receive FCC1 Clock Source is BRG5 */
79262306a36Sopenharmony_ci#define CMXFCR_RF1CS_BRG6  0x08000000   /* Receive FCC1 Clock Source is BRG6 */
79362306a36Sopenharmony_ci#define CMXFCR_RF1CS_BRG7  0x10000000   /* Receive FCC1 Clock Source is BRG7 */
79462306a36Sopenharmony_ci#define CMXFCR_RF1CS_BRG8  0x18000000   /* Receive FCC1 Clock Source is BRG8 */
79562306a36Sopenharmony_ci#define CMXFCR_RF1CS_CLK9  0x20000000   /* Receive FCC1 Clock Source is CLK9 */
79662306a36Sopenharmony_ci#define CMXFCR_RF1CS_CLK10 0x28000000   /* Receive FCC1 Clock Source is CLK10 */
79762306a36Sopenharmony_ci#define CMXFCR_RF1CS_CLK11 0x30000000   /* Receive FCC1 Clock Source is CLK11 */
79862306a36Sopenharmony_ci#define CMXFCR_RF1CS_CLK12 0x38000000   /* Receive FCC1 Clock Source is CLK12 */
79962306a36Sopenharmony_ci
80062306a36Sopenharmony_ci#define CMXFCR_TF1CS_BRG5  0x00000000   /* Transmit FCC1 Clock Source is BRG5 */
80162306a36Sopenharmony_ci#define CMXFCR_TF1CS_BRG6  0x01000000   /* Transmit FCC1 Clock Source is BRG6 */
80262306a36Sopenharmony_ci#define CMXFCR_TF1CS_BRG7  0x02000000   /* Transmit FCC1 Clock Source is BRG7 */
80362306a36Sopenharmony_ci#define CMXFCR_TF1CS_BRG8  0x03000000   /* Transmit FCC1 Clock Source is BRG8 */
80462306a36Sopenharmony_ci#define CMXFCR_TF1CS_CLK9  0x04000000   /* Transmit FCC1 Clock Source is CLK9 */
80562306a36Sopenharmony_ci#define CMXFCR_TF1CS_CLK10 0x05000000   /* Transmit FCC1 Clock Source is CLK10 */
80662306a36Sopenharmony_ci#define CMXFCR_TF1CS_CLK11 0x06000000   /* Transmit FCC1 Clock Source is CLK11 */
80762306a36Sopenharmony_ci#define CMXFCR_TF1CS_CLK12 0x07000000   /* Transmit FCC1 Clock Source is CLK12 */
80862306a36Sopenharmony_ci
80962306a36Sopenharmony_ci#define CMXFCR_RF2CS_BRG5  0x00000000   /* Receive FCC2 Clock Source is BRG5 */
81062306a36Sopenharmony_ci#define CMXFCR_RF2CS_BRG6  0x00080000   /* Receive FCC2 Clock Source is BRG6 */
81162306a36Sopenharmony_ci#define CMXFCR_RF2CS_BRG7  0x00100000   /* Receive FCC2 Clock Source is BRG7 */
81262306a36Sopenharmony_ci#define CMXFCR_RF2CS_BRG8  0x00180000   /* Receive FCC2 Clock Source is BRG8 */
81362306a36Sopenharmony_ci#define CMXFCR_RF2CS_CLK13 0x00200000   /* Receive FCC2 Clock Source is CLK13 */
81462306a36Sopenharmony_ci#define CMXFCR_RF2CS_CLK14 0x00280000   /* Receive FCC2 Clock Source is CLK14 */
81562306a36Sopenharmony_ci#define CMXFCR_RF2CS_CLK15 0x00300000   /* Receive FCC2 Clock Source is CLK15 */
81662306a36Sopenharmony_ci#define CMXFCR_RF2CS_CLK16 0x00380000   /* Receive FCC2 Clock Source is CLK16 */
81762306a36Sopenharmony_ci
81862306a36Sopenharmony_ci#define CMXFCR_TF2CS_BRG5  0x00000000   /* Transmit FCC2 Clock Source is BRG5 */
81962306a36Sopenharmony_ci#define CMXFCR_TF2CS_BRG6  0x00010000   /* Transmit FCC2 Clock Source is BRG6 */
82062306a36Sopenharmony_ci#define CMXFCR_TF2CS_BRG7  0x00020000   /* Transmit FCC2 Clock Source is BRG7 */
82162306a36Sopenharmony_ci#define CMXFCR_TF2CS_BRG8  0x00030000   /* Transmit FCC2 Clock Source is BRG8 */
82262306a36Sopenharmony_ci#define CMXFCR_TF2CS_CLK13 0x00040000   /* Transmit FCC2 Clock Source is CLK13 */
82362306a36Sopenharmony_ci#define CMXFCR_TF2CS_CLK14 0x00050000   /* Transmit FCC2 Clock Source is CLK14 */
82462306a36Sopenharmony_ci#define CMXFCR_TF2CS_CLK15 0x00060000   /* Transmit FCC2 Clock Source is CLK15 */
82562306a36Sopenharmony_ci#define CMXFCR_TF2CS_CLK16 0x00070000   /* Transmit FCC2 Clock Source is CLK16 */
82662306a36Sopenharmony_ci
82762306a36Sopenharmony_ci#define CMXFCR_RF3CS_BRG5  0x00000000   /* Receive FCC3 Clock Source is BRG5 */
82862306a36Sopenharmony_ci#define CMXFCR_RF3CS_BRG6  0x00000800   /* Receive FCC3 Clock Source is BRG6 */
82962306a36Sopenharmony_ci#define CMXFCR_RF3CS_BRG7  0x00001000   /* Receive FCC3 Clock Source is BRG7 */
83062306a36Sopenharmony_ci#define CMXFCR_RF3CS_BRG8  0x00001800   /* Receive FCC3 Clock Source is BRG8 */
83162306a36Sopenharmony_ci#define CMXFCR_RF3CS_CLK13 0x00002000   /* Receive FCC3 Clock Source is CLK13 */
83262306a36Sopenharmony_ci#define CMXFCR_RF3CS_CLK14 0x00002800   /* Receive FCC3 Clock Source is CLK14 */
83362306a36Sopenharmony_ci#define CMXFCR_RF3CS_CLK15 0x00003000   /* Receive FCC3 Clock Source is CLK15 */
83462306a36Sopenharmony_ci#define CMXFCR_RF3CS_CLK16 0x00003800   /* Receive FCC3 Clock Source is CLK16 */
83562306a36Sopenharmony_ci
83662306a36Sopenharmony_ci#define CMXFCR_TF3CS_BRG5  0x00000000   /* Transmit FCC3 Clock Source is BRG5 */
83762306a36Sopenharmony_ci#define CMXFCR_TF3CS_BRG6  0x00000100   /* Transmit FCC3 Clock Source is BRG6 */
83862306a36Sopenharmony_ci#define CMXFCR_TF3CS_BRG7  0x00000200   /* Transmit FCC3 Clock Source is BRG7 */
83962306a36Sopenharmony_ci#define CMXFCR_TF3CS_BRG8  0x00000300   /* Transmit FCC3 Clock Source is BRG8 */
84062306a36Sopenharmony_ci#define CMXFCR_TF3CS_CLK13 0x00000400   /* Transmit FCC3 Clock Source is CLK13 */
84162306a36Sopenharmony_ci#define CMXFCR_TF3CS_CLK14 0x00000500   /* Transmit FCC3 Clock Source is CLK14 */
84262306a36Sopenharmony_ci#define CMXFCR_TF3CS_CLK15 0x00000600   /* Transmit FCC3 Clock Source is CLK15 */
84362306a36Sopenharmony_ci#define CMXFCR_TF3CS_CLK16 0x00000700   /* Transmit FCC3 Clock Source is CLK16 */
84462306a36Sopenharmony_ci
84562306a36Sopenharmony_ci/*-----------------------------------------------------------------------
84662306a36Sopenharmony_ci * CMXSCR - CMX SCC Clock Route Register
84762306a36Sopenharmony_ci */
84862306a36Sopenharmony_ci#define CMXSCR_GR1         0x80000000   /* Grant Support of SCC1        */
84962306a36Sopenharmony_ci#define CMXSCR_SC1         0x40000000   /* SCC1 connection              */
85062306a36Sopenharmony_ci#define CMXSCR_RS1CS_MSK   0x38000000   /* Receive SCC1 Clock Source Mask */
85162306a36Sopenharmony_ci#define CMXSCR_TS1CS_MSK   0x07000000   /* Transmit SCC1 Clock Source Mask */
85262306a36Sopenharmony_ci#define CMXSCR_GR2         0x00800000   /* Grant Support of SCC2        */
85362306a36Sopenharmony_ci#define CMXSCR_SC2         0x00400000   /* SCC2 connection              */
85462306a36Sopenharmony_ci#define CMXSCR_RS2CS_MSK   0x00380000   /* Receive SCC2 Clock Source Mask */
85562306a36Sopenharmony_ci#define CMXSCR_TS2CS_MSK   0x00070000   /* Transmit SCC2 Clock Source Mask */
85662306a36Sopenharmony_ci#define CMXSCR_GR3         0x00008000   /* Grant Support of SCC3        */
85762306a36Sopenharmony_ci#define CMXSCR_SC3         0x00004000   /* SCC3 connection              */
85862306a36Sopenharmony_ci#define CMXSCR_RS3CS_MSK   0x00003800   /* Receive SCC3 Clock Source Mask */
85962306a36Sopenharmony_ci#define CMXSCR_TS3CS_MSK   0x00000700   /* Transmit SCC3 Clock Source Mask */
86062306a36Sopenharmony_ci#define CMXSCR_GR4         0x00000080   /* Grant Support of SCC4        */
86162306a36Sopenharmony_ci#define CMXSCR_SC4         0x00000040   /* SCC4 connection              */
86262306a36Sopenharmony_ci#define CMXSCR_RS4CS_MSK   0x00000038   /* Receive SCC4 Clock Source Mask */
86362306a36Sopenharmony_ci#define CMXSCR_TS4CS_MSK   0x00000007   /* Transmit SCC4 Clock Source Mask */
86462306a36Sopenharmony_ci
86562306a36Sopenharmony_ci#define CMXSCR_RS1CS_BRG1  0x00000000   /* SCC1 Rx Clock Source is BRG1 */
86662306a36Sopenharmony_ci#define CMXSCR_RS1CS_BRG2  0x08000000   /* SCC1 Rx Clock Source is BRG2 */
86762306a36Sopenharmony_ci#define CMXSCR_RS1CS_BRG3  0x10000000   /* SCC1 Rx Clock Source is BRG3 */
86862306a36Sopenharmony_ci#define CMXSCR_RS1CS_BRG4  0x18000000   /* SCC1 Rx Clock Source is BRG4 */
86962306a36Sopenharmony_ci#define CMXSCR_RS1CS_CLK11 0x20000000   /* SCC1 Rx Clock Source is CLK11 */
87062306a36Sopenharmony_ci#define CMXSCR_RS1CS_CLK12 0x28000000   /* SCC1 Rx Clock Source is CLK12 */
87162306a36Sopenharmony_ci#define CMXSCR_RS1CS_CLK3  0x30000000   /* SCC1 Rx Clock Source is CLK3 */
87262306a36Sopenharmony_ci#define CMXSCR_RS1CS_CLK4  0x38000000   /* SCC1 Rx Clock Source is CLK4 */
87362306a36Sopenharmony_ci
87462306a36Sopenharmony_ci#define CMXSCR_TS1CS_BRG1  0x00000000   /* SCC1 Tx Clock Source is BRG1 */
87562306a36Sopenharmony_ci#define CMXSCR_TS1CS_BRG2  0x01000000   /* SCC1 Tx Clock Source is BRG2 */
87662306a36Sopenharmony_ci#define CMXSCR_TS1CS_BRG3  0x02000000   /* SCC1 Tx Clock Source is BRG3 */
87762306a36Sopenharmony_ci#define CMXSCR_TS1CS_BRG4  0x03000000   /* SCC1 Tx Clock Source is BRG4 */
87862306a36Sopenharmony_ci#define CMXSCR_TS1CS_CLK11 0x04000000   /* SCC1 Tx Clock Source is CLK11 */
87962306a36Sopenharmony_ci#define CMXSCR_TS1CS_CLK12 0x05000000   /* SCC1 Tx Clock Source is CLK12 */
88062306a36Sopenharmony_ci#define CMXSCR_TS1CS_CLK3  0x06000000   /* SCC1 Tx Clock Source is CLK3 */
88162306a36Sopenharmony_ci#define CMXSCR_TS1CS_CLK4  0x07000000   /* SCC1 Tx Clock Source is CLK4 */
88262306a36Sopenharmony_ci
88362306a36Sopenharmony_ci#define CMXSCR_RS2CS_BRG1  0x00000000   /* SCC2 Rx Clock Source is BRG1 */
88462306a36Sopenharmony_ci#define CMXSCR_RS2CS_BRG2  0x00080000   /* SCC2 Rx Clock Source is BRG2 */
88562306a36Sopenharmony_ci#define CMXSCR_RS2CS_BRG3  0x00100000   /* SCC2 Rx Clock Source is BRG3 */
88662306a36Sopenharmony_ci#define CMXSCR_RS2CS_BRG4  0x00180000   /* SCC2 Rx Clock Source is BRG4 */
88762306a36Sopenharmony_ci#define CMXSCR_RS2CS_CLK11 0x00200000   /* SCC2 Rx Clock Source is CLK11 */
88862306a36Sopenharmony_ci#define CMXSCR_RS2CS_CLK12 0x00280000   /* SCC2 Rx Clock Source is CLK12 */
88962306a36Sopenharmony_ci#define CMXSCR_RS2CS_CLK3  0x00300000   /* SCC2 Rx Clock Source is CLK3 */
89062306a36Sopenharmony_ci#define CMXSCR_RS2CS_CLK4  0x00380000   /* SCC2 Rx Clock Source is CLK4 */
89162306a36Sopenharmony_ci
89262306a36Sopenharmony_ci#define CMXSCR_TS2CS_BRG1  0x00000000   /* SCC2 Tx Clock Source is BRG1 */
89362306a36Sopenharmony_ci#define CMXSCR_TS2CS_BRG2  0x00010000   /* SCC2 Tx Clock Source is BRG2 */
89462306a36Sopenharmony_ci#define CMXSCR_TS2CS_BRG3  0x00020000   /* SCC2 Tx Clock Source is BRG3 */
89562306a36Sopenharmony_ci#define CMXSCR_TS2CS_BRG4  0x00030000   /* SCC2 Tx Clock Source is BRG4 */
89662306a36Sopenharmony_ci#define CMXSCR_TS2CS_CLK11 0x00040000   /* SCC2 Tx Clock Source is CLK11 */
89762306a36Sopenharmony_ci#define CMXSCR_TS2CS_CLK12 0x00050000   /* SCC2 Tx Clock Source is CLK12 */
89862306a36Sopenharmony_ci#define CMXSCR_TS2CS_CLK3  0x00060000   /* SCC2 Tx Clock Source is CLK3 */
89962306a36Sopenharmony_ci#define CMXSCR_TS2CS_CLK4  0x00070000   /* SCC2 Tx Clock Source is CLK4 */
90062306a36Sopenharmony_ci
90162306a36Sopenharmony_ci#define CMXSCR_RS3CS_BRG1  0x00000000   /* SCC3 Rx Clock Source is BRG1 */
90262306a36Sopenharmony_ci#define CMXSCR_RS3CS_BRG2  0x00000800   /* SCC3 Rx Clock Source is BRG2 */
90362306a36Sopenharmony_ci#define CMXSCR_RS3CS_BRG3  0x00001000   /* SCC3 Rx Clock Source is BRG3 */
90462306a36Sopenharmony_ci#define CMXSCR_RS3CS_BRG4  0x00001800   /* SCC3 Rx Clock Source is BRG4 */
90562306a36Sopenharmony_ci#define CMXSCR_RS3CS_CLK5  0x00002000   /* SCC3 Rx Clock Source is CLK5 */
90662306a36Sopenharmony_ci#define CMXSCR_RS3CS_CLK6  0x00002800   /* SCC3 Rx Clock Source is CLK6 */
90762306a36Sopenharmony_ci#define CMXSCR_RS3CS_CLK7  0x00003000   /* SCC3 Rx Clock Source is CLK7 */
90862306a36Sopenharmony_ci#define CMXSCR_RS3CS_CLK8  0x00003800   /* SCC3 Rx Clock Source is CLK8 */
90962306a36Sopenharmony_ci
91062306a36Sopenharmony_ci#define CMXSCR_TS3CS_BRG1  0x00000000   /* SCC3 Tx Clock Source is BRG1 */
91162306a36Sopenharmony_ci#define CMXSCR_TS3CS_BRG2  0x00000100   /* SCC3 Tx Clock Source is BRG2 */
91262306a36Sopenharmony_ci#define CMXSCR_TS3CS_BRG3  0x00000200   /* SCC3 Tx Clock Source is BRG3 */
91362306a36Sopenharmony_ci#define CMXSCR_TS3CS_BRG4  0x00000300   /* SCC3 Tx Clock Source is BRG4 */
91462306a36Sopenharmony_ci#define CMXSCR_TS3CS_CLK5  0x00000400   /* SCC3 Tx Clock Source is CLK5 */
91562306a36Sopenharmony_ci#define CMXSCR_TS3CS_CLK6  0x00000500   /* SCC3 Tx Clock Source is CLK6 */
91662306a36Sopenharmony_ci#define CMXSCR_TS3CS_CLK7  0x00000600   /* SCC3 Tx Clock Source is CLK7 */
91762306a36Sopenharmony_ci#define CMXSCR_TS3CS_CLK8  0x00000700   /* SCC3 Tx Clock Source is CLK8 */
91862306a36Sopenharmony_ci
91962306a36Sopenharmony_ci#define CMXSCR_RS4CS_BRG1  0x00000000   /* SCC4 Rx Clock Source is BRG1 */
92062306a36Sopenharmony_ci#define CMXSCR_RS4CS_BRG2  0x00000008   /* SCC4 Rx Clock Source is BRG2 */
92162306a36Sopenharmony_ci#define CMXSCR_RS4CS_BRG3  0x00000010   /* SCC4 Rx Clock Source is BRG3 */
92262306a36Sopenharmony_ci#define CMXSCR_RS4CS_BRG4  0x00000018   /* SCC4 Rx Clock Source is BRG4 */
92362306a36Sopenharmony_ci#define CMXSCR_RS4CS_CLK5  0x00000020   /* SCC4 Rx Clock Source is CLK5 */
92462306a36Sopenharmony_ci#define CMXSCR_RS4CS_CLK6  0x00000028   /* SCC4 Rx Clock Source is CLK6 */
92562306a36Sopenharmony_ci#define CMXSCR_RS4CS_CLK7  0x00000030   /* SCC4 Rx Clock Source is CLK7 */
92662306a36Sopenharmony_ci#define CMXSCR_RS4CS_CLK8  0x00000038   /* SCC4 Rx Clock Source is CLK8 */
92762306a36Sopenharmony_ci
92862306a36Sopenharmony_ci#define CMXSCR_TS4CS_BRG1  0x00000000   /* SCC4 Tx Clock Source is BRG1 */
92962306a36Sopenharmony_ci#define CMXSCR_TS4CS_BRG2  0x00000001   /* SCC4 Tx Clock Source is BRG2 */
93062306a36Sopenharmony_ci#define CMXSCR_TS4CS_BRG3  0x00000002   /* SCC4 Tx Clock Source is BRG3 */
93162306a36Sopenharmony_ci#define CMXSCR_TS4CS_BRG4  0x00000003   /* SCC4 Tx Clock Source is BRG4 */
93262306a36Sopenharmony_ci#define CMXSCR_TS4CS_CLK5  0x00000004   /* SCC4 Tx Clock Source is CLK5 */
93362306a36Sopenharmony_ci#define CMXSCR_TS4CS_CLK6  0x00000005   /* SCC4 Tx Clock Source is CLK6 */
93462306a36Sopenharmony_ci#define CMXSCR_TS4CS_CLK7  0x00000006   /* SCC4 Tx Clock Source is CLK7 */
93562306a36Sopenharmony_ci#define CMXSCR_TS4CS_CLK8  0x00000007   /* SCC4 Tx Clock Source is CLK8 */
93662306a36Sopenharmony_ci
93762306a36Sopenharmony_ci/*-----------------------------------------------------------------------
93862306a36Sopenharmony_ci * SIUMCR - SIU Module Configuration Register				 4-31
93962306a36Sopenharmony_ci */
94062306a36Sopenharmony_ci#define SIUMCR_BBD	0x80000000	/* Bus Busy Disable		*/
94162306a36Sopenharmony_ci#define SIUMCR_ESE	0x40000000	/* External Snoop Enable	*/
94262306a36Sopenharmony_ci#define SIUMCR_PBSE	0x20000000	/* Parity Byte Select Enable	*/
94362306a36Sopenharmony_ci#define SIUMCR_CDIS	0x10000000	/* Core Disable			*/
94462306a36Sopenharmony_ci#define SIUMCR_DPPC00	0x00000000	/* Data Parity Pins Configuration*/
94562306a36Sopenharmony_ci#define SIUMCR_DPPC01	0x04000000	/* - " -			*/
94662306a36Sopenharmony_ci#define SIUMCR_DPPC10	0x08000000	/* - " -			*/
94762306a36Sopenharmony_ci#define SIUMCR_DPPC11	0x0c000000	/* - " -			*/
94862306a36Sopenharmony_ci#define SIUMCR_L2CPC00	0x00000000	/* L2 Cache Pins Configuration	*/
94962306a36Sopenharmony_ci#define SIUMCR_L2CPC01	0x01000000	/* - " -			*/
95062306a36Sopenharmony_ci#define SIUMCR_L2CPC10	0x02000000	/* - " -			*/
95162306a36Sopenharmony_ci#define SIUMCR_L2CPC11	0x03000000	/* - " -			*/
95262306a36Sopenharmony_ci#define SIUMCR_LBPC00	0x00000000	/* Local Bus Pins Configuration	*/
95362306a36Sopenharmony_ci#define SIUMCR_LBPC01	0x00400000	/* - " -			*/
95462306a36Sopenharmony_ci#define SIUMCR_LBPC10	0x00800000	/* - " -			*/
95562306a36Sopenharmony_ci#define SIUMCR_LBPC11	0x00c00000	/* - " -			*/
95662306a36Sopenharmony_ci#define SIUMCR_APPC00	0x00000000	/* Address Parity Pins Configuration*/
95762306a36Sopenharmony_ci#define SIUMCR_APPC01	0x00100000	/* - " -			*/
95862306a36Sopenharmony_ci#define SIUMCR_APPC10	0x00200000	/* - " -			*/
95962306a36Sopenharmony_ci#define SIUMCR_APPC11	0x00300000	/* - " -			*/
96062306a36Sopenharmony_ci#define SIUMCR_CS10PC00	0x00000000	/* CS10 Pin Configuration	*/
96162306a36Sopenharmony_ci#define SIUMCR_CS10PC01	0x00040000	/* - " -			*/
96262306a36Sopenharmony_ci#define SIUMCR_CS10PC10	0x00080000	/* - " -			*/
96362306a36Sopenharmony_ci#define SIUMCR_CS10PC11	0x000c0000	/* - " -			*/
96462306a36Sopenharmony_ci#define SIUMCR_BCTLC00	0x00000000	/* Buffer Control Configuration	*/
96562306a36Sopenharmony_ci#define SIUMCR_BCTLC01	0x00010000	/* - " -			*/
96662306a36Sopenharmony_ci#define SIUMCR_BCTLC10	0x00020000	/* - " -			*/
96762306a36Sopenharmony_ci#define SIUMCR_BCTLC11	0x00030000	/* - " -			*/
96862306a36Sopenharmony_ci#define SIUMCR_MMR00	0x00000000	/* Mask Masters Requests	*/
96962306a36Sopenharmony_ci#define SIUMCR_MMR01	0x00004000	/* - " -			*/
97062306a36Sopenharmony_ci#define SIUMCR_MMR10	0x00008000	/* - " -			*/
97162306a36Sopenharmony_ci#define SIUMCR_MMR11	0x0000c000	/* - " -			*/
97262306a36Sopenharmony_ci#define SIUMCR_LPBSE	0x00002000	/* LocalBus Parity Byte Select Enable*/
97362306a36Sopenharmony_ci
97462306a36Sopenharmony_ci/*-----------------------------------------------------------------------
97562306a36Sopenharmony_ci * SCCR - System Clock Control Register					 9-8
97662306a36Sopenharmony_ci*/
97762306a36Sopenharmony_ci#define SCCR_PCI_MODE	0x00000100	/* PCI Mode	*/
97862306a36Sopenharmony_ci#define SCCR_PCI_MODCK	0x00000080	/* Value of PCI_MODCK pin	*/
97962306a36Sopenharmony_ci#define SCCR_PCIDF_MSK	0x00000078	/* PCI division factor	*/
98062306a36Sopenharmony_ci#define SCCR_PCIDF_SHIFT 3
98162306a36Sopenharmony_ci
98262306a36Sopenharmony_ci#ifndef CPM_IMMR_OFFSET
98362306a36Sopenharmony_ci#define CPM_IMMR_OFFSET	0x101a8
98462306a36Sopenharmony_ci#endif
98562306a36Sopenharmony_ci
98662306a36Sopenharmony_ci#define FCC_PSMR_RMII	((uint)0x00020000)	/* Use RMII interface */
98762306a36Sopenharmony_ci
98862306a36Sopenharmony_ci/* FCC iop & clock configuration. BSP code is responsible to define Fx_RXCLK & Fx_TXCLK
98962306a36Sopenharmony_ci * in order to use clock-computing stuff below for the FCC x
99062306a36Sopenharmony_ci */
99162306a36Sopenharmony_ci
99262306a36Sopenharmony_ci/* Automatically generates register configurations */
99362306a36Sopenharmony_ci#define PC_CLK(x)	((uint)(1<<(x-1)))	/* FCC CLK I/O ports */
99462306a36Sopenharmony_ci
99562306a36Sopenharmony_ci#define CMXFCR_RF1CS(x)	((uint)((x-5)<<27))	/* FCC1 Receive Clock Source */
99662306a36Sopenharmony_ci#define CMXFCR_TF1CS(x)	((uint)((x-5)<<24))	/* FCC1 Transmit Clock Source */
99762306a36Sopenharmony_ci#define CMXFCR_RF2CS(x)	((uint)((x-9)<<19))	/* FCC2 Receive Clock Source */
99862306a36Sopenharmony_ci#define CMXFCR_TF2CS(x) ((uint)((x-9)<<16))	/* FCC2 Transmit Clock Source */
99962306a36Sopenharmony_ci#define CMXFCR_RF3CS(x)	((uint)((x-9)<<11))	/* FCC3 Receive Clock Source */
100062306a36Sopenharmony_ci#define CMXFCR_TF3CS(x) ((uint)((x-9)<<8))	/* FCC3 Transmit Clock Source */
100162306a36Sopenharmony_ci
100262306a36Sopenharmony_ci#define PC_F1RXCLK	PC_CLK(F1_RXCLK)
100362306a36Sopenharmony_ci#define PC_F1TXCLK	PC_CLK(F1_TXCLK)
100462306a36Sopenharmony_ci#define CMX1_CLK_ROUTE	(CMXFCR_RF1CS(F1_RXCLK) | CMXFCR_TF1CS(F1_TXCLK))
100562306a36Sopenharmony_ci#define CMX1_CLK_MASK	((uint)0xff000000)
100662306a36Sopenharmony_ci
100762306a36Sopenharmony_ci#define PC_F2RXCLK	PC_CLK(F2_RXCLK)
100862306a36Sopenharmony_ci#define PC_F2TXCLK	PC_CLK(F2_TXCLK)
100962306a36Sopenharmony_ci#define CMX2_CLK_ROUTE	(CMXFCR_RF2CS(F2_RXCLK) | CMXFCR_TF2CS(F2_TXCLK))
101062306a36Sopenharmony_ci#define CMX2_CLK_MASK	((uint)0x00ff0000)
101162306a36Sopenharmony_ci
101262306a36Sopenharmony_ci#define PC_F3RXCLK	PC_CLK(F3_RXCLK)
101362306a36Sopenharmony_ci#define PC_F3TXCLK	PC_CLK(F3_TXCLK)
101462306a36Sopenharmony_ci#define CMX3_CLK_ROUTE	(CMXFCR_RF3CS(F3_RXCLK) | CMXFCR_TF3CS(F3_TXCLK))
101562306a36Sopenharmony_ci#define CMX3_CLK_MASK	((uint)0x0000ff00)
101662306a36Sopenharmony_ci
101762306a36Sopenharmony_ci#define CPMUX_CLK_MASK (CMX3_CLK_MASK | CMX2_CLK_MASK)
101862306a36Sopenharmony_ci#define CPMUX_CLK_ROUTE (CMX3_CLK_ROUTE | CMX2_CLK_ROUTE)
101962306a36Sopenharmony_ci
102062306a36Sopenharmony_ci#define CLK_TRX (PC_F3TXCLK | PC_F3RXCLK | PC_F2TXCLK | PC_F2RXCLK)
102162306a36Sopenharmony_ci
102262306a36Sopenharmony_ci/* I/O Pin assignment for FCC1.  I don't yet know the best way to do this,
102362306a36Sopenharmony_ci * but there is little variation among the choices.
102462306a36Sopenharmony_ci */
102562306a36Sopenharmony_ci#define PA1_COL		0x00000001U
102662306a36Sopenharmony_ci#define PA1_CRS		0x00000002U
102762306a36Sopenharmony_ci#define PA1_TXER	0x00000004U
102862306a36Sopenharmony_ci#define PA1_TXEN	0x00000008U
102962306a36Sopenharmony_ci#define PA1_RXDV	0x00000010U
103062306a36Sopenharmony_ci#define PA1_RXER	0x00000020U
103162306a36Sopenharmony_ci#define PA1_TXDAT	0x00003c00U
103262306a36Sopenharmony_ci#define PA1_RXDAT	0x0003c000U
103362306a36Sopenharmony_ci#define PA1_PSORA0	(PA1_RXDAT | PA1_TXDAT)
103462306a36Sopenharmony_ci#define PA1_PSORA1	(PA1_COL | PA1_CRS | PA1_TXER | PA1_TXEN | \
103562306a36Sopenharmony_ci		PA1_RXDV | PA1_RXER)
103662306a36Sopenharmony_ci#define PA1_DIRA0	(PA1_RXDAT | PA1_CRS | PA1_COL | PA1_RXER | PA1_RXDV)
103762306a36Sopenharmony_ci#define PA1_DIRA1	(PA1_TXDAT | PA1_TXEN | PA1_TXER)
103862306a36Sopenharmony_ci
103962306a36Sopenharmony_ci
104062306a36Sopenharmony_ci/* I/O Pin assignment for FCC2.  I don't yet know the best way to do this,
104162306a36Sopenharmony_ci * but there is little variation among the choices.
104262306a36Sopenharmony_ci */
104362306a36Sopenharmony_ci#define PB2_TXER	0x00000001U
104462306a36Sopenharmony_ci#define PB2_RXDV	0x00000002U
104562306a36Sopenharmony_ci#define PB2_TXEN	0x00000004U
104662306a36Sopenharmony_ci#define PB2_RXER	0x00000008U
104762306a36Sopenharmony_ci#define PB2_COL		0x00000010U
104862306a36Sopenharmony_ci#define PB2_CRS		0x00000020U
104962306a36Sopenharmony_ci#define PB2_TXDAT	0x000003c0U
105062306a36Sopenharmony_ci#define PB2_RXDAT	0x00003c00U
105162306a36Sopenharmony_ci#define PB2_PSORB0	(PB2_RXDAT | PB2_TXDAT | PB2_CRS | PB2_COL | \
105262306a36Sopenharmony_ci		PB2_RXER | PB2_RXDV | PB2_TXER)
105362306a36Sopenharmony_ci#define PB2_PSORB1	(PB2_TXEN)
105462306a36Sopenharmony_ci#define PB2_DIRB0	(PB2_RXDAT | PB2_CRS | PB2_COL | PB2_RXER | PB2_RXDV)
105562306a36Sopenharmony_ci#define PB2_DIRB1	(PB2_TXDAT | PB2_TXEN | PB2_TXER)
105662306a36Sopenharmony_ci
105762306a36Sopenharmony_ci
105862306a36Sopenharmony_ci/* I/O Pin assignment for FCC3.  I don't yet know the best way to do this,
105962306a36Sopenharmony_ci * but there is little variation among the choices.
106062306a36Sopenharmony_ci */
106162306a36Sopenharmony_ci#define PB3_RXDV	0x00004000U
106262306a36Sopenharmony_ci#define PB3_RXER	0x00008000U
106362306a36Sopenharmony_ci#define PB3_TXER	0x00010000U
106462306a36Sopenharmony_ci#define PB3_TXEN	0x00020000U
106562306a36Sopenharmony_ci#define PB3_COL		0x00040000U
106662306a36Sopenharmony_ci#define PB3_CRS		0x00080000U
106762306a36Sopenharmony_ci#define PB3_TXDAT	0x0f000000U
106862306a36Sopenharmony_ci#define PC3_TXDAT	0x00000010U
106962306a36Sopenharmony_ci#define PB3_RXDAT	0x00f00000U
107062306a36Sopenharmony_ci#define PB3_PSORB0	(PB3_RXDAT | PB3_TXDAT | PB3_CRS | PB3_COL | \
107162306a36Sopenharmony_ci		PB3_RXER | PB3_RXDV | PB3_TXER | PB3_TXEN)
107262306a36Sopenharmony_ci#define PB3_PSORB1	0
107362306a36Sopenharmony_ci#define PB3_DIRB0	(PB3_RXDAT | PB3_CRS | PB3_COL | PB3_RXER | PB3_RXDV)
107462306a36Sopenharmony_ci#define PB3_DIRB1	(PB3_TXDAT | PB3_TXEN | PB3_TXER)
107562306a36Sopenharmony_ci#define PC3_DIRC1	(PC3_TXDAT)
107662306a36Sopenharmony_ci
107762306a36Sopenharmony_ci/* Handy macro to specify mem for FCCs*/
107862306a36Sopenharmony_ci#define FCC_MEM_OFFSET(x) (CPM_FCC_SPECIAL_BASE + (x*128))
107962306a36Sopenharmony_ci#define FCC1_MEM_OFFSET FCC_MEM_OFFSET(0)
108062306a36Sopenharmony_ci#define FCC2_MEM_OFFSET FCC_MEM_OFFSET(1)
108162306a36Sopenharmony_ci#define FCC3_MEM_OFFSET FCC_MEM_OFFSET(2)
108262306a36Sopenharmony_ci
108362306a36Sopenharmony_ci/* Pipeline Maximum Depth */
108462306a36Sopenharmony_ci#define MPC82XX_BCR_PLDP 0x00800000
108562306a36Sopenharmony_ci
108662306a36Sopenharmony_ci/* Clocks and GRG's */
108762306a36Sopenharmony_ci
108862306a36Sopenharmony_cienum cpm_clk_dir {
108962306a36Sopenharmony_ci	CPM_CLK_RX,
109062306a36Sopenharmony_ci	CPM_CLK_TX,
109162306a36Sopenharmony_ci	CPM_CLK_RTX
109262306a36Sopenharmony_ci};
109362306a36Sopenharmony_ci
109462306a36Sopenharmony_cienum cpm_clk_target {
109562306a36Sopenharmony_ci	CPM_CLK_SCC1,
109662306a36Sopenharmony_ci	CPM_CLK_SCC2,
109762306a36Sopenharmony_ci	CPM_CLK_SCC3,
109862306a36Sopenharmony_ci	CPM_CLK_SCC4,
109962306a36Sopenharmony_ci	CPM_CLK_FCC1,
110062306a36Sopenharmony_ci	CPM_CLK_FCC2,
110162306a36Sopenharmony_ci	CPM_CLK_FCC3,
110262306a36Sopenharmony_ci	CPM_CLK_SMC1,
110362306a36Sopenharmony_ci	CPM_CLK_SMC2,
110462306a36Sopenharmony_ci};
110562306a36Sopenharmony_ci
110662306a36Sopenharmony_cienum cpm_clk {
110762306a36Sopenharmony_ci	CPM_CLK_NONE = 0,
110862306a36Sopenharmony_ci	CPM_BRG1,	/* Baud Rate Generator  1 */
110962306a36Sopenharmony_ci	CPM_BRG2,	/* Baud Rate Generator  2 */
111062306a36Sopenharmony_ci	CPM_BRG3,	/* Baud Rate Generator  3 */
111162306a36Sopenharmony_ci	CPM_BRG4,	/* Baud Rate Generator  4 */
111262306a36Sopenharmony_ci	CPM_BRG5,	/* Baud Rate Generator  5 */
111362306a36Sopenharmony_ci	CPM_BRG6,	/* Baud Rate Generator  6 */
111462306a36Sopenharmony_ci	CPM_BRG7,	/* Baud Rate Generator  7 */
111562306a36Sopenharmony_ci	CPM_BRG8,	/* Baud Rate Generator  8 */
111662306a36Sopenharmony_ci	CPM_CLK1,	/* Clock  1 */
111762306a36Sopenharmony_ci	CPM_CLK2,	/* Clock  2 */
111862306a36Sopenharmony_ci	CPM_CLK3,	/* Clock  3 */
111962306a36Sopenharmony_ci	CPM_CLK4,	/* Clock  4 */
112062306a36Sopenharmony_ci	CPM_CLK5,	/* Clock  5 */
112162306a36Sopenharmony_ci	CPM_CLK6,	/* Clock  6 */
112262306a36Sopenharmony_ci	CPM_CLK7,	/* Clock  7 */
112362306a36Sopenharmony_ci	CPM_CLK8,	/* Clock  8 */
112462306a36Sopenharmony_ci	CPM_CLK9,	/* Clock  9 */
112562306a36Sopenharmony_ci	CPM_CLK10,	/* Clock 10 */
112662306a36Sopenharmony_ci	CPM_CLK11,	/* Clock 11 */
112762306a36Sopenharmony_ci	CPM_CLK12,	/* Clock 12 */
112862306a36Sopenharmony_ci	CPM_CLK13,	/* Clock 13 */
112962306a36Sopenharmony_ci	CPM_CLK14,	/* Clock 14 */
113062306a36Sopenharmony_ci	CPM_CLK15,	/* Clock 15 */
113162306a36Sopenharmony_ci	CPM_CLK16,	/* Clock 16 */
113262306a36Sopenharmony_ci	CPM_CLK17,	/* Clock 17 */
113362306a36Sopenharmony_ci	CPM_CLK18,	/* Clock 18 */
113462306a36Sopenharmony_ci	CPM_CLK19,	/* Clock 19 */
113562306a36Sopenharmony_ci	CPM_CLK20,	/* Clock 20 */
113662306a36Sopenharmony_ci	CPM_CLK_DUMMY
113762306a36Sopenharmony_ci};
113862306a36Sopenharmony_ci
113962306a36Sopenharmony_ciint __init cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode);
114062306a36Sopenharmony_ciint __init cpm2_smc_clk_setup(enum cpm_clk_target target, int clock);
114162306a36Sopenharmony_ci
114262306a36Sopenharmony_ci#define CPM_PIN_INPUT     0
114362306a36Sopenharmony_ci#define CPM_PIN_OUTPUT    1
114462306a36Sopenharmony_ci#define CPM_PIN_PRIMARY   0
114562306a36Sopenharmony_ci#define CPM_PIN_SECONDARY 2
114662306a36Sopenharmony_ci#define CPM_PIN_GPIO      4
114762306a36Sopenharmony_ci#define CPM_PIN_OPENDRAIN 8
114862306a36Sopenharmony_ci
114962306a36Sopenharmony_civoid __init cpm2_set_pin(int port, int pin, int flags);
115062306a36Sopenharmony_ci
115162306a36Sopenharmony_ci#endif /* __CPM2__ */
115262306a36Sopenharmony_ci#endif /* __KERNEL__ */
1153