18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * MPC8xx Communication Processor Module.
48c2ecf20Sopenharmony_ci * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * This file contains structures and information for the communication
78c2ecf20Sopenharmony_ci * processor channels.  Some CPM control and status is available
88c2ecf20Sopenharmony_ci * through the MPC8xx internal memory map.  See immap.h for details.
98c2ecf20Sopenharmony_ci * This file only contains what I need for the moment, not the total
108c2ecf20Sopenharmony_ci * CPM capabilities.  I (or someone else) will add definitions as they
118c2ecf20Sopenharmony_ci * are needed.  -- Dan
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci * On the MBX board, EPPC-Bug loads CPM microcode into the first 512
148c2ecf20Sopenharmony_ci * bytes of the DP RAM and relocates the I2C parameter area to the
158c2ecf20Sopenharmony_ci * IDMA1 space.  The remaining DP RAM is available for buffer descriptors
168c2ecf20Sopenharmony_ci * or other use.
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci#ifndef __CPM1__
198c2ecf20Sopenharmony_ci#define __CPM1__
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#include <linux/init.h>
228c2ecf20Sopenharmony_ci#include <asm/8xx_immap.h>
238c2ecf20Sopenharmony_ci#include <asm/ptrace.h>
248c2ecf20Sopenharmony_ci#include <asm/cpm.h>
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* CPM Command register.
278c2ecf20Sopenharmony_ci*/
288c2ecf20Sopenharmony_ci#define CPM_CR_RST	((ushort)0x8000)
298c2ecf20Sopenharmony_ci#define CPM_CR_OPCODE	((ushort)0x0f00)
308c2ecf20Sopenharmony_ci#define CPM_CR_CHAN	((ushort)0x00f0)
318c2ecf20Sopenharmony_ci#define CPM_CR_FLG	((ushort)0x0001)
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/* Channel numbers.
348c2ecf20Sopenharmony_ci*/
358c2ecf20Sopenharmony_ci#define CPM_CR_CH_SCC1		((ushort)0x0000)
368c2ecf20Sopenharmony_ci#define CPM_CR_CH_I2C		((ushort)0x0001)	/* I2C and IDMA1 */
378c2ecf20Sopenharmony_ci#define CPM_CR_CH_SCC2		((ushort)0x0004)
388c2ecf20Sopenharmony_ci#define CPM_CR_CH_SPI		((ushort)0x0005)	/* SPI / IDMA2 / Timers */
398c2ecf20Sopenharmony_ci#define CPM_CR_CH_TIMER		CPM_CR_CH_SPI
408c2ecf20Sopenharmony_ci#define CPM_CR_CH_SCC3		((ushort)0x0008)
418c2ecf20Sopenharmony_ci#define CPM_CR_CH_SMC1		((ushort)0x0009)	/* SMC1 / DSP1 */
428c2ecf20Sopenharmony_ci#define CPM_CR_CH_SCC4		((ushort)0x000c)
438c2ecf20Sopenharmony_ci#define CPM_CR_CH_SMC2		((ushort)0x000d)	/* SMC2 / DSP2 */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define mk_cr_cmd(CH, CMD)	((CMD << 8) | (CH << 4))
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* Export the base address of the communication processor registers
488c2ecf20Sopenharmony_ci * and dual port ram.
498c2ecf20Sopenharmony_ci */
508c2ecf20Sopenharmony_ciextern cpm8xx_t __iomem *cpmp; /* Pointer to comm processor */
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define cpm_dpalloc cpm_muram_alloc
538c2ecf20Sopenharmony_ci#define cpm_dpfree cpm_muram_free
548c2ecf20Sopenharmony_ci#define cpm_dpram_addr cpm_muram_addr
558c2ecf20Sopenharmony_ci#define cpm_dpram_phys cpm_muram_dma
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciextern void cpm_setbrg(uint brg, uint rate);
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ciextern void __init cpm_load_patch(cpm8xx_t *cp);
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciextern void cpm_reset(void);
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/* Parameter RAM offsets.
648c2ecf20Sopenharmony_ci*/
658c2ecf20Sopenharmony_ci#define PROFF_SCC1	((uint)0x0000)
668c2ecf20Sopenharmony_ci#define PROFF_IIC	((uint)0x0080)
678c2ecf20Sopenharmony_ci#define PROFF_SCC2	((uint)0x0100)
688c2ecf20Sopenharmony_ci#define PROFF_SPI	((uint)0x0180)
698c2ecf20Sopenharmony_ci#define PROFF_SCC3	((uint)0x0200)
708c2ecf20Sopenharmony_ci#define PROFF_SMC1	((uint)0x0280)
718c2ecf20Sopenharmony_ci#define PROFF_DSP1	((uint)0x02c0)
728c2ecf20Sopenharmony_ci#define PROFF_SCC4	((uint)0x0300)
738c2ecf20Sopenharmony_ci#define PROFF_SMC2	((uint)0x0380)
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/* Define enough so I can at least use the serial port as a UART.
768c2ecf20Sopenharmony_ci * The MBX uses SMC1 as the host serial port.
778c2ecf20Sopenharmony_ci */
788c2ecf20Sopenharmony_citypedef struct smc_uart {
798c2ecf20Sopenharmony_ci	ushort	smc_rbase;	/* Rx Buffer descriptor base address */
808c2ecf20Sopenharmony_ci	ushort	smc_tbase;	/* Tx Buffer descriptor base address */
818c2ecf20Sopenharmony_ci	u_char	smc_rfcr;	/* Rx function code */
828c2ecf20Sopenharmony_ci	u_char	smc_tfcr;	/* Tx function code */
838c2ecf20Sopenharmony_ci	ushort	smc_mrblr;	/* Max receive buffer length */
848c2ecf20Sopenharmony_ci	uint	smc_rstate;	/* Internal */
858c2ecf20Sopenharmony_ci	uint	smc_idp;	/* Internal */
868c2ecf20Sopenharmony_ci	ushort	smc_rbptr;	/* Internal */
878c2ecf20Sopenharmony_ci	ushort	smc_ibc;	/* Internal */
888c2ecf20Sopenharmony_ci	uint	smc_rxtmp;	/* Internal */
898c2ecf20Sopenharmony_ci	uint	smc_tstate;	/* Internal */
908c2ecf20Sopenharmony_ci	uint	smc_tdp;	/* Internal */
918c2ecf20Sopenharmony_ci	ushort	smc_tbptr;	/* Internal */
928c2ecf20Sopenharmony_ci	ushort	smc_tbc;	/* Internal */
938c2ecf20Sopenharmony_ci	uint	smc_txtmp;	/* Internal */
948c2ecf20Sopenharmony_ci	ushort	smc_maxidl;	/* Maximum idle characters */
958c2ecf20Sopenharmony_ci	ushort	smc_tmpidl;	/* Temporary idle counter */
968c2ecf20Sopenharmony_ci	ushort	smc_brklen;	/* Last received break length */
978c2ecf20Sopenharmony_ci	ushort	smc_brkec;	/* rcv'd break condition counter */
988c2ecf20Sopenharmony_ci	ushort	smc_brkcr;	/* xmt break count register */
998c2ecf20Sopenharmony_ci	ushort	smc_rmask;	/* Temporary bit mask */
1008c2ecf20Sopenharmony_ci	char	res1[8];	/* Reserved */
1018c2ecf20Sopenharmony_ci	ushort	smc_rpbase;	/* Relocation pointer */
1028c2ecf20Sopenharmony_ci} smc_uart_t;
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci/* Function code bits.
1058c2ecf20Sopenharmony_ci*/
1068c2ecf20Sopenharmony_ci#define SMC_EB	((u_char)0x10)	/* Set big endian byte order */
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci/* SMC uart mode register.
1098c2ecf20Sopenharmony_ci*/
1108c2ecf20Sopenharmony_ci#define	SMCMR_REN	((ushort)0x0001)
1118c2ecf20Sopenharmony_ci#define SMCMR_TEN	((ushort)0x0002)
1128c2ecf20Sopenharmony_ci#define SMCMR_DM	((ushort)0x000c)
1138c2ecf20Sopenharmony_ci#define SMCMR_SM_GCI	((ushort)0x0000)
1148c2ecf20Sopenharmony_ci#define SMCMR_SM_UART	((ushort)0x0020)
1158c2ecf20Sopenharmony_ci#define SMCMR_SM_TRANS	((ushort)0x0030)
1168c2ecf20Sopenharmony_ci#define SMCMR_SM_MASK	((ushort)0x0030)
1178c2ecf20Sopenharmony_ci#define SMCMR_PM_EVEN	((ushort)0x0100)	/* Even parity, else odd */
1188c2ecf20Sopenharmony_ci#define SMCMR_REVD	SMCMR_PM_EVEN
1198c2ecf20Sopenharmony_ci#define SMCMR_PEN	((ushort)0x0200)	/* Parity enable */
1208c2ecf20Sopenharmony_ci#define SMCMR_BS	SMCMR_PEN
1218c2ecf20Sopenharmony_ci#define SMCMR_SL	((ushort)0x0400)	/* Two stops, else one */
1228c2ecf20Sopenharmony_ci#define SMCR_CLEN_MASK	((ushort)0x7800)	/* Character length */
1238c2ecf20Sopenharmony_ci#define smcr_mk_clen(C)	(((C) << 11) & SMCR_CLEN_MASK)
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/* SMC2 as Centronics parallel printer.  It is half duplex, in that
1268c2ecf20Sopenharmony_ci * it can only receive or transmit.  The parameter ram values for
1278c2ecf20Sopenharmony_ci * each direction are either unique or properly overlap, so we can
1288c2ecf20Sopenharmony_ci * include them in one structure.
1298c2ecf20Sopenharmony_ci */
1308c2ecf20Sopenharmony_citypedef struct smc_centronics {
1318c2ecf20Sopenharmony_ci	ushort	scent_rbase;
1328c2ecf20Sopenharmony_ci	ushort	scent_tbase;
1338c2ecf20Sopenharmony_ci	u_char	scent_cfcr;
1348c2ecf20Sopenharmony_ci	u_char	scent_smask;
1358c2ecf20Sopenharmony_ci	ushort	scent_mrblr;
1368c2ecf20Sopenharmony_ci	uint	scent_rstate;
1378c2ecf20Sopenharmony_ci	uint	scent_r_ptr;
1388c2ecf20Sopenharmony_ci	ushort	scent_rbptr;
1398c2ecf20Sopenharmony_ci	ushort	scent_r_cnt;
1408c2ecf20Sopenharmony_ci	uint	scent_rtemp;
1418c2ecf20Sopenharmony_ci	uint	scent_tstate;
1428c2ecf20Sopenharmony_ci	uint	scent_t_ptr;
1438c2ecf20Sopenharmony_ci	ushort	scent_tbptr;
1448c2ecf20Sopenharmony_ci	ushort	scent_t_cnt;
1458c2ecf20Sopenharmony_ci	uint	scent_ttemp;
1468c2ecf20Sopenharmony_ci	ushort	scent_max_sl;
1478c2ecf20Sopenharmony_ci	ushort	scent_sl_cnt;
1488c2ecf20Sopenharmony_ci	ushort	scent_character1;
1498c2ecf20Sopenharmony_ci	ushort	scent_character2;
1508c2ecf20Sopenharmony_ci	ushort	scent_character3;
1518c2ecf20Sopenharmony_ci	ushort	scent_character4;
1528c2ecf20Sopenharmony_ci	ushort	scent_character5;
1538c2ecf20Sopenharmony_ci	ushort	scent_character6;
1548c2ecf20Sopenharmony_ci	ushort	scent_character7;
1558c2ecf20Sopenharmony_ci	ushort	scent_character8;
1568c2ecf20Sopenharmony_ci	ushort	scent_rccm;
1578c2ecf20Sopenharmony_ci	ushort	scent_rccr;
1588c2ecf20Sopenharmony_ci} smc_cent_t;
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci/* Centronics Status Mask Register.
1618c2ecf20Sopenharmony_ci*/
1628c2ecf20Sopenharmony_ci#define SMC_CENT_F	((u_char)0x08)
1638c2ecf20Sopenharmony_ci#define SMC_CENT_PE	((u_char)0x04)
1648c2ecf20Sopenharmony_ci#define SMC_CENT_S	((u_char)0x02)
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci/* SMC Event and Mask register.
1678c2ecf20Sopenharmony_ci*/
1688c2ecf20Sopenharmony_ci#define	SMCM_BRKE	((unsigned char)0x40)	/* When in UART Mode */
1698c2ecf20Sopenharmony_ci#define	SMCM_BRK	((unsigned char)0x10)	/* When in UART Mode */
1708c2ecf20Sopenharmony_ci#define	SMCM_TXE	((unsigned char)0x10)	/* When in Transparent Mode */
1718c2ecf20Sopenharmony_ci#define	SMCM_BSY	((unsigned char)0x04)
1728c2ecf20Sopenharmony_ci#define	SMCM_TX		((unsigned char)0x02)
1738c2ecf20Sopenharmony_ci#define	SMCM_RX		((unsigned char)0x01)
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci/* Baud rate generators.
1768c2ecf20Sopenharmony_ci*/
1778c2ecf20Sopenharmony_ci#define CPM_BRG_RST		((uint)0x00020000)
1788c2ecf20Sopenharmony_ci#define CPM_BRG_EN		((uint)0x00010000)
1798c2ecf20Sopenharmony_ci#define CPM_BRG_EXTC_INT	((uint)0x00000000)
1808c2ecf20Sopenharmony_ci#define CPM_BRG_EXTC_CLK2	((uint)0x00004000)
1818c2ecf20Sopenharmony_ci#define CPM_BRG_EXTC_CLK6	((uint)0x00008000)
1828c2ecf20Sopenharmony_ci#define CPM_BRG_ATB		((uint)0x00002000)
1838c2ecf20Sopenharmony_ci#define CPM_BRG_CD_MASK		((uint)0x00001ffe)
1848c2ecf20Sopenharmony_ci#define CPM_BRG_DIV16		((uint)0x00000001)
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci/* SI Clock Route Register
1878c2ecf20Sopenharmony_ci*/
1888c2ecf20Sopenharmony_ci#define SICR_RCLK_SCC1_BRG1	((uint)0x00000000)
1898c2ecf20Sopenharmony_ci#define SICR_TCLK_SCC1_BRG1	((uint)0x00000000)
1908c2ecf20Sopenharmony_ci#define SICR_RCLK_SCC2_BRG2	((uint)0x00000800)
1918c2ecf20Sopenharmony_ci#define SICR_TCLK_SCC2_BRG2	((uint)0x00000100)
1928c2ecf20Sopenharmony_ci#define SICR_RCLK_SCC3_BRG3	((uint)0x00100000)
1938c2ecf20Sopenharmony_ci#define SICR_TCLK_SCC3_BRG3	((uint)0x00020000)
1948c2ecf20Sopenharmony_ci#define SICR_RCLK_SCC4_BRG4	((uint)0x18000000)
1958c2ecf20Sopenharmony_ci#define SICR_TCLK_SCC4_BRG4	((uint)0x03000000)
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci/* SCCs.
1988c2ecf20Sopenharmony_ci*/
1998c2ecf20Sopenharmony_ci#define SCC_GSMRH_IRP		((uint)0x00040000)
2008c2ecf20Sopenharmony_ci#define SCC_GSMRH_GDE		((uint)0x00010000)
2018c2ecf20Sopenharmony_ci#define SCC_GSMRH_TCRC_CCITT	((uint)0x00008000)
2028c2ecf20Sopenharmony_ci#define SCC_GSMRH_TCRC_BISYNC	((uint)0x00004000)
2038c2ecf20Sopenharmony_ci#define SCC_GSMRH_TCRC_HDLC	((uint)0x00000000)
2048c2ecf20Sopenharmony_ci#define SCC_GSMRH_REVD		((uint)0x00002000)
2058c2ecf20Sopenharmony_ci#define SCC_GSMRH_TRX		((uint)0x00001000)
2068c2ecf20Sopenharmony_ci#define SCC_GSMRH_TTX		((uint)0x00000800)
2078c2ecf20Sopenharmony_ci#define SCC_GSMRH_CDP		((uint)0x00000400)
2088c2ecf20Sopenharmony_ci#define SCC_GSMRH_CTSP		((uint)0x00000200)
2098c2ecf20Sopenharmony_ci#define SCC_GSMRH_CDS		((uint)0x00000100)
2108c2ecf20Sopenharmony_ci#define SCC_GSMRH_CTSS		((uint)0x00000080)
2118c2ecf20Sopenharmony_ci#define SCC_GSMRH_TFL		((uint)0x00000040)
2128c2ecf20Sopenharmony_ci#define SCC_GSMRH_RFW		((uint)0x00000020)
2138c2ecf20Sopenharmony_ci#define SCC_GSMRH_TXSY		((uint)0x00000010)
2148c2ecf20Sopenharmony_ci#define SCC_GSMRH_SYNL16	((uint)0x0000000c)
2158c2ecf20Sopenharmony_ci#define SCC_GSMRH_SYNL8		((uint)0x00000008)
2168c2ecf20Sopenharmony_ci#define SCC_GSMRH_SYNL4		((uint)0x00000004)
2178c2ecf20Sopenharmony_ci#define SCC_GSMRH_RTSM		((uint)0x00000002)
2188c2ecf20Sopenharmony_ci#define SCC_GSMRH_RSYN		((uint)0x00000001)
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci#define SCC_GSMRL_SIR		((uint)0x80000000)	/* SCC2 only */
2218c2ecf20Sopenharmony_ci#define SCC_GSMRL_EDGE_NONE	((uint)0x60000000)
2228c2ecf20Sopenharmony_ci#define SCC_GSMRL_EDGE_NEG	((uint)0x40000000)
2238c2ecf20Sopenharmony_ci#define SCC_GSMRL_EDGE_POS	((uint)0x20000000)
2248c2ecf20Sopenharmony_ci#define SCC_GSMRL_EDGE_BOTH	((uint)0x00000000)
2258c2ecf20Sopenharmony_ci#define SCC_GSMRL_TCI		((uint)0x10000000)
2268c2ecf20Sopenharmony_ci#define SCC_GSMRL_TSNC_3	((uint)0x0c000000)
2278c2ecf20Sopenharmony_ci#define SCC_GSMRL_TSNC_4	((uint)0x08000000)
2288c2ecf20Sopenharmony_ci#define SCC_GSMRL_TSNC_14	((uint)0x04000000)
2298c2ecf20Sopenharmony_ci#define SCC_GSMRL_TSNC_INF	((uint)0x00000000)
2308c2ecf20Sopenharmony_ci#define SCC_GSMRL_RINV		((uint)0x02000000)
2318c2ecf20Sopenharmony_ci#define SCC_GSMRL_TINV		((uint)0x01000000)
2328c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPL_128	((uint)0x00c00000)
2338c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPL_64	((uint)0x00a00000)
2348c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPL_48	((uint)0x00800000)
2358c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPL_32	((uint)0x00600000)
2368c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPL_16	((uint)0x00400000)
2378c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPL_8		((uint)0x00200000)
2388c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPL_NONE	((uint)0x00000000)
2398c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPP_ALL1	((uint)0x00180000)
2408c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPP_01	((uint)0x00100000)
2418c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPP_10	((uint)0x00080000)
2428c2ecf20Sopenharmony_ci#define SCC_GSMRL_TPP_ZEROS	((uint)0x00000000)
2438c2ecf20Sopenharmony_ci#define SCC_GSMRL_TEND		((uint)0x00040000)
2448c2ecf20Sopenharmony_ci#define SCC_GSMRL_TDCR_32	((uint)0x00030000)
2458c2ecf20Sopenharmony_ci#define SCC_GSMRL_TDCR_16	((uint)0x00020000)
2468c2ecf20Sopenharmony_ci#define SCC_GSMRL_TDCR_8	((uint)0x00010000)
2478c2ecf20Sopenharmony_ci#define SCC_GSMRL_TDCR_1	((uint)0x00000000)
2488c2ecf20Sopenharmony_ci#define SCC_GSMRL_RDCR_32	((uint)0x0000c000)
2498c2ecf20Sopenharmony_ci#define SCC_GSMRL_RDCR_16	((uint)0x00008000)
2508c2ecf20Sopenharmony_ci#define SCC_GSMRL_RDCR_8	((uint)0x00004000)
2518c2ecf20Sopenharmony_ci#define SCC_GSMRL_RDCR_1	((uint)0x00000000)
2528c2ecf20Sopenharmony_ci#define SCC_GSMRL_RENC_DFMAN	((uint)0x00003000)
2538c2ecf20Sopenharmony_ci#define SCC_GSMRL_RENC_MANCH	((uint)0x00002000)
2548c2ecf20Sopenharmony_ci#define SCC_GSMRL_RENC_FM0	((uint)0x00001000)
2558c2ecf20Sopenharmony_ci#define SCC_GSMRL_RENC_NRZI	((uint)0x00000800)
2568c2ecf20Sopenharmony_ci#define SCC_GSMRL_RENC_NRZ	((uint)0x00000000)
2578c2ecf20Sopenharmony_ci#define SCC_GSMRL_TENC_DFMAN	((uint)0x00000600)
2588c2ecf20Sopenharmony_ci#define SCC_GSMRL_TENC_MANCH	((uint)0x00000400)
2598c2ecf20Sopenharmony_ci#define SCC_GSMRL_TENC_FM0	((uint)0x00000200)
2608c2ecf20Sopenharmony_ci#define SCC_GSMRL_TENC_NRZI	((uint)0x00000100)
2618c2ecf20Sopenharmony_ci#define SCC_GSMRL_TENC_NRZ	((uint)0x00000000)
2628c2ecf20Sopenharmony_ci#define SCC_GSMRL_DIAG_LE	((uint)0x000000c0)	/* Loop and echo */
2638c2ecf20Sopenharmony_ci#define SCC_GSMRL_DIAG_ECHO	((uint)0x00000080)
2648c2ecf20Sopenharmony_ci#define SCC_GSMRL_DIAG_LOOP	((uint)0x00000040)
2658c2ecf20Sopenharmony_ci#define SCC_GSMRL_DIAG_NORM	((uint)0x00000000)
2668c2ecf20Sopenharmony_ci#define SCC_GSMRL_ENR		((uint)0x00000020)
2678c2ecf20Sopenharmony_ci#define SCC_GSMRL_ENT		((uint)0x00000010)
2688c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_ENET	((uint)0x0000000c)
2698c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_QMC	((uint)0x0000000a)
2708c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_DDCMP	((uint)0x00000009)
2718c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_BISYNC	((uint)0x00000008)
2728c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_V14	((uint)0x00000007)
2738c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_AHDLC	((uint)0x00000006)
2748c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_PROFIBUS	((uint)0x00000005)
2758c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_UART	((uint)0x00000004)
2768c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_SS7	((uint)0x00000003)
2778c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_ATALK	((uint)0x00000002)
2788c2ecf20Sopenharmony_ci#define SCC_GSMRL_MODE_HDLC	((uint)0x00000000)
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci#define SCC_TODR_TOD		((ushort)0x8000)
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci/* SCC Event and Mask register.
2838c2ecf20Sopenharmony_ci*/
2848c2ecf20Sopenharmony_ci#define	SCCM_TXE	((unsigned char)0x10)
2858c2ecf20Sopenharmony_ci#define	SCCM_BSY	((unsigned char)0x04)
2868c2ecf20Sopenharmony_ci#define	SCCM_TX		((unsigned char)0x02)
2878c2ecf20Sopenharmony_ci#define	SCCM_RX		((unsigned char)0x01)
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_citypedef struct scc_param {
2908c2ecf20Sopenharmony_ci	ushort	scc_rbase;	/* Rx Buffer descriptor base address */
2918c2ecf20Sopenharmony_ci	ushort	scc_tbase;	/* Tx Buffer descriptor base address */
2928c2ecf20Sopenharmony_ci	u_char	scc_rfcr;	/* Rx function code */
2938c2ecf20Sopenharmony_ci	u_char	scc_tfcr;	/* Tx function code */
2948c2ecf20Sopenharmony_ci	ushort	scc_mrblr;	/* Max receive buffer length */
2958c2ecf20Sopenharmony_ci	uint	scc_rstate;	/* Internal */
2968c2ecf20Sopenharmony_ci	uint	scc_idp;	/* Internal */
2978c2ecf20Sopenharmony_ci	ushort	scc_rbptr;	/* Internal */
2988c2ecf20Sopenharmony_ci	ushort	scc_ibc;	/* Internal */
2998c2ecf20Sopenharmony_ci	uint	scc_rxtmp;	/* Internal */
3008c2ecf20Sopenharmony_ci	uint	scc_tstate;	/* Internal */
3018c2ecf20Sopenharmony_ci	uint	scc_tdp;	/* Internal */
3028c2ecf20Sopenharmony_ci	ushort	scc_tbptr;	/* Internal */
3038c2ecf20Sopenharmony_ci	ushort	scc_tbc;	/* Internal */
3048c2ecf20Sopenharmony_ci	uint	scc_txtmp;	/* Internal */
3058c2ecf20Sopenharmony_ci	uint	scc_rcrc;	/* Internal */
3068c2ecf20Sopenharmony_ci	uint	scc_tcrc;	/* Internal */
3078c2ecf20Sopenharmony_ci} sccp_t;
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci/* Function code bits.
3108c2ecf20Sopenharmony_ci*/
3118c2ecf20Sopenharmony_ci#define SCC_EB	((u_char)0x10)	/* Set big endian byte order */
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ci/* CPM Ethernet through SCCx.
3148c2ecf20Sopenharmony_ci */
3158c2ecf20Sopenharmony_citypedef struct scc_enet {
3168c2ecf20Sopenharmony_ci	sccp_t	sen_genscc;
3178c2ecf20Sopenharmony_ci	uint	sen_cpres;	/* Preset CRC */
3188c2ecf20Sopenharmony_ci	uint	sen_cmask;	/* Constant mask for CRC */
3198c2ecf20Sopenharmony_ci	uint	sen_crcec;	/* CRC Error counter */
3208c2ecf20Sopenharmony_ci	uint	sen_alec;	/* alignment error counter */
3218c2ecf20Sopenharmony_ci	uint	sen_disfc;	/* discard frame counter */
3228c2ecf20Sopenharmony_ci	ushort	sen_pads;	/* Tx short frame pad character */
3238c2ecf20Sopenharmony_ci	ushort	sen_retlim;	/* Retry limit threshold */
3248c2ecf20Sopenharmony_ci	ushort	sen_retcnt;	/* Retry limit counter */
3258c2ecf20Sopenharmony_ci	ushort	sen_maxflr;	/* maximum frame length register */
3268c2ecf20Sopenharmony_ci	ushort	sen_minflr;	/* minimum frame length register */
3278c2ecf20Sopenharmony_ci	ushort	sen_maxd1;	/* maximum DMA1 length */
3288c2ecf20Sopenharmony_ci	ushort	sen_maxd2;	/* maximum DMA2 length */
3298c2ecf20Sopenharmony_ci	ushort	sen_maxd;	/* Rx max DMA */
3308c2ecf20Sopenharmony_ci	ushort	sen_dmacnt;	/* Rx DMA counter */
3318c2ecf20Sopenharmony_ci	ushort	sen_maxb;	/* Max BD byte count */
3328c2ecf20Sopenharmony_ci	ushort	sen_gaddr1;	/* Group address filter */
3338c2ecf20Sopenharmony_ci	ushort	sen_gaddr2;
3348c2ecf20Sopenharmony_ci	ushort	sen_gaddr3;
3358c2ecf20Sopenharmony_ci	ushort	sen_gaddr4;
3368c2ecf20Sopenharmony_ci	uint	sen_tbuf0data0;	/* Save area 0 - current frame */
3378c2ecf20Sopenharmony_ci	uint	sen_tbuf0data1;	/* Save area 1 - current frame */
3388c2ecf20Sopenharmony_ci	uint	sen_tbuf0rba;	/* Internal */
3398c2ecf20Sopenharmony_ci	uint	sen_tbuf0crc;	/* Internal */
3408c2ecf20Sopenharmony_ci	ushort	sen_tbuf0bcnt;	/* Internal */
3418c2ecf20Sopenharmony_ci	ushort	sen_paddrh;	/* physical address (MSB) */
3428c2ecf20Sopenharmony_ci	ushort	sen_paddrm;
3438c2ecf20Sopenharmony_ci	ushort	sen_paddrl;	/* physical address (LSB) */
3448c2ecf20Sopenharmony_ci	ushort	sen_pper;	/* persistence */
3458c2ecf20Sopenharmony_ci	ushort	sen_rfbdptr;	/* Rx first BD pointer */
3468c2ecf20Sopenharmony_ci	ushort	sen_tfbdptr;	/* Tx first BD pointer */
3478c2ecf20Sopenharmony_ci	ushort	sen_tlbdptr;	/* Tx last BD pointer */
3488c2ecf20Sopenharmony_ci	uint	sen_tbuf1data0;	/* Save area 0 - current frame */
3498c2ecf20Sopenharmony_ci	uint	sen_tbuf1data1;	/* Save area 1 - current frame */
3508c2ecf20Sopenharmony_ci	uint	sen_tbuf1rba;	/* Internal */
3518c2ecf20Sopenharmony_ci	uint	sen_tbuf1crc;	/* Internal */
3528c2ecf20Sopenharmony_ci	ushort	sen_tbuf1bcnt;	/* Internal */
3538c2ecf20Sopenharmony_ci	ushort	sen_txlen;	/* Tx Frame length counter */
3548c2ecf20Sopenharmony_ci	ushort	sen_iaddr1;	/* Individual address filter */
3558c2ecf20Sopenharmony_ci	ushort	sen_iaddr2;
3568c2ecf20Sopenharmony_ci	ushort	sen_iaddr3;
3578c2ecf20Sopenharmony_ci	ushort	sen_iaddr4;
3588c2ecf20Sopenharmony_ci	ushort	sen_boffcnt;	/* Backoff counter */
3598c2ecf20Sopenharmony_ci
3608c2ecf20Sopenharmony_ci	/* NOTE: Some versions of the manual have the following items
3618c2ecf20Sopenharmony_ci	 * incorrectly documented.  Below is the proper order.
3628c2ecf20Sopenharmony_ci	 */
3638c2ecf20Sopenharmony_ci	ushort	sen_taddrh;	/* temp address (MSB) */
3648c2ecf20Sopenharmony_ci	ushort	sen_taddrm;
3658c2ecf20Sopenharmony_ci	ushort	sen_taddrl;	/* temp address (LSB) */
3668c2ecf20Sopenharmony_ci} scc_enet_t;
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ci/* SCC Event register as used by Ethernet.
3698c2ecf20Sopenharmony_ci*/
3708c2ecf20Sopenharmony_ci#define SCCE_ENET_GRA	((ushort)0x0080)	/* Graceful stop complete */
3718c2ecf20Sopenharmony_ci#define SCCE_ENET_TXE	((ushort)0x0010)	/* Transmit Error */
3728c2ecf20Sopenharmony_ci#define SCCE_ENET_RXF	((ushort)0x0008)	/* Full frame received */
3738c2ecf20Sopenharmony_ci#define SCCE_ENET_BSY	((ushort)0x0004)	/* All incoming buffers full */
3748c2ecf20Sopenharmony_ci#define SCCE_ENET_TXB	((ushort)0x0002)	/* A buffer was transmitted */
3758c2ecf20Sopenharmony_ci#define SCCE_ENET_RXB	((ushort)0x0001)	/* A buffer was received */
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_ci/* SCC Mode Register (PMSR) as used by Ethernet.
3788c2ecf20Sopenharmony_ci*/
3798c2ecf20Sopenharmony_ci#define SCC_PSMR_HBC	((ushort)0x8000)	/* Enable heartbeat */
3808c2ecf20Sopenharmony_ci#define SCC_PSMR_FC	((ushort)0x4000)	/* Force collision */
3818c2ecf20Sopenharmony_ci#define SCC_PSMR_RSH	((ushort)0x2000)	/* Receive short frames */
3828c2ecf20Sopenharmony_ci#define SCC_PSMR_IAM	((ushort)0x1000)	/* Check individual hash */
3838c2ecf20Sopenharmony_ci#define SCC_PSMR_ENCRC	((ushort)0x0800)	/* Ethernet CRC mode */
3848c2ecf20Sopenharmony_ci#define SCC_PSMR_PRO	((ushort)0x0200)	/* Promiscuous mode */
3858c2ecf20Sopenharmony_ci#define SCC_PSMR_BRO	((ushort)0x0100)	/* Catch broadcast pkts */
3868c2ecf20Sopenharmony_ci#define SCC_PSMR_SBT	((ushort)0x0080)	/* Special backoff timer */
3878c2ecf20Sopenharmony_ci#define SCC_PSMR_LPB	((ushort)0x0040)	/* Set Loopback mode */
3888c2ecf20Sopenharmony_ci#define SCC_PSMR_SIP	((ushort)0x0020)	/* Sample Input Pins */
3898c2ecf20Sopenharmony_ci#define SCC_PSMR_LCW	((ushort)0x0010)	/* Late collision window */
3908c2ecf20Sopenharmony_ci#define SCC_PSMR_NIB22	((ushort)0x000a)	/* Start frame search */
3918c2ecf20Sopenharmony_ci#define SCC_PSMR_FDE	((ushort)0x0001)	/* Full duplex enable */
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_ci/* SCC as UART
3948c2ecf20Sopenharmony_ci*/
3958c2ecf20Sopenharmony_citypedef struct scc_uart {
3968c2ecf20Sopenharmony_ci	sccp_t	scc_genscc;
3978c2ecf20Sopenharmony_ci	char	res1[8];	/* Reserved */
3988c2ecf20Sopenharmony_ci	ushort	scc_maxidl;	/* Maximum idle chars */
3998c2ecf20Sopenharmony_ci	ushort	scc_idlc;	/* temp idle counter */
4008c2ecf20Sopenharmony_ci	ushort	scc_brkcr;	/* Break count register */
4018c2ecf20Sopenharmony_ci	ushort	scc_parec;	/* receive parity error counter */
4028c2ecf20Sopenharmony_ci	ushort	scc_frmec;	/* receive framing error counter */
4038c2ecf20Sopenharmony_ci	ushort	scc_nosec;	/* receive noise counter */
4048c2ecf20Sopenharmony_ci	ushort	scc_brkec;	/* receive break condition counter */
4058c2ecf20Sopenharmony_ci	ushort	scc_brkln;	/* last received break length */
4068c2ecf20Sopenharmony_ci	ushort	scc_uaddr1;	/* UART address character 1 */
4078c2ecf20Sopenharmony_ci	ushort	scc_uaddr2;	/* UART address character 2 */
4088c2ecf20Sopenharmony_ci	ushort	scc_rtemp;	/* Temp storage */
4098c2ecf20Sopenharmony_ci	ushort	scc_toseq;	/* Transmit out of sequence char */
4108c2ecf20Sopenharmony_ci	ushort	scc_char1;	/* control character 1 */
4118c2ecf20Sopenharmony_ci	ushort	scc_char2;	/* control character 2 */
4128c2ecf20Sopenharmony_ci	ushort	scc_char3;	/* control character 3 */
4138c2ecf20Sopenharmony_ci	ushort	scc_char4;	/* control character 4 */
4148c2ecf20Sopenharmony_ci	ushort	scc_char5;	/* control character 5 */
4158c2ecf20Sopenharmony_ci	ushort	scc_char6;	/* control character 6 */
4168c2ecf20Sopenharmony_ci	ushort	scc_char7;	/* control character 7 */
4178c2ecf20Sopenharmony_ci	ushort	scc_char8;	/* control character 8 */
4188c2ecf20Sopenharmony_ci	ushort	scc_rccm;	/* receive control character mask */
4198c2ecf20Sopenharmony_ci	ushort	scc_rccr;	/* receive control character register */
4208c2ecf20Sopenharmony_ci	ushort	scc_rlbc;	/* receive last break character */
4218c2ecf20Sopenharmony_ci} scc_uart_t;
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_ci/* SCC Event and Mask registers when it is used as a UART.
4248c2ecf20Sopenharmony_ci*/
4258c2ecf20Sopenharmony_ci#define UART_SCCM_GLR		((ushort)0x1000)
4268c2ecf20Sopenharmony_ci#define UART_SCCM_GLT		((ushort)0x0800)
4278c2ecf20Sopenharmony_ci#define UART_SCCM_AB		((ushort)0x0200)
4288c2ecf20Sopenharmony_ci#define UART_SCCM_IDL		((ushort)0x0100)
4298c2ecf20Sopenharmony_ci#define UART_SCCM_GRA		((ushort)0x0080)
4308c2ecf20Sopenharmony_ci#define UART_SCCM_BRKE		((ushort)0x0040)
4318c2ecf20Sopenharmony_ci#define UART_SCCM_BRKS		((ushort)0x0020)
4328c2ecf20Sopenharmony_ci#define UART_SCCM_CCR		((ushort)0x0008)
4338c2ecf20Sopenharmony_ci#define UART_SCCM_BSY		((ushort)0x0004)
4348c2ecf20Sopenharmony_ci#define UART_SCCM_TX		((ushort)0x0002)
4358c2ecf20Sopenharmony_ci#define UART_SCCM_RX		((ushort)0x0001)
4368c2ecf20Sopenharmony_ci
4378c2ecf20Sopenharmony_ci/* The SCC PMSR when used as a UART.
4388c2ecf20Sopenharmony_ci*/
4398c2ecf20Sopenharmony_ci#define SCU_PSMR_FLC		((ushort)0x8000)
4408c2ecf20Sopenharmony_ci#define SCU_PSMR_SL		((ushort)0x4000)
4418c2ecf20Sopenharmony_ci#define SCU_PSMR_CL		((ushort)0x3000)
4428c2ecf20Sopenharmony_ci#define SCU_PSMR_UM		((ushort)0x0c00)
4438c2ecf20Sopenharmony_ci#define SCU_PSMR_FRZ		((ushort)0x0200)
4448c2ecf20Sopenharmony_ci#define SCU_PSMR_RZS		((ushort)0x0100)
4458c2ecf20Sopenharmony_ci#define SCU_PSMR_SYN		((ushort)0x0080)
4468c2ecf20Sopenharmony_ci#define SCU_PSMR_DRT		((ushort)0x0040)
4478c2ecf20Sopenharmony_ci#define SCU_PSMR_PEN		((ushort)0x0010)
4488c2ecf20Sopenharmony_ci#define SCU_PSMR_RPM		((ushort)0x000c)
4498c2ecf20Sopenharmony_ci#define SCU_PSMR_REVP		((ushort)0x0008)
4508c2ecf20Sopenharmony_ci#define SCU_PSMR_TPM		((ushort)0x0003)
4518c2ecf20Sopenharmony_ci#define SCU_PSMR_TEVP		((ushort)0x0002)
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci/* CPM Transparent mode SCC.
4548c2ecf20Sopenharmony_ci */
4558c2ecf20Sopenharmony_citypedef struct scc_trans {
4568c2ecf20Sopenharmony_ci	sccp_t	st_genscc;
4578c2ecf20Sopenharmony_ci	uint	st_cpres;	/* Preset CRC */
4588c2ecf20Sopenharmony_ci	uint	st_cmask;	/* Constant mask for CRC */
4598c2ecf20Sopenharmony_ci} scc_trans_t;
4608c2ecf20Sopenharmony_ci
4618c2ecf20Sopenharmony_ci/* IIC parameter RAM.
4628c2ecf20Sopenharmony_ci*/
4638c2ecf20Sopenharmony_citypedef struct iic {
4648c2ecf20Sopenharmony_ci	ushort	iic_rbase;	/* Rx Buffer descriptor base address */
4658c2ecf20Sopenharmony_ci	ushort	iic_tbase;	/* Tx Buffer descriptor base address */
4668c2ecf20Sopenharmony_ci	u_char	iic_rfcr;	/* Rx function code */
4678c2ecf20Sopenharmony_ci	u_char	iic_tfcr;	/* Tx function code */
4688c2ecf20Sopenharmony_ci	ushort	iic_mrblr;	/* Max receive buffer length */
4698c2ecf20Sopenharmony_ci	uint	iic_rstate;	/* Internal */
4708c2ecf20Sopenharmony_ci	uint	iic_rdp;	/* Internal */
4718c2ecf20Sopenharmony_ci	ushort	iic_rbptr;	/* Internal */
4728c2ecf20Sopenharmony_ci	ushort	iic_rbc;	/* Internal */
4738c2ecf20Sopenharmony_ci	uint	iic_rxtmp;	/* Internal */
4748c2ecf20Sopenharmony_ci	uint	iic_tstate;	/* Internal */
4758c2ecf20Sopenharmony_ci	uint	iic_tdp;	/* Internal */
4768c2ecf20Sopenharmony_ci	ushort	iic_tbptr;	/* Internal */
4778c2ecf20Sopenharmony_ci	ushort	iic_tbc;	/* Internal */
4788c2ecf20Sopenharmony_ci	uint	iic_txtmp;	/* Internal */
4798c2ecf20Sopenharmony_ci	char	res1[4];	/* Reserved */
4808c2ecf20Sopenharmony_ci	ushort	iic_rpbase;	/* Relocation pointer */
4818c2ecf20Sopenharmony_ci	char	res2[2];	/* Reserved */
4828c2ecf20Sopenharmony_ci} iic_t;
4838c2ecf20Sopenharmony_ci
4848c2ecf20Sopenharmony_ci/*
4858c2ecf20Sopenharmony_ci * RISC Controller Configuration Register definitons
4868c2ecf20Sopenharmony_ci */
4878c2ecf20Sopenharmony_ci#define RCCR_TIME	0x8000			/* RISC Timer Enable */
4888c2ecf20Sopenharmony_ci#define RCCR_TIMEP(t)	(((t) & 0x3F)<<8)	/* RISC Timer Period */
4898c2ecf20Sopenharmony_ci#define RCCR_TIME_MASK	0x00FF			/* not RISC Timer related bits */
4908c2ecf20Sopenharmony_ci
4918c2ecf20Sopenharmony_ci/* RISC Timer Parameter RAM offset */
4928c2ecf20Sopenharmony_ci#define PROFF_RTMR	((uint)0x01B0)
4938c2ecf20Sopenharmony_ci
4948c2ecf20Sopenharmony_citypedef struct risc_timer_pram {
4958c2ecf20Sopenharmony_ci	unsigned short	tm_base;	/* RISC Timer Table Base Address */
4968c2ecf20Sopenharmony_ci	unsigned short	tm_ptr;		/* RISC Timer Table Pointer (internal) */
4978c2ecf20Sopenharmony_ci	unsigned short	r_tmr;		/* RISC Timer Mode Register */
4988c2ecf20Sopenharmony_ci	unsigned short	r_tmv;		/* RISC Timer Valid Register */
4998c2ecf20Sopenharmony_ci	unsigned long	tm_cmd;		/* RISC Timer Command Register */
5008c2ecf20Sopenharmony_ci	unsigned long	tm_cnt;		/* RISC Timer Internal Count */
5018c2ecf20Sopenharmony_ci} rt_pram_t;
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ci/* Bits in RISC Timer Command Register */
5048c2ecf20Sopenharmony_ci#define TM_CMD_VALID	0x80000000	/* Valid - Enables the timer */
5058c2ecf20Sopenharmony_ci#define TM_CMD_RESTART	0x40000000	/* Restart - for automatic restart */
5068c2ecf20Sopenharmony_ci#define TM_CMD_PWM	0x20000000	/* Run in Pulse Width Modulation Mode */
5078c2ecf20Sopenharmony_ci#define TM_CMD_NUM(n)	(((n)&0xF)<<16)	/* Timer Number */
5088c2ecf20Sopenharmony_ci#define TM_CMD_PERIOD(p) ((p)&0xFFFF)	/* Timer Period */
5098c2ecf20Sopenharmony_ci
5108c2ecf20Sopenharmony_ci/* CPM interrupts.  There are nearly 32 interrupts generated by CPM
5118c2ecf20Sopenharmony_ci * channels or devices.  All of these are presented to the PPC core
5128c2ecf20Sopenharmony_ci * as a single interrupt.  The CPM interrupt handler dispatches its
5138c2ecf20Sopenharmony_ci * own handlers, in a similar fashion to the PPC core handler.  We
5148c2ecf20Sopenharmony_ci * use the table as defined in the manuals (i.e. no special high
5158c2ecf20Sopenharmony_ci * priority and SCC1 == SCCa, etc...).
5168c2ecf20Sopenharmony_ci */
5178c2ecf20Sopenharmony_ci#define CPMVEC_NR		32
5188c2ecf20Sopenharmony_ci#define	CPMVEC_PIO_PC15		((ushort)0x1f)
5198c2ecf20Sopenharmony_ci#define	CPMVEC_SCC1		((ushort)0x1e)
5208c2ecf20Sopenharmony_ci#define	CPMVEC_SCC2		((ushort)0x1d)
5218c2ecf20Sopenharmony_ci#define	CPMVEC_SCC3		((ushort)0x1c)
5228c2ecf20Sopenharmony_ci#define	CPMVEC_SCC4		((ushort)0x1b)
5238c2ecf20Sopenharmony_ci#define	CPMVEC_PIO_PC14		((ushort)0x1a)
5248c2ecf20Sopenharmony_ci#define	CPMVEC_TIMER1		((ushort)0x19)
5258c2ecf20Sopenharmony_ci#define	CPMVEC_PIO_PC13		((ushort)0x18)
5268c2ecf20Sopenharmony_ci#define	CPMVEC_PIO_PC12		((ushort)0x17)
5278c2ecf20Sopenharmony_ci#define	CPMVEC_SDMA_CB_ERR	((ushort)0x16)
5288c2ecf20Sopenharmony_ci#define CPMVEC_IDMA1		((ushort)0x15)
5298c2ecf20Sopenharmony_ci#define CPMVEC_IDMA2		((ushort)0x14)
5308c2ecf20Sopenharmony_ci#define CPMVEC_TIMER2		((ushort)0x12)
5318c2ecf20Sopenharmony_ci#define CPMVEC_RISCTIMER	((ushort)0x11)
5328c2ecf20Sopenharmony_ci#define CPMVEC_I2C		((ushort)0x10)
5338c2ecf20Sopenharmony_ci#define	CPMVEC_PIO_PC11		((ushort)0x0f)
5348c2ecf20Sopenharmony_ci#define	CPMVEC_PIO_PC10		((ushort)0x0e)
5358c2ecf20Sopenharmony_ci#define CPMVEC_TIMER3		((ushort)0x0c)
5368c2ecf20Sopenharmony_ci#define	CPMVEC_PIO_PC9		((ushort)0x0b)
5378c2ecf20Sopenharmony_ci#define	CPMVEC_PIO_PC8		((ushort)0x0a)
5388c2ecf20Sopenharmony_ci#define	CPMVEC_PIO_PC7		((ushort)0x09)
5398c2ecf20Sopenharmony_ci#define CPMVEC_TIMER4		((ushort)0x07)
5408c2ecf20Sopenharmony_ci#define	CPMVEC_PIO_PC6		((ushort)0x06)
5418c2ecf20Sopenharmony_ci#define	CPMVEC_SPI		((ushort)0x05)
5428c2ecf20Sopenharmony_ci#define	CPMVEC_SMC1		((ushort)0x04)
5438c2ecf20Sopenharmony_ci#define	CPMVEC_SMC2		((ushort)0x03)
5448c2ecf20Sopenharmony_ci#define	CPMVEC_PIO_PC5		((ushort)0x02)
5458c2ecf20Sopenharmony_ci#define	CPMVEC_PIO_PC4		((ushort)0x01)
5468c2ecf20Sopenharmony_ci#define	CPMVEC_ERROR		((ushort)0x00)
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ci/* CPM interrupt configuration vector.
5498c2ecf20Sopenharmony_ci*/
5508c2ecf20Sopenharmony_ci#define	CICR_SCD_SCC4		((uint)0x00c00000)	/* SCC4 @ SCCd */
5518c2ecf20Sopenharmony_ci#define	CICR_SCC_SCC3		((uint)0x00200000)	/* SCC3 @ SCCc */
5528c2ecf20Sopenharmony_ci#define	CICR_SCB_SCC2		((uint)0x00040000)	/* SCC2 @ SCCb */
5538c2ecf20Sopenharmony_ci#define	CICR_SCA_SCC1		((uint)0x00000000)	/* SCC1 @ SCCa */
5548c2ecf20Sopenharmony_ci#define CICR_IRL_MASK		((uint)0x0000e000)	/* Core interrupt */
5558c2ecf20Sopenharmony_ci#define CICR_HP_MASK		((uint)0x00001f00)	/* Hi-pri int. */
5568c2ecf20Sopenharmony_ci#define CICR_IEN		((uint)0x00000080)	/* Int. enable */
5578c2ecf20Sopenharmony_ci#define CICR_SPS		((uint)0x00000001)	/* SCC Spread */
5588c2ecf20Sopenharmony_ci
5598c2ecf20Sopenharmony_ci#define CPM_PIN_INPUT     0
5608c2ecf20Sopenharmony_ci#define CPM_PIN_OUTPUT    1
5618c2ecf20Sopenharmony_ci#define CPM_PIN_PRIMARY   0
5628c2ecf20Sopenharmony_ci#define CPM_PIN_SECONDARY 2
5638c2ecf20Sopenharmony_ci#define CPM_PIN_GPIO      4
5648c2ecf20Sopenharmony_ci#define CPM_PIN_OPENDRAIN 8
5658c2ecf20Sopenharmony_ci#define CPM_PIN_FALLEDGE  16
5668c2ecf20Sopenharmony_ci#define CPM_PIN_ANYEDGE   0
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_cienum cpm_port {
5698c2ecf20Sopenharmony_ci	CPM_PORTA,
5708c2ecf20Sopenharmony_ci	CPM_PORTB,
5718c2ecf20Sopenharmony_ci	CPM_PORTC,
5728c2ecf20Sopenharmony_ci	CPM_PORTD,
5738c2ecf20Sopenharmony_ci	CPM_PORTE,
5748c2ecf20Sopenharmony_ci};
5758c2ecf20Sopenharmony_ci
5768c2ecf20Sopenharmony_civoid cpm1_set_pin(enum cpm_port port, int pin, int flags);
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_cienum cpm_clk_dir {
5798c2ecf20Sopenharmony_ci	CPM_CLK_RX,
5808c2ecf20Sopenharmony_ci	CPM_CLK_TX,
5818c2ecf20Sopenharmony_ci	CPM_CLK_RTX
5828c2ecf20Sopenharmony_ci};
5838c2ecf20Sopenharmony_ci
5848c2ecf20Sopenharmony_cienum cpm_clk_target {
5858c2ecf20Sopenharmony_ci	CPM_CLK_SCC1,
5868c2ecf20Sopenharmony_ci	CPM_CLK_SCC2,
5878c2ecf20Sopenharmony_ci	CPM_CLK_SCC3,
5888c2ecf20Sopenharmony_ci	CPM_CLK_SCC4,
5898c2ecf20Sopenharmony_ci	CPM_CLK_SMC1,
5908c2ecf20Sopenharmony_ci	CPM_CLK_SMC2,
5918c2ecf20Sopenharmony_ci};
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_cienum cpm_clk {
5948c2ecf20Sopenharmony_ci	CPM_BRG1,	/* Baud Rate Generator  1 */
5958c2ecf20Sopenharmony_ci	CPM_BRG2,	/* Baud Rate Generator  2 */
5968c2ecf20Sopenharmony_ci	CPM_BRG3,	/* Baud Rate Generator  3 */
5978c2ecf20Sopenharmony_ci	CPM_BRG4,	/* Baud Rate Generator  4 */
5988c2ecf20Sopenharmony_ci	CPM_CLK1,	/* Clock  1 */
5998c2ecf20Sopenharmony_ci	CPM_CLK2,	/* Clock  2 */
6008c2ecf20Sopenharmony_ci	CPM_CLK3,	/* Clock  3 */
6018c2ecf20Sopenharmony_ci	CPM_CLK4,	/* Clock  4 */
6028c2ecf20Sopenharmony_ci	CPM_CLK5,	/* Clock  5 */
6038c2ecf20Sopenharmony_ci	CPM_CLK6,	/* Clock  6 */
6048c2ecf20Sopenharmony_ci	CPM_CLK7,	/* Clock  7 */
6058c2ecf20Sopenharmony_ci	CPM_CLK8,	/* Clock  8 */
6068c2ecf20Sopenharmony_ci};
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_ciint cpm1_clk_setup(enum cpm_clk_target target, int clock, int mode);
6098c2ecf20Sopenharmony_ciint cpm1_gpiochip_add16(struct device *dev);
6108c2ecf20Sopenharmony_ciint cpm1_gpiochip_add32(struct device *dev);
6118c2ecf20Sopenharmony_ci
6128c2ecf20Sopenharmony_ci#endif /* __CPM1__ */
613