Path: blob/master/arch/m68k/include/asm/commproc.h
10820 views
1/*2* 68360 Communication Processor Module.3* Copyright (c) 2000 Michael Leslie <[email protected]> (mc68360) after:4* Copyright (c) 1997 Dan Malek <[email protected]> (mpc8xx)5*6* This file contains structures and information for the communication7* processor channels. Some CPM control and status is available8* through the 68360 internal memory map. See include/asm/360_immap.h for details.9* This file is not a complete map of all of the 360 QUICC's capabilities10*11* On the MBX board, EPPC-Bug loads CPM microcode into the first 51212* bytes of the DP RAM and relocates the I2C parameter area to the13* IDMA1 space. The remaining DP RAM is available for buffer descriptors14* or other use.15*/16#ifndef __CPM_360__17#define __CPM_360__181920/* CPM Command register masks: */21#define CPM_CR_RST ((ushort)0x8000)22#define CPM_CR_OPCODE ((ushort)0x0f00)23#define CPM_CR_CHAN ((ushort)0x00f0)24#define CPM_CR_FLG ((ushort)0x0001)2526/* CPM Command set (opcodes): */27#define CPM_CR_INIT_TRX ((ushort)0x0000)28#define CPM_CR_INIT_RX ((ushort)0x0001)29#define CPM_CR_INIT_TX ((ushort)0x0002)30#define CPM_CR_HUNT_MODE ((ushort)0x0003)31#define CPM_CR_STOP_TX ((ushort)0x0004)32#define CPM_CR_GRSTOP_TX ((ushort)0x0005)33#define CPM_CR_RESTART_TX ((ushort)0x0006)34#define CPM_CR_CLOSE_RXBD ((ushort)0x0007)35#define CPM_CR_SET_GADDR ((ushort)0x0008)36#define CPM_CR_GCI_TIMEOUT ((ushort)0x0009)37#define CPM_CR_GCI_ABORT ((ushort)0x000a)38#define CPM_CR_RESET_BCS ((ushort)0x000a)3940/* CPM Channel numbers. */41#define CPM_CR_CH_SCC1 ((ushort)0x0000)42#define CPM_CR_CH_SCC2 ((ushort)0x0004)43#define CPM_CR_CH_SPI ((ushort)0x0005) /* SPI / Timers */44#define CPM_CR_CH_TMR ((ushort)0x0005)45#define CPM_CR_CH_SCC3 ((ushort)0x0008)46#define CPM_CR_CH_SMC1 ((ushort)0x0009) /* SMC1 / IDMA1 */47#define CPM_CR_CH_IDMA1 ((ushort)0x0009)48#define CPM_CR_CH_SCC4 ((ushort)0x000c)49#define CPM_CR_CH_SMC2 ((ushort)0x000d) /* SMC2 / IDMA2 */50#define CPM_CR_CH_IDMA2 ((ushort)0x000d)515253#define mk_cr_cmd(CH, CMD) ((CMD << 8) | (CH << 4))5455#if 1 /* mleslie: I dinna think we have any such restrictions on56* DP RAM aboard the 360 board - see the MC68360UM p.3-3 */5758/* The dual ported RAM is multi-functional. Some areas can be (and are59* being) used for microcode. There is an area that can only be used60* as data ram for buffer descriptors, which is all we use right now.61* Currently the first 512 and last 256 bytes are used for microcode.62*/63/* mleslie: The uCquicc board is using no extra microcode in DPRAM */64#define CPM_DATAONLY_BASE ((uint)0x0000)65#define CPM_DATAONLY_SIZE ((uint)0x0800)66#define CPM_DP_NOSPACE ((uint)0x7fffffff)6768#endif697071/* Export the base address of the communication processor registers72* and dual port ram. */73/* extern cpm360_t *cpmp; */ /* Pointer to comm processor */74extern QUICC *pquicc;75uint m360_cpm_dpalloc(uint size);76/* void *m360_cpm_hostalloc(uint size); */77void m360_cpm_setbrg(uint brg, uint rate);7879#if 0 /* use QUICC_BD declared in include/asm/m68360_quicc.h */80/* Buffer descriptors used by many of the CPM protocols. */81typedef struct cpm_buf_desc {82ushort cbd_sc; /* Status and Control */83ushort cbd_datlen; /* Data length in buffer */84uint cbd_bufaddr; /* Buffer address in host memory */85} cbd_t;86#endif878889/* rx bd status/control bits */90#define BD_SC_EMPTY ((ushort)0x8000) /* Receive is empty */91#define BD_SC_WRAP ((ushort)0x2000) /* Last buffer descriptor in table */92#define BD_SC_INTRPT ((ushort)0x1000) /* Interrupt on change */93#define BD_SC_LAST ((ushort)0x0800) /* Last buffer in frame OR control char */9495#define BD_SC_FIRST ((ushort)0x0400) /* 1st buffer in an HDLC frame */96#define BD_SC_ADDR ((ushort)0x0400) /* 1st byte is a multidrop address */9798#define BD_SC_CM ((ushort)0x0200) /* Continuous mode */99#define BD_SC_ID ((ushort)0x0100) /* Received too many idles */100101#define BD_SC_AM ((ushort)0x0080) /* Multidrop address match */102#define BD_SC_DE ((ushort)0x0080) /* DPLL Error (HDLC) */103104#define BD_SC_BR ((ushort)0x0020) /* Break received */105#define BD_SC_LG ((ushort)0x0020) /* Frame length violation (HDLC) */106107#define BD_SC_FR ((ushort)0x0010) /* Framing error */108#define BD_SC_NO ((ushort)0x0010) /* Nonoctet aligned frame (HDLC) */109110#define BD_SC_PR ((ushort)0x0008) /* Parity error */111#define BD_SC_AB ((ushort)0x0008) /* Received abort Sequence (HDLC) */112113#define BD_SC_OV ((ushort)0x0002) /* Overrun */114#define BD_SC_CD ((ushort)0x0001) /* Carrier Detect lost */115116/* tx bd status/control bits (as differ from rx bd) */117#define BD_SC_READY ((ushort)0x8000) /* Transmit is ready */118#define BD_SC_TC ((ushort)0x0400) /* Transmit CRC */119#define BD_SC_P ((ushort)0x0100) /* xmt preamble */120#define BD_SC_UN ((ushort)0x0002) /* Underrun */121122123124125/* Parameter RAM offsets. */126127128129/* In 2.4 ppc, the PROFF_S?C? are used as byte offsets into DPRAM.130* In 2.0, we use a more structured C struct map of DPRAM, and so131* instead, we need only a parameter ram `slot' */132133#define PRSLOT_SCC1 0134#define PRSLOT_SCC2 1135#define PRSLOT_SCC3 2136#define PRSLOT_SMC1 2137#define PRSLOT_SCC4 3138#define PRSLOT_SMC2 3139140141/* #define PROFF_SCC1 ((uint)0x0000) */142/* #define PROFF_SCC2 ((uint)0x0100) */143/* #define PROFF_SCC3 ((uint)0x0200) */144/* #define PROFF_SMC1 ((uint)0x0280) */145/* #define PROFF_SCC4 ((uint)0x0300) */146/* #define PROFF_SMC2 ((uint)0x0380) */147148149/* Define enough so I can at least use the serial port as a UART.150* The MBX uses SMC1 as the host serial port.151*/152typedef struct smc_uart {153ushort smc_rbase; /* Rx Buffer descriptor base address */154ushort smc_tbase; /* Tx Buffer descriptor base address */155u_char smc_rfcr; /* Rx function code */156u_char smc_tfcr; /* Tx function code */157ushort smc_mrblr; /* Max receive buffer length */158uint smc_rstate; /* Internal */159uint smc_idp; /* Internal */160ushort smc_rbptr; /* Internal */161ushort smc_ibc; /* Internal */162uint smc_rxtmp; /* Internal */163uint smc_tstate; /* Internal */164uint smc_tdp; /* Internal */165ushort smc_tbptr; /* Internal */166ushort smc_tbc; /* Internal */167uint smc_txtmp; /* Internal */168ushort smc_maxidl; /* Maximum idle characters */169ushort smc_tmpidl; /* Temporary idle counter */170ushort smc_brklen; /* Last received break length */171ushort smc_brkec; /* rcv'd break condition counter */172ushort smc_brkcr; /* xmt break count register */173ushort smc_rmask; /* Temporary bit mask */174} smc_uart_t;175176/* Function code bits.177*/178#define SMC_EB ((u_char)0x10) /* Set big endian byte order */179180/* SMC uart mode register.181*/182#define SMCMR_REN ((ushort)0x0001)183#define SMCMR_TEN ((ushort)0x0002)184#define SMCMR_DM ((ushort)0x000c)185#define SMCMR_SM_GCI ((ushort)0x0000)186#define SMCMR_SM_UART ((ushort)0x0020)187#define SMCMR_SM_TRANS ((ushort)0x0030)188#define SMCMR_SM_MASK ((ushort)0x0030)189#define SMCMR_PM_EVEN ((ushort)0x0100) /* Even parity, else odd */190#define SMCMR_REVD SMCMR_PM_EVEN191#define SMCMR_PEN ((ushort)0x0200) /* Parity enable */192#define SMCMR_BS SMCMR_PEN193#define SMCMR_SL ((ushort)0x0400) /* Two stops, else one */194#define SMCR_CLEN_MASK ((ushort)0x7800) /* Character length */195#define smcr_mk_clen(C) (((C) << 11) & SMCR_CLEN_MASK)196197/* SMC2 as Centronics parallel printer. It is half duplex, in that198* it can only receive or transmit. The parameter ram values for199* each direction are either unique or properly overlap, so we can200* include them in one structure.201*/202typedef struct smc_centronics {203ushort scent_rbase;204ushort scent_tbase;205u_char scent_cfcr;206u_char scent_smask;207ushort scent_mrblr;208uint scent_rstate;209uint scent_r_ptr;210ushort scent_rbptr;211ushort scent_r_cnt;212uint scent_rtemp;213uint scent_tstate;214uint scent_t_ptr;215ushort scent_tbptr;216ushort scent_t_cnt;217uint scent_ttemp;218ushort scent_max_sl;219ushort scent_sl_cnt;220ushort scent_character1;221ushort scent_character2;222ushort scent_character3;223ushort scent_character4;224ushort scent_character5;225ushort scent_character6;226ushort scent_character7;227ushort scent_character8;228ushort scent_rccm;229ushort scent_rccr;230} smc_cent_t;231232/* Centronics Status Mask Register.233*/234#define SMC_CENT_F ((u_char)0x08)235#define SMC_CENT_PE ((u_char)0x04)236#define SMC_CENT_S ((u_char)0x02)237238/* SMC Event and Mask register.239*/240#define SMCM_BRKE ((unsigned char)0x40) /* When in UART Mode */241#define SMCM_BRK ((unsigned char)0x10) /* When in UART Mode */242#define SMCM_TXE ((unsigned char)0x10) /* When in Transparent Mode */243#define SMCM_BSY ((unsigned char)0x04)244#define SMCM_TX ((unsigned char)0x02)245#define SMCM_RX ((unsigned char)0x01)246247/* Baud rate generators.248*/249#define CPM_BRG_RST ((uint)0x00020000)250#define CPM_BRG_EN ((uint)0x00010000)251#define CPM_BRG_EXTC_INT ((uint)0x00000000)252#define CPM_BRG_EXTC_CLK2 ((uint)0x00004000)253#define CPM_BRG_EXTC_CLK6 ((uint)0x00008000)254#define CPM_BRG_ATB ((uint)0x00002000)255#define CPM_BRG_CD_MASK ((uint)0x00001ffe)256#define CPM_BRG_DIV16 ((uint)0x00000001)257258/* SCCs.259*/260#define SCC_GSMRH_IRP ((uint)0x00040000)261#define SCC_GSMRH_GDE ((uint)0x00010000)262#define SCC_GSMRH_TCRC_CCITT ((uint)0x00008000)263#define SCC_GSMRH_TCRC_BISYNC ((uint)0x00004000)264#define SCC_GSMRH_TCRC_HDLC ((uint)0x00000000)265#define SCC_GSMRH_REVD ((uint)0x00002000)266#define SCC_GSMRH_TRX ((uint)0x00001000)267#define SCC_GSMRH_TTX ((uint)0x00000800)268#define SCC_GSMRH_CDP ((uint)0x00000400)269#define SCC_GSMRH_CTSP ((uint)0x00000200)270#define SCC_GSMRH_CDS ((uint)0x00000100)271#define SCC_GSMRH_CTSS ((uint)0x00000080)272#define SCC_GSMRH_TFL ((uint)0x00000040)273#define SCC_GSMRH_RFW ((uint)0x00000020)274#define SCC_GSMRH_TXSY ((uint)0x00000010)275#define SCC_GSMRH_SYNL16 ((uint)0x0000000c)276#define SCC_GSMRH_SYNL8 ((uint)0x00000008)277#define SCC_GSMRH_SYNL4 ((uint)0x00000004)278#define SCC_GSMRH_RTSM ((uint)0x00000002)279#define SCC_GSMRH_RSYN ((uint)0x00000001)280281#define SCC_GSMRL_SIR ((uint)0x80000000) /* SCC2 only */282#define SCC_GSMRL_EDGE_NONE ((uint)0x60000000)283#define SCC_GSMRL_EDGE_NEG ((uint)0x40000000)284#define SCC_GSMRL_EDGE_POS ((uint)0x20000000)285#define SCC_GSMRL_EDGE_BOTH ((uint)0x00000000)286#define SCC_GSMRL_TCI ((uint)0x10000000)287#define SCC_GSMRL_TSNC_3 ((uint)0x0c000000)288#define SCC_GSMRL_TSNC_4 ((uint)0x08000000)289#define SCC_GSMRL_TSNC_14 ((uint)0x04000000)290#define SCC_GSMRL_TSNC_INF ((uint)0x00000000)291#define SCC_GSMRL_RINV ((uint)0x02000000)292#define SCC_GSMRL_TINV ((uint)0x01000000)293#define SCC_GSMRL_TPL_128 ((uint)0x00c00000)294#define SCC_GSMRL_TPL_64 ((uint)0x00a00000)295#define SCC_GSMRL_TPL_48 ((uint)0x00800000)296#define SCC_GSMRL_TPL_32 ((uint)0x00600000)297#define SCC_GSMRL_TPL_16 ((uint)0x00400000)298#define SCC_GSMRL_TPL_8 ((uint)0x00200000)299#define SCC_GSMRL_TPL_NONE ((uint)0x00000000)300#define SCC_GSMRL_TPP_ALL1 ((uint)0x00180000)301#define SCC_GSMRL_TPP_01 ((uint)0x00100000)302#define SCC_GSMRL_TPP_10 ((uint)0x00080000)303#define SCC_GSMRL_TPP_ZEROS ((uint)0x00000000)304#define SCC_GSMRL_TEND ((uint)0x00040000)305#define SCC_GSMRL_TDCR_32 ((uint)0x00030000)306#define SCC_GSMRL_TDCR_16 ((uint)0x00020000)307#define SCC_GSMRL_TDCR_8 ((uint)0x00010000)308#define SCC_GSMRL_TDCR_1 ((uint)0x00000000)309#define SCC_GSMRL_RDCR_32 ((uint)0x0000c000)310#define SCC_GSMRL_RDCR_16 ((uint)0x00008000)311#define SCC_GSMRL_RDCR_8 ((uint)0x00004000)312#define SCC_GSMRL_RDCR_1 ((uint)0x00000000)313#define SCC_GSMRL_RENC_DFMAN ((uint)0x00003000)314#define SCC_GSMRL_RENC_MANCH ((uint)0x00002000)315#define SCC_GSMRL_RENC_FM0 ((uint)0x00001000)316#define SCC_GSMRL_RENC_NRZI ((uint)0x00000800)317#define SCC_GSMRL_RENC_NRZ ((uint)0x00000000)318#define SCC_GSMRL_TENC_DFMAN ((uint)0x00000600)319#define SCC_GSMRL_TENC_MANCH ((uint)0x00000400)320#define SCC_GSMRL_TENC_FM0 ((uint)0x00000200)321#define SCC_GSMRL_TENC_NRZI ((uint)0x00000100)322#define SCC_GSMRL_TENC_NRZ ((uint)0x00000000)323#define SCC_GSMRL_DIAG_LE ((uint)0x000000c0) /* Loop and echo */324#define SCC_GSMRL_DIAG_ECHO ((uint)0x00000080)325#define SCC_GSMRL_DIAG_LOOP ((uint)0x00000040)326#define SCC_GSMRL_DIAG_NORM ((uint)0x00000000)327#define SCC_GSMRL_ENR ((uint)0x00000020)328#define SCC_GSMRL_ENT ((uint)0x00000010)329#define SCC_GSMRL_MODE_ENET ((uint)0x0000000c)330#define SCC_GSMRL_MODE_DDCMP ((uint)0x00000009)331#define SCC_GSMRL_MODE_BISYNC ((uint)0x00000008)332#define SCC_GSMRL_MODE_V14 ((uint)0x00000007)333#define SCC_GSMRL_MODE_AHDLC ((uint)0x00000006)334#define SCC_GSMRL_MODE_PROFIBUS ((uint)0x00000005)335#define SCC_GSMRL_MODE_UART ((uint)0x00000004)336#define SCC_GSMRL_MODE_SS7 ((uint)0x00000003)337#define SCC_GSMRL_MODE_ATALK ((uint)0x00000002)338#define SCC_GSMRL_MODE_HDLC ((uint)0x00000000)339340#define SCC_TODR_TOD ((ushort)0x8000)341342/* SCC Event and Mask register.343*/344#define SCCM_TXE ((unsigned char)0x10)345#define SCCM_BSY ((unsigned char)0x04)346#define SCCM_TX ((unsigned char)0x02)347#define SCCM_RX ((unsigned char)0x01)348349typedef struct scc_param {350ushort scc_rbase; /* Rx Buffer descriptor base address */351ushort scc_tbase; /* Tx Buffer descriptor base address */352u_char scc_rfcr; /* Rx function code */353u_char scc_tfcr; /* Tx function code */354ushort scc_mrblr; /* Max receive buffer length */355uint scc_rstate; /* Internal */356uint scc_idp; /* Internal */357ushort scc_rbptr; /* Internal */358ushort scc_ibc; /* Internal */359uint scc_rxtmp; /* Internal */360uint scc_tstate; /* Internal */361uint scc_tdp; /* Internal */362ushort scc_tbptr; /* Internal */363ushort scc_tbc; /* Internal */364uint scc_txtmp; /* Internal */365uint scc_rcrc; /* Internal */366uint scc_tcrc; /* Internal */367} sccp_t;368369370/* Function code bits.371*/372#define SCC_EB ((u_char)0x10) /* Set big endian byte order */373#define SCC_FC_DMA ((u_char)0x08) /* Set SDMA */374375/* CPM Ethernet through SCC1.376*/377typedef struct scc_enet {378sccp_t sen_genscc;379uint sen_cpres; /* Preset CRC */380uint sen_cmask; /* Constant mask for CRC */381uint sen_crcec; /* CRC Error counter */382uint sen_alec; /* alignment error counter */383uint sen_disfc; /* discard frame counter */384ushort sen_pads; /* Tx short frame pad character */385ushort sen_retlim; /* Retry limit threshold */386ushort sen_retcnt; /* Retry limit counter */387ushort sen_maxflr; /* maximum frame length register */388ushort sen_minflr; /* minimum frame length register */389ushort sen_maxd1; /* maximum DMA1 length */390ushort sen_maxd2; /* maximum DMA2 length */391ushort sen_maxd; /* Rx max DMA */392ushort sen_dmacnt; /* Rx DMA counter */393ushort sen_maxb; /* Max BD byte count */394ushort sen_gaddr1; /* Group address filter */395ushort sen_gaddr2;396ushort sen_gaddr3;397ushort sen_gaddr4;398uint sen_tbuf0data0; /* Save area 0 - current frame */399uint sen_tbuf0data1; /* Save area 1 - current frame */400uint sen_tbuf0rba; /* Internal */401uint sen_tbuf0crc; /* Internal */402ushort sen_tbuf0bcnt; /* Internal */403ushort sen_paddrh; /* physical address (MSB) */404ushort sen_paddrm;405ushort sen_paddrl; /* physical address (LSB) */406ushort sen_pper; /* persistence */407ushort sen_rfbdptr; /* Rx first BD pointer */408ushort sen_tfbdptr; /* Tx first BD pointer */409ushort sen_tlbdptr; /* Tx last BD pointer */410uint sen_tbuf1data0; /* Save area 0 - current frame */411uint sen_tbuf1data1; /* Save area 1 - current frame */412uint sen_tbuf1rba; /* Internal */413uint sen_tbuf1crc; /* Internal */414ushort sen_tbuf1bcnt; /* Internal */415ushort sen_txlen; /* Tx Frame length counter */416ushort sen_iaddr1; /* Individual address filter */417ushort sen_iaddr2;418ushort sen_iaddr3;419ushort sen_iaddr4;420ushort sen_boffcnt; /* Backoff counter */421422/* NOTE: Some versions of the manual have the following items423* incorrectly documented. Below is the proper order.424*/425ushort sen_taddrh; /* temp address (MSB) */426ushort sen_taddrm;427ushort sen_taddrl; /* temp address (LSB) */428} scc_enet_t;429430431432#if defined (CONFIG_UCQUICC)433/* uCquicc has the following signals connected to Ethernet:434* 68360 - lxt905435* PA0/RXD1 - rxd436* PA1/TXD1 - txd437* PA8/CLK1 - tclk438* PA9/CLK2 - rclk439* PC0/!RTS1 - t_en440* PC1/!CTS1 - col441* PC5/!CD1 - cd442*/443#define PA_ENET_RXD PA_RXD1444#define PA_ENET_TXD PA_TXD1445#define PA_ENET_TCLK PA_CLK1446#define PA_ENET_RCLK PA_CLK2447#define PC_ENET_TENA PC_RTS1448#define PC_ENET_CLSN PC_CTS1449#define PC_ENET_RENA PC_CD1450451/* Control bits in the SICR to route TCLK (CLK1) and RCLK (CLK2) to452* SCC1.453*/454#define SICR_ENET_MASK ((uint)0x000000ff)455#define SICR_ENET_CLKRT ((uint)0x0000002c)456457#endif /* config_ucquicc */458459460#ifdef MBX461/* Bits in parallel I/O port registers that have to be set/cleared462* to configure the pins for SCC1 use. The TCLK and RCLK seem unique463* to the MBX860 board. Any two of the four available clocks could be464* used, and the MPC860 cookbook manual has an example using different465* clock pins.466*/467#define PA_ENET_RXD ((ushort)0x0001)468#define PA_ENET_TXD ((ushort)0x0002)469#define PA_ENET_TCLK ((ushort)0x0200)470#define PA_ENET_RCLK ((ushort)0x0800)471#define PC_ENET_TENA ((ushort)0x0001)472#define PC_ENET_CLSN ((ushort)0x0010)473#define PC_ENET_RENA ((ushort)0x0020)474475/* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to476* SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.477*/478#define SICR_ENET_MASK ((uint)0x000000ff)479#define SICR_ENET_CLKRT ((uint)0x0000003d)480#endif481482#ifdef CONFIG_RPXLITE483/* This ENET stuff is for the MPC850 with ethernet on SCC2. Some of484* this may be unique to the RPX-Lite configuration.485* Note TENA is on Port B.486*/487#define PA_ENET_RXD ((ushort)0x0004)488#define PA_ENET_TXD ((ushort)0x0008)489#define PA_ENET_TCLK ((ushort)0x0200)490#define PA_ENET_RCLK ((ushort)0x0800)491#define PB_ENET_TENA ((uint)0x00002000)492#define PC_ENET_CLSN ((ushort)0x0040)493#define PC_ENET_RENA ((ushort)0x0080)494495#define SICR_ENET_MASK ((uint)0x0000ff00)496#define SICR_ENET_CLKRT ((uint)0x00003d00)497#endif498499#ifdef CONFIG_BSEIP500/* This ENET stuff is for the MPC823 with ethernet on SCC2.501* This is unique to the BSE ip-Engine board.502*/503#define PA_ENET_RXD ((ushort)0x0004)504#define PA_ENET_TXD ((ushort)0x0008)505#define PA_ENET_TCLK ((ushort)0x0100)506#define PA_ENET_RCLK ((ushort)0x0200)507#define PB_ENET_TENA ((uint)0x00002000)508#define PC_ENET_CLSN ((ushort)0x0040)509#define PC_ENET_RENA ((ushort)0x0080)510511/* BSE uses port B and C bits for PHY control also.512*/513#define PB_BSE_POWERUP ((uint)0x00000004)514#define PB_BSE_FDXDIS ((uint)0x00008000)515#define PC_BSE_LOOPBACK ((ushort)0x0800)516517#define SICR_ENET_MASK ((uint)0x0000ff00)518#define SICR_ENET_CLKRT ((uint)0x00002c00)519#endif520521/* SCC Event register as used by Ethernet.522*/523#define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */524#define SCCE_ENET_TXE ((ushort)0x0010) /* Transmit Error */525#define SCCE_ENET_RXF ((ushort)0x0008) /* Full frame received */526#define SCCE_ENET_BSY ((ushort)0x0004) /* All incoming buffers full */527#define SCCE_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */528#define SCCE_ENET_RXB ((ushort)0x0001) /* A buffer was received */529530/* SCC Mode Register (PMSR) as used by Ethernet.531*/532#define SCC_PMSR_HBC ((ushort)0x8000) /* Enable heartbeat */533#define SCC_PMSR_FC ((ushort)0x4000) /* Force collision */534#define SCC_PMSR_RSH ((ushort)0x2000) /* Receive short frames */535#define SCC_PMSR_IAM ((ushort)0x1000) /* Check individual hash */536#define SCC_PMSR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */537#define SCC_PMSR_PRO ((ushort)0x0200) /* Promiscuous mode */538#define SCC_PMSR_BRO ((ushort)0x0100) /* Catch broadcast pkts */539#define SCC_PMSR_SBT ((ushort)0x0080) /* Special backoff timer */540#define SCC_PMSR_LPB ((ushort)0x0040) /* Set Loopback mode */541#define SCC_PMSR_SIP ((ushort)0x0020) /* Sample Input Pins */542#define SCC_PMSR_LCW ((ushort)0x0010) /* Late collision window */543#define SCC_PMSR_NIB22 ((ushort)0x000a) /* Start frame search */544#define SCC_PMSR_FDE ((ushort)0x0001) /* Full duplex enable */545546/* Buffer descriptor control/status used by Ethernet receive.547*/548#define BD_ENET_RX_EMPTY ((ushort)0x8000)549#define BD_ENET_RX_WRAP ((ushort)0x2000)550#define BD_ENET_RX_INTR ((ushort)0x1000)551#define BD_ENET_RX_LAST ((ushort)0x0800)552#define BD_ENET_RX_FIRST ((ushort)0x0400)553#define BD_ENET_RX_MISS ((ushort)0x0100)554#define BD_ENET_RX_LG ((ushort)0x0020)555#define BD_ENET_RX_NO ((ushort)0x0010)556#define BD_ENET_RX_SH ((ushort)0x0008)557#define BD_ENET_RX_CR ((ushort)0x0004)558#define BD_ENET_RX_OV ((ushort)0x0002)559#define BD_ENET_RX_CL ((ushort)0x0001)560#define BD_ENET_RX_STATS ((ushort)0x013f) /* All status bits */561562/* Buffer descriptor control/status used by Ethernet transmit.563*/564#define BD_ENET_TX_READY ((ushort)0x8000)565#define BD_ENET_TX_PAD ((ushort)0x4000)566#define BD_ENET_TX_WRAP ((ushort)0x2000)567#define BD_ENET_TX_INTR ((ushort)0x1000)568#define BD_ENET_TX_LAST ((ushort)0x0800)569#define BD_ENET_TX_TC ((ushort)0x0400)570#define BD_ENET_TX_DEF ((ushort)0x0200)571#define BD_ENET_TX_HB ((ushort)0x0100)572#define BD_ENET_TX_LC ((ushort)0x0080)573#define BD_ENET_TX_RL ((ushort)0x0040)574#define BD_ENET_TX_RCMASK ((ushort)0x003c)575#define BD_ENET_TX_UN ((ushort)0x0002)576#define BD_ENET_TX_CSL ((ushort)0x0001)577#define BD_ENET_TX_STATS ((ushort)0x03ff) /* All status bits */578579/* SCC as UART580*/581typedef struct scc_uart {582sccp_t scc_genscc;583uint scc_res1; /* Reserved */584uint scc_res2; /* Reserved */585ushort scc_maxidl; /* Maximum idle chars */586ushort scc_idlc; /* temp idle counter */587ushort scc_brkcr; /* Break count register */588ushort scc_parec; /* receive parity error counter */589ushort scc_frmec; /* receive framing error counter */590ushort scc_nosec; /* receive noise counter */591ushort scc_brkec; /* receive break condition counter */592ushort scc_brkln; /* last received break length */593ushort scc_uaddr1; /* UART address character 1 */594ushort scc_uaddr2; /* UART address character 2 */595ushort scc_rtemp; /* Temp storage */596ushort scc_toseq; /* Transmit out of sequence char */597ushort scc_char1; /* control character 1 */598ushort scc_char2; /* control character 2 */599ushort scc_char3; /* control character 3 */600ushort scc_char4; /* control character 4 */601ushort scc_char5; /* control character 5 */602ushort scc_char6; /* control character 6 */603ushort scc_char7; /* control character 7 */604ushort scc_char8; /* control character 8 */605ushort scc_rccm; /* receive control character mask */606ushort scc_rccr; /* receive control character register */607ushort scc_rlbc; /* receive last break character */608} scc_uart_t;609610/* SCC Event and Mask registers when it is used as a UART.611*/612#define UART_SCCM_GLR ((ushort)0x1000)613#define UART_SCCM_GLT ((ushort)0x0800)614#define UART_SCCM_AB ((ushort)0x0200)615#define UART_SCCM_IDL ((ushort)0x0100)616#define UART_SCCM_GRA ((ushort)0x0080)617#define UART_SCCM_BRKE ((ushort)0x0040)618#define UART_SCCM_BRKS ((ushort)0x0020)619#define UART_SCCM_CCR ((ushort)0x0008)620#define UART_SCCM_BSY ((ushort)0x0004)621#define UART_SCCM_TX ((ushort)0x0002)622#define UART_SCCM_RX ((ushort)0x0001)623624/* The SCC PMSR when used as a UART.625*/626#define SCU_PMSR_FLC ((ushort)0x8000)627#define SCU_PMSR_SL ((ushort)0x4000)628#define SCU_PMSR_CL ((ushort)0x3000)629#define SCU_PMSR_UM ((ushort)0x0c00)630#define SCU_PMSR_FRZ ((ushort)0x0200)631#define SCU_PMSR_RZS ((ushort)0x0100)632#define SCU_PMSR_SYN ((ushort)0x0080)633#define SCU_PMSR_DRT ((ushort)0x0040)634#define SCU_PMSR_PEN ((ushort)0x0010)635#define SCU_PMSR_RPM ((ushort)0x000c)636#define SCU_PMSR_REVP ((ushort)0x0008)637#define SCU_PMSR_TPM ((ushort)0x0003)638#define SCU_PMSR_TEVP ((ushort)0x0003)639640/* CPM Transparent mode SCC.641*/642typedef struct scc_trans {643sccp_t st_genscc;644uint st_cpres; /* Preset CRC */645uint st_cmask; /* Constant mask for CRC */646} scc_trans_t;647648#define BD_SCC_TX_LAST ((ushort)0x0800)649650651652/* CPM interrupts. There are nearly 32 interrupts generated by CPM653* channels or devices. All of these are presented to the PPC core654* as a single interrupt. The CPM interrupt handler dispatches its655* own handlers, in a similar fashion to the PPC core handler. We656* use the table as defined in the manuals (i.e. no special high657* priority and SCC1 == SCCa, etc...).658*/659/* #define CPMVEC_NR 32 */660/* #define CPMVEC_PIO_PC15 ((ushort)0x1f) */661/* #define CPMVEC_SCC1 ((ushort)0x1e) */662/* #define CPMVEC_SCC2 ((ushort)0x1d) */663/* #define CPMVEC_SCC3 ((ushort)0x1c) */664/* #define CPMVEC_SCC4 ((ushort)0x1b) */665/* #define CPMVEC_PIO_PC14 ((ushort)0x1a) */666/* #define CPMVEC_TIMER1 ((ushort)0x19) */667/* #define CPMVEC_PIO_PC13 ((ushort)0x18) */668/* #define CPMVEC_PIO_PC12 ((ushort)0x17) */669/* #define CPMVEC_SDMA_CB_ERR ((ushort)0x16) */670/* #define CPMVEC_IDMA1 ((ushort)0x15) */671/* #define CPMVEC_IDMA2 ((ushort)0x14) */672/* #define CPMVEC_TIMER2 ((ushort)0x12) */673/* #define CPMVEC_RISCTIMER ((ushort)0x11) */674/* #define CPMVEC_I2C ((ushort)0x10) */675/* #define CPMVEC_PIO_PC11 ((ushort)0x0f) */676/* #define CPMVEC_PIO_PC10 ((ushort)0x0e) */677/* #define CPMVEC_TIMER3 ((ushort)0x0c) */678/* #define CPMVEC_PIO_PC9 ((ushort)0x0b) */679/* #define CPMVEC_PIO_PC8 ((ushort)0x0a) */680/* #define CPMVEC_PIO_PC7 ((ushort)0x09) */681/* #define CPMVEC_TIMER4 ((ushort)0x07) */682/* #define CPMVEC_PIO_PC6 ((ushort)0x06) */683/* #define CPMVEC_SPI ((ushort)0x05) */684/* #define CPMVEC_SMC1 ((ushort)0x04) */685/* #define CPMVEC_SMC2 ((ushort)0x03) */686/* #define CPMVEC_PIO_PC5 ((ushort)0x02) */687/* #define CPMVEC_PIO_PC4 ((ushort)0x01) */688/* #define CPMVEC_ERROR ((ushort)0x00) */689690extern void cpm_install_handler(int vec, void (*handler)(void *), void *dev_id);691692/* CPM interrupt configuration vector.693*/694#define CICR_SCD_SCC4 ((uint)0x00c00000) /* SCC4 @ SCCd */695#define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */696#define CICR_SCB_SCC2 ((uint)0x00040000) /* SCC2 @ SCCb */697#define CICR_SCA_SCC1 ((uint)0x00000000) /* SCC1 @ SCCa */698#define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrupt */699#define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */700#define CICR_IEN ((uint)0x00000080) /* Int. enable */701#define CICR_SPS ((uint)0x00000001) /* SCC Spread */702#endif /* __CPM_360__ */703704705