18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Communication Processor Module v2.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * This file contains structures and information for the communication
68c2ecf20Sopenharmony_ci * processor channels found in the dual port RAM or parameter RAM.
78c2ecf20Sopenharmony_ci * All CPM control and status is available through the CPM2 internal
88c2ecf20Sopenharmony_ci * memory map.  See immap_cpm2.h for details.
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci#ifdef __KERNEL__
118c2ecf20Sopenharmony_ci#ifndef __CPM2__
128c2ecf20Sopenharmony_ci#define __CPM2__
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <asm/immap_cpm2.h>
158c2ecf20Sopenharmony_ci#include <asm/cpm.h>
168c2ecf20Sopenharmony_ci#include <sysdev/fsl_soc.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* CPM Command register.
198c2ecf20Sopenharmony_ci*/
208c2ecf20Sopenharmony_ci#define CPM_CR_RST	((uint)0x80000000)
218c2ecf20Sopenharmony_ci#define CPM_CR_PAGE	((uint)0x7c000000)
228c2ecf20Sopenharmony_ci#define CPM_CR_SBLOCK	((uint)0x03e00000)
238c2ecf20Sopenharmony_ci#define CPM_CR_FLG	((uint)0x00010000)
248c2ecf20Sopenharmony_ci#define CPM_CR_MCN	((uint)0x00003fc0)
258c2ecf20Sopenharmony_ci#define CPM_CR_OPCODE	((uint)0x0000000f)
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/* Device sub-block and page codes.
288c2ecf20Sopenharmony_ci*/
298c2ecf20Sopenharmony_ci#define CPM_CR_SCC1_SBLOCK	(0x04)
308c2ecf20Sopenharmony_ci#define CPM_CR_SCC2_SBLOCK	(0x05)
318c2ecf20Sopenharmony_ci#define CPM_CR_SCC3_SBLOCK	(0x06)
328c2ecf20Sopenharmony_ci#define CPM_CR_SCC4_SBLOCK	(0x07)
338c2ecf20Sopenharmony_ci#define CPM_CR_SMC1_SBLOCK	(0x08)
348c2ecf20Sopenharmony_ci#define CPM_CR_SMC2_SBLOCK	(0x09)
358c2ecf20Sopenharmony_ci#define CPM_CR_SPI_SBLOCK	(0x0a)
368c2ecf20Sopenharmony_ci#define CPM_CR_I2C_SBLOCK	(0x0b)
378c2ecf20Sopenharmony_ci#define CPM_CR_TIMER_SBLOCK	(0x0f)
388c2ecf20Sopenharmony_ci#define CPM_CR_RAND_SBLOCK	(0x0e)
398c2ecf20Sopenharmony_ci#define CPM_CR_FCC1_SBLOCK	(0x10)
408c2ecf20Sopenharmony_ci#define CPM_CR_FCC2_SBLOCK	(0x11)
418c2ecf20Sopenharmony_ci#define CPM_CR_FCC3_SBLOCK	(0x12)
428c2ecf20Sopenharmony_ci#define CPM_CR_IDMA1_SBLOCK	(0x14)
438c2ecf20Sopenharmony_ci#define CPM_CR_IDMA2_SBLOCK	(0x15)
448c2ecf20Sopenharmony_ci#define CPM_CR_IDMA3_SBLOCK	(0x16)
458c2ecf20Sopenharmony_ci#define CPM_CR_IDMA4_SBLOCK	(0x17)
468c2ecf20Sopenharmony_ci#define CPM_CR_MCC1_SBLOCK	(0x1c)
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#define CPM_CR_FCC_SBLOCK(x)	(x + 0x10)
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define CPM_CR_SCC1_PAGE	(0x00)
518c2ecf20Sopenharmony_ci#define CPM_CR_SCC2_PAGE	(0x01)
528c2ecf20Sopenharmony_ci#define CPM_CR_SCC3_PAGE	(0x02)
538c2ecf20Sopenharmony_ci#define CPM_CR_SCC4_PAGE	(0x03)
548c2ecf20Sopenharmony_ci#define CPM_CR_SMC1_PAGE	(0x07)
558c2ecf20Sopenharmony_ci#define CPM_CR_SMC2_PAGE	(0x08)
568c2ecf20Sopenharmony_ci#define CPM_CR_SPI_PAGE		(0x09)
578c2ecf20Sopenharmony_ci#define CPM_CR_I2C_PAGE		(0x0a)
588c2ecf20Sopenharmony_ci#define CPM_CR_TIMER_PAGE	(0x0a)
598c2ecf20Sopenharmony_ci#define CPM_CR_RAND_PAGE	(0x0a)
608c2ecf20Sopenharmony_ci#define CPM_CR_FCC1_PAGE	(0x04)
618c2ecf20Sopenharmony_ci#define CPM_CR_FCC2_PAGE	(0x05)
628c2ecf20Sopenharmony_ci#define CPM_CR_FCC3_PAGE	(0x06)
638c2ecf20Sopenharmony_ci#define CPM_CR_IDMA1_PAGE	(0x07)
648c2ecf20Sopenharmony_ci#define CPM_CR_IDMA2_PAGE	(0x08)
658c2ecf20Sopenharmony_ci#define CPM_CR_IDMA3_PAGE	(0x09)
668c2ecf20Sopenharmony_ci#define CPM_CR_IDMA4_PAGE	(0x0a)
678c2ecf20Sopenharmony_ci#define CPM_CR_MCC1_PAGE	(0x07)
688c2ecf20Sopenharmony_ci#define CPM_CR_MCC2_PAGE	(0x08)
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#define CPM_CR_FCC_PAGE(x)	(x + 0x04)
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci/* CPM2-specific opcodes (see cpm.h for common opcodes)
738c2ecf20Sopenharmony_ci*/
748c2ecf20Sopenharmony_ci#define CPM_CR_START_IDMA	((ushort)0x0009)
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci#define mk_cr_cmd(PG, SBC, MCN, OP) \
778c2ecf20Sopenharmony_ci	((PG << 26) | (SBC << 21) | (MCN << 6) | OP)
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/* The number of pages of host memory we allocate for CPM.  This is
808c2ecf20Sopenharmony_ci * done early in kernel initialization to get physically contiguous
818c2ecf20Sopenharmony_ci * pages.
828c2ecf20Sopenharmony_ci */
838c2ecf20Sopenharmony_ci#define NUM_CPM_HOST_PAGES	2
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/* Export the base address of the communication processor registers
868c2ecf20Sopenharmony_ci * and dual port ram.
878c2ecf20Sopenharmony_ci */
888c2ecf20Sopenharmony_ciextern cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor */
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#define cpm_dpalloc cpm_muram_alloc
918c2ecf20Sopenharmony_ci#define cpm_dpfree cpm_muram_free
928c2ecf20Sopenharmony_ci#define cpm_dpram_addr cpm_muram_addr
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ciextern void cpm2_reset(void);
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci/* Baud rate generators.
978c2ecf20Sopenharmony_ci*/
988c2ecf20Sopenharmony_ci#define CPM_BRG_RST		((uint)0x00020000)
998c2ecf20Sopenharmony_ci#define CPM_BRG_EN		((uint)0x00010000)
1008c2ecf20Sopenharmony_ci#define CPM_BRG_EXTC_INT	((uint)0x00000000)
1018c2ecf20Sopenharmony_ci#define CPM_BRG_EXTC_CLK3_9	((uint)0x00004000)
1028c2ecf20Sopenharmony_ci#define CPM_BRG_EXTC_CLK5_15	((uint)0x00008000)
1038c2ecf20Sopenharmony_ci#define CPM_BRG_ATB		((uint)0x00002000)
1048c2ecf20Sopenharmony_ci#define CPM_BRG_CD_MASK		((uint)0x00001ffe)
1058c2ecf20Sopenharmony_ci#define CPM_BRG_DIV16		((uint)0x00000001)
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci#define CPM2_BRG_INT_CLK	(get_brgfreq())
1088c2ecf20Sopenharmony_ci#define CPM2_BRG_UART_CLK	(CPM2_BRG_INT_CLK/16)
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ciextern void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src);
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci/* This function is used by UARTS, or anything else that uses a 16x
1138c2ecf20Sopenharmony_ci * oversampled clock.
1148c2ecf20Sopenharmony_ci */
1158c2ecf20Sopenharmony_cistatic inline void cpm_setbrg(uint brg, uint rate)
1168c2ecf20Sopenharmony_ci{
1178c2ecf20Sopenharmony_ci	__cpm2_setbrg(brg, rate, CPM2_BRG_UART_CLK, 0, CPM_BRG_EXTC_INT);
1188c2ecf20Sopenharmony_ci}
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* This function is used to set high speed synchronous baud rate
1218c2ecf20Sopenharmony_ci * clocks.
1228c2ecf20Sopenharmony_ci */
1238c2ecf20Sopenharmony_cistatic inline void cpm2_fastbrg(uint brg, uint rate, int div16)
1248c2ecf20Sopenharmony_ci{
1258c2ecf20Sopenharmony_ci	__cpm2_setbrg(brg, rate, CPM2_BRG_INT_CLK, div16, CPM_BRG_EXTC_INT);
1268c2ecf20Sopenharmony_ci}
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci/* Parameter RAM offsets from the base.
1298c2ecf20Sopenharmony_ci*/
1308c2ecf20Sopenharmony_ci#define PROFF_SCC1		((uint)0x8000)
1318c2ecf20Sopenharmony_ci#define PROFF_SCC2		((uint)0x8100)
1328c2ecf20Sopenharmony_ci#define PROFF_SCC3		((uint)0x8200)
1338c2ecf20Sopenharmony_ci#define PROFF_SCC4		((uint)0x8300)
1348c2ecf20Sopenharmony_ci#define PROFF_FCC1		((uint)0x8400)
1358c2ecf20Sopenharmony_ci#define PROFF_FCC2		((uint)0x8500)
1368c2ecf20Sopenharmony_ci#define PROFF_FCC3		((uint)0x8600)
1378c2ecf20Sopenharmony_ci#define PROFF_MCC1		((uint)0x8700)
1388c2ecf20Sopenharmony_ci#define PROFF_SMC1_BASE		((uint)0x87fc)
1398c2ecf20Sopenharmony_ci#define PROFF_IDMA1_BASE	((uint)0x87fe)
1408c2ecf20Sopenharmony_ci#define PROFF_MCC2		((uint)0x8800)
1418c2ecf20Sopenharmony_ci#define PROFF_SMC2_BASE		((uint)0x88fc)
1428c2ecf20Sopenharmony_ci#define PROFF_IDMA2_BASE	((uint)0x88fe)
1438c2ecf20Sopenharmony_ci#define PROFF_SPI_BASE		((uint)0x89fc)
1448c2ecf20Sopenharmony_ci#define PROFF_IDMA3_BASE	((uint)0x89fe)
1458c2ecf20Sopenharmony_ci#define PROFF_TIMERS		((uint)0x8ae0)
1468c2ecf20Sopenharmony_ci#define PROFF_REVNUM		((uint)0x8af0)
1478c2ecf20Sopenharmony_ci#define PROFF_RAND		((uint)0x8af8)
1488c2ecf20Sopenharmony_ci#define PROFF_I2C_BASE		((uint)0x8afc)
1498c2ecf20Sopenharmony_ci#define PROFF_IDMA4_BASE	((uint)0x8afe)
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci#define PROFF_SCC_SIZE		((uint)0x100)
1528c2ecf20Sopenharmony_ci#define PROFF_FCC_SIZE		((uint)0x100)
1538c2ecf20Sopenharmony_ci#define PROFF_SMC_SIZE		((uint)64)
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci/* The SMCs are relocated to any of the first eight DPRAM pages.
1568c2ecf20Sopenharmony_ci * We will fix these at the first locations of DPRAM, until we
1578c2ecf20Sopenharmony_ci * get some microcode patches :-).
1588c2ecf20Sopenharmony_ci * The parameter ram space for the SMCs is fifty-some bytes, and
1598c2ecf20Sopenharmony_ci * they are required to start on a 64 byte boundary.
1608c2ecf20Sopenharmony_ci */
1618c2ecf20Sopenharmony_ci#define PROFF_SMC1	(0)
1628c2ecf20Sopenharmony_ci#define PROFF_SMC2	(64)
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/* Define enough so I can at least use the serial port as a UART.
1668c2ecf20Sopenharmony_ci */
1678c2ecf20Sopenharmony_citypedef struct smc_uart {
1688c2ecf20Sopenharmony_ci	ushort	smc_rbase;	/* Rx Buffer descriptor base address */
1698c2ecf20Sopenharmony_ci	ushort	smc_tbase;	/* Tx Buffer descriptor base address */
1708c2ecf20Sopenharmony_ci	u_char	smc_rfcr;	/* Rx function code */
1718c2ecf20Sopenharmony_ci	u_char	smc_tfcr;	/* Tx function code */
1728c2ecf20Sopenharmony_ci	ushort	smc_mrblr;	/* Max receive buffer length */
1738c2ecf20Sopenharmony_ci	uint	smc_rstate;	/* Internal */
1748c2ecf20Sopenharmony_ci	uint	smc_idp;	/* Internal */
1758c2ecf20Sopenharmony_ci	ushort	smc_rbptr;	/* Internal */
1768c2ecf20Sopenharmony_ci	ushort	smc_ibc;	/* Internal */
1778c2ecf20Sopenharmony_ci	uint	smc_rxtmp;	/* Internal */
1788c2ecf20Sopenharmony_ci	uint	smc_tstate;	/* Internal */
1798c2ecf20Sopenharmony_ci	uint	smc_tdp;	/* Internal */
1808c2ecf20Sopenharmony_ci	ushort	smc_tbptr;	/* Internal */
1818c2ecf20Sopenharmony_ci	ushort	smc_tbc;	/* Internal */
1828c2ecf20Sopenharmony_ci	uint	smc_txtmp;	/* Internal */
1838c2ecf20Sopenharmony_ci	ushort	smc_maxidl;	/* Maximum idle characters */
1848c2ecf20Sopenharmony_ci	ushort	smc_tmpidl;	/* Temporary idle counter */
1858c2ecf20Sopenharmony_ci	ushort	smc_brklen;	/* Last received break length */
1868c2ecf20Sopenharmony_ci	ushort	smc_brkec;	/* rcv'd break condition counter */
1878c2ecf20Sopenharmony_ci	ushort	smc_brkcr;	/* xmt break count register */
1888c2ecf20Sopenharmony_ci	ushort	smc_rmask;	/* Temporary bit mask */
1898c2ecf20Sopenharmony_ci	uint	smc_stmp;	/* SDMA Temp */
1908c2ecf20Sopenharmony_ci} smc_uart_t;
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci/* SMC uart mode register (Internal memory map).
1938c2ecf20Sopenharmony_ci*/
1948c2ecf20Sopenharmony_ci#define SMCMR_REN	((ushort)0x0001)
1958c2ecf20Sopenharmony_ci#define SMCMR_TEN	((ushort)0x0002)
1968c2ecf20Sopenharmony_ci#define SMCMR_DM	((ushort)0x000c)
1978c2ecf20Sopenharmony_ci#define SMCMR_SM_GCI	((ushort)0x0000)
1988c2ecf20Sopenharmony_ci#define SMCMR_SM_UART	((ushort)0x0020)
1998c2ecf20Sopenharmony_ci#define SMCMR_SM_TRANS	((ushort)0x0030)
2008c2ecf20Sopenharmony_ci#define SMCMR_SM_MASK	((ushort)0x0030)
2018c2ecf20Sopenharmony_ci#define SMCMR_PM_EVEN	((ushort)0x0100)	/* Even parity, else odd */
2028c2ecf20Sopenharmony_ci#define SMCMR_REVD	SMCMR_PM_EVEN
2038c2ecf20Sopenharmony_ci#define SMCMR_PEN	((ushort)0x0200)	/* Parity enable */
2048c2ecf20Sopenharmony_ci#define SMCMR_BS	SMCMR_PEN
2058c2ecf20Sopenharmony_ci#define SMCMR_SL	((ushort)0x0400)	/* Two stops, else one */
2068c2ecf20Sopenharmony_ci#define SMCR_CLEN_MASK	((ushort)0x7800)	/* Character length */
2078c2ecf20Sopenharmony_ci#define smcr_mk_clen(C)	(((C) << 11) & SMCR_CLEN_MASK)
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci/* SMC Event and Mask register.
2108c2ecf20Sopenharmony_ci*/
2118c2ecf20Sopenharmony_ci#define SMCM_BRKE       ((unsigned char)0x40)   /* When in UART Mode */
2128c2ecf20Sopenharmony_ci#define SMCM_BRK        ((unsigned char)0x10)   /* When in UART Mode */
2138c2ecf20Sopenharmony_ci#define SMCM_TXE	((unsigned char)0x10)
2148c2ecf20Sopenharmony_ci#define SMCM_BSY	((unsigned char)0x04)
2158c2ecf20Sopenharmony_ci#define SMCM_TX		((unsigned char)0x02)
2168c2ecf20Sopenharmony_ci#define SMCM_RX		((unsigned char)0x01)
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci/* SCCs.
2198c2ecf20Sopenharmony_ci*/
2208c2ecf20Sopenharmony_ci#define SCC_GSMRH_IRP		((uint)0x00040000)
2218c2ecf20Sopenharmony_ci#define SCC_GSMRH_GDE		((uint)0x00010000)
2228c2ecf20Sopenharmony_ci#define SCC_GSMRH_TCRC_CCITT	((uint)0x00008000)
2238c2ecf20Sopenharmony_ci#define SCC_GSMRH_TCRC_BISYNC	((uint)0x00004000)
2248c2ecf20Sopenharmony_ci#define SCC_GSMRH_TCRC_HDLC	((uint)0x00000000)
2258c2ecf20Sopenharmony_ci#define SCC_GSMRH_REVD		((uint)0x00002000)
2268c2ecf20Sopenharmony_ci#define SCC_GSMRH_TRX		((uint)0x00001000)
2278c2ecf20Sopenharmony_ci#define SCC_GSMRH_TTX		((uint)0x00000800)
2288c2ecf20Sopenharmony_ci#define SCC_GSMRH_CDP		((uint)0x00000400)
2298c2ecf20Sopenharmony_ci#define SCC_GSMRH_CTSP		((uint)0x00000200)
2308c2ecf20Sopenharmony_ci#define SCC_GSMRH_CDS		((uint)0x00000100)
2318c2ecf20Sopenharmony_ci#define SCC_GSMRH_CTSS		((uint)0x00000080)
2328c2ecf20Sopenharmony_ci#define SCC_GSMRH_TFL		((uint)0x00000040)
2338c2ecf20Sopenharmony_ci#define SCC_GSMRH_RFW		((uint)0x00000020)
2348c2ecf20Sopenharmony_ci#define SCC_GSMRH_TXSY		((uint)0x00000010)
2358c2ecf20Sopenharmony_ci#define SCC_GSMRH_SYNL16	((uint)0x0000000c)
2368c2ecf20Sopenharmony_ci#define SCC_GSMRH_SYNL8		((uint)0x00000008)
2378c2ecf20Sopenharmony_ci#define SCC_GSMRH_SYNL4		((uint)0x00000004)
2388c2ecf20Sopenharmony_ci#define SCC_GSMRH_RTSM		((uint)0x00000002)
2398c2ecf20Sopenharmony_ci#define SCC_GSMRH_RSYN		((uint)0x00000001)
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_ci#define SCC_GSMRL_SIR		((uint)0x80000000)	/* SCC2 only */
2428c2ecf20Sopenharmony_ci#define SCC_GSMRL_EDGE_NONE	((uint)0x60000000)
2438c2ecf20Sopenharmony_ci#define SCC_GSMRL_EDGE_NEG	((uint)0x40000000)
2448c2ecf20Sopenharmony_ci#define SCC_GSMRL_EDGE_POS	((uint)0x20000000)
2458c2ecf20Sopenharmony_ci#define SCC_GSMRL_EDGE_BOTH	((uint)0x00000000)
2468c2ecf20Sopenharmony_ci#define SCC_GSMRL_TCI		((uint)0x10000000)
2478c2ecf20Sopenharmony_ci#define SCC_GSMRL_TSNC_3	((uint)0x0c000000)
2488c2ecf20Sopenharmony_ci#define SCC_GSMRL_TSNC_4	((uint)0x08000000)
2498c2ecf20Sopenharmony_ci#define SCC_GSMRL_TSNC_14	((uint)0x04000000)
2508c2ecf20Sopenharmony_ci#define SCC_GSMRL_TSNC_INF	((uint)0x00000000)
2518c2ecf20Sopenharmony_ci#define SCC_GSMRL_RINV		((uint)0x02000000)
2528c2ecf20Sopenharmony_ci#define SCC_GSMRL_TINV		((uint)0x01000000)
2538c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPL_128	((uint)0x00c00000)
2548c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPL_64	((uint)0x00a00000)
2558c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPL_48	((uint)0x00800000)
2568c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPL_32	((uint)0x00600000)
2578c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPL_16	((uint)0x00400000)
2588c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPL_8		((uint)0x00200000)
2598c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPL_NONE	((uint)0x00000000)
2608c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPP_ALL1	((uint)0x00180000)
2618c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPP_01	((uint)0x00100000)
2628c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPP_10	((uint)0x00080000)
2638c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPP_ZEROS	((uint)0x00000000)
2648c2ecf20Sopenharmony_ci#define SCC_GSMRL_TEND		((uint)0x00040000)
2658c2ecf20Sopenharmony_ci#define SCC_GSMRL_TDCR_32	((uint)0x00030000)
2668c2ecf20Sopenharmony_ci#define SCC_GSMRL_TDCR_16	((uint)0x00020000)
2678c2ecf20Sopenharmony_ci#define SCC_GSMRL_TDCR_8	((uint)0x00010000)
2688c2ecf20Sopenharmony_ci#define SCC_GSMRL_TDCR_1	((uint)0x00000000)
2698c2ecf20Sopenharmony_ci#define SCC_GSMRL_RDCR_32	((uint)0x0000c000)
2708c2ecf20Sopenharmony_ci#define SCC_GSMRL_RDCR_16	((uint)0x00008000)
2718c2ecf20Sopenharmony_ci#define SCC_GSMRL_RDCR_8	((uint)0x00004000)
2728c2ecf20Sopenharmony_ci#define SCC_GSMRL_RDCR_1	((uint)0x00000000)
2738c2ecf20Sopenharmony_ci#define SCC_GSMRL_RENC_DFMAN	((uint)0x00003000)
2748c2ecf20Sopenharmony_ci#define SCC_GSMRL_RENC_MANCH	((uint)0x00002000)
2758c2ecf20Sopenharmony_ci#define SCC_GSMRL_RENC_FM0	((uint)0x00001000)
2768c2ecf20Sopenharmony_ci#define SCC_GSMRL_RENC_NRZI	((uint)0x00000800)
2778c2ecf20Sopenharmony_ci#define SCC_GSMRL_RENC_NRZ	((uint)0x00000000)
2788c2ecf20Sopenharmony_ci#define SCC_GSMRL_TENC_DFMAN	((uint)0x00000600)
2798c2ecf20Sopenharmony_ci#define SCC_GSMRL_TENC_MANCH	((uint)0x00000400)
2808c2ecf20Sopenharmony_ci#define SCC_GSMRL_TENC_FM0	((uint)0x00000200)
2818c2ecf20Sopenharmony_ci#define SCC_GSMRL_TENC_NRZI	((uint)0x00000100)
2828c2ecf20Sopenharmony_ci#define SCC_GSMRL_TENC_NRZ	((uint)0x00000000)
2838c2ecf20Sopenharmony_ci#define SCC_GSMRL_DIAG_LE	((uint)0x000000c0)	/* Loop and echo */
2848c2ecf20Sopenharmony_ci#define SCC_GSMRL_DIAG_ECHO	((uint)0x00000080)
2858c2ecf20Sopenharmony_ci#define SCC_GSMRL_DIAG_LOOP	((uint)0x00000040)
2868c2ecf20Sopenharmony_ci#define SCC_GSMRL_DIAG_NORM	((uint)0x00000000)
2878c2ecf20Sopenharmony_ci#define SCC_GSMRL_ENR		((uint)0x00000020)
2888c2ecf20Sopenharmony_ci#define SCC_GSMRL_ENT		((uint)0x00000010)
2898c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_ENET	((uint)0x0000000c)
2908c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_DDCMP	((uint)0x00000009)
2918c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_BISYNC	((uint)0x00000008)
2928c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_V14	((uint)0x00000007)
2938c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_AHDLC	((uint)0x00000006)
2948c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_PROFIBUS	((uint)0x00000005)
2958c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_UART	((uint)0x00000004)
2968c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_SS7	((uint)0x00000003)
2978c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_ATALK	((uint)0x00000002)
2988c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_HDLC	((uint)0x00000000)
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci#define SCC_TODR_TOD		((ushort)0x8000)
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci/* SCC Event and Mask register.
3038c2ecf20Sopenharmony_ci*/
3048c2ecf20Sopenharmony_ci#define SCCM_TXE	((unsigned char)0x10)
3058c2ecf20Sopenharmony_ci#define SCCM_BSY	((unsigned char)0x04)
3068c2ecf20Sopenharmony_ci#define SCCM_TX		((unsigned char)0x02)
3078c2ecf20Sopenharmony_ci#define SCCM_RX		((unsigned char)0x01)
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_citypedef struct scc_param {
3108c2ecf20Sopenharmony_ci	ushort	scc_rbase;	/* Rx Buffer descriptor base address */
3118c2ecf20Sopenharmony_ci	ushort	scc_tbase;	/* Tx Buffer descriptor base address */
3128c2ecf20Sopenharmony_ci	u_char	scc_rfcr;	/* Rx function code */
3138c2ecf20Sopenharmony_ci	u_char	scc_tfcr;	/* Tx function code */
3148c2ecf20Sopenharmony_ci	ushort	scc_mrblr;	/* Max receive buffer length */
3158c2ecf20Sopenharmony_ci	uint	scc_rstate;	/* Internal */
3168c2ecf20Sopenharmony_ci	uint	scc_idp;	/* Internal */
3178c2ecf20Sopenharmony_ci	ushort	scc_rbptr;	/* Internal */
3188c2ecf20Sopenharmony_ci	ushort	scc_ibc;	/* Internal */
3198c2ecf20Sopenharmony_ci	uint	scc_rxtmp;	/* Internal */
3208c2ecf20Sopenharmony_ci	uint	scc_tstate;	/* Internal */
3218c2ecf20Sopenharmony_ci	uint	scc_tdp;	/* Internal */
3228c2ecf20Sopenharmony_ci	ushort	scc_tbptr;	/* Internal */
3238c2ecf20Sopenharmony_ci	ushort	scc_tbc;	/* Internal */
3248c2ecf20Sopenharmony_ci	uint	scc_txtmp;	/* Internal */
3258c2ecf20Sopenharmony_ci	uint	scc_rcrc;	/* Internal */
3268c2ecf20Sopenharmony_ci	uint	scc_tcrc;	/* Internal */
3278c2ecf20Sopenharmony_ci} sccp_t;
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci/* Function code bits.
3308c2ecf20Sopenharmony_ci*/
3318c2ecf20Sopenharmony_ci#define SCC_EB	((u_char) 0x10)	/* Set big endian byte order */
3328c2ecf20Sopenharmony_ci#define SCC_GBL	((u_char) 0x20) /* Snooping enabled */
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci/* CPM Ethernet through SCC1.
3358c2ecf20Sopenharmony_ci */
3368c2ecf20Sopenharmony_citypedef struct scc_enet {
3378c2ecf20Sopenharmony_ci	sccp_t	sen_genscc;
3388c2ecf20Sopenharmony_ci	uint	sen_cpres;	/* Preset CRC */
3398c2ecf20Sopenharmony_ci	uint	sen_cmask;	/* Constant mask for CRC */
3408c2ecf20Sopenharmony_ci	uint	sen_crcec;	/* CRC Error counter */
3418c2ecf20Sopenharmony_ci	uint	sen_alec;	/* alignment error counter */
3428c2ecf20Sopenharmony_ci	uint	sen_disfc;	/* discard frame counter */
3438c2ecf20Sopenharmony_ci	ushort	sen_pads;	/* Tx short frame pad character */
3448c2ecf20Sopenharmony_ci	ushort	sen_retlim;	/* Retry limit threshold */
3458c2ecf20Sopenharmony_ci	ushort	sen_retcnt;	/* Retry limit counter */
3468c2ecf20Sopenharmony_ci	ushort	sen_maxflr;	/* maximum frame length register */
3478c2ecf20Sopenharmony_ci	ushort	sen_minflr;	/* minimum frame length register */
3488c2ecf20Sopenharmony_ci	ushort	sen_maxd1;	/* maximum DMA1 length */
3498c2ecf20Sopenharmony_ci	ushort	sen_maxd2;	/* maximum DMA2 length */
3508c2ecf20Sopenharmony_ci	ushort	sen_maxd;	/* Rx max DMA */
3518c2ecf20Sopenharmony_ci	ushort	sen_dmacnt;	/* Rx DMA counter */
3528c2ecf20Sopenharmony_ci	ushort	sen_maxb;	/* Max BD byte count */
3538c2ecf20Sopenharmony_ci	ushort	sen_gaddr1;	/* Group address filter */
3548c2ecf20Sopenharmony_ci	ushort	sen_gaddr2;
3558c2ecf20Sopenharmony_ci	ushort	sen_gaddr3;
3568c2ecf20Sopenharmony_ci	ushort	sen_gaddr4;
3578c2ecf20Sopenharmony_ci	uint	sen_tbuf0data0;	/* Save area 0 - current frame */
3588c2ecf20Sopenharmony_ci	uint	sen_tbuf0data1;	/* Save area 1 - current frame */
3598c2ecf20Sopenharmony_ci	uint	sen_tbuf0rba;	/* Internal */
3608c2ecf20Sopenharmony_ci	uint	sen_tbuf0crc;	/* Internal */
3618c2ecf20Sopenharmony_ci	ushort	sen_tbuf0bcnt;	/* Internal */
3628c2ecf20Sopenharmony_ci	ushort	sen_paddrh;	/* physical address (MSB) */
3638c2ecf20Sopenharmony_ci	ushort	sen_paddrm;
3648c2ecf20Sopenharmony_ci	ushort	sen_paddrl;	/* physical address (LSB) */
3658c2ecf20Sopenharmony_ci	ushort	sen_pper;	/* persistence */
3668c2ecf20Sopenharmony_ci	ushort	sen_rfbdptr;	/* Rx first BD pointer */
3678c2ecf20Sopenharmony_ci	ushort	sen_tfbdptr;	/* Tx first BD pointer */
3688c2ecf20Sopenharmony_ci	ushort	sen_tlbdptr;	/* Tx last BD pointer */
3698c2ecf20Sopenharmony_ci	uint	sen_tbuf1data0;	/* Save area 0 - current frame */
3708c2ecf20Sopenharmony_ci	uint	sen_tbuf1data1;	/* Save area 1 - current frame */
3718c2ecf20Sopenharmony_ci	uint	sen_tbuf1rba;	/* Internal */
3728c2ecf20Sopenharmony_ci	uint	sen_tbuf1crc;	/* Internal */
3738c2ecf20Sopenharmony_ci	ushort	sen_tbuf1bcnt;	/* Internal */
3748c2ecf20Sopenharmony_ci	ushort	sen_txlen;	/* Tx Frame length counter */
3758c2ecf20Sopenharmony_ci	ushort	sen_iaddr1;	/* Individual address filter */
3768c2ecf20Sopenharmony_ci	ushort	sen_iaddr2;
3778c2ecf20Sopenharmony_ci	ushort	sen_iaddr3;
3788c2ecf20Sopenharmony_ci	ushort	sen_iaddr4;
3798c2ecf20Sopenharmony_ci	ushort	sen_boffcnt;	/* Backoff counter */
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_ci	/* NOTE: Some versions of the manual have the following items
3828c2ecf20Sopenharmony_ci	 * incorrectly documented.  Below is the proper order.
3838c2ecf20Sopenharmony_ci	 */
3848c2ecf20Sopenharmony_ci	ushort	sen_taddrh;	/* temp address (MSB) */
3858c2ecf20Sopenharmony_ci	ushort	sen_taddrm;
3868c2ecf20Sopenharmony_ci	ushort	sen_taddrl;	/* temp address (LSB) */
3878c2ecf20Sopenharmony_ci} scc_enet_t;
3888c2ecf20Sopenharmony_ci
3898c2ecf20Sopenharmony_ci
3908c2ecf20Sopenharmony_ci/* SCC Event register as used by Ethernet.
3918c2ecf20Sopenharmony_ci*/
3928c2ecf20Sopenharmony_ci#define SCCE_ENET_GRA	((ushort)0x0080)	/* Graceful stop complete */
3938c2ecf20Sopenharmony_ci#define SCCE_ENET_TXE	((ushort)0x0010)	/* Transmit Error */
3948c2ecf20Sopenharmony_ci#define SCCE_ENET_RXF	((ushort)0x0008)	/* Full frame received */
3958c2ecf20Sopenharmony_ci#define SCCE_ENET_BSY	((ushort)0x0004)	/* All incoming buffers full */
3968c2ecf20Sopenharmony_ci#define SCCE_ENET_TXB	((ushort)0x0002)	/* A buffer was transmitted */
3978c2ecf20Sopenharmony_ci#define SCCE_ENET_RXB	((ushort)0x0001)	/* A buffer was received */
3988c2ecf20Sopenharmony_ci
3998c2ecf20Sopenharmony_ci/* SCC Mode Register (PSMR) as used by Ethernet.
4008c2ecf20Sopenharmony_ci*/
4018c2ecf20Sopenharmony_ci#define SCC_PSMR_HBC	((ushort)0x8000)	/* Enable heartbeat */
4028c2ecf20Sopenharmony_ci#define SCC_PSMR_FC	((ushort)0x4000)	/* Force collision */
4038c2ecf20Sopenharmony_ci#define SCC_PSMR_RSH	((ushort)0x2000)	/* Receive short frames */
4048c2ecf20Sopenharmony_ci#define SCC_PSMR_IAM	((ushort)0x1000)	/* Check individual hash */
4058c2ecf20Sopenharmony_ci#define SCC_PSMR_ENCRC	((ushort)0x0800)	/* Ethernet CRC mode */
4068c2ecf20Sopenharmony_ci#define SCC_PSMR_PRO	((ushort)0x0200)	/* Promiscuous mode */
4078c2ecf20Sopenharmony_ci#define SCC_PSMR_BRO	((ushort)0x0100)	/* Catch broadcast pkts */
4088c2ecf20Sopenharmony_ci#define SCC_PSMR_SBT	((ushort)0x0080)	/* Special backoff timer */
4098c2ecf20Sopenharmony_ci#define SCC_PSMR_LPB	((ushort)0x0040)	/* Set Loopback mode */
4108c2ecf20Sopenharmony_ci#define SCC_PSMR_SIP	((ushort)0x0020)	/* Sample Input Pins */
4118c2ecf20Sopenharmony_ci#define SCC_PSMR_LCW	((ushort)0x0010)	/* Late collision window */
4128c2ecf20Sopenharmony_ci#define SCC_PSMR_NIB22	((ushort)0x000a)	/* Start frame search */
4138c2ecf20Sopenharmony_ci#define SCC_PSMR_FDE	((ushort)0x0001)	/* Full duplex enable */
4148c2ecf20Sopenharmony_ci
4158c2ecf20Sopenharmony_ci/* SCC as UART
4168c2ecf20Sopenharmony_ci*/
4178c2ecf20Sopenharmony_citypedef struct scc_uart {
4188c2ecf20Sopenharmony_ci	sccp_t	scc_genscc;
4198c2ecf20Sopenharmony_ci	uint	scc_res1;	/* Reserved */
4208c2ecf20Sopenharmony_ci	uint	scc_res2;	/* Reserved */
4218c2ecf20Sopenharmony_ci	ushort	scc_maxidl;	/* Maximum idle chars */
4228c2ecf20Sopenharmony_ci	ushort	scc_idlc;	/* temp idle counter */
4238c2ecf20Sopenharmony_ci	ushort	scc_brkcr;	/* Break count register */
4248c2ecf20Sopenharmony_ci	ushort	scc_parec;	/* receive parity error counter */
4258c2ecf20Sopenharmony_ci	ushort	scc_frmec;	/* receive framing error counter */
4268c2ecf20Sopenharmony_ci	ushort	scc_nosec;	/* receive noise counter */
4278c2ecf20Sopenharmony_ci	ushort	scc_brkec;	/* receive break condition counter */
4288c2ecf20Sopenharmony_ci	ushort	scc_brkln;	/* last received break length */
4298c2ecf20Sopenharmony_ci	ushort	scc_uaddr1;	/* UART address character 1 */
4308c2ecf20Sopenharmony_ci	ushort	scc_uaddr2;	/* UART address character 2 */
4318c2ecf20Sopenharmony_ci	ushort	scc_rtemp;	/* Temp storage */
4328c2ecf20Sopenharmony_ci	ushort	scc_toseq;	/* Transmit out of sequence char */
4338c2ecf20Sopenharmony_ci	ushort	scc_char1;	/* control character 1 */
4348c2ecf20Sopenharmony_ci	ushort	scc_char2;	/* control character 2 */
4358c2ecf20Sopenharmony_ci	ushort	scc_char3;	/* control character 3 */
4368c2ecf20Sopenharmony_ci	ushort	scc_char4;	/* control character 4 */
4378c2ecf20Sopenharmony_ci	ushort	scc_char5;	/* control character 5 */
4388c2ecf20Sopenharmony_ci	ushort	scc_char6;	/* control character 6 */
4398c2ecf20Sopenharmony_ci	ushort	scc_char7;	/* control character 7 */
4408c2ecf20Sopenharmony_ci	ushort	scc_char8;	/* control character 8 */
4418c2ecf20Sopenharmony_ci	ushort	scc_rccm;	/* receive control character mask */
4428c2ecf20Sopenharmony_ci	ushort	scc_rccr;	/* receive control character register */
4438c2ecf20Sopenharmony_ci	ushort	scc_rlbc;	/* receive last break character */
4448c2ecf20Sopenharmony_ci} scc_uart_t;
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_ci/* SCC Event and Mask registers when it is used as a UART.
4478c2ecf20Sopenharmony_ci*/
4488c2ecf20Sopenharmony_ci#define UART_SCCM_GLR		((ushort)0x1000)
4498c2ecf20Sopenharmony_ci#define UART_SCCM_GLT		((ushort)0x0800)
4508c2ecf20Sopenharmony_ci#define UART_SCCM_AB		((ushort)0x0200)
4518c2ecf20Sopenharmony_ci#define UART_SCCM_IDL		((ushort)0x0100)
4528c2ecf20Sopenharmony_ci#define UART_SCCM_GRA		((ushort)0x0080)
4538c2ecf20Sopenharmony_ci#define UART_SCCM_BRKE		((ushort)0x0040)
4548c2ecf20Sopenharmony_ci#define UART_SCCM_BRKS		((ushort)0x0020)
4558c2ecf20Sopenharmony_ci#define UART_SCCM_CCR		((ushort)0x0008)
4568c2ecf20Sopenharmony_ci#define UART_SCCM_BSY		((ushort)0x0004)
4578c2ecf20Sopenharmony_ci#define UART_SCCM_TX		((ushort)0x0002)
4588c2ecf20Sopenharmony_ci#define UART_SCCM_RX		((ushort)0x0001)
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_ci/* The SCC PSMR when used as a UART.
4618c2ecf20Sopenharmony_ci*/
4628c2ecf20Sopenharmony_ci#define SCU_PSMR_FLC		((ushort)0x8000)
4638c2ecf20Sopenharmony_ci#define SCU_PSMR_SL		((ushort)0x4000)
4648c2ecf20Sopenharmony_ci#define SCU_PSMR_CL		((ushort)0x3000)
4658c2ecf20Sopenharmony_ci#define SCU_PSMR_UM		((ushort)0x0c00)
4668c2ecf20Sopenharmony_ci#define SCU_PSMR_FRZ		((ushort)0x0200)
4678c2ecf20Sopenharmony_ci#define SCU_PSMR_RZS		((ushort)0x0100)
4688c2ecf20Sopenharmony_ci#define SCU_PSMR_SYN		((ushort)0x0080)
4698c2ecf20Sopenharmony_ci#define SCU_PSMR_DRT		((ushort)0x0040)
4708c2ecf20Sopenharmony_ci#define SCU_PSMR_PEN		((ushort)0x0010)
4718c2ecf20Sopenharmony_ci#define SCU_PSMR_RPM		((ushort)0x000c)
4728c2ecf20Sopenharmony_ci#define SCU_PSMR_REVP		((ushort)0x0008)
4738c2ecf20Sopenharmony_ci#define SCU_PSMR_TPM		((ushort)0x0003)
4748c2ecf20Sopenharmony_ci#define SCU_PSMR_TEVP		((ushort)0x0002)
4758c2ecf20Sopenharmony_ci
4768c2ecf20Sopenharmony_ci/* CPM Transparent mode SCC.
4778c2ecf20Sopenharmony_ci */
4788c2ecf20Sopenharmony_citypedef struct scc_trans {
4798c2ecf20Sopenharmony_ci	sccp_t	st_genscc;
4808c2ecf20Sopenharmony_ci	uint	st_cpres;	/* Preset CRC */
4818c2ecf20Sopenharmony_ci	uint	st_cmask;	/* Constant mask for CRC */
4828c2ecf20Sopenharmony_ci} scc_trans_t;
4838c2ecf20Sopenharmony_ci
4848c2ecf20Sopenharmony_ci/* How about some FCCs.....
4858c2ecf20Sopenharmony_ci*/
4868c2ecf20Sopenharmony_ci#define FCC_GFMR_DIAG_NORM	((uint)0x00000000)
4878c2ecf20Sopenharmony_ci#define FCC_GFMR_DIAG_LE	((uint)0x40000000)
4888c2ecf20Sopenharmony_ci#define FCC_GFMR_DIAG_AE	((uint)0x80000000)
4898c2ecf20Sopenharmony_ci#define FCC_GFMR_DIAG_ALE	((uint)0xc0000000)
4908c2ecf20Sopenharmony_ci#define FCC_GFMR_TCI		((uint)0x20000000)
4918c2ecf20Sopenharmony_ci#define FCC_GFMR_TRX		((uint)0x10000000)
4928c2ecf20Sopenharmony_ci#define FCC_GFMR_TTX		((uint)0x08000000)
4938c2ecf20Sopenharmony_ci#define FCC_GFMR_CDP		((uint)0x04000000)
4948c2ecf20Sopenharmony_ci#define FCC_GFMR_CTSP		((uint)0x02000000)
4958c2ecf20Sopenharmony_ci#define FCC_GFMR_CDS		((uint)0x01000000)
4968c2ecf20Sopenharmony_ci#define FCC_GFMR_CTSS		((uint)0x00800000)
4978c2ecf20Sopenharmony_ci#define FCC_GFMR_SYNL_NONE	((uint)0x00000000)
4988c2ecf20Sopenharmony_ci#define FCC_GFMR_SYNL_AUTO	((uint)0x00004000)
4998c2ecf20Sopenharmony_ci#define FCC_GFMR_SYNL_8		((uint)0x00008000)
5008c2ecf20Sopenharmony_ci#define FCC_GFMR_SYNL_16	((uint)0x0000c000)
5018c2ecf20Sopenharmony_ci#define FCC_GFMR_RTSM		((uint)0x00002000)
5028c2ecf20Sopenharmony_ci#define FCC_GFMR_RENC_NRZ	((uint)0x00000000)
5038c2ecf20Sopenharmony_ci#define FCC_GFMR_RENC_NRZI	((uint)0x00000800)
5048c2ecf20Sopenharmony_ci#define FCC_GFMR_REVD		((uint)0x00000400)
5058c2ecf20Sopenharmony_ci#define FCC_GFMR_TENC_NRZ	((uint)0x00000000)
5068c2ecf20Sopenharmony_ci#define FCC_GFMR_TENC_NRZI	((uint)0x00000100)
5078c2ecf20Sopenharmony_ci#define FCC_GFMR_TCRC_16	((uint)0x00000000)
5088c2ecf20Sopenharmony_ci#define FCC_GFMR_TCRC_32	((uint)0x00000080)
5098c2ecf20Sopenharmony_ci#define FCC_GFMR_ENR		((uint)0x00000020)
5108c2ecf20Sopenharmony_ci#define FCC_GFMR_ENT		((uint)0x00000010)
5118c2ecf20Sopenharmony_ci#define FCC_GFMR_MODE_ENET	((uint)0x0000000c)
5128c2ecf20Sopenharmony_ci#define FCC_GFMR_MODE_ATM	((uint)0x0000000a)
5138c2ecf20Sopenharmony_ci#define FCC_GFMR_MODE_HDLC	((uint)0x00000000)
5148c2ecf20Sopenharmony_ci
5158c2ecf20Sopenharmony_ci/* Generic FCC parameter ram.
5168c2ecf20Sopenharmony_ci*/
5178c2ecf20Sopenharmony_citypedef struct fcc_param {
5188c2ecf20Sopenharmony_ci	ushort	fcc_riptr;	/* Rx Internal temp pointer */
5198c2ecf20Sopenharmony_ci	ushort	fcc_tiptr;	/* Tx Internal temp pointer */
5208c2ecf20Sopenharmony_ci	ushort	fcc_res1;
5218c2ecf20Sopenharmony_ci	ushort	fcc_mrblr;	/* Max receive buffer length, mod 32 bytes */
5228c2ecf20Sopenharmony_ci	uint	fcc_rstate;	/* Upper byte is Func code, must be set */
5238c2ecf20Sopenharmony_ci	uint	fcc_rbase;	/* Receive BD base */
5248c2ecf20Sopenharmony_ci	ushort	fcc_rbdstat;	/* RxBD status */
5258c2ecf20Sopenharmony_ci	ushort	fcc_rbdlen;	/* RxBD down counter */
5268c2ecf20Sopenharmony_ci	uint	fcc_rdptr;	/* RxBD internal data pointer */
5278c2ecf20Sopenharmony_ci	uint	fcc_tstate;	/* Upper byte is Func code, must be set */
5288c2ecf20Sopenharmony_ci	uint	fcc_tbase;	/* Transmit BD base */
5298c2ecf20Sopenharmony_ci	ushort	fcc_tbdstat;	/* TxBD status */
5308c2ecf20Sopenharmony_ci	ushort	fcc_tbdlen;	/* TxBD down counter */
5318c2ecf20Sopenharmony_ci	uint	fcc_tdptr;	/* TxBD internal data pointer */
5328c2ecf20Sopenharmony_ci	uint	fcc_rbptr;	/* Rx BD Internal buf pointer */
5338c2ecf20Sopenharmony_ci	uint	fcc_tbptr;	/* Tx BD Internal buf pointer */
5348c2ecf20Sopenharmony_ci	uint	fcc_rcrc;	/* Rx temp CRC */
5358c2ecf20Sopenharmony_ci	uint	fcc_res2;
5368c2ecf20Sopenharmony_ci	uint	fcc_tcrc;	/* Tx temp CRC */
5378c2ecf20Sopenharmony_ci} fccp_t;
5388c2ecf20Sopenharmony_ci
5398c2ecf20Sopenharmony_ci
5408c2ecf20Sopenharmony_ci/* Ethernet controller through FCC.
5418c2ecf20Sopenharmony_ci*/
5428c2ecf20Sopenharmony_citypedef struct fcc_enet {
5438c2ecf20Sopenharmony_ci	fccp_t	fen_genfcc;
5448c2ecf20Sopenharmony_ci	uint	fen_statbuf;	/* Internal status buffer */
5458c2ecf20Sopenharmony_ci	uint	fen_camptr;	/* CAM address */
5468c2ecf20Sopenharmony_ci	uint	fen_cmask;	/* Constant mask for CRC */
5478c2ecf20Sopenharmony_ci	uint	fen_cpres;	/* Preset CRC */
5488c2ecf20Sopenharmony_ci	uint	fen_crcec;	/* CRC Error counter */
5498c2ecf20Sopenharmony_ci	uint	fen_alec;	/* alignment error counter */
5508c2ecf20Sopenharmony_ci	uint	fen_disfc;	/* discard frame counter */
5518c2ecf20Sopenharmony_ci	ushort	fen_retlim;	/* Retry limit */
5528c2ecf20Sopenharmony_ci	ushort	fen_retcnt;	/* Retry counter */
5538c2ecf20Sopenharmony_ci	ushort	fen_pper;	/* Persistence */
5548c2ecf20Sopenharmony_ci	ushort	fen_boffcnt;	/* backoff counter */
5558c2ecf20Sopenharmony_ci	uint	fen_gaddrh;	/* Group address filter, high 32-bits */
5568c2ecf20Sopenharmony_ci	uint	fen_gaddrl;	/* Group address filter, low 32-bits */
5578c2ecf20Sopenharmony_ci	ushort	fen_tfcstat;	/* out of sequence TxBD */
5588c2ecf20Sopenharmony_ci	ushort	fen_tfclen;
5598c2ecf20Sopenharmony_ci	uint	fen_tfcptr;
5608c2ecf20Sopenharmony_ci	ushort	fen_mflr;	/* Maximum frame length (1518) */
5618c2ecf20Sopenharmony_ci	ushort	fen_paddrh;	/* MAC address */
5628c2ecf20Sopenharmony_ci	ushort	fen_paddrm;
5638c2ecf20Sopenharmony_ci	ushort	fen_paddrl;
5648c2ecf20Sopenharmony_ci	ushort	fen_ibdcount;	/* Internal BD counter */
5658c2ecf20Sopenharmony_ci	ushort	fen_ibdstart;	/* Internal BD start pointer */
5668c2ecf20Sopenharmony_ci	ushort	fen_ibdend;	/* Internal BD end pointer */
5678c2ecf20Sopenharmony_ci	ushort	fen_txlen;	/* Internal Tx frame length counter */
5688c2ecf20Sopenharmony_ci	uint	fen_ibdbase[8]; /* Internal use */
5698c2ecf20Sopenharmony_ci	uint	fen_iaddrh;	/* Individual address filter */
5708c2ecf20Sopenharmony_ci	uint	fen_iaddrl;
5718c2ecf20Sopenharmony_ci	ushort	fen_minflr;	/* Minimum frame length (64) */
5728c2ecf20Sopenharmony_ci	ushort	fen_taddrh;	/* Filter transfer MAC address */
5738c2ecf20Sopenharmony_ci	ushort	fen_taddrm;
5748c2ecf20Sopenharmony_ci	ushort	fen_taddrl;
5758c2ecf20Sopenharmony_ci	ushort	fen_padptr;	/* Pointer to pad byte buffer */
5768c2ecf20Sopenharmony_ci	ushort	fen_cftype;	/* control frame type */
5778c2ecf20Sopenharmony_ci	ushort	fen_cfrange;	/* control frame range */
5788c2ecf20Sopenharmony_ci	ushort	fen_maxb;	/* maximum BD count */
5798c2ecf20Sopenharmony_ci	ushort	fen_maxd1;	/* Max DMA1 length (1520) */
5808c2ecf20Sopenharmony_ci	ushort	fen_maxd2;	/* Max DMA2 length (1520) */
5818c2ecf20Sopenharmony_ci	ushort	fen_maxd;	/* internal max DMA count */
5828c2ecf20Sopenharmony_ci	ushort	fen_dmacnt;	/* internal DMA counter */
5838c2ecf20Sopenharmony_ci	uint	fen_octc;	/* Total octect counter */
5848c2ecf20Sopenharmony_ci	uint	fen_colc;	/* Total collision counter */
5858c2ecf20Sopenharmony_ci	uint	fen_broc;	/* Total broadcast packet counter */
5868c2ecf20Sopenharmony_ci	uint	fen_mulc;	/* Total multicast packet count */
5878c2ecf20Sopenharmony_ci	uint	fen_uspc;	/* Total packets < 64 bytes */
5888c2ecf20Sopenharmony_ci	uint	fen_frgc;	/* Total packets < 64 bytes with errors */
5898c2ecf20Sopenharmony_ci	uint	fen_ospc;	/* Total packets > 1518 */
5908c2ecf20Sopenharmony_ci	uint	fen_jbrc;	/* Total packets > 1518 with errors */
5918c2ecf20Sopenharmony_ci	uint	fen_p64c;	/* Total packets == 64 bytes */
5928c2ecf20Sopenharmony_ci	uint	fen_p65c;	/* Total packets 64 < bytes <= 127 */
5938c2ecf20Sopenharmony_ci	uint	fen_p128c;	/* Total packets 127 < bytes <= 255 */
5948c2ecf20Sopenharmony_ci	uint	fen_p256c;	/* Total packets 256 < bytes <= 511 */
5958c2ecf20Sopenharmony_ci	uint	fen_p512c;	/* Total packets 512 < bytes <= 1023 */
5968c2ecf20Sopenharmony_ci	uint	fen_p1024c;	/* Total packets 1024 < bytes <= 1518 */
5978c2ecf20Sopenharmony_ci	uint	fen_cambuf;	/* Internal CAM buffer poiner */
5988c2ecf20Sopenharmony_ci	ushort	fen_rfthr;	/* Received frames threshold */
5998c2ecf20Sopenharmony_ci	ushort	fen_rfcnt;	/* Received frames count */
6008c2ecf20Sopenharmony_ci} fcc_enet_t;
6018c2ecf20Sopenharmony_ci
6028c2ecf20Sopenharmony_ci/* FCC Event/Mask register as used by Ethernet.
6038c2ecf20Sopenharmony_ci*/
6048c2ecf20Sopenharmony_ci#define FCC_ENET_GRA	((ushort)0x0080)	/* Graceful stop complete */
6058c2ecf20Sopenharmony_ci#define FCC_ENET_RXC	((ushort)0x0040)	/* Control Frame Received */
6068c2ecf20Sopenharmony_ci#define FCC_ENET_TXC	((ushort)0x0020)	/* Out of seq. Tx sent */
6078c2ecf20Sopenharmony_ci#define FCC_ENET_TXE	((ushort)0x0010)	/* Transmit Error */
6088c2ecf20Sopenharmony_ci#define FCC_ENET_RXF	((ushort)0x0008)	/* Full frame received */
6098c2ecf20Sopenharmony_ci#define FCC_ENET_BSY	((ushort)0x0004)	/* Busy.  Rx Frame dropped */
6108c2ecf20Sopenharmony_ci#define FCC_ENET_TXB	((ushort)0x0002)	/* A buffer was transmitted */
6118c2ecf20Sopenharmony_ci#define FCC_ENET_RXB	((ushort)0x0001)	/* A buffer was received */
6128c2ecf20Sopenharmony_ci
6138c2ecf20Sopenharmony_ci/* FCC Mode Register (FPSMR) as used by Ethernet.
6148c2ecf20Sopenharmony_ci*/
6158c2ecf20Sopenharmony_ci#define FCC_PSMR_HBC	((uint)0x80000000)	/* Enable heartbeat */
6168c2ecf20Sopenharmony_ci#define FCC_PSMR_FC	((uint)0x40000000)	/* Force Collision */
6178c2ecf20Sopenharmony_ci#define FCC_PSMR_SBT	((uint)0x20000000)	/* Stop backoff timer */
6188c2ecf20Sopenharmony_ci#define FCC_PSMR_LPB	((uint)0x10000000)	/* Local protect. 1 = FDX */
6198c2ecf20Sopenharmony_ci#define FCC_PSMR_LCW	((uint)0x08000000)	/* Late collision select */
6208c2ecf20Sopenharmony_ci#define FCC_PSMR_FDE	((uint)0x04000000)	/* Full Duplex Enable */
6218c2ecf20Sopenharmony_ci#define FCC_PSMR_MON	((uint)0x02000000)	/* RMON Enable */
6228c2ecf20Sopenharmony_ci#define FCC_PSMR_PRO	((uint)0x00400000)	/* Promiscuous Enable */
6238c2ecf20Sopenharmony_ci#define FCC_PSMR_FCE	((uint)0x00200000)	/* Flow Control Enable */
6248c2ecf20Sopenharmony_ci#define FCC_PSMR_RSH	((uint)0x00100000)	/* Receive Short Frames */
6258c2ecf20Sopenharmony_ci#define FCC_PSMR_CAM	((uint)0x00000400)	/* CAM enable */
6268c2ecf20Sopenharmony_ci#define FCC_PSMR_BRO	((uint)0x00000200)	/* Broadcast pkt discard */
6278c2ecf20Sopenharmony_ci#define FCC_PSMR_ENCRC	((uint)0x00000080)	/* Use 32-bit CRC */
6288c2ecf20Sopenharmony_ci
6298c2ecf20Sopenharmony_ci/* IIC parameter RAM.
6308c2ecf20Sopenharmony_ci*/
6318c2ecf20Sopenharmony_citypedef struct iic {
6328c2ecf20Sopenharmony_ci	ushort	iic_rbase;	/* Rx Buffer descriptor base address */
6338c2ecf20Sopenharmony_ci	ushort	iic_tbase;	/* Tx Buffer descriptor base address */
6348c2ecf20Sopenharmony_ci	u_char	iic_rfcr;	/* Rx function code */
6358c2ecf20Sopenharmony_ci	u_char	iic_tfcr;	/* Tx function code */
6368c2ecf20Sopenharmony_ci	ushort	iic_mrblr;	/* Max receive buffer length */
6378c2ecf20Sopenharmony_ci	uint	iic_rstate;	/* Internal */
6388c2ecf20Sopenharmony_ci	uint	iic_rdp;	/* Internal */
6398c2ecf20Sopenharmony_ci	ushort	iic_rbptr;	/* Internal */
6408c2ecf20Sopenharmony_ci	ushort	iic_rbc;	/* Internal */
6418c2ecf20Sopenharmony_ci	uint	iic_rxtmp;	/* Internal */
6428c2ecf20Sopenharmony_ci	uint	iic_tstate;	/* Internal */
6438c2ecf20Sopenharmony_ci	uint	iic_tdp;	/* Internal */
6448c2ecf20Sopenharmony_ci	ushort	iic_tbptr;	/* Internal */
6458c2ecf20Sopenharmony_ci	ushort	iic_tbc;	/* Internal */
6468c2ecf20Sopenharmony_ci	uint	iic_txtmp;	/* Internal */
6478c2ecf20Sopenharmony_ci} iic_t;
6488c2ecf20Sopenharmony_ci
6498c2ecf20Sopenharmony_ci/* IDMA parameter RAM
6508c2ecf20Sopenharmony_ci*/
6518c2ecf20Sopenharmony_citypedef struct idma {
6528c2ecf20Sopenharmony_ci	ushort ibase;		/* IDMA buffer descriptor table base address */
6538c2ecf20Sopenharmony_ci	ushort dcm;		/* DMA channel mode */
6548c2ecf20Sopenharmony_ci	ushort ibdptr;		/* IDMA current buffer descriptor pointer */
6558c2ecf20Sopenharmony_ci	ushort dpr_buf;		/* IDMA transfer buffer base address */
6568c2ecf20Sopenharmony_ci	ushort buf_inv;		/* internal buffer inventory */
6578c2ecf20Sopenharmony_ci	ushort ss_max;		/* steady-state maximum transfer size */
6588c2ecf20Sopenharmony_ci	ushort dpr_in_ptr;	/* write pointer inside the internal buffer */
6598c2ecf20Sopenharmony_ci	ushort sts;		/* source transfer size */
6608c2ecf20Sopenharmony_ci	ushort dpr_out_ptr;	/* read pointer inside the internal buffer */
6618c2ecf20Sopenharmony_ci	ushort seob;		/* source end of burst */
6628c2ecf20Sopenharmony_ci	ushort deob;		/* destination end of burst */
6638c2ecf20Sopenharmony_ci	ushort dts;		/* destination transfer size */
6648c2ecf20Sopenharmony_ci	ushort ret_add;		/* return address when working in ERM=1 mode */
6658c2ecf20Sopenharmony_ci	ushort res0;		/* reserved */
6668c2ecf20Sopenharmony_ci	uint   bd_cnt;		/* internal byte count */
6678c2ecf20Sopenharmony_ci	uint   s_ptr;		/* source internal data pointer */
6688c2ecf20Sopenharmony_ci	uint   d_ptr;		/* destination internal data pointer */
6698c2ecf20Sopenharmony_ci	uint   istate;		/* internal state */
6708c2ecf20Sopenharmony_ci	u_char res1[20];	/* pad to 64-byte length */
6718c2ecf20Sopenharmony_ci} idma_t;
6728c2ecf20Sopenharmony_ci
6738c2ecf20Sopenharmony_ci/* DMA channel mode bit fields
6748c2ecf20Sopenharmony_ci*/
6758c2ecf20Sopenharmony_ci#define IDMA_DCM_FB		((ushort)0x8000) /* fly-by mode */
6768c2ecf20Sopenharmony_ci#define IDMA_DCM_LP		((ushort)0x4000) /* low priority */
6778c2ecf20Sopenharmony_ci#define IDMA_DCM_TC2		((ushort)0x0400) /* value driven on TC[2] */
6788c2ecf20Sopenharmony_ci#define IDMA_DCM_DMA_WRAP_MASK	((ushort)0x01c0) /* mask for DMA wrap */
6798c2ecf20Sopenharmony_ci#define IDMA_DCM_DMA_WRAP_64	((ushort)0x0000) /* 64-byte DMA xfer buffer */
6808c2ecf20Sopenharmony_ci#define IDMA_DCM_DMA_WRAP_128	((ushort)0x0040) /* 128-byte DMA xfer buffer */
6818c2ecf20Sopenharmony_ci#define IDMA_DCM_DMA_WRAP_256	((ushort)0x0080) /* 256-byte DMA xfer buffer */
6828c2ecf20Sopenharmony_ci#define IDMA_DCM_DMA_WRAP_512	((ushort)0x00c0) /* 512-byte DMA xfer buffer */
6838c2ecf20Sopenharmony_ci#define IDMA_DCM_DMA_WRAP_1024	((ushort)0x0100) /* 1024-byte DMA xfer buffer */
6848c2ecf20Sopenharmony_ci#define IDMA_DCM_DMA_WRAP_2048	((ushort)0x0140) /* 2048-byte DMA xfer buffer */
6858c2ecf20Sopenharmony_ci#define IDMA_DCM_SINC		((ushort)0x0020) /* source inc addr */
6868c2ecf20Sopenharmony_ci#define IDMA_DCM_DINC		((ushort)0x0010) /* destination inc addr */
6878c2ecf20Sopenharmony_ci#define IDMA_DCM_ERM		((ushort)0x0008) /* external request mode */
6888c2ecf20Sopenharmony_ci#define IDMA_DCM_DT		((ushort)0x0004) /* DONE treatment */
6898c2ecf20Sopenharmony_ci#define IDMA_DCM_SD_MASK	((ushort)0x0003) /* mask for SD bit field */
6908c2ecf20Sopenharmony_ci#define IDMA_DCM_SD_MEM2MEM	((ushort)0x0000) /* memory-to-memory xfer */
6918c2ecf20Sopenharmony_ci#define IDMA_DCM_SD_PER2MEM	((ushort)0x0002) /* peripheral-to-memory xfer */
6928c2ecf20Sopenharmony_ci#define IDMA_DCM_SD_MEM2PER	((ushort)0x0001) /* memory-to-peripheral xfer */
6938c2ecf20Sopenharmony_ci
6948c2ecf20Sopenharmony_ci/* IDMA Buffer Descriptors
6958c2ecf20Sopenharmony_ci*/
6968c2ecf20Sopenharmony_citypedef struct idma_bd {
6978c2ecf20Sopenharmony_ci	uint flags;
6988c2ecf20Sopenharmony_ci	uint len;	/* data length */
6998c2ecf20Sopenharmony_ci	uint src;	/* source data buffer pointer */
7008c2ecf20Sopenharmony_ci	uint dst;	/* destination data buffer pointer */
7018c2ecf20Sopenharmony_ci} idma_bd_t;
7028c2ecf20Sopenharmony_ci
7038c2ecf20Sopenharmony_ci/* IDMA buffer descriptor flag bit fields
7048c2ecf20Sopenharmony_ci*/
7058c2ecf20Sopenharmony_ci#define IDMA_BD_V	((uint)0x80000000)	/* valid */
7068c2ecf20Sopenharmony_ci#define IDMA_BD_W	((uint)0x20000000)	/* wrap */
7078c2ecf20Sopenharmony_ci#define IDMA_BD_I	((uint)0x10000000)	/* interrupt */
7088c2ecf20Sopenharmony_ci#define IDMA_BD_L	((uint)0x08000000)	/* last */
7098c2ecf20Sopenharmony_ci#define IDMA_BD_CM	((uint)0x02000000)	/* continuous mode */
7108c2ecf20Sopenharmony_ci#define IDMA_BD_SDN	((uint)0x00400000)	/* source done */
7118c2ecf20Sopenharmony_ci#define IDMA_BD_DDN	((uint)0x00200000)	/* destination done */
7128c2ecf20Sopenharmony_ci#define IDMA_BD_DGBL	((uint)0x00100000)	/* destination global */
7138c2ecf20Sopenharmony_ci#define IDMA_BD_DBO_LE	((uint)0x00040000)	/* little-end dest byte order */
7148c2ecf20Sopenharmony_ci#define IDMA_BD_DBO_BE	((uint)0x00080000)	/* big-end dest byte order */
7158c2ecf20Sopenharmony_ci#define IDMA_BD_DDTB	((uint)0x00010000)	/* destination data bus */
7168c2ecf20Sopenharmony_ci#define IDMA_BD_SGBL	((uint)0x00002000)	/* source global */
7178c2ecf20Sopenharmony_ci#define IDMA_BD_SBO_LE	((uint)0x00000800)	/* little-end src byte order */
7188c2ecf20Sopenharmony_ci#define IDMA_BD_SBO_BE	((uint)0x00001000)	/* big-end src byte order */
7198c2ecf20Sopenharmony_ci#define IDMA_BD_SDTB	((uint)0x00000200)	/* source data bus */
7208c2ecf20Sopenharmony_ci
7218c2ecf20Sopenharmony_ci/* per-channel IDMA registers
7228c2ecf20Sopenharmony_ci*/
7238c2ecf20Sopenharmony_citypedef struct im_idma {
7248c2ecf20Sopenharmony_ci	u_char idsr;			/* IDMAn event status register */
7258c2ecf20Sopenharmony_ci	u_char res0[3];
7268c2ecf20Sopenharmony_ci	u_char idmr;			/* IDMAn event mask register */
7278c2ecf20Sopenharmony_ci	u_char res1[3];
7288c2ecf20Sopenharmony_ci} im_idma_t;
7298c2ecf20Sopenharmony_ci
7308c2ecf20Sopenharmony_ci/* IDMA event register bit fields
7318c2ecf20Sopenharmony_ci*/
7328c2ecf20Sopenharmony_ci#define IDMA_EVENT_SC	((unsigned char)0x08)	/* stop completed */
7338c2ecf20Sopenharmony_ci#define IDMA_EVENT_OB	((unsigned char)0x04)	/* out of buffers */
7348c2ecf20Sopenharmony_ci#define IDMA_EVENT_EDN	((unsigned char)0x02)	/* external DONE asserted */
7358c2ecf20Sopenharmony_ci#define IDMA_EVENT_BC	((unsigned char)0x01)	/* buffer descriptor complete */
7368c2ecf20Sopenharmony_ci
7378c2ecf20Sopenharmony_ci/* RISC Controller Configuration Register (RCCR) bit fields
7388c2ecf20Sopenharmony_ci*/
7398c2ecf20Sopenharmony_ci#define RCCR_TIME	((uint)0x80000000) /* timer enable */
7408c2ecf20Sopenharmony_ci#define RCCR_TIMEP_MASK	((uint)0x3f000000) /* mask for timer period bit field */
7418c2ecf20Sopenharmony_ci#define RCCR_DR0M	((uint)0x00800000) /* IDMA0 request mode */
7428c2ecf20Sopenharmony_ci#define RCCR_DR1M	((uint)0x00400000) /* IDMA1 request mode */
7438c2ecf20Sopenharmony_ci#define RCCR_DR2M	((uint)0x00000080) /* IDMA2 request mode */
7448c2ecf20Sopenharmony_ci#define RCCR_DR3M	((uint)0x00000040) /* IDMA3 request mode */
7458c2ecf20Sopenharmony_ci#define RCCR_DR0QP_MASK	((uint)0x00300000) /* mask for IDMA0 req priority */
7468c2ecf20Sopenharmony_ci#define RCCR_DR0QP_HIGH ((uint)0x00000000) /* IDMA0 has high req priority */
7478c2ecf20Sopenharmony_ci#define RCCR_DR0QP_MED	((uint)0x00100000) /* IDMA0 has medium req priority */
7488c2ecf20Sopenharmony_ci#define RCCR_DR0QP_LOW	((uint)0x00200000) /* IDMA0 has low req priority */
7498c2ecf20Sopenharmony_ci#define RCCR_DR1QP_MASK	((uint)0x00030000) /* mask for IDMA1 req priority */
7508c2ecf20Sopenharmony_ci#define RCCR_DR1QP_HIGH ((uint)0x00000000) /* IDMA1 has high req priority */
7518c2ecf20Sopenharmony_ci#define RCCR_DR1QP_MED	((uint)0x00010000) /* IDMA1 has medium req priority */
7528c2ecf20Sopenharmony_ci#define RCCR_DR1QP_LOW	((uint)0x00020000) /* IDMA1 has low req priority */
7538c2ecf20Sopenharmony_ci#define RCCR_DR2QP_MASK	((uint)0x00000030) /* mask for IDMA2 req priority */
7548c2ecf20Sopenharmony_ci#define RCCR_DR2QP_HIGH ((uint)0x00000000) /* IDMA2 has high req priority */
7558c2ecf20Sopenharmony_ci#define RCCR_DR2QP_MED	((uint)0x00000010) /* IDMA2 has medium req priority */
7568c2ecf20Sopenharmony_ci#define RCCR_DR2QP_LOW	((uint)0x00000020) /* IDMA2 has low req priority */
7578c2ecf20Sopenharmony_ci#define RCCR_DR3QP_MASK	((uint)0x00000003) /* mask for IDMA3 req priority */
7588c2ecf20Sopenharmony_ci#define RCCR_DR3QP_HIGH ((uint)0x00000000) /* IDMA3 has high req priority */
7598c2ecf20Sopenharmony_ci#define RCCR_DR3QP_MED	((uint)0x00000001) /* IDMA3 has medium req priority */
7608c2ecf20Sopenharmony_ci#define RCCR_DR3QP_LOW	((uint)0x00000002) /* IDMA3 has low req priority */
7618c2ecf20Sopenharmony_ci#define RCCR_EIE	((uint)0x00080000) /* external interrupt enable */
7628c2ecf20Sopenharmony_ci#define RCCR_SCD	((uint)0x00040000) /* scheduler configuration */
7638c2ecf20Sopenharmony_ci#define RCCR_ERAM_MASK	((uint)0x0000e000) /* mask for enable RAM microcode */
7648c2ecf20Sopenharmony_ci#define RCCR_ERAM_0KB	((uint)0x00000000) /* use 0KB of dpram for microcode */
7658c2ecf20Sopenharmony_ci#define RCCR_ERAM_2KB	((uint)0x00002000) /* use 2KB of dpram for microcode */
7668c2ecf20Sopenharmony_ci#define RCCR_ERAM_4KB	((uint)0x00004000) /* use 4KB of dpram for microcode */
7678c2ecf20Sopenharmony_ci#define RCCR_ERAM_6KB	((uint)0x00006000) /* use 6KB of dpram for microcode */
7688c2ecf20Sopenharmony_ci#define RCCR_ERAM_8KB	((uint)0x00008000) /* use 8KB of dpram for microcode */
7698c2ecf20Sopenharmony_ci#define RCCR_ERAM_10KB	((uint)0x0000a000) /* use 10KB of dpram for microcode */
7708c2ecf20Sopenharmony_ci#define RCCR_ERAM_12KB	((uint)0x0000c000) /* use 12KB of dpram for microcode */
7718c2ecf20Sopenharmony_ci#define RCCR_EDM0	((uint)0x00000800) /* DREQ0 edge detect mode */
7728c2ecf20Sopenharmony_ci#define RCCR_EDM1	((uint)0x00000400) /* DREQ1 edge detect mode */
7738c2ecf20Sopenharmony_ci#define RCCR_EDM2	((uint)0x00000200) /* DREQ2 edge detect mode */
7748c2ecf20Sopenharmony_ci#define RCCR_EDM3	((uint)0x00000100) /* DREQ3 edge detect mode */
7758c2ecf20Sopenharmony_ci#define RCCR_DEM01	((uint)0x00000008) /* DONE0/DONE1 edge detect mode */
7768c2ecf20Sopenharmony_ci#define RCCR_DEM23	((uint)0x00000004) /* DONE2/DONE3 edge detect mode */
7778c2ecf20Sopenharmony_ci
7788c2ecf20Sopenharmony_ci/*-----------------------------------------------------------------------
7798c2ecf20Sopenharmony_ci * CMXFCR - CMX FCC Clock Route Register
7808c2ecf20Sopenharmony_ci */
7818c2ecf20Sopenharmony_ci#define CMXFCR_FC1         0x40000000   /* FCC1 connection              */
7828c2ecf20Sopenharmony_ci#define CMXFCR_RF1CS_MSK   0x38000000   /* Receive FCC1 Clock Source Mask */
7838c2ecf20Sopenharmony_ci#define CMXFCR_TF1CS_MSK   0x07000000   /* Transmit FCC1 Clock Source Mask */
7848c2ecf20Sopenharmony_ci#define CMXFCR_FC2         0x00400000   /* FCC2 connection              */
7858c2ecf20Sopenharmony_ci#define CMXFCR_RF2CS_MSK   0x00380000   /* Receive FCC2 Clock Source Mask */
7868c2ecf20Sopenharmony_ci#define CMXFCR_TF2CS_MSK   0x00070000   /* Transmit FCC2 Clock Source Mask */
7878c2ecf20Sopenharmony_ci#define CMXFCR_FC3         0x00004000   /* FCC3 connection              */
7888c2ecf20Sopenharmony_ci#define CMXFCR_RF3CS_MSK   0x00003800   /* Receive FCC3 Clock Source Mask */
7898c2ecf20Sopenharmony_ci#define CMXFCR_TF3CS_MSK   0x00000700   /* Transmit FCC3 Clock Source Mask */
7908c2ecf20Sopenharmony_ci
7918c2ecf20Sopenharmony_ci#define CMXFCR_RF1CS_BRG5  0x00000000   /* Receive FCC1 Clock Source is BRG5 */
7928c2ecf20Sopenharmony_ci#define CMXFCR_RF1CS_BRG6  0x08000000   /* Receive FCC1 Clock Source is BRG6 */
7938c2ecf20Sopenharmony_ci#define CMXFCR_RF1CS_BRG7  0x10000000   /* Receive FCC1 Clock Source is BRG7 */
7948c2ecf20Sopenharmony_ci#define CMXFCR_RF1CS_BRG8  0x18000000   /* Receive FCC1 Clock Source is BRG8 */
7958c2ecf20Sopenharmony_ci#define CMXFCR_RF1CS_CLK9  0x20000000   /* Receive FCC1 Clock Source is CLK9 */
7968c2ecf20Sopenharmony_ci#define CMXFCR_RF1CS_CLK10 0x28000000   /* Receive FCC1 Clock Source is CLK10 */
7978c2ecf20Sopenharmony_ci#define CMXFCR_RF1CS_CLK11 0x30000000   /* Receive FCC1 Clock Source is CLK11 */
7988c2ecf20Sopenharmony_ci#define CMXFCR_RF1CS_CLK12 0x38000000   /* Receive FCC1 Clock Source is CLK12 */
7998c2ecf20Sopenharmony_ci
8008c2ecf20Sopenharmony_ci#define CMXFCR_TF1CS_BRG5  0x00000000   /* Transmit FCC1 Clock Source is BRG5 */
8018c2ecf20Sopenharmony_ci#define CMXFCR_TF1CS_BRG6  0x01000000   /* Transmit FCC1 Clock Source is BRG6 */
8028c2ecf20Sopenharmony_ci#define CMXFCR_TF1CS_BRG7  0x02000000   /* Transmit FCC1 Clock Source is BRG7 */
8038c2ecf20Sopenharmony_ci#define CMXFCR_TF1CS_BRG8  0x03000000   /* Transmit FCC1 Clock Source is BRG8 */
8048c2ecf20Sopenharmony_ci#define CMXFCR_TF1CS_CLK9  0x04000000   /* Transmit FCC1 Clock Source is CLK9 */
8058c2ecf20Sopenharmony_ci#define CMXFCR_TF1CS_CLK10 0x05000000   /* Transmit FCC1 Clock Source is CLK10 */
8068c2ecf20Sopenharmony_ci#define CMXFCR_TF1CS_CLK11 0x06000000   /* Transmit FCC1 Clock Source is CLK11 */
8078c2ecf20Sopenharmony_ci#define CMXFCR_TF1CS_CLK12 0x07000000   /* Transmit FCC1 Clock Source is CLK12 */
8088c2ecf20Sopenharmony_ci
8098c2ecf20Sopenharmony_ci#define CMXFCR_RF2CS_BRG5  0x00000000   /* Receive FCC2 Clock Source is BRG5 */
8108c2ecf20Sopenharmony_ci#define CMXFCR_RF2CS_BRG6  0x00080000   /* Receive FCC2 Clock Source is BRG6 */
8118c2ecf20Sopenharmony_ci#define CMXFCR_RF2CS_BRG7  0x00100000   /* Receive FCC2 Clock Source is BRG7 */
8128c2ecf20Sopenharmony_ci#define CMXFCR_RF2CS_BRG8  0x00180000   /* Receive FCC2 Clock Source is BRG8 */
8138c2ecf20Sopenharmony_ci#define CMXFCR_RF2CS_CLK13 0x00200000   /* Receive FCC2 Clock Source is CLK13 */
8148c2ecf20Sopenharmony_ci#define CMXFCR_RF2CS_CLK14 0x00280000   /* Receive FCC2 Clock Source is CLK14 */
8158c2ecf20Sopenharmony_ci#define CMXFCR_RF2CS_CLK15 0x00300000   /* Receive FCC2 Clock Source is CLK15 */
8168c2ecf20Sopenharmony_ci#define CMXFCR_RF2CS_CLK16 0x00380000   /* Receive FCC2 Clock Source is CLK16 */
8178c2ecf20Sopenharmony_ci
8188c2ecf20Sopenharmony_ci#define CMXFCR_TF2CS_BRG5  0x00000000   /* Transmit FCC2 Clock Source is BRG5 */
8198c2ecf20Sopenharmony_ci#define CMXFCR_TF2CS_BRG6  0x00010000   /* Transmit FCC2 Clock Source is BRG6 */
8208c2ecf20Sopenharmony_ci#define CMXFCR_TF2CS_BRG7  0x00020000   /* Transmit FCC2 Clock Source is BRG7 */
8218c2ecf20Sopenharmony_ci#define CMXFCR_TF2CS_BRG8  0x00030000   /* Transmit FCC2 Clock Source is BRG8 */
8228c2ecf20Sopenharmony_ci#define CMXFCR_TF2CS_CLK13 0x00040000   /* Transmit FCC2 Clock Source is CLK13 */
8238c2ecf20Sopenharmony_ci#define CMXFCR_TF2CS_CLK14 0x00050000   /* Transmit FCC2 Clock Source is CLK14 */
8248c2ecf20Sopenharmony_ci#define CMXFCR_TF2CS_CLK15 0x00060000   /* Transmit FCC2 Clock Source is CLK15 */
8258c2ecf20Sopenharmony_ci#define CMXFCR_TF2CS_CLK16 0x00070000   /* Transmit FCC2 Clock Source is CLK16 */
8268c2ecf20Sopenharmony_ci
8278c2ecf20Sopenharmony_ci#define CMXFCR_RF3CS_BRG5  0x00000000   /* Receive FCC3 Clock Source is BRG5 */
8288c2ecf20Sopenharmony_ci#define CMXFCR_RF3CS_BRG6  0x00000800   /* Receive FCC3 Clock Source is BRG6 */
8298c2ecf20Sopenharmony_ci#define CMXFCR_RF3CS_BRG7  0x00001000   /* Receive FCC3 Clock Source is BRG7 */
8308c2ecf20Sopenharmony_ci#define CMXFCR_RF3CS_BRG8  0x00001800   /* Receive FCC3 Clock Source is BRG8 */
8318c2ecf20Sopenharmony_ci#define CMXFCR_RF3CS_CLK13 0x00002000   /* Receive FCC3 Clock Source is CLK13 */
8328c2ecf20Sopenharmony_ci#define CMXFCR_RF3CS_CLK14 0x00002800   /* Receive FCC3 Clock Source is CLK14 */
8338c2ecf20Sopenharmony_ci#define CMXFCR_RF3CS_CLK15 0x00003000   /* Receive FCC3 Clock Source is CLK15 */
8348c2ecf20Sopenharmony_ci#define CMXFCR_RF3CS_CLK16 0x00003800   /* Receive FCC3 Clock Source is CLK16 */
8358c2ecf20Sopenharmony_ci
8368c2ecf20Sopenharmony_ci#define CMXFCR_TF3CS_BRG5  0x00000000   /* Transmit FCC3 Clock Source is BRG5 */
8378c2ecf20Sopenharmony_ci#define CMXFCR_TF3CS_BRG6  0x00000100   /* Transmit FCC3 Clock Source is BRG6 */
8388c2ecf20Sopenharmony_ci#define CMXFCR_TF3CS_BRG7  0x00000200   /* Transmit FCC3 Clock Source is BRG7 */
8398c2ecf20Sopenharmony_ci#define CMXFCR_TF3CS_BRG8  0x00000300   /* Transmit FCC3 Clock Source is BRG8 */
8408c2ecf20Sopenharmony_ci#define CMXFCR_TF3CS_CLK13 0x00000400   /* Transmit FCC3 Clock Source is CLK13 */
8418c2ecf20Sopenharmony_ci#define CMXFCR_TF3CS_CLK14 0x00000500   /* Transmit FCC3 Clock Source is CLK14 */
8428c2ecf20Sopenharmony_ci#define CMXFCR_TF3CS_CLK15 0x00000600   /* Transmit FCC3 Clock Source is CLK15 */
8438c2ecf20Sopenharmony_ci#define CMXFCR_TF3CS_CLK16 0x00000700   /* Transmit FCC3 Clock Source is CLK16 */
8448c2ecf20Sopenharmony_ci
8458c2ecf20Sopenharmony_ci/*-----------------------------------------------------------------------
8468c2ecf20Sopenharmony_ci * CMXSCR - CMX SCC Clock Route Register
8478c2ecf20Sopenharmony_ci */
8488c2ecf20Sopenharmony_ci#define CMXSCR_GR1         0x80000000   /* Grant Support of SCC1        */
8498c2ecf20Sopenharmony_ci#define CMXSCR_SC1         0x40000000   /* SCC1 connection              */
8508c2ecf20Sopenharmony_ci#define CMXSCR_RS1CS_MSK   0x38000000   /* Receive SCC1 Clock Source Mask */
8518c2ecf20Sopenharmony_ci#define CMXSCR_TS1CS_MSK   0x07000000   /* Transmit SCC1 Clock Source Mask */
8528c2ecf20Sopenharmony_ci#define CMXSCR_GR2         0x00800000   /* Grant Support of SCC2        */
8538c2ecf20Sopenharmony_ci#define CMXSCR_SC2         0x00400000   /* SCC2 connection              */
8548c2ecf20Sopenharmony_ci#define CMXSCR_RS2CS_MSK   0x00380000   /* Receive SCC2 Clock Source Mask */
8558c2ecf20Sopenharmony_ci#define CMXSCR_TS2CS_MSK   0x00070000   /* Transmit SCC2 Clock Source Mask */
8568c2ecf20Sopenharmony_ci#define CMXSCR_GR3         0x00008000   /* Grant Support of SCC3        */
8578c2ecf20Sopenharmony_ci#define CMXSCR_SC3         0x00004000   /* SCC3 connection              */
8588c2ecf20Sopenharmony_ci#define CMXSCR_RS3CS_MSK   0x00003800   /* Receive SCC3 Clock Source Mask */
8598c2ecf20Sopenharmony_ci#define CMXSCR_TS3CS_MSK   0x00000700   /* Transmit SCC3 Clock Source Mask */
8608c2ecf20Sopenharmony_ci#define CMXSCR_GR4         0x00000080   /* Grant Support of SCC4        */
8618c2ecf20Sopenharmony_ci#define CMXSCR_SC4         0x00000040   /* SCC4 connection              */
8628c2ecf20Sopenharmony_ci#define CMXSCR_RS4CS_MSK   0x00000038   /* Receive SCC4 Clock Source Mask */
8638c2ecf20Sopenharmony_ci#define CMXSCR_TS4CS_MSK   0x00000007   /* Transmit SCC4 Clock Source Mask */
8648c2ecf20Sopenharmony_ci
8658c2ecf20Sopenharmony_ci#define CMXSCR_RS1CS_BRG1  0x00000000   /* SCC1 Rx Clock Source is BRG1 */
8668c2ecf20Sopenharmony_ci#define CMXSCR_RS1CS_BRG2  0x08000000   /* SCC1 Rx Clock Source is BRG2 */
8678c2ecf20Sopenharmony_ci#define CMXSCR_RS1CS_BRG3  0x10000000   /* SCC1 Rx Clock Source is BRG3 */
8688c2ecf20Sopenharmony_ci#define CMXSCR_RS1CS_BRG4  0x18000000   /* SCC1 Rx Clock Source is BRG4 */
8698c2ecf20Sopenharmony_ci#define CMXSCR_RS1CS_CLK11 0x20000000   /* SCC1 Rx Clock Source is CLK11 */
8708c2ecf20Sopenharmony_ci#define CMXSCR_RS1CS_CLK12 0x28000000   /* SCC1 Rx Clock Source is CLK12 */
8718c2ecf20Sopenharmony_ci#define CMXSCR_RS1CS_CLK3  0x30000000   /* SCC1 Rx Clock Source is CLK3 */
8728c2ecf20Sopenharmony_ci#define CMXSCR_RS1CS_CLK4  0x38000000   /* SCC1 Rx Clock Source is CLK4 */
8738c2ecf20Sopenharmony_ci
8748c2ecf20Sopenharmony_ci#define CMXSCR_TS1CS_BRG1  0x00000000   /* SCC1 Tx Clock Source is BRG1 */
8758c2ecf20Sopenharmony_ci#define CMXSCR_TS1CS_BRG2  0x01000000   /* SCC1 Tx Clock Source is BRG2 */
8768c2ecf20Sopenharmony_ci#define CMXSCR_TS1CS_BRG3  0x02000000   /* SCC1 Tx Clock Source is BRG3 */
8778c2ecf20Sopenharmony_ci#define CMXSCR_TS1CS_BRG4  0x03000000   /* SCC1 Tx Clock Source is BRG4 */
8788c2ecf20Sopenharmony_ci#define CMXSCR_TS1CS_CLK11 0x04000000   /* SCC1 Tx Clock Source is CLK11 */
8798c2ecf20Sopenharmony_ci#define CMXSCR_TS1CS_CLK12 0x05000000   /* SCC1 Tx Clock Source is CLK12 */
8808c2ecf20Sopenharmony_ci#define CMXSCR_TS1CS_CLK3  0x06000000   /* SCC1 Tx Clock Source is CLK3 */
8818c2ecf20Sopenharmony_ci#define CMXSCR_TS1CS_CLK4  0x07000000   /* SCC1 Tx Clock Source is CLK4 */
8828c2ecf20Sopenharmony_ci
8838c2ecf20Sopenharmony_ci#define CMXSCR_RS2CS_BRG1  0x00000000   /* SCC2 Rx Clock Source is BRG1 */
8848c2ecf20Sopenharmony_ci#define CMXSCR_RS2CS_BRG2  0x00080000   /* SCC2 Rx Clock Source is BRG2 */
8858c2ecf20Sopenharmony_ci#define CMXSCR_RS2CS_BRG3  0x00100000   /* SCC2 Rx Clock Source is BRG3 */
8868c2ecf20Sopenharmony_ci#define CMXSCR_RS2CS_BRG4  0x00180000   /* SCC2 Rx Clock Source is BRG4 */
8878c2ecf20Sopenharmony_ci#define CMXSCR_RS2CS_CLK11 0x00200000   /* SCC2 Rx Clock Source is CLK11 */
8888c2ecf20Sopenharmony_ci#define CMXSCR_RS2CS_CLK12 0x00280000   /* SCC2 Rx Clock Source is CLK12 */
8898c2ecf20Sopenharmony_ci#define CMXSCR_RS2CS_CLK3  0x00300000   /* SCC2 Rx Clock Source is CLK3 */
8908c2ecf20Sopenharmony_ci#define CMXSCR_RS2CS_CLK4  0x00380000   /* SCC2 Rx Clock Source is CLK4 */
8918c2ecf20Sopenharmony_ci
8928c2ecf20Sopenharmony_ci#define CMXSCR_TS2CS_BRG1  0x00000000   /* SCC2 Tx Clock Source is BRG1 */
8938c2ecf20Sopenharmony_ci#define CMXSCR_TS2CS_BRG2  0x00010000   /* SCC2 Tx Clock Source is BRG2 */
8948c2ecf20Sopenharmony_ci#define CMXSCR_TS2CS_BRG3  0x00020000   /* SCC2 Tx Clock Source is BRG3 */
8958c2ecf20Sopenharmony_ci#define CMXSCR_TS2CS_BRG4  0x00030000   /* SCC2 Tx Clock Source is BRG4 */
8968c2ecf20Sopenharmony_ci#define CMXSCR_TS2CS_CLK11 0x00040000   /* SCC2 Tx Clock Source is CLK11 */
8978c2ecf20Sopenharmony_ci#define CMXSCR_TS2CS_CLK12 0x00050000   /* SCC2 Tx Clock Source is CLK12 */
8988c2ecf20Sopenharmony_ci#define CMXSCR_TS2CS_CLK3  0x00060000   /* SCC2 Tx Clock Source is CLK3 */
8998c2ecf20Sopenharmony_ci#define CMXSCR_TS2CS_CLK4  0x00070000   /* SCC2 Tx Clock Source is CLK4 */
9008c2ecf20Sopenharmony_ci
9018c2ecf20Sopenharmony_ci#define CMXSCR_RS3CS_BRG1  0x00000000   /* SCC3 Rx Clock Source is BRG1 */
9028c2ecf20Sopenharmony_ci#define CMXSCR_RS3CS_BRG2  0x00000800   /* SCC3 Rx Clock Source is BRG2 */
9038c2ecf20Sopenharmony_ci#define CMXSCR_RS3CS_BRG3  0x00001000   /* SCC3 Rx Clock Source is BRG3 */
9048c2ecf20Sopenharmony_ci#define CMXSCR_RS3CS_BRG4  0x00001800   /* SCC3 Rx Clock Source is BRG4 */
9058c2ecf20Sopenharmony_ci#define CMXSCR_RS3CS_CLK5  0x00002000   /* SCC3 Rx Clock Source is CLK5 */
9068c2ecf20Sopenharmony_ci#define CMXSCR_RS3CS_CLK6  0x00002800   /* SCC3 Rx Clock Source is CLK6 */
9078c2ecf20Sopenharmony_ci#define CMXSCR_RS3CS_CLK7  0x00003000   /* SCC3 Rx Clock Source is CLK7 */
9088c2ecf20Sopenharmony_ci#define CMXSCR_RS3CS_CLK8  0x00003800   /* SCC3 Rx Clock Source is CLK8 */
9098c2ecf20Sopenharmony_ci
9108c2ecf20Sopenharmony_ci#define CMXSCR_TS3CS_BRG1  0x00000000   /* SCC3 Tx Clock Source is BRG1 */
9118c2ecf20Sopenharmony_ci#define CMXSCR_TS3CS_BRG2  0x00000100   /* SCC3 Tx Clock Source is BRG2 */
9128c2ecf20Sopenharmony_ci#define CMXSCR_TS3CS_BRG3  0x00000200   /* SCC3 Tx Clock Source is BRG3 */
9138c2ecf20Sopenharmony_ci#define CMXSCR_TS3CS_BRG4  0x00000300   /* SCC3 Tx Clock Source is BRG4 */
9148c2ecf20Sopenharmony_ci#define CMXSCR_TS3CS_CLK5  0x00000400   /* SCC3 Tx Clock Source is CLK5 */
9158c2ecf20Sopenharmony_ci#define CMXSCR_TS3CS_CLK6  0x00000500   /* SCC3 Tx Clock Source is CLK6 */
9168c2ecf20Sopenharmony_ci#define CMXSCR_TS3CS_CLK7  0x00000600   /* SCC3 Tx Clock Source is CLK7 */
9178c2ecf20Sopenharmony_ci#define CMXSCR_TS3CS_CLK8  0x00000700   /* SCC3 Tx Clock Source is CLK8 */
9188c2ecf20Sopenharmony_ci
9198c2ecf20Sopenharmony_ci#define CMXSCR_RS4CS_BRG1  0x00000000   /* SCC4 Rx Clock Source is BRG1 */
9208c2ecf20Sopenharmony_ci#define CMXSCR_RS4CS_BRG2  0x00000008   /* SCC4 Rx Clock Source is BRG2 */
9218c2ecf20Sopenharmony_ci#define CMXSCR_RS4CS_BRG3  0x00000010   /* SCC4 Rx Clock Source is BRG3 */
9228c2ecf20Sopenharmony_ci#define CMXSCR_RS4CS_BRG4  0x00000018   /* SCC4 Rx Clock Source is BRG4 */
9238c2ecf20Sopenharmony_ci#define CMXSCR_RS4CS_CLK5  0x00000020   /* SCC4 Rx Clock Source is CLK5 */
9248c2ecf20Sopenharmony_ci#define CMXSCR_RS4CS_CLK6  0x00000028   /* SCC4 Rx Clock Source is CLK6 */
9258c2ecf20Sopenharmony_ci#define CMXSCR_RS4CS_CLK7  0x00000030   /* SCC4 Rx Clock Source is CLK7 */
9268c2ecf20Sopenharmony_ci#define CMXSCR_RS4CS_CLK8  0x00000038   /* SCC4 Rx Clock Source is CLK8 */
9278c2ecf20Sopenharmony_ci
9288c2ecf20Sopenharmony_ci#define CMXSCR_TS4CS_BRG1  0x00000000   /* SCC4 Tx Clock Source is BRG1 */
9298c2ecf20Sopenharmony_ci#define CMXSCR_TS4CS_BRG2  0x00000001   /* SCC4 Tx Clock Source is BRG2 */
9308c2ecf20Sopenharmony_ci#define CMXSCR_TS4CS_BRG3  0x00000002   /* SCC4 Tx Clock Source is BRG3 */
9318c2ecf20Sopenharmony_ci#define CMXSCR_TS4CS_BRG4  0x00000003   /* SCC4 Tx Clock Source is BRG4 */
9328c2ecf20Sopenharmony_ci#define CMXSCR_TS4CS_CLK5  0x00000004   /* SCC4 Tx Clock Source is CLK5 */
9338c2ecf20Sopenharmony_ci#define CMXSCR_TS4CS_CLK6  0x00000005   /* SCC4 Tx Clock Source is CLK6 */
9348c2ecf20Sopenharmony_ci#define CMXSCR_TS4CS_CLK7  0x00000006   /* SCC4 Tx Clock Source is CLK7 */
9358c2ecf20Sopenharmony_ci#define CMXSCR_TS4CS_CLK8  0x00000007   /* SCC4 Tx Clock Source is CLK8 */
9368c2ecf20Sopenharmony_ci
9378c2ecf20Sopenharmony_ci/*-----------------------------------------------------------------------
9388c2ecf20Sopenharmony_ci * SIUMCR - SIU Module Configuration Register				 4-31
9398c2ecf20Sopenharmony_ci */
9408c2ecf20Sopenharmony_ci#define SIUMCR_BBD	0x80000000	/* Bus Busy Disable		*/
9418c2ecf20Sopenharmony_ci#define SIUMCR_ESE	0x40000000	/* External Snoop Enable	*/
9428c2ecf20Sopenharmony_ci#define SIUMCR_PBSE	0x20000000	/* Parity Byte Select Enable	*/
9438c2ecf20Sopenharmony_ci#define SIUMCR_CDIS	0x10000000	/* Core Disable			*/
9448c2ecf20Sopenharmony_ci#define SIUMCR_DPPC00	0x00000000	/* Data Parity Pins Configuration*/
9458c2ecf20Sopenharmony_ci#define SIUMCR_DPPC01	0x04000000	/* - " -			*/
9468c2ecf20Sopenharmony_ci#define SIUMCR_DPPC10	0x08000000	/* - " -			*/
9478c2ecf20Sopenharmony_ci#define SIUMCR_DPPC11	0x0c000000	/* - " -			*/
9488c2ecf20Sopenharmony_ci#define SIUMCR_L2CPC00	0x00000000	/* L2 Cache Pins Configuration	*/
9498c2ecf20Sopenharmony_ci#define SIUMCR_L2CPC01	0x01000000	/* - " -			*/
9508c2ecf20Sopenharmony_ci#define SIUMCR_L2CPC10	0x02000000	/* - " -			*/
9518c2ecf20Sopenharmony_ci#define SIUMCR_L2CPC11	0x03000000	/* - " -			*/
9528c2ecf20Sopenharmony_ci#define SIUMCR_LBPC00	0x00000000	/* Local Bus Pins Configuration	*/
9538c2ecf20Sopenharmony_ci#define SIUMCR_LBPC01	0x00400000	/* - " -			*/
9548c2ecf20Sopenharmony_ci#define SIUMCR_LBPC10	0x00800000	/* - " -			*/
9558c2ecf20Sopenharmony_ci#define SIUMCR_LBPC11	0x00c00000	/* - " -			*/
9568c2ecf20Sopenharmony_ci#define SIUMCR_APPC00	0x00000000	/* Address Parity Pins Configuration*/
9578c2ecf20Sopenharmony_ci#define SIUMCR_APPC01	0x00100000	/* - " -			*/
9588c2ecf20Sopenharmony_ci#define SIUMCR_APPC10	0x00200000	/* - " -			*/
9598c2ecf20Sopenharmony_ci#define SIUMCR_APPC11	0x00300000	/* - " -			*/
9608c2ecf20Sopenharmony_ci#define SIUMCR_CS10PC00	0x00000000	/* CS10 Pin Configuration	*/
9618c2ecf20Sopenharmony_ci#define SIUMCR_CS10PC01	0x00040000	/* - " -			*/
9628c2ecf20Sopenharmony_ci#define SIUMCR_CS10PC10	0x00080000	/* - " -			*/
9638c2ecf20Sopenharmony_ci#define SIUMCR_CS10PC11	0x000c0000	/* - " -			*/
9648c2ecf20Sopenharmony_ci#define SIUMCR_BCTLC00	0x00000000	/* Buffer Control Configuration	*/
9658c2ecf20Sopenharmony_ci#define SIUMCR_BCTLC01	0x00010000	/* - " -			*/
9668c2ecf20Sopenharmony_ci#define SIUMCR_BCTLC10	0x00020000	/* - " -			*/
9678c2ecf20Sopenharmony_ci#define SIUMCR_BCTLC11	0x00030000	/* - " -			*/
9688c2ecf20Sopenharmony_ci#define SIUMCR_MMR00	0x00000000	/* Mask Masters Requests	*/
9698c2ecf20Sopenharmony_ci#define SIUMCR_MMR01	0x00004000	/* - " -			*/
9708c2ecf20Sopenharmony_ci#define SIUMCR_MMR10	0x00008000	/* - " -			*/
9718c2ecf20Sopenharmony_ci#define SIUMCR_MMR11	0x0000c000	/* - " -			*/
9728c2ecf20Sopenharmony_ci#define SIUMCR_LPBSE	0x00002000	/* LocalBus Parity Byte Select Enable*/
9738c2ecf20Sopenharmony_ci
9748c2ecf20Sopenharmony_ci/*-----------------------------------------------------------------------
9758c2ecf20Sopenharmony_ci * SCCR - System Clock Control Register					 9-8
9768c2ecf20Sopenharmony_ci*/
9778c2ecf20Sopenharmony_ci#define SCCR_PCI_MODE	0x00000100	/* PCI Mode	*/
9788c2ecf20Sopenharmony_ci#define SCCR_PCI_MODCK	0x00000080	/* Value of PCI_MODCK pin	*/
9798c2ecf20Sopenharmony_ci#define SCCR_PCIDF_MSK	0x00000078	/* PCI division factor	*/
9808c2ecf20Sopenharmony_ci#define SCCR_PCIDF_SHIFT 3
9818c2ecf20Sopenharmony_ci
9828c2ecf20Sopenharmony_ci#ifndef CPM_IMMR_OFFSET
9838c2ecf20Sopenharmony_ci#define CPM_IMMR_OFFSET	0x101a8
9848c2ecf20Sopenharmony_ci#endif
9858c2ecf20Sopenharmony_ci
9868c2ecf20Sopenharmony_ci#define FCC_PSMR_RMII	((uint)0x00020000)	/* Use RMII interface */
9878c2ecf20Sopenharmony_ci
9888c2ecf20Sopenharmony_ci/* FCC iop & clock configuration. BSP code is responsible to define Fx_RXCLK & Fx_TXCLK
9898c2ecf20Sopenharmony_ci * in order to use clock-computing stuff below for the FCC x
9908c2ecf20Sopenharmony_ci */
9918c2ecf20Sopenharmony_ci
9928c2ecf20Sopenharmony_ci/* Automatically generates register configurations */
9938c2ecf20Sopenharmony_ci#define PC_CLK(x)	((uint)(1<<(x-1)))	/* FCC CLK I/O ports */
9948c2ecf20Sopenharmony_ci
9958c2ecf20Sopenharmony_ci#define CMXFCR_RF1CS(x)	((uint)((x-5)<<27))	/* FCC1 Receive Clock Source */
9968c2ecf20Sopenharmony_ci#define CMXFCR_TF1CS(x)	((uint)((x-5)<<24))	/* FCC1 Transmit Clock Source */
9978c2ecf20Sopenharmony_ci#define CMXFCR_RF2CS(x)	((uint)((x-9)<<19))	/* FCC2 Receive Clock Source */
9988c2ecf20Sopenharmony_ci#define CMXFCR_TF2CS(x) ((uint)((x-9)<<16))	/* FCC2 Transmit Clock Source */
9998c2ecf20Sopenharmony_ci#define CMXFCR_RF3CS(x)	((uint)((x-9)<<11))	/* FCC3 Receive Clock Source */
10008c2ecf20Sopenharmony_ci#define CMXFCR_TF3CS(x) ((uint)((x-9)<<8))	/* FCC3 Transmit Clock Source */
10018c2ecf20Sopenharmony_ci
10028c2ecf20Sopenharmony_ci#define PC_F1RXCLK	PC_CLK(F1_RXCLK)
10038c2ecf20Sopenharmony_ci#define PC_F1TXCLK	PC_CLK(F1_TXCLK)
10048c2ecf20Sopenharmony_ci#define CMX1_CLK_ROUTE	(CMXFCR_RF1CS(F1_RXCLK) | CMXFCR_TF1CS(F1_TXCLK))
10058c2ecf20Sopenharmony_ci#define CMX1_CLK_MASK	((uint)0xff000000)
10068c2ecf20Sopenharmony_ci
10078c2ecf20Sopenharmony_ci#define PC_F2RXCLK	PC_CLK(F2_RXCLK)
10088c2ecf20Sopenharmony_ci#define PC_F2TXCLK	PC_CLK(F2_TXCLK)
10098c2ecf20Sopenharmony_ci#define CMX2_CLK_ROUTE	(CMXFCR_RF2CS(F2_RXCLK) | CMXFCR_TF2CS(F2_TXCLK))
10108c2ecf20Sopenharmony_ci#define CMX2_CLK_MASK	((uint)0x00ff0000)
10118c2ecf20Sopenharmony_ci
10128c2ecf20Sopenharmony_ci#define PC_F3RXCLK	PC_CLK(F3_RXCLK)
10138c2ecf20Sopenharmony_ci#define PC_F3TXCLK	PC_CLK(F3_TXCLK)
10148c2ecf20Sopenharmony_ci#define CMX3_CLK_ROUTE	(CMXFCR_RF3CS(F3_RXCLK) | CMXFCR_TF3CS(F3_TXCLK))
10158c2ecf20Sopenharmony_ci#define CMX3_CLK_MASK	((uint)0x0000ff00)
10168c2ecf20Sopenharmony_ci
10178c2ecf20Sopenharmony_ci#define CPMUX_CLK_MASK (CMX3_CLK_MASK | CMX2_CLK_MASK)
10188c2ecf20Sopenharmony_ci#define CPMUX_CLK_ROUTE (CMX3_CLK_ROUTE | CMX2_CLK_ROUTE)
10198c2ecf20Sopenharmony_ci
10208c2ecf20Sopenharmony_ci#define CLK_TRX (PC_F3TXCLK | PC_F3RXCLK | PC_F2TXCLK | PC_F2RXCLK)
10218c2ecf20Sopenharmony_ci
10228c2ecf20Sopenharmony_ci/* I/O Pin assignment for FCC1.  I don't yet know the best way to do this,
10238c2ecf20Sopenharmony_ci * but there is little variation among the choices.
10248c2ecf20Sopenharmony_ci */
10258c2ecf20Sopenharmony_ci#define PA1_COL		0x00000001U
10268c2ecf20Sopenharmony_ci#define PA1_CRS		0x00000002U
10278c2ecf20Sopenharmony_ci#define PA1_TXER	0x00000004U
10288c2ecf20Sopenharmony_ci#define PA1_TXEN	0x00000008U
10298c2ecf20Sopenharmony_ci#define PA1_RXDV	0x00000010U
10308c2ecf20Sopenharmony_ci#define PA1_RXER	0x00000020U
10318c2ecf20Sopenharmony_ci#define PA1_TXDAT	0x00003c00U
10328c2ecf20Sopenharmony_ci#define PA1_RXDAT	0x0003c000U
10338c2ecf20Sopenharmony_ci#define PA1_PSORA0	(PA1_RXDAT | PA1_TXDAT)
10348c2ecf20Sopenharmony_ci#define PA1_PSORA1	(PA1_COL | PA1_CRS | PA1_TXER | PA1_TXEN | \
10358c2ecf20Sopenharmony_ci		PA1_RXDV | PA1_RXER)
10368c2ecf20Sopenharmony_ci#define PA1_DIRA0	(PA1_RXDAT | PA1_CRS | PA1_COL | PA1_RXER | PA1_RXDV)
10378c2ecf20Sopenharmony_ci#define PA1_DIRA1	(PA1_TXDAT | PA1_TXEN | PA1_TXER)
10388c2ecf20Sopenharmony_ci
10398c2ecf20Sopenharmony_ci
10408c2ecf20Sopenharmony_ci/* I/O Pin assignment for FCC2.  I don't yet know the best way to do this,
10418c2ecf20Sopenharmony_ci * but there is little variation among the choices.
10428c2ecf20Sopenharmony_ci */
10438c2ecf20Sopenharmony_ci#define PB2_TXER	0x00000001U
10448c2ecf20Sopenharmony_ci#define PB2_RXDV	0x00000002U
10458c2ecf20Sopenharmony_ci#define PB2_TXEN	0x00000004U
10468c2ecf20Sopenharmony_ci#define PB2_RXER	0x00000008U
10478c2ecf20Sopenharmony_ci#define PB2_COL		0x00000010U
10488c2ecf20Sopenharmony_ci#define PB2_CRS		0x00000020U
10498c2ecf20Sopenharmony_ci#define PB2_TXDAT	0x000003c0U
10508c2ecf20Sopenharmony_ci#define PB2_RXDAT	0x00003c00U
10518c2ecf20Sopenharmony_ci#define PB2_PSORB0	(PB2_RXDAT | PB2_TXDAT | PB2_CRS | PB2_COL | \
10528c2ecf20Sopenharmony_ci		PB2_RXER | PB2_RXDV | PB2_TXER)
10538c2ecf20Sopenharmony_ci#define PB2_PSORB1	(PB2_TXEN)
10548c2ecf20Sopenharmony_ci#define PB2_DIRB0	(PB2_RXDAT | PB2_CRS | PB2_COL | PB2_RXER | PB2_RXDV)
10558c2ecf20Sopenharmony_ci#define PB2_DIRB1	(PB2_TXDAT | PB2_TXEN | PB2_TXER)
10568c2ecf20Sopenharmony_ci
10578c2ecf20Sopenharmony_ci
10588c2ecf20Sopenharmony_ci/* I/O Pin assignment for FCC3.  I don't yet know the best way to do this,
10598c2ecf20Sopenharmony_ci * but there is little variation among the choices.
10608c2ecf20Sopenharmony_ci */
10618c2ecf20Sopenharmony_ci#define PB3_RXDV	0x00004000U
10628c2ecf20Sopenharmony_ci#define PB3_RXER	0x00008000U
10638c2ecf20Sopenharmony_ci#define PB3_TXER	0x00010000U
10648c2ecf20Sopenharmony_ci#define PB3_TXEN	0x00020000U
10658c2ecf20Sopenharmony_ci#define PB3_COL		0x00040000U
10668c2ecf20Sopenharmony_ci#define PB3_CRS		0x00080000U
10678c2ecf20Sopenharmony_ci#define PB3_TXDAT	0x0f000000U
10688c2ecf20Sopenharmony_ci#define PC3_TXDAT	0x00000010U
10698c2ecf20Sopenharmony_ci#define PB3_RXDAT	0x00f00000U
10708c2ecf20Sopenharmony_ci#define PB3_PSORB0	(PB3_RXDAT | PB3_TXDAT | PB3_CRS | PB3_COL | \
10718c2ecf20Sopenharmony_ci		PB3_RXER | PB3_RXDV | PB3_TXER | PB3_TXEN)
10728c2ecf20Sopenharmony_ci#define PB3_PSORB1	0
10738c2ecf20Sopenharmony_ci#define PB3_DIRB0	(PB3_RXDAT | PB3_CRS | PB3_COL | PB3_RXER | PB3_RXDV)
10748c2ecf20Sopenharmony_ci#define PB3_DIRB1	(PB3_TXDAT | PB3_TXEN | PB3_TXER)
10758c2ecf20Sopenharmony_ci#define PC3_DIRC1	(PC3_TXDAT)
10768c2ecf20Sopenharmony_ci
10778c2ecf20Sopenharmony_ci/* Handy macro to specify mem for FCCs*/
10788c2ecf20Sopenharmony_ci#define FCC_MEM_OFFSET(x) (CPM_FCC_SPECIAL_BASE + (x*128))
10798c2ecf20Sopenharmony_ci#define FCC1_MEM_OFFSET FCC_MEM_OFFSET(0)
10808c2ecf20Sopenharmony_ci#define FCC2_MEM_OFFSET FCC_MEM_OFFSET(1)
10818c2ecf20Sopenharmony_ci#define FCC3_MEM_OFFSET FCC_MEM_OFFSET(2)
10828c2ecf20Sopenharmony_ci
10838c2ecf20Sopenharmony_ci/* Clocks and GRG's */
10848c2ecf20Sopenharmony_ci
10858c2ecf20Sopenharmony_cienum cpm_clk_dir {
10868c2ecf20Sopenharmony_ci	CPM_CLK_RX,
10878c2ecf20Sopenharmony_ci	CPM_CLK_TX,
10888c2ecf20Sopenharmony_ci	CPM_CLK_RTX
10898c2ecf20Sopenharmony_ci};
10908c2ecf20Sopenharmony_ci
10918c2ecf20Sopenharmony_cienum cpm_clk_target {
10928c2ecf20Sopenharmony_ci	CPM_CLK_SCC1,
10938c2ecf20Sopenharmony_ci	CPM_CLK_SCC2,
10948c2ecf20Sopenharmony_ci	CPM_CLK_SCC3,
10958c2ecf20Sopenharmony_ci	CPM_CLK_SCC4,
10968c2ecf20Sopenharmony_ci	CPM_CLK_FCC1,
10978c2ecf20Sopenharmony_ci	CPM_CLK_FCC2,
10988c2ecf20Sopenharmony_ci	CPM_CLK_FCC3,
10998c2ecf20Sopenharmony_ci	CPM_CLK_SMC1,
11008c2ecf20Sopenharmony_ci	CPM_CLK_SMC2,
11018c2ecf20Sopenharmony_ci};
11028c2ecf20Sopenharmony_ci
11038c2ecf20Sopenharmony_cienum cpm_clk {
11048c2ecf20Sopenharmony_ci	CPM_CLK_NONE = 0,
11058c2ecf20Sopenharmony_ci	CPM_BRG1,	/* Baud Rate Generator  1 */
11068c2ecf20Sopenharmony_ci	CPM_BRG2,	/* Baud Rate Generator  2 */
11078c2ecf20Sopenharmony_ci	CPM_BRG3,	/* Baud Rate Generator  3 */
11088c2ecf20Sopenharmony_ci	CPM_BRG4,	/* Baud Rate Generator  4 */
11098c2ecf20Sopenharmony_ci	CPM_BRG5,	/* Baud Rate Generator  5 */
11108c2ecf20Sopenharmony_ci	CPM_BRG6,	/* Baud Rate Generator  6 */
11118c2ecf20Sopenharmony_ci	CPM_BRG7,	/* Baud Rate Generator  7 */
11128c2ecf20Sopenharmony_ci	CPM_BRG8,	/* Baud Rate Generator  8 */
11138c2ecf20Sopenharmony_ci	CPM_CLK1,	/* Clock  1 */
11148c2ecf20Sopenharmony_ci	CPM_CLK2,	/* Clock  2 */
11158c2ecf20Sopenharmony_ci	CPM_CLK3,	/* Clock  3 */
11168c2ecf20Sopenharmony_ci	CPM_CLK4,	/* Clock  4 */
11178c2ecf20Sopenharmony_ci	CPM_CLK5,	/* Clock  5 */
11188c2ecf20Sopenharmony_ci	CPM_CLK6,	/* Clock  6 */
11198c2ecf20Sopenharmony_ci	CPM_CLK7,	/* Clock  7 */
11208c2ecf20Sopenharmony_ci	CPM_CLK8,	/* Clock  8 */
11218c2ecf20Sopenharmony_ci	CPM_CLK9,	/* Clock  9 */
11228c2ecf20Sopenharmony_ci	CPM_CLK10,	/* Clock 10 */
11238c2ecf20Sopenharmony_ci	CPM_CLK11,	/* Clock 11 */
11248c2ecf20Sopenharmony_ci	CPM_CLK12,	/* Clock 12 */
11258c2ecf20Sopenharmony_ci	CPM_CLK13,	/* Clock 13 */
11268c2ecf20Sopenharmony_ci	CPM_CLK14,	/* Clock 14 */
11278c2ecf20Sopenharmony_ci	CPM_CLK15,	/* Clock 15 */
11288c2ecf20Sopenharmony_ci	CPM_CLK16,	/* Clock 16 */
11298c2ecf20Sopenharmony_ci	CPM_CLK17,	/* Clock 17 */
11308c2ecf20Sopenharmony_ci	CPM_CLK18,	/* Clock 18 */
11318c2ecf20Sopenharmony_ci	CPM_CLK19,	/* Clock 19 */
11328c2ecf20Sopenharmony_ci	CPM_CLK20,	/* Clock 20 */
11338c2ecf20Sopenharmony_ci	CPM_CLK_DUMMY
11348c2ecf20Sopenharmony_ci};
11358c2ecf20Sopenharmony_ci
11368c2ecf20Sopenharmony_ciextern int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode);
11378c2ecf20Sopenharmony_ciextern int cpm2_smc_clk_setup(enum cpm_clk_target target, int clock);
11388c2ecf20Sopenharmony_ci
11398c2ecf20Sopenharmony_ci#define CPM_PIN_INPUT     0
11408c2ecf20Sopenharmony_ci#define CPM_PIN_OUTPUT    1
11418c2ecf20Sopenharmony_ci#define CPM_PIN_PRIMARY   0
11428c2ecf20Sopenharmony_ci#define CPM_PIN_SECONDARY 2
11438c2ecf20Sopenharmony_ci#define CPM_PIN_GPIO      4
11448c2ecf20Sopenharmony_ci#define CPM_PIN_OPENDRAIN 8
11458c2ecf20Sopenharmony_ci
11468c2ecf20Sopenharmony_civoid cpm2_set_pin(int port, int pin, int flags);
11478c2ecf20Sopenharmony_ci
11488c2ecf20Sopenharmony_ci#endif /* __CPM2__ */
11498c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
1150