Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Communication Processor Module v2. |
| 3 | * |
| 4 | * This file contains structures and information for the communication |
| 5 | * processor channels found in the dual port RAM or parameter RAM. |
| 6 | * All CPM control and status is available through the CPM2 internal |
| 7 | * memory map. See immap_cpm2.h for details. |
| 8 | */ |
| 9 | #ifdef __KERNEL__ |
| 10 | #ifndef __CPM2__ |
| 11 | #define __CPM2__ |
| 12 | |
| 13 | #include <asm/immap_cpm2.h> |
Scott Wood | 15f8c60 | 2007-09-28 14:06:16 -0500 | [diff] [blame] | 14 | #include <asm/cpm.h> |
Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 15 | |
Kumar Gala | 0bfd5df | 2007-10-11 09:13:41 -0500 | [diff] [blame] | 16 | #ifdef CONFIG_PPC_85xx |
| 17 | #define CPM_MAP_ADDR (get_immrbase() + 0x80000) |
| 18 | #endif |
| 19 | |
Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 20 | /* CPM Command register. |
| 21 | */ |
| 22 | #define CPM_CR_RST ((uint)0x80000000) |
| 23 | #define CPM_CR_PAGE ((uint)0x7c000000) |
| 24 | #define CPM_CR_SBLOCK ((uint)0x03e00000) |
| 25 | #define CPM_CR_FLG ((uint)0x00010000) |
| 26 | #define CPM_CR_MCN ((uint)0x00003fc0) |
| 27 | #define CPM_CR_OPCODE ((uint)0x0000000f) |
| 28 | |
| 29 | /* Device sub-block and page codes. |
| 30 | */ |
| 31 | #define CPM_CR_SCC1_SBLOCK (0x04) |
| 32 | #define CPM_CR_SCC2_SBLOCK (0x05) |
| 33 | #define CPM_CR_SCC3_SBLOCK (0x06) |
| 34 | #define CPM_CR_SCC4_SBLOCK (0x07) |
| 35 | #define CPM_CR_SMC1_SBLOCK (0x08) |
| 36 | #define CPM_CR_SMC2_SBLOCK (0x09) |
| 37 | #define CPM_CR_SPI_SBLOCK (0x0a) |
| 38 | #define CPM_CR_I2C_SBLOCK (0x0b) |
| 39 | #define CPM_CR_TIMER_SBLOCK (0x0f) |
| 40 | #define CPM_CR_RAND_SBLOCK (0x0e) |
| 41 | #define CPM_CR_FCC1_SBLOCK (0x10) |
| 42 | #define CPM_CR_FCC2_SBLOCK (0x11) |
| 43 | #define CPM_CR_FCC3_SBLOCK (0x12) |
| 44 | #define CPM_CR_IDMA1_SBLOCK (0x14) |
| 45 | #define CPM_CR_IDMA2_SBLOCK (0x15) |
| 46 | #define CPM_CR_IDMA3_SBLOCK (0x16) |
| 47 | #define CPM_CR_IDMA4_SBLOCK (0x17) |
| 48 | #define CPM_CR_MCC1_SBLOCK (0x1c) |
| 49 | |
| 50 | #define CPM_CR_FCC_SBLOCK(x) (x + 0x10) |
| 51 | |
| 52 | #define CPM_CR_SCC1_PAGE (0x00) |
| 53 | #define CPM_CR_SCC2_PAGE (0x01) |
| 54 | #define CPM_CR_SCC3_PAGE (0x02) |
| 55 | #define CPM_CR_SCC4_PAGE (0x03) |
| 56 | #define CPM_CR_SMC1_PAGE (0x07) |
| 57 | #define CPM_CR_SMC2_PAGE (0x08) |
| 58 | #define CPM_CR_SPI_PAGE (0x09) |
| 59 | #define CPM_CR_I2C_PAGE (0x0a) |
| 60 | #define CPM_CR_TIMER_PAGE (0x0a) |
| 61 | #define CPM_CR_RAND_PAGE (0x0a) |
| 62 | #define CPM_CR_FCC1_PAGE (0x04) |
| 63 | #define CPM_CR_FCC2_PAGE (0x05) |
| 64 | #define CPM_CR_FCC3_PAGE (0x06) |
| 65 | #define CPM_CR_IDMA1_PAGE (0x07) |
| 66 | #define CPM_CR_IDMA2_PAGE (0x08) |
| 67 | #define CPM_CR_IDMA3_PAGE (0x09) |
| 68 | #define CPM_CR_IDMA4_PAGE (0x0a) |
| 69 | #define CPM_CR_MCC1_PAGE (0x07) |
| 70 | #define CPM_CR_MCC2_PAGE (0x08) |
| 71 | |
| 72 | #define CPM_CR_FCC_PAGE(x) (x + 0x04) |
| 73 | |
| 74 | /* Some opcodes (there are more...later) |
| 75 | */ |
| 76 | #define CPM_CR_INIT_TRX ((ushort)0x0000) |
| 77 | #define CPM_CR_INIT_RX ((ushort)0x0001) |
| 78 | #define CPM_CR_INIT_TX ((ushort)0x0002) |
| 79 | #define CPM_CR_HUNT_MODE ((ushort)0x0003) |
| 80 | #define CPM_CR_STOP_TX ((ushort)0x0004) |
| 81 | #define CPM_CR_GRA_STOP_TX ((ushort)0x0005) |
| 82 | #define CPM_CR_RESTART_TX ((ushort)0x0006) |
| 83 | #define CPM_CR_SET_GADDR ((ushort)0x0008) |
| 84 | #define CPM_CR_START_IDMA ((ushort)0x0009) |
| 85 | #define CPM_CR_STOP_IDMA ((ushort)0x000b) |
| 86 | |
| 87 | #define mk_cr_cmd(PG, SBC, MCN, OP) \ |
| 88 | ((PG << 26) | (SBC << 21) | (MCN << 6) | OP) |
| 89 | |
Scott Wood | 15f8c60 | 2007-09-28 14:06:16 -0500 | [diff] [blame] | 90 | #ifndef CONFIG_PPC_CPM_NEW_BINDING |
Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 91 | /* Dual Port RAM addresses. The first 16K is available for almost |
| 92 | * any CPM use, so we put the BDs there. The first 128 bytes are |
| 93 | * used for SMC1 and SMC2 parameter RAM, so we start allocating |
| 94 | * BDs above that. All of this must change when we start |
| 95 | * downloading RAM microcode. |
| 96 | */ |
| 97 | #define CPM_DATAONLY_BASE ((uint)128) |
| 98 | #define CPM_DP_NOSPACE ((uint)0x7fffffff) |
| 99 | #if defined(CONFIG_8272) || defined(CONFIG_MPC8555) |
| 100 | #define CPM_DATAONLY_SIZE ((uint)(8 * 1024) - CPM_DATAONLY_BASE) |
| 101 | #define CPM_FCC_SPECIAL_BASE ((uint)0x00009000) |
| 102 | #else |
| 103 | #define CPM_DATAONLY_SIZE ((uint)(16 * 1024) - CPM_DATAONLY_BASE) |
| 104 | #define CPM_FCC_SPECIAL_BASE ((uint)0x0000b000) |
| 105 | #endif |
Scott Wood | 15f8c60 | 2007-09-28 14:06:16 -0500 | [diff] [blame] | 106 | #endif |
Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 107 | |
| 108 | /* The number of pages of host memory we allocate for CPM. This is |
| 109 | * done early in kernel initialization to get physically contiguous |
| 110 | * pages. |
| 111 | */ |
| 112 | #define NUM_CPM_HOST_PAGES 2 |
| 113 | |
| 114 | /* Export the base address of the communication processor registers |
| 115 | * and dual port ram. |
| 116 | */ |
Scott Wood | 449012d | 2007-09-14 15:30:44 -0500 | [diff] [blame] | 117 | extern cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor */ |
Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 118 | |
Scott Wood | 15f8c60 | 2007-09-28 14:06:16 -0500 | [diff] [blame] | 119 | #ifdef CONFIG_PPC_CPM_NEW_BINDING |
| 120 | #define cpm_dpalloc cpm_muram_alloc |
| 121 | #define cpm_dpfree cpm_muram_free |
| 122 | #define cpm_dpram_addr cpm_muram_addr |
| 123 | #else |
Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 124 | extern unsigned long cpm_dpalloc(uint size, uint align); |
| 125 | extern int cpm_dpfree(unsigned long offset); |
| 126 | extern unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align); |
| 127 | extern void cpm_dpdump(void); |
| 128 | extern void *cpm_dpram_addr(unsigned long offset); |
Scott Wood | 15f8c60 | 2007-09-28 14:06:16 -0500 | [diff] [blame] | 129 | #endif |
| 130 | |
Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 131 | extern void cpm_setbrg(uint brg, uint rate); |
| 132 | extern void cpm2_fastbrg(uint brg, uint rate, int div16); |
| 133 | extern void cpm2_reset(void); |
| 134 | |
Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 135 | /* Function code bits, usually generic to devices. |
| 136 | */ |
| 137 | #define CPMFCR_GBL ((u_char)0x20) /* Set memory snooping */ |
| 138 | #define CPMFCR_EB ((u_char)0x10) /* Set big endian byte order */ |
| 139 | #define CPMFCR_TC2 ((u_char)0x04) /* Transfer code 2 value */ |
| 140 | #define CPMFCR_DTB ((u_char)0x02) /* Use local bus for data when set */ |
| 141 | #define CPMFCR_BDB ((u_char)0x01) /* Use local bus for BD when set */ |
| 142 | |
| 143 | /* Parameter RAM offsets from the base. |
| 144 | */ |
| 145 | #define PROFF_SCC1 ((uint)0x8000) |
| 146 | #define PROFF_SCC2 ((uint)0x8100) |
| 147 | #define PROFF_SCC3 ((uint)0x8200) |
| 148 | #define PROFF_SCC4 ((uint)0x8300) |
| 149 | #define PROFF_FCC1 ((uint)0x8400) |
| 150 | #define PROFF_FCC2 ((uint)0x8500) |
| 151 | #define PROFF_FCC3 ((uint)0x8600) |
| 152 | #define PROFF_MCC1 ((uint)0x8700) |
| 153 | #define PROFF_SMC1_BASE ((uint)0x87fc) |
| 154 | #define PROFF_IDMA1_BASE ((uint)0x87fe) |
| 155 | #define PROFF_MCC2 ((uint)0x8800) |
| 156 | #define PROFF_SMC2_BASE ((uint)0x88fc) |
| 157 | #define PROFF_IDMA2_BASE ((uint)0x88fe) |
| 158 | #define PROFF_SPI_BASE ((uint)0x89fc) |
| 159 | #define PROFF_IDMA3_BASE ((uint)0x89fe) |
| 160 | #define PROFF_TIMERS ((uint)0x8ae0) |
| 161 | #define PROFF_REVNUM ((uint)0x8af0) |
| 162 | #define PROFF_RAND ((uint)0x8af8) |
| 163 | #define PROFF_I2C_BASE ((uint)0x8afc) |
| 164 | #define PROFF_IDMA4_BASE ((uint)0x8afe) |
| 165 | |
| 166 | #define PROFF_SCC_SIZE ((uint)0x100) |
| 167 | #define PROFF_FCC_SIZE ((uint)0x100) |
| 168 | #define PROFF_SMC_SIZE ((uint)64) |
| 169 | |
| 170 | /* The SMCs are relocated to any of the first eight DPRAM pages. |
| 171 | * We will fix these at the first locations of DPRAM, until we |
| 172 | * get some microcode patches :-). |
| 173 | * The parameter ram space for the SMCs is fifty-some bytes, and |
| 174 | * they are required to start on a 64 byte boundary. |
| 175 | */ |
| 176 | #define PROFF_SMC1 (0) |
| 177 | #define PROFF_SMC2 (64) |
| 178 | |
| 179 | |
| 180 | /* Define enough so I can at least use the serial port as a UART. |
| 181 | */ |
| 182 | typedef struct smc_uart { |
| 183 | ushort smc_rbase; /* Rx Buffer descriptor base address */ |
| 184 | ushort smc_tbase; /* Tx Buffer descriptor base address */ |
| 185 | u_char smc_rfcr; /* Rx function code */ |
| 186 | u_char smc_tfcr; /* Tx function code */ |
| 187 | ushort smc_mrblr; /* Max receive buffer length */ |
| 188 | uint smc_rstate; /* Internal */ |
| 189 | uint smc_idp; /* Internal */ |
| 190 | ushort smc_rbptr; /* Internal */ |
| 191 | ushort smc_ibc; /* Internal */ |
| 192 | uint smc_rxtmp; /* Internal */ |
| 193 | uint smc_tstate; /* Internal */ |
| 194 | uint smc_tdp; /* Internal */ |
| 195 | ushort smc_tbptr; /* Internal */ |
| 196 | ushort smc_tbc; /* Internal */ |
| 197 | uint smc_txtmp; /* Internal */ |
| 198 | ushort smc_maxidl; /* Maximum idle characters */ |
| 199 | ushort smc_tmpidl; /* Temporary idle counter */ |
| 200 | ushort smc_brklen; /* Last received break length */ |
| 201 | ushort smc_brkec; /* rcv'd break condition counter */ |
| 202 | ushort smc_brkcr; /* xmt break count register */ |
| 203 | ushort smc_rmask; /* Temporary bit mask */ |
| 204 | uint smc_stmp; /* SDMA Temp */ |
| 205 | } smc_uart_t; |
| 206 | |
| 207 | /* SMC uart mode register (Internal memory map). |
| 208 | */ |
| 209 | #define SMCMR_REN ((ushort)0x0001) |
| 210 | #define SMCMR_TEN ((ushort)0x0002) |
| 211 | #define SMCMR_DM ((ushort)0x000c) |
| 212 | #define SMCMR_SM_GCI ((ushort)0x0000) |
| 213 | #define SMCMR_SM_UART ((ushort)0x0020) |
| 214 | #define SMCMR_SM_TRANS ((ushort)0x0030) |
| 215 | #define SMCMR_SM_MASK ((ushort)0x0030) |
| 216 | #define SMCMR_PM_EVEN ((ushort)0x0100) /* Even parity, else odd */ |
| 217 | #define SMCMR_REVD SMCMR_PM_EVEN |
| 218 | #define SMCMR_PEN ((ushort)0x0200) /* Parity enable */ |
| 219 | #define SMCMR_BS SMCMR_PEN |
| 220 | #define SMCMR_SL ((ushort)0x0400) /* Two stops, else one */ |
| 221 | #define SMCR_CLEN_MASK ((ushort)0x7800) /* Character length */ |
| 222 | #define smcr_mk_clen(C) (((C) << 11) & SMCR_CLEN_MASK) |
| 223 | |
| 224 | /* SMC Event and Mask register. |
| 225 | */ |
| 226 | #define SMCM_BRKE ((unsigned char)0x40) /* When in UART Mode */ |
| 227 | #define SMCM_BRK ((unsigned char)0x10) /* When in UART Mode */ |
| 228 | #define SMCM_TXE ((unsigned char)0x10) |
| 229 | #define SMCM_BSY ((unsigned char)0x04) |
| 230 | #define SMCM_TX ((unsigned char)0x02) |
| 231 | #define SMCM_RX ((unsigned char)0x01) |
| 232 | |
| 233 | /* Baud rate generators. |
| 234 | */ |
| 235 | #define CPM_BRG_RST ((uint)0x00020000) |
| 236 | #define CPM_BRG_EN ((uint)0x00010000) |
| 237 | #define CPM_BRG_EXTC_INT ((uint)0x00000000) |
| 238 | #define CPM_BRG_EXTC_CLK3_9 ((uint)0x00004000) |
| 239 | #define CPM_BRG_EXTC_CLK5_15 ((uint)0x00008000) |
| 240 | #define CPM_BRG_ATB ((uint)0x00002000) |
| 241 | #define CPM_BRG_CD_MASK ((uint)0x00001ffe) |
| 242 | #define CPM_BRG_DIV16 ((uint)0x00000001) |
| 243 | |
| 244 | /* SCCs. |
| 245 | */ |
| 246 | #define SCC_GSMRH_IRP ((uint)0x00040000) |
| 247 | #define SCC_GSMRH_GDE ((uint)0x00010000) |
| 248 | #define SCC_GSMRH_TCRC_CCITT ((uint)0x00008000) |
| 249 | #define SCC_GSMRH_TCRC_BISYNC ((uint)0x00004000) |
| 250 | #define SCC_GSMRH_TCRC_HDLC ((uint)0x00000000) |
| 251 | #define SCC_GSMRH_REVD ((uint)0x00002000) |
| 252 | #define SCC_GSMRH_TRX ((uint)0x00001000) |
| 253 | #define SCC_GSMRH_TTX ((uint)0x00000800) |
| 254 | #define SCC_GSMRH_CDP ((uint)0x00000400) |
| 255 | #define SCC_GSMRH_CTSP ((uint)0x00000200) |
| 256 | #define SCC_GSMRH_CDS ((uint)0x00000100) |
| 257 | #define SCC_GSMRH_CTSS ((uint)0x00000080) |
| 258 | #define SCC_GSMRH_TFL ((uint)0x00000040) |
| 259 | #define SCC_GSMRH_RFW ((uint)0x00000020) |
| 260 | #define SCC_GSMRH_TXSY ((uint)0x00000010) |
| 261 | #define SCC_GSMRH_SYNL16 ((uint)0x0000000c) |
| 262 | #define SCC_GSMRH_SYNL8 ((uint)0x00000008) |
| 263 | #define SCC_GSMRH_SYNL4 ((uint)0x00000004) |
| 264 | #define SCC_GSMRH_RTSM ((uint)0x00000002) |
| 265 | #define SCC_GSMRH_RSYN ((uint)0x00000001) |
| 266 | |
| 267 | #define SCC_GSMRL_SIR ((uint)0x80000000) /* SCC2 only */ |
| 268 | #define SCC_GSMRL_EDGE_NONE ((uint)0x60000000) |
| 269 | #define SCC_GSMRL_EDGE_NEG ((uint)0x40000000) |
| 270 | #define SCC_GSMRL_EDGE_POS ((uint)0x20000000) |
| 271 | #define SCC_GSMRL_EDGE_BOTH ((uint)0x00000000) |
| 272 | #define SCC_GSMRL_TCI ((uint)0x10000000) |
| 273 | #define SCC_GSMRL_TSNC_3 ((uint)0x0c000000) |
| 274 | #define SCC_GSMRL_TSNC_4 ((uint)0x08000000) |
| 275 | #define SCC_GSMRL_TSNC_14 ((uint)0x04000000) |
| 276 | #define SCC_GSMRL_TSNC_INF ((uint)0x00000000) |
| 277 | #define SCC_GSMRL_RINV ((uint)0x02000000) |
| 278 | #define SCC_GSMRL_TINV ((uint)0x01000000) |
| 279 | #define SCC_GSMRL_TPL_128 ((uint)0x00c00000) |
| 280 | #define SCC_GSMRL_TPL_64 ((uint)0x00a00000) |
| 281 | #define SCC_GSMRL_TPL_48 ((uint)0x00800000) |
| 282 | #define SCC_GSMRL_TPL_32 ((uint)0x00600000) |
| 283 | #define SCC_GSMRL_TPL_16 ((uint)0x00400000) |
| 284 | #define SCC_GSMRL_TPL_8 ((uint)0x00200000) |
| 285 | #define SCC_GSMRL_TPL_NONE ((uint)0x00000000) |
| 286 | #define SCC_GSMRL_TPP_ALL1 ((uint)0x00180000) |
| 287 | #define SCC_GSMRL_TPP_01 ((uint)0x00100000) |
| 288 | #define SCC_GSMRL_TPP_10 ((uint)0x00080000) |
| 289 | #define SCC_GSMRL_TPP_ZEROS ((uint)0x00000000) |
| 290 | #define SCC_GSMRL_TEND ((uint)0x00040000) |
| 291 | #define SCC_GSMRL_TDCR_32 ((uint)0x00030000) |
| 292 | #define SCC_GSMRL_TDCR_16 ((uint)0x00020000) |
| 293 | #define SCC_GSMRL_TDCR_8 ((uint)0x00010000) |
| 294 | #define SCC_GSMRL_TDCR_1 ((uint)0x00000000) |
| 295 | #define SCC_GSMRL_RDCR_32 ((uint)0x0000c000) |
| 296 | #define SCC_GSMRL_RDCR_16 ((uint)0x00008000) |
| 297 | #define SCC_GSMRL_RDCR_8 ((uint)0x00004000) |
| 298 | #define SCC_GSMRL_RDCR_1 ((uint)0x00000000) |
| 299 | #define SCC_GSMRL_RENC_DFMAN ((uint)0x00003000) |
| 300 | #define SCC_GSMRL_RENC_MANCH ((uint)0x00002000) |
| 301 | #define SCC_GSMRL_RENC_FM0 ((uint)0x00001000) |
| 302 | #define SCC_GSMRL_RENC_NRZI ((uint)0x00000800) |
| 303 | #define SCC_GSMRL_RENC_NRZ ((uint)0x00000000) |
| 304 | #define SCC_GSMRL_TENC_DFMAN ((uint)0x00000600) |
| 305 | #define SCC_GSMRL_TENC_MANCH ((uint)0x00000400) |
| 306 | #define SCC_GSMRL_TENC_FM0 ((uint)0x00000200) |
| 307 | #define SCC_GSMRL_TENC_NRZI ((uint)0x00000100) |
| 308 | #define SCC_GSMRL_TENC_NRZ ((uint)0x00000000) |
| 309 | #define SCC_GSMRL_DIAG_LE ((uint)0x000000c0) /* Loop and echo */ |
| 310 | #define SCC_GSMRL_DIAG_ECHO ((uint)0x00000080) |
| 311 | #define SCC_GSMRL_DIAG_LOOP ((uint)0x00000040) |
| 312 | #define SCC_GSMRL_DIAG_NORM ((uint)0x00000000) |
| 313 | #define SCC_GSMRL_ENR ((uint)0x00000020) |
| 314 | #define SCC_GSMRL_ENT ((uint)0x00000010) |
| 315 | #define SCC_GSMRL_MODE_ENET ((uint)0x0000000c) |
| 316 | #define SCC_GSMRL_MODE_DDCMP ((uint)0x00000009) |
| 317 | #define SCC_GSMRL_MODE_BISYNC ((uint)0x00000008) |
| 318 | #define SCC_GSMRL_MODE_V14 ((uint)0x00000007) |
| 319 | #define SCC_GSMRL_MODE_AHDLC ((uint)0x00000006) |
| 320 | #define SCC_GSMRL_MODE_PROFIBUS ((uint)0x00000005) |
| 321 | #define SCC_GSMRL_MODE_UART ((uint)0x00000004) |
| 322 | #define SCC_GSMRL_MODE_SS7 ((uint)0x00000003) |
| 323 | #define SCC_GSMRL_MODE_ATALK ((uint)0x00000002) |
| 324 | #define SCC_GSMRL_MODE_HDLC ((uint)0x00000000) |
| 325 | |
| 326 | #define SCC_TODR_TOD ((ushort)0x8000) |
| 327 | |
| 328 | /* SCC Event and Mask register. |
| 329 | */ |
| 330 | #define SCCM_TXE ((unsigned char)0x10) |
| 331 | #define SCCM_BSY ((unsigned char)0x04) |
| 332 | #define SCCM_TX ((unsigned char)0x02) |
| 333 | #define SCCM_RX ((unsigned char)0x01) |
| 334 | |
| 335 | typedef struct scc_param { |
| 336 | ushort scc_rbase; /* Rx Buffer descriptor base address */ |
| 337 | ushort scc_tbase; /* Tx Buffer descriptor base address */ |
| 338 | u_char scc_rfcr; /* Rx function code */ |
| 339 | u_char scc_tfcr; /* Tx function code */ |
| 340 | ushort scc_mrblr; /* Max receive buffer length */ |
| 341 | uint scc_rstate; /* Internal */ |
| 342 | uint scc_idp; /* Internal */ |
| 343 | ushort scc_rbptr; /* Internal */ |
| 344 | ushort scc_ibc; /* Internal */ |
| 345 | uint scc_rxtmp; /* Internal */ |
| 346 | uint scc_tstate; /* Internal */ |
| 347 | uint scc_tdp; /* Internal */ |
| 348 | ushort scc_tbptr; /* Internal */ |
| 349 | ushort scc_tbc; /* Internal */ |
| 350 | uint scc_txtmp; /* Internal */ |
| 351 | uint scc_rcrc; /* Internal */ |
| 352 | uint scc_tcrc; /* Internal */ |
| 353 | } sccp_t; |
| 354 | |
| 355 | /* CPM Ethernet through SCC1. |
| 356 | */ |
| 357 | typedef struct scc_enet { |
| 358 | sccp_t sen_genscc; |
| 359 | uint sen_cpres; /* Preset CRC */ |
| 360 | uint sen_cmask; /* Constant mask for CRC */ |
| 361 | uint sen_crcec; /* CRC Error counter */ |
| 362 | uint sen_alec; /* alignment error counter */ |
| 363 | uint sen_disfc; /* discard frame counter */ |
| 364 | ushort sen_pads; /* Tx short frame pad character */ |
| 365 | ushort sen_retlim; /* Retry limit threshold */ |
| 366 | ushort sen_retcnt; /* Retry limit counter */ |
| 367 | ushort sen_maxflr; /* maximum frame length register */ |
| 368 | ushort sen_minflr; /* minimum frame length register */ |
| 369 | ushort sen_maxd1; /* maximum DMA1 length */ |
| 370 | ushort sen_maxd2; /* maximum DMA2 length */ |
| 371 | ushort sen_maxd; /* Rx max DMA */ |
| 372 | ushort sen_dmacnt; /* Rx DMA counter */ |
| 373 | ushort sen_maxb; /* Max BD byte count */ |
| 374 | ushort sen_gaddr1; /* Group address filter */ |
| 375 | ushort sen_gaddr2; |
| 376 | ushort sen_gaddr3; |
| 377 | ushort sen_gaddr4; |
| 378 | uint sen_tbuf0data0; /* Save area 0 - current frame */ |
| 379 | uint sen_tbuf0data1; /* Save area 1 - current frame */ |
| 380 | uint sen_tbuf0rba; /* Internal */ |
| 381 | uint sen_tbuf0crc; /* Internal */ |
| 382 | ushort sen_tbuf0bcnt; /* Internal */ |
| 383 | ushort sen_paddrh; /* physical address (MSB) */ |
| 384 | ushort sen_paddrm; |
| 385 | ushort sen_paddrl; /* physical address (LSB) */ |
| 386 | ushort sen_pper; /* persistence */ |
| 387 | ushort sen_rfbdptr; /* Rx first BD pointer */ |
| 388 | ushort sen_tfbdptr; /* Tx first BD pointer */ |
| 389 | ushort sen_tlbdptr; /* Tx last BD pointer */ |
| 390 | uint sen_tbuf1data0; /* Save area 0 - current frame */ |
| 391 | uint sen_tbuf1data1; /* Save area 1 - current frame */ |
| 392 | uint sen_tbuf1rba; /* Internal */ |
| 393 | uint sen_tbuf1crc; /* Internal */ |
| 394 | ushort sen_tbuf1bcnt; /* Internal */ |
| 395 | ushort sen_txlen; /* Tx Frame length counter */ |
| 396 | ushort sen_iaddr1; /* Individual address filter */ |
| 397 | ushort sen_iaddr2; |
| 398 | ushort sen_iaddr3; |
| 399 | ushort sen_iaddr4; |
| 400 | ushort sen_boffcnt; /* Backoff counter */ |
| 401 | |
| 402 | /* NOTE: Some versions of the manual have the following items |
| 403 | * incorrectly documented. Below is the proper order. |
| 404 | */ |
| 405 | ushort sen_taddrh; /* temp address (MSB) */ |
| 406 | ushort sen_taddrm; |
| 407 | ushort sen_taddrl; /* temp address (LSB) */ |
| 408 | } scc_enet_t; |
| 409 | |
| 410 | |
| 411 | /* SCC Event register as used by Ethernet. |
| 412 | */ |
| 413 | #define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */ |
| 414 | #define SCCE_ENET_TXE ((ushort)0x0010) /* Transmit Error */ |
| 415 | #define SCCE_ENET_RXF ((ushort)0x0008) /* Full frame received */ |
| 416 | #define SCCE_ENET_BSY ((ushort)0x0004) /* All incoming buffers full */ |
| 417 | #define SCCE_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */ |
| 418 | #define SCCE_ENET_RXB ((ushort)0x0001) /* A buffer was received */ |
| 419 | |
| 420 | /* SCC Mode Register (PSMR) as used by Ethernet. |
| 421 | */ |
| 422 | #define SCC_PSMR_HBC ((ushort)0x8000) /* Enable heartbeat */ |
| 423 | #define SCC_PSMR_FC ((ushort)0x4000) /* Force collision */ |
| 424 | #define SCC_PSMR_RSH ((ushort)0x2000) /* Receive short frames */ |
| 425 | #define SCC_PSMR_IAM ((ushort)0x1000) /* Check individual hash */ |
| 426 | #define SCC_PSMR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */ |
| 427 | #define SCC_PSMR_PRO ((ushort)0x0200) /* Promiscuous mode */ |
| 428 | #define SCC_PSMR_BRO ((ushort)0x0100) /* Catch broadcast pkts */ |
| 429 | #define SCC_PSMR_SBT ((ushort)0x0080) /* Special backoff timer */ |
| 430 | #define SCC_PSMR_LPB ((ushort)0x0040) /* Set Loopback mode */ |
| 431 | #define SCC_PSMR_SIP ((ushort)0x0020) /* Sample Input Pins */ |
| 432 | #define SCC_PSMR_LCW ((ushort)0x0010) /* Late collision window */ |
| 433 | #define SCC_PSMR_NIB22 ((ushort)0x000a) /* Start frame search */ |
| 434 | #define SCC_PSMR_FDE ((ushort)0x0001) /* Full duplex enable */ |
| 435 | |
Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 436 | /* SCC as UART |
| 437 | */ |
| 438 | typedef struct scc_uart { |
| 439 | sccp_t scc_genscc; |
| 440 | uint scc_res1; /* Reserved */ |
| 441 | uint scc_res2; /* Reserved */ |
| 442 | ushort scc_maxidl; /* Maximum idle chars */ |
| 443 | ushort scc_idlc; /* temp idle counter */ |
| 444 | ushort scc_brkcr; /* Break count register */ |
| 445 | ushort scc_parec; /* receive parity error counter */ |
| 446 | ushort scc_frmec; /* receive framing error counter */ |
| 447 | ushort scc_nosec; /* receive noise counter */ |
| 448 | ushort scc_brkec; /* receive break condition counter */ |
| 449 | ushort scc_brkln; /* last received break length */ |
| 450 | ushort scc_uaddr1; /* UART address character 1 */ |
| 451 | ushort scc_uaddr2; /* UART address character 2 */ |
| 452 | ushort scc_rtemp; /* Temp storage */ |
| 453 | ushort scc_toseq; /* Transmit out of sequence char */ |
| 454 | ushort scc_char1; /* control character 1 */ |
| 455 | ushort scc_char2; /* control character 2 */ |
| 456 | ushort scc_char3; /* control character 3 */ |
| 457 | ushort scc_char4; /* control character 4 */ |
| 458 | ushort scc_char5; /* control character 5 */ |
| 459 | ushort scc_char6; /* control character 6 */ |
| 460 | ushort scc_char7; /* control character 7 */ |
| 461 | ushort scc_char8; /* control character 8 */ |
| 462 | ushort scc_rccm; /* receive control character mask */ |
| 463 | ushort scc_rccr; /* receive control character register */ |
| 464 | ushort scc_rlbc; /* receive last break character */ |
| 465 | } scc_uart_t; |
| 466 | |
| 467 | /* SCC Event and Mask registers when it is used as a UART. |
| 468 | */ |
| 469 | #define UART_SCCM_GLR ((ushort)0x1000) |
| 470 | #define UART_SCCM_GLT ((ushort)0x0800) |
| 471 | #define UART_SCCM_AB ((ushort)0x0200) |
| 472 | #define UART_SCCM_IDL ((ushort)0x0100) |
| 473 | #define UART_SCCM_GRA ((ushort)0x0080) |
| 474 | #define UART_SCCM_BRKE ((ushort)0x0040) |
| 475 | #define UART_SCCM_BRKS ((ushort)0x0020) |
| 476 | #define UART_SCCM_CCR ((ushort)0x0008) |
| 477 | #define UART_SCCM_BSY ((ushort)0x0004) |
| 478 | #define UART_SCCM_TX ((ushort)0x0002) |
| 479 | #define UART_SCCM_RX ((ushort)0x0001) |
| 480 | |
| 481 | /* The SCC PSMR when used as a UART. |
| 482 | */ |
| 483 | #define SCU_PSMR_FLC ((ushort)0x8000) |
| 484 | #define SCU_PSMR_SL ((ushort)0x4000) |
| 485 | #define SCU_PSMR_CL ((ushort)0x3000) |
| 486 | #define SCU_PSMR_UM ((ushort)0x0c00) |
| 487 | #define SCU_PSMR_FRZ ((ushort)0x0200) |
| 488 | #define SCU_PSMR_RZS ((ushort)0x0100) |
| 489 | #define SCU_PSMR_SYN ((ushort)0x0080) |
| 490 | #define SCU_PSMR_DRT ((ushort)0x0040) |
| 491 | #define SCU_PSMR_PEN ((ushort)0x0010) |
| 492 | #define SCU_PSMR_RPM ((ushort)0x000c) |
| 493 | #define SCU_PSMR_REVP ((ushort)0x0008) |
| 494 | #define SCU_PSMR_TPM ((ushort)0x0003) |
| 495 | #define SCU_PSMR_TEVP ((ushort)0x0002) |
| 496 | |
| 497 | /* CPM Transparent mode SCC. |
| 498 | */ |
| 499 | typedef struct scc_trans { |
| 500 | sccp_t st_genscc; |
| 501 | uint st_cpres; /* Preset CRC */ |
| 502 | uint st_cmask; /* Constant mask for CRC */ |
| 503 | } scc_trans_t; |
| 504 | |
Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 505 | /* How about some FCCs..... |
| 506 | */ |
| 507 | #define FCC_GFMR_DIAG_NORM ((uint)0x00000000) |
| 508 | #define FCC_GFMR_DIAG_LE ((uint)0x40000000) |
| 509 | #define FCC_GFMR_DIAG_AE ((uint)0x80000000) |
| 510 | #define FCC_GFMR_DIAG_ALE ((uint)0xc0000000) |
| 511 | #define FCC_GFMR_TCI ((uint)0x20000000) |
| 512 | #define FCC_GFMR_TRX ((uint)0x10000000) |
| 513 | #define FCC_GFMR_TTX ((uint)0x08000000) |
| 514 | #define FCC_GFMR_TTX ((uint)0x08000000) |
| 515 | #define FCC_GFMR_CDP ((uint)0x04000000) |
| 516 | #define FCC_GFMR_CTSP ((uint)0x02000000) |
| 517 | #define FCC_GFMR_CDS ((uint)0x01000000) |
| 518 | #define FCC_GFMR_CTSS ((uint)0x00800000) |
| 519 | #define FCC_GFMR_SYNL_NONE ((uint)0x00000000) |
| 520 | #define FCC_GFMR_SYNL_AUTO ((uint)0x00004000) |
| 521 | #define FCC_GFMR_SYNL_8 ((uint)0x00008000) |
| 522 | #define FCC_GFMR_SYNL_16 ((uint)0x0000c000) |
| 523 | #define FCC_GFMR_RTSM ((uint)0x00002000) |
| 524 | #define FCC_GFMR_RENC_NRZ ((uint)0x00000000) |
| 525 | #define FCC_GFMR_RENC_NRZI ((uint)0x00000800) |
| 526 | #define FCC_GFMR_REVD ((uint)0x00000400) |
| 527 | #define FCC_GFMR_TENC_NRZ ((uint)0x00000000) |
| 528 | #define FCC_GFMR_TENC_NRZI ((uint)0x00000100) |
| 529 | #define FCC_GFMR_TCRC_16 ((uint)0x00000000) |
| 530 | #define FCC_GFMR_TCRC_32 ((uint)0x00000080) |
| 531 | #define FCC_GFMR_ENR ((uint)0x00000020) |
| 532 | #define FCC_GFMR_ENT ((uint)0x00000010) |
| 533 | #define FCC_GFMR_MODE_ENET ((uint)0x0000000c) |
| 534 | #define FCC_GFMR_MODE_ATM ((uint)0x0000000a) |
| 535 | #define FCC_GFMR_MODE_HDLC ((uint)0x00000000) |
| 536 | |
| 537 | /* Generic FCC parameter ram. |
| 538 | */ |
| 539 | typedef struct fcc_param { |
| 540 | ushort fcc_riptr; /* Rx Internal temp pointer */ |
| 541 | ushort fcc_tiptr; /* Tx Internal temp pointer */ |
| 542 | ushort fcc_res1; |
| 543 | ushort fcc_mrblr; /* Max receive buffer length, mod 32 bytes */ |
| 544 | uint fcc_rstate; /* Upper byte is Func code, must be set */ |
| 545 | uint fcc_rbase; /* Receive BD base */ |
| 546 | ushort fcc_rbdstat; /* RxBD status */ |
| 547 | ushort fcc_rbdlen; /* RxBD down counter */ |
| 548 | uint fcc_rdptr; /* RxBD internal data pointer */ |
| 549 | uint fcc_tstate; /* Upper byte is Func code, must be set */ |
| 550 | uint fcc_tbase; /* Transmit BD base */ |
| 551 | ushort fcc_tbdstat; /* TxBD status */ |
| 552 | ushort fcc_tbdlen; /* TxBD down counter */ |
| 553 | uint fcc_tdptr; /* TxBD internal data pointer */ |
| 554 | uint fcc_rbptr; /* Rx BD Internal buf pointer */ |
| 555 | uint fcc_tbptr; /* Tx BD Internal buf pointer */ |
| 556 | uint fcc_rcrc; /* Rx temp CRC */ |
| 557 | uint fcc_res2; |
| 558 | uint fcc_tcrc; /* Tx temp CRC */ |
| 559 | } fccp_t; |
| 560 | |
| 561 | |
| 562 | /* Ethernet controller through FCC. |
| 563 | */ |
| 564 | typedef struct fcc_enet { |
| 565 | fccp_t fen_genfcc; |
| 566 | uint fen_statbuf; /* Internal status buffer */ |
| 567 | uint fen_camptr; /* CAM address */ |
| 568 | uint fen_cmask; /* Constant mask for CRC */ |
| 569 | uint fen_cpres; /* Preset CRC */ |
| 570 | uint fen_crcec; /* CRC Error counter */ |
| 571 | uint fen_alec; /* alignment error counter */ |
| 572 | uint fen_disfc; /* discard frame counter */ |
| 573 | ushort fen_retlim; /* Retry limit */ |
| 574 | ushort fen_retcnt; /* Retry counter */ |
| 575 | ushort fen_pper; /* Persistence */ |
| 576 | ushort fen_boffcnt; /* backoff counter */ |
| 577 | uint fen_gaddrh; /* Group address filter, high 32-bits */ |
| 578 | uint fen_gaddrl; /* Group address filter, low 32-bits */ |
| 579 | ushort fen_tfcstat; /* out of sequence TxBD */ |
| 580 | ushort fen_tfclen; |
| 581 | uint fen_tfcptr; |
| 582 | ushort fen_mflr; /* Maximum frame length (1518) */ |
| 583 | ushort fen_paddrh; /* MAC address */ |
| 584 | ushort fen_paddrm; |
| 585 | ushort fen_paddrl; |
| 586 | ushort fen_ibdcount; /* Internal BD counter */ |
| 587 | ushort fen_ibdstart; /* Internal BD start pointer */ |
| 588 | ushort fen_ibdend; /* Internal BD end pointer */ |
| 589 | ushort fen_txlen; /* Internal Tx frame length counter */ |
| 590 | uint fen_ibdbase[8]; /* Internal use */ |
| 591 | uint fen_iaddrh; /* Individual address filter */ |
| 592 | uint fen_iaddrl; |
| 593 | ushort fen_minflr; /* Minimum frame length (64) */ |
| 594 | ushort fen_taddrh; /* Filter transfer MAC address */ |
| 595 | ushort fen_taddrm; |
| 596 | ushort fen_taddrl; |
| 597 | ushort fen_padptr; /* Pointer to pad byte buffer */ |
| 598 | ushort fen_cftype; /* control frame type */ |
| 599 | ushort fen_cfrange; /* control frame range */ |
| 600 | ushort fen_maxb; /* maximum BD count */ |
| 601 | ushort fen_maxd1; /* Max DMA1 length (1520) */ |
| 602 | ushort fen_maxd2; /* Max DMA2 length (1520) */ |
| 603 | ushort fen_maxd; /* internal max DMA count */ |
| 604 | ushort fen_dmacnt; /* internal DMA counter */ |
| 605 | uint fen_octc; /* Total octect counter */ |
| 606 | uint fen_colc; /* Total collision counter */ |
| 607 | uint fen_broc; /* Total broadcast packet counter */ |
| 608 | uint fen_mulc; /* Total multicast packet count */ |
| 609 | uint fen_uspc; /* Total packets < 64 bytes */ |
| 610 | uint fen_frgc; /* Total packets < 64 bytes with errors */ |
| 611 | uint fen_ospc; /* Total packets > 1518 */ |
| 612 | uint fen_jbrc; /* Total packets > 1518 with errors */ |
| 613 | uint fen_p64c; /* Total packets == 64 bytes */ |
| 614 | uint fen_p65c; /* Total packets 64 < bytes <= 127 */ |
| 615 | uint fen_p128c; /* Total packets 127 < bytes <= 255 */ |
| 616 | uint fen_p256c; /* Total packets 256 < bytes <= 511 */ |
| 617 | uint fen_p512c; /* Total packets 512 < bytes <= 1023 */ |
| 618 | uint fen_p1024c; /* Total packets 1024 < bytes <= 1518 */ |
| 619 | uint fen_cambuf; /* Internal CAM buffer poiner */ |
| 620 | ushort fen_rfthr; /* Received frames threshold */ |
| 621 | ushort fen_rfcnt; /* Received frames count */ |
| 622 | } fcc_enet_t; |
| 623 | |
| 624 | /* FCC Event/Mask register as used by Ethernet. |
| 625 | */ |
| 626 | #define FCC_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */ |
| 627 | #define FCC_ENET_RXC ((ushort)0x0040) /* Control Frame Received */ |
| 628 | #define FCC_ENET_TXC ((ushort)0x0020) /* Out of seq. Tx sent */ |
| 629 | #define FCC_ENET_TXE ((ushort)0x0010) /* Transmit Error */ |
| 630 | #define FCC_ENET_RXF ((ushort)0x0008) /* Full frame received */ |
| 631 | #define FCC_ENET_BSY ((ushort)0x0004) /* Busy. Rx Frame dropped */ |
| 632 | #define FCC_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */ |
| 633 | #define FCC_ENET_RXB ((ushort)0x0001) /* A buffer was received */ |
| 634 | |
| 635 | /* FCC Mode Register (FPSMR) as used by Ethernet. |
| 636 | */ |
| 637 | #define FCC_PSMR_HBC ((uint)0x80000000) /* Enable heartbeat */ |
| 638 | #define FCC_PSMR_FC ((uint)0x40000000) /* Force Collision */ |
| 639 | #define FCC_PSMR_SBT ((uint)0x20000000) /* Stop backoff timer */ |
| 640 | #define FCC_PSMR_LPB ((uint)0x10000000) /* Local protect. 1 = FDX */ |
| 641 | #define FCC_PSMR_LCW ((uint)0x08000000) /* Late collision select */ |
| 642 | #define FCC_PSMR_FDE ((uint)0x04000000) /* Full Duplex Enable */ |
| 643 | #define FCC_PSMR_MON ((uint)0x02000000) /* RMON Enable */ |
| 644 | #define FCC_PSMR_PRO ((uint)0x00400000) /* Promiscuous Enable */ |
| 645 | #define FCC_PSMR_FCE ((uint)0x00200000) /* Flow Control Enable */ |
| 646 | #define FCC_PSMR_RSH ((uint)0x00100000) /* Receive Short Frames */ |
| 647 | #define FCC_PSMR_CAM ((uint)0x00000400) /* CAM enable */ |
| 648 | #define FCC_PSMR_BRO ((uint)0x00000200) /* Broadcast pkt discard */ |
| 649 | #define FCC_PSMR_ENCRC ((uint)0x00000080) /* Use 32-bit CRC */ |
| 650 | |
| 651 | /* IIC parameter RAM. |
| 652 | */ |
| 653 | typedef struct iic { |
| 654 | ushort iic_rbase; /* Rx Buffer descriptor base address */ |
| 655 | ushort iic_tbase; /* Tx Buffer descriptor base address */ |
| 656 | u_char iic_rfcr; /* Rx function code */ |
| 657 | u_char iic_tfcr; /* Tx function code */ |
| 658 | ushort iic_mrblr; /* Max receive buffer length */ |
| 659 | uint iic_rstate; /* Internal */ |
| 660 | uint iic_rdp; /* Internal */ |
| 661 | ushort iic_rbptr; /* Internal */ |
| 662 | ushort iic_rbc; /* Internal */ |
| 663 | uint iic_rxtmp; /* Internal */ |
| 664 | uint iic_tstate; /* Internal */ |
| 665 | uint iic_tdp; /* Internal */ |
| 666 | ushort iic_tbptr; /* Internal */ |
| 667 | ushort iic_tbc; /* Internal */ |
| 668 | uint iic_txtmp; /* Internal */ |
| 669 | } iic_t; |
| 670 | |
| 671 | /* SPI parameter RAM. |
| 672 | */ |
| 673 | typedef struct spi { |
| 674 | ushort spi_rbase; /* Rx Buffer descriptor base address */ |
| 675 | ushort spi_tbase; /* Tx Buffer descriptor base address */ |
| 676 | u_char spi_rfcr; /* Rx function code */ |
| 677 | u_char spi_tfcr; /* Tx function code */ |
| 678 | ushort spi_mrblr; /* Max receive buffer length */ |
| 679 | uint spi_rstate; /* Internal */ |
| 680 | uint spi_rdp; /* Internal */ |
| 681 | ushort spi_rbptr; /* Internal */ |
| 682 | ushort spi_rbc; /* Internal */ |
| 683 | uint spi_rxtmp; /* Internal */ |
| 684 | uint spi_tstate; /* Internal */ |
| 685 | uint spi_tdp; /* Internal */ |
| 686 | ushort spi_tbptr; /* Internal */ |
| 687 | ushort spi_tbc; /* Internal */ |
| 688 | uint spi_txtmp; /* Internal */ |
| 689 | uint spi_res; /* Tx temp. */ |
| 690 | uint spi_res1[4]; /* SDMA temp. */ |
| 691 | } spi_t; |
| 692 | |
| 693 | /* SPI Mode register. |
| 694 | */ |
| 695 | #define SPMODE_LOOP ((ushort)0x4000) /* Loopback */ |
| 696 | #define SPMODE_CI ((ushort)0x2000) /* Clock Invert */ |
| 697 | #define SPMODE_CP ((ushort)0x1000) /* Clock Phase */ |
| 698 | #define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */ |
| 699 | #define SPMODE_REV ((ushort)0x0400) /* Reversed Data */ |
| 700 | #define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */ |
| 701 | #define SPMODE_EN ((ushort)0x0100) /* Enable */ |
| 702 | #define SPMODE_LENMSK ((ushort)0x00f0) /* character length */ |
| 703 | #define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */ |
| 704 | |
| 705 | #define SPMODE_LEN(x) ((((x)-1)&0xF)<<4) |
| 706 | #define SPMODE_PM(x) ((x) &0xF) |
| 707 | |
| 708 | #define SPI_EB ((u_char)0x10) /* big endian byte order */ |
| 709 | |
Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 710 | /* IDMA parameter RAM |
| 711 | */ |
| 712 | typedef struct idma { |
| 713 | ushort ibase; /* IDMA buffer descriptor table base address */ |
| 714 | ushort dcm; /* DMA channel mode */ |
| 715 | ushort ibdptr; /* IDMA current buffer descriptor pointer */ |
| 716 | ushort dpr_buf; /* IDMA transfer buffer base address */ |
| 717 | ushort buf_inv; /* internal buffer inventory */ |
| 718 | ushort ss_max; /* steady-state maximum transfer size */ |
| 719 | ushort dpr_in_ptr; /* write pointer inside the internal buffer */ |
| 720 | ushort sts; /* source transfer size */ |
| 721 | ushort dpr_out_ptr; /* read pointer inside the internal buffer */ |
| 722 | ushort seob; /* source end of burst */ |
| 723 | ushort deob; /* destination end of burst */ |
| 724 | ushort dts; /* destination transfer size */ |
| 725 | ushort ret_add; /* return address when working in ERM=1 mode */ |
| 726 | ushort res0; /* reserved */ |
| 727 | uint bd_cnt; /* internal byte count */ |
| 728 | uint s_ptr; /* source internal data pointer */ |
| 729 | uint d_ptr; /* destination internal data pointer */ |
| 730 | uint istate; /* internal state */ |
| 731 | u_char res1[20]; /* pad to 64-byte length */ |
| 732 | } idma_t; |
| 733 | |
| 734 | /* DMA channel mode bit fields |
| 735 | */ |
| 736 | #define IDMA_DCM_FB ((ushort)0x8000) /* fly-by mode */ |
| 737 | #define IDMA_DCM_LP ((ushort)0x4000) /* low priority */ |
| 738 | #define IDMA_DCM_TC2 ((ushort)0x0400) /* value driven on TC[2] */ |
| 739 | #define IDMA_DCM_DMA_WRAP_MASK ((ushort)0x01c0) /* mask for DMA wrap */ |
| 740 | #define IDMA_DCM_DMA_WRAP_64 ((ushort)0x0000) /* 64-byte DMA xfer buffer */ |
| 741 | #define IDMA_DCM_DMA_WRAP_128 ((ushort)0x0040) /* 128-byte DMA xfer buffer */ |
| 742 | #define IDMA_DCM_DMA_WRAP_256 ((ushort)0x0080) /* 256-byte DMA xfer buffer */ |
| 743 | #define IDMA_DCM_DMA_WRAP_512 ((ushort)0x00c0) /* 512-byte DMA xfer buffer */ |
| 744 | #define IDMA_DCM_DMA_WRAP_1024 ((ushort)0x0100) /* 1024-byte DMA xfer buffer */ |
| 745 | #define IDMA_DCM_DMA_WRAP_2048 ((ushort)0x0140) /* 2048-byte DMA xfer buffer */ |
| 746 | #define IDMA_DCM_SINC ((ushort)0x0020) /* source inc addr */ |
| 747 | #define IDMA_DCM_DINC ((ushort)0x0010) /* destination inc addr */ |
| 748 | #define IDMA_DCM_ERM ((ushort)0x0008) /* external request mode */ |
| 749 | #define IDMA_DCM_DT ((ushort)0x0004) /* DONE treatment */ |
| 750 | #define IDMA_DCM_SD_MASK ((ushort)0x0003) /* mask for SD bit field */ |
| 751 | #define IDMA_DCM_SD_MEM2MEM ((ushort)0x0000) /* memory-to-memory xfer */ |
| 752 | #define IDMA_DCM_SD_PER2MEM ((ushort)0x0002) /* peripheral-to-memory xfer */ |
| 753 | #define IDMA_DCM_SD_MEM2PER ((ushort)0x0001) /* memory-to-peripheral xfer */ |
| 754 | |
| 755 | /* IDMA Buffer Descriptors |
| 756 | */ |
| 757 | typedef struct idma_bd { |
| 758 | uint flags; |
| 759 | uint len; /* data length */ |
| 760 | uint src; /* source data buffer pointer */ |
| 761 | uint dst; /* destination data buffer pointer */ |
| 762 | } idma_bd_t; |
| 763 | |
| 764 | /* IDMA buffer descriptor flag bit fields |
| 765 | */ |
| 766 | #define IDMA_BD_V ((uint)0x80000000) /* valid */ |
| 767 | #define IDMA_BD_W ((uint)0x20000000) /* wrap */ |
| 768 | #define IDMA_BD_I ((uint)0x10000000) /* interrupt */ |
| 769 | #define IDMA_BD_L ((uint)0x08000000) /* last */ |
| 770 | #define IDMA_BD_CM ((uint)0x02000000) /* continuous mode */ |
| 771 | #define IDMA_BD_SDN ((uint)0x00400000) /* source done */ |
| 772 | #define IDMA_BD_DDN ((uint)0x00200000) /* destination done */ |
| 773 | #define IDMA_BD_DGBL ((uint)0x00100000) /* destination global */ |
| 774 | #define IDMA_BD_DBO_LE ((uint)0x00040000) /* little-end dest byte order */ |
| 775 | #define IDMA_BD_DBO_BE ((uint)0x00080000) /* big-end dest byte order */ |
| 776 | #define IDMA_BD_DDTB ((uint)0x00010000) /* destination data bus */ |
| 777 | #define IDMA_BD_SGBL ((uint)0x00002000) /* source global */ |
| 778 | #define IDMA_BD_SBO_LE ((uint)0x00000800) /* little-end src byte order */ |
| 779 | #define IDMA_BD_SBO_BE ((uint)0x00001000) /* big-end src byte order */ |
| 780 | #define IDMA_BD_SDTB ((uint)0x00000200) /* source data bus */ |
| 781 | |
| 782 | /* per-channel IDMA registers |
| 783 | */ |
| 784 | typedef struct im_idma { |
| 785 | u_char idsr; /* IDMAn event status register */ |
| 786 | u_char res0[3]; |
| 787 | u_char idmr; /* IDMAn event mask register */ |
| 788 | u_char res1[3]; |
| 789 | } im_idma_t; |
| 790 | |
| 791 | /* IDMA event register bit fields |
| 792 | */ |
| 793 | #define IDMA_EVENT_SC ((unsigned char)0x08) /* stop completed */ |
| 794 | #define IDMA_EVENT_OB ((unsigned char)0x04) /* out of buffers */ |
| 795 | #define IDMA_EVENT_EDN ((unsigned char)0x02) /* external DONE asserted */ |
| 796 | #define IDMA_EVENT_BC ((unsigned char)0x01) /* buffer descriptor complete */ |
| 797 | |
| 798 | /* RISC Controller Configuration Register (RCCR) bit fields |
| 799 | */ |
| 800 | #define RCCR_TIME ((uint)0x80000000) /* timer enable */ |
| 801 | #define RCCR_TIMEP_MASK ((uint)0x3f000000) /* mask for timer period bit field */ |
| 802 | #define RCCR_DR0M ((uint)0x00800000) /* IDMA0 request mode */ |
| 803 | #define RCCR_DR1M ((uint)0x00400000) /* IDMA1 request mode */ |
| 804 | #define RCCR_DR2M ((uint)0x00000080) /* IDMA2 request mode */ |
| 805 | #define RCCR_DR3M ((uint)0x00000040) /* IDMA3 request mode */ |
| 806 | #define RCCR_DR0QP_MASK ((uint)0x00300000) /* mask for IDMA0 req priority */ |
| 807 | #define RCCR_DR0QP_HIGH ((uint)0x00000000) /* IDMA0 has high req priority */ |
| 808 | #define RCCR_DR0QP_MED ((uint)0x00100000) /* IDMA0 has medium req priority */ |
| 809 | #define RCCR_DR0QP_LOW ((uint)0x00200000) /* IDMA0 has low req priority */ |
| 810 | #define RCCR_DR1QP_MASK ((uint)0x00030000) /* mask for IDMA1 req priority */ |
| 811 | #define RCCR_DR1QP_HIGH ((uint)0x00000000) /* IDMA1 has high req priority */ |
| 812 | #define RCCR_DR1QP_MED ((uint)0x00010000) /* IDMA1 has medium req priority */ |
| 813 | #define RCCR_DR1QP_LOW ((uint)0x00020000) /* IDMA1 has low req priority */ |
| 814 | #define RCCR_DR2QP_MASK ((uint)0x00000030) /* mask for IDMA2 req priority */ |
| 815 | #define RCCR_DR2QP_HIGH ((uint)0x00000000) /* IDMA2 has high req priority */ |
| 816 | #define RCCR_DR2QP_MED ((uint)0x00000010) /* IDMA2 has medium req priority */ |
| 817 | #define RCCR_DR2QP_LOW ((uint)0x00000020) /* IDMA2 has low req priority */ |
| 818 | #define RCCR_DR3QP_MASK ((uint)0x00000003) /* mask for IDMA3 req priority */ |
| 819 | #define RCCR_DR3QP_HIGH ((uint)0x00000000) /* IDMA3 has high req priority */ |
| 820 | #define RCCR_DR3QP_MED ((uint)0x00000001) /* IDMA3 has medium req priority */ |
| 821 | #define RCCR_DR3QP_LOW ((uint)0x00000002) /* IDMA3 has low req priority */ |
| 822 | #define RCCR_EIE ((uint)0x00080000) /* external interrupt enable */ |
| 823 | #define RCCR_SCD ((uint)0x00040000) /* scheduler configuration */ |
| 824 | #define RCCR_ERAM_MASK ((uint)0x0000e000) /* mask for enable RAM microcode */ |
| 825 | #define RCCR_ERAM_0KB ((uint)0x00000000) /* use 0KB of dpram for microcode */ |
| 826 | #define RCCR_ERAM_2KB ((uint)0x00002000) /* use 2KB of dpram for microcode */ |
| 827 | #define RCCR_ERAM_4KB ((uint)0x00004000) /* use 4KB of dpram for microcode */ |
| 828 | #define RCCR_ERAM_6KB ((uint)0x00006000) /* use 6KB of dpram for microcode */ |
| 829 | #define RCCR_ERAM_8KB ((uint)0x00008000) /* use 8KB of dpram for microcode */ |
| 830 | #define RCCR_ERAM_10KB ((uint)0x0000a000) /* use 10KB of dpram for microcode */ |
| 831 | #define RCCR_ERAM_12KB ((uint)0x0000c000) /* use 12KB of dpram for microcode */ |
| 832 | #define RCCR_EDM0 ((uint)0x00000800) /* DREQ0 edge detect mode */ |
| 833 | #define RCCR_EDM1 ((uint)0x00000400) /* DREQ1 edge detect mode */ |
| 834 | #define RCCR_EDM2 ((uint)0x00000200) /* DREQ2 edge detect mode */ |
| 835 | #define RCCR_EDM3 ((uint)0x00000100) /* DREQ3 edge detect mode */ |
| 836 | #define RCCR_DEM01 ((uint)0x00000008) /* DONE0/DONE1 edge detect mode */ |
| 837 | #define RCCR_DEM23 ((uint)0x00000004) /* DONE2/DONE3 edge detect mode */ |
| 838 | |
| 839 | /*----------------------------------------------------------------------- |
| 840 | * CMXFCR - CMX FCC Clock Route Register |
| 841 | */ |
| 842 | #define CMXFCR_FC1 0x40000000 /* FCC1 connection */ |
| 843 | #define CMXFCR_RF1CS_MSK 0x38000000 /* Receive FCC1 Clock Source Mask */ |
| 844 | #define CMXFCR_TF1CS_MSK 0x07000000 /* Transmit FCC1 Clock Source Mask */ |
| 845 | #define CMXFCR_FC2 0x00400000 /* FCC2 connection */ |
| 846 | #define CMXFCR_RF2CS_MSK 0x00380000 /* Receive FCC2 Clock Source Mask */ |
| 847 | #define CMXFCR_TF2CS_MSK 0x00070000 /* Transmit FCC2 Clock Source Mask */ |
| 848 | #define CMXFCR_FC3 0x00004000 /* FCC3 connection */ |
| 849 | #define CMXFCR_RF3CS_MSK 0x00003800 /* Receive FCC3 Clock Source Mask */ |
| 850 | #define CMXFCR_TF3CS_MSK 0x00000700 /* Transmit FCC3 Clock Source Mask */ |
| 851 | |
| 852 | #define CMXFCR_RF1CS_BRG5 0x00000000 /* Receive FCC1 Clock Source is BRG5 */ |
| 853 | #define CMXFCR_RF1CS_BRG6 0x08000000 /* Receive FCC1 Clock Source is BRG6 */ |
| 854 | #define CMXFCR_RF1CS_BRG7 0x10000000 /* Receive FCC1 Clock Source is BRG7 */ |
| 855 | #define CMXFCR_RF1CS_BRG8 0x18000000 /* Receive FCC1 Clock Source is BRG8 */ |
| 856 | #define CMXFCR_RF1CS_CLK9 0x20000000 /* Receive FCC1 Clock Source is CLK9 */ |
| 857 | #define CMXFCR_RF1CS_CLK10 0x28000000 /* Receive FCC1 Clock Source is CLK10 */ |
| 858 | #define CMXFCR_RF1CS_CLK11 0x30000000 /* Receive FCC1 Clock Source is CLK11 */ |
| 859 | #define CMXFCR_RF1CS_CLK12 0x38000000 /* Receive FCC1 Clock Source is CLK12 */ |
| 860 | |
| 861 | #define CMXFCR_TF1CS_BRG5 0x00000000 /* Transmit FCC1 Clock Source is BRG5 */ |
| 862 | #define CMXFCR_TF1CS_BRG6 0x01000000 /* Transmit FCC1 Clock Source is BRG6 */ |
| 863 | #define CMXFCR_TF1CS_BRG7 0x02000000 /* Transmit FCC1 Clock Source is BRG7 */ |
| 864 | #define CMXFCR_TF1CS_BRG8 0x03000000 /* Transmit FCC1 Clock Source is BRG8 */ |
| 865 | #define CMXFCR_TF1CS_CLK9 0x04000000 /* Transmit FCC1 Clock Source is CLK9 */ |
| 866 | #define CMXFCR_TF1CS_CLK10 0x05000000 /* Transmit FCC1 Clock Source is CLK10 */ |
| 867 | #define CMXFCR_TF1CS_CLK11 0x06000000 /* Transmit FCC1 Clock Source is CLK11 */ |
| 868 | #define CMXFCR_TF1CS_CLK12 0x07000000 /* Transmit FCC1 Clock Source is CLK12 */ |
| 869 | |
| 870 | #define CMXFCR_RF2CS_BRG5 0x00000000 /* Receive FCC2 Clock Source is BRG5 */ |
| 871 | #define CMXFCR_RF2CS_BRG6 0x00080000 /* Receive FCC2 Clock Source is BRG6 */ |
| 872 | #define CMXFCR_RF2CS_BRG7 0x00100000 /* Receive FCC2 Clock Source is BRG7 */ |
| 873 | #define CMXFCR_RF2CS_BRG8 0x00180000 /* Receive FCC2 Clock Source is BRG8 */ |
| 874 | #define CMXFCR_RF2CS_CLK13 0x00200000 /* Receive FCC2 Clock Source is CLK13 */ |
| 875 | #define CMXFCR_RF2CS_CLK14 0x00280000 /* Receive FCC2 Clock Source is CLK14 */ |
| 876 | #define CMXFCR_RF2CS_CLK15 0x00300000 /* Receive FCC2 Clock Source is CLK15 */ |
| 877 | #define CMXFCR_RF2CS_CLK16 0x00380000 /* Receive FCC2 Clock Source is CLK16 */ |
| 878 | |
| 879 | #define CMXFCR_TF2CS_BRG5 0x00000000 /* Transmit FCC2 Clock Source is BRG5 */ |
| 880 | #define CMXFCR_TF2CS_BRG6 0x00010000 /* Transmit FCC2 Clock Source is BRG6 */ |
| 881 | #define CMXFCR_TF2CS_BRG7 0x00020000 /* Transmit FCC2 Clock Source is BRG7 */ |
| 882 | #define CMXFCR_TF2CS_BRG8 0x00030000 /* Transmit FCC2 Clock Source is BRG8 */ |
| 883 | #define CMXFCR_TF2CS_CLK13 0x00040000 /* Transmit FCC2 Clock Source is CLK13 */ |
| 884 | #define CMXFCR_TF2CS_CLK14 0x00050000 /* Transmit FCC2 Clock Source is CLK14 */ |
| 885 | #define CMXFCR_TF2CS_CLK15 0x00060000 /* Transmit FCC2 Clock Source is CLK15 */ |
| 886 | #define CMXFCR_TF2CS_CLK16 0x00070000 /* Transmit FCC2 Clock Source is CLK16 */ |
| 887 | |
| 888 | #define CMXFCR_RF3CS_BRG5 0x00000000 /* Receive FCC3 Clock Source is BRG5 */ |
| 889 | #define CMXFCR_RF3CS_BRG6 0x00000800 /* Receive FCC3 Clock Source is BRG6 */ |
| 890 | #define CMXFCR_RF3CS_BRG7 0x00001000 /* Receive FCC3 Clock Source is BRG7 */ |
| 891 | #define CMXFCR_RF3CS_BRG8 0x00001800 /* Receive FCC3 Clock Source is BRG8 */ |
| 892 | #define CMXFCR_RF3CS_CLK13 0x00002000 /* Receive FCC3 Clock Source is CLK13 */ |
| 893 | #define CMXFCR_RF3CS_CLK14 0x00002800 /* Receive FCC3 Clock Source is CLK14 */ |
| 894 | #define CMXFCR_RF3CS_CLK15 0x00003000 /* Receive FCC3 Clock Source is CLK15 */ |
| 895 | #define CMXFCR_RF3CS_CLK16 0x00003800 /* Receive FCC3 Clock Source is CLK16 */ |
| 896 | |
| 897 | #define CMXFCR_TF3CS_BRG5 0x00000000 /* Transmit FCC3 Clock Source is BRG5 */ |
| 898 | #define CMXFCR_TF3CS_BRG6 0x00000100 /* Transmit FCC3 Clock Source is BRG6 */ |
| 899 | #define CMXFCR_TF3CS_BRG7 0x00000200 /* Transmit FCC3 Clock Source is BRG7 */ |
| 900 | #define CMXFCR_TF3CS_BRG8 0x00000300 /* Transmit FCC3 Clock Source is BRG8 */ |
| 901 | #define CMXFCR_TF3CS_CLK13 0x00000400 /* Transmit FCC3 Clock Source is CLK13 */ |
| 902 | #define CMXFCR_TF3CS_CLK14 0x00000500 /* Transmit FCC3 Clock Source is CLK14 */ |
| 903 | #define CMXFCR_TF3CS_CLK15 0x00000600 /* Transmit FCC3 Clock Source is CLK15 */ |
| 904 | #define CMXFCR_TF3CS_CLK16 0x00000700 /* Transmit FCC3 Clock Source is CLK16 */ |
| 905 | |
| 906 | /*----------------------------------------------------------------------- |
| 907 | * CMXSCR - CMX SCC Clock Route Register |
| 908 | */ |
| 909 | #define CMXSCR_GR1 0x80000000 /* Grant Support of SCC1 */ |
| 910 | #define CMXSCR_SC1 0x40000000 /* SCC1 connection */ |
| 911 | #define CMXSCR_RS1CS_MSK 0x38000000 /* Receive SCC1 Clock Source Mask */ |
| 912 | #define CMXSCR_TS1CS_MSK 0x07000000 /* Transmit SCC1 Clock Source Mask */ |
| 913 | #define CMXSCR_GR2 0x00800000 /* Grant Support of SCC2 */ |
| 914 | #define CMXSCR_SC2 0x00400000 /* SCC2 connection */ |
| 915 | #define CMXSCR_RS2CS_MSK 0x00380000 /* Receive SCC2 Clock Source Mask */ |
| 916 | #define CMXSCR_TS2CS_MSK 0x00070000 /* Transmit SCC2 Clock Source Mask */ |
| 917 | #define CMXSCR_GR3 0x00008000 /* Grant Support of SCC3 */ |
| 918 | #define CMXSCR_SC3 0x00004000 /* SCC3 connection */ |
| 919 | #define CMXSCR_RS3CS_MSK 0x00003800 /* Receive SCC3 Clock Source Mask */ |
| 920 | #define CMXSCR_TS3CS_MSK 0x00000700 /* Transmit SCC3 Clock Source Mask */ |
| 921 | #define CMXSCR_GR4 0x00000080 /* Grant Support of SCC4 */ |
| 922 | #define CMXSCR_SC4 0x00000040 /* SCC4 connection */ |
| 923 | #define CMXSCR_RS4CS_MSK 0x00000038 /* Receive SCC4 Clock Source Mask */ |
| 924 | #define CMXSCR_TS4CS_MSK 0x00000007 /* Transmit SCC4 Clock Source Mask */ |
| 925 | |
| 926 | #define CMXSCR_RS1CS_BRG1 0x00000000 /* SCC1 Rx Clock Source is BRG1 */ |
| 927 | #define CMXSCR_RS1CS_BRG2 0x08000000 /* SCC1 Rx Clock Source is BRG2 */ |
| 928 | #define CMXSCR_RS1CS_BRG3 0x10000000 /* SCC1 Rx Clock Source is BRG3 */ |
| 929 | #define CMXSCR_RS1CS_BRG4 0x18000000 /* SCC1 Rx Clock Source is BRG4 */ |
| 930 | #define CMXSCR_RS1CS_CLK11 0x20000000 /* SCC1 Rx Clock Source is CLK11 */ |
| 931 | #define CMXSCR_RS1CS_CLK12 0x28000000 /* SCC1 Rx Clock Source is CLK12 */ |
| 932 | #define CMXSCR_RS1CS_CLK3 0x30000000 /* SCC1 Rx Clock Source is CLK3 */ |
| 933 | #define CMXSCR_RS1CS_CLK4 0x38000000 /* SCC1 Rx Clock Source is CLK4 */ |
| 934 | |
| 935 | #define CMXSCR_TS1CS_BRG1 0x00000000 /* SCC1 Tx Clock Source is BRG1 */ |
| 936 | #define CMXSCR_TS1CS_BRG2 0x01000000 /* SCC1 Tx Clock Source is BRG2 */ |
| 937 | #define CMXSCR_TS1CS_BRG3 0x02000000 /* SCC1 Tx Clock Source is BRG3 */ |
| 938 | #define CMXSCR_TS1CS_BRG4 0x03000000 /* SCC1 Tx Clock Source is BRG4 */ |
| 939 | #define CMXSCR_TS1CS_CLK11 0x04000000 /* SCC1 Tx Clock Source is CLK11 */ |
| 940 | #define CMXSCR_TS1CS_CLK12 0x05000000 /* SCC1 Tx Clock Source is CLK12 */ |
| 941 | #define CMXSCR_TS1CS_CLK3 0x06000000 /* SCC1 Tx Clock Source is CLK3 */ |
| 942 | #define CMXSCR_TS1CS_CLK4 0x07000000 /* SCC1 Tx Clock Source is CLK4 */ |
| 943 | |
| 944 | #define CMXSCR_RS2CS_BRG1 0x00000000 /* SCC2 Rx Clock Source is BRG1 */ |
| 945 | #define CMXSCR_RS2CS_BRG2 0x00080000 /* SCC2 Rx Clock Source is BRG2 */ |
| 946 | #define CMXSCR_RS2CS_BRG3 0x00100000 /* SCC2 Rx Clock Source is BRG3 */ |
| 947 | #define CMXSCR_RS2CS_BRG4 0x00180000 /* SCC2 Rx Clock Source is BRG4 */ |
| 948 | #define CMXSCR_RS2CS_CLK11 0x00200000 /* SCC2 Rx Clock Source is CLK11 */ |
| 949 | #define CMXSCR_RS2CS_CLK12 0x00280000 /* SCC2 Rx Clock Source is CLK12 */ |
| 950 | #define CMXSCR_RS2CS_CLK3 0x00300000 /* SCC2 Rx Clock Source is CLK3 */ |
| 951 | #define CMXSCR_RS2CS_CLK4 0x00380000 /* SCC2 Rx Clock Source is CLK4 */ |
| 952 | |
| 953 | #define CMXSCR_TS2CS_BRG1 0x00000000 /* SCC2 Tx Clock Source is BRG1 */ |
| 954 | #define CMXSCR_TS2CS_BRG2 0x00010000 /* SCC2 Tx Clock Source is BRG2 */ |
| 955 | #define CMXSCR_TS2CS_BRG3 0x00020000 /* SCC2 Tx Clock Source is BRG3 */ |
| 956 | #define CMXSCR_TS2CS_BRG4 0x00030000 /* SCC2 Tx Clock Source is BRG4 */ |
| 957 | #define CMXSCR_TS2CS_CLK11 0x00040000 /* SCC2 Tx Clock Source is CLK11 */ |
| 958 | #define CMXSCR_TS2CS_CLK12 0x00050000 /* SCC2 Tx Clock Source is CLK12 */ |
| 959 | #define CMXSCR_TS2CS_CLK3 0x00060000 /* SCC2 Tx Clock Source is CLK3 */ |
| 960 | #define CMXSCR_TS2CS_CLK4 0x00070000 /* SCC2 Tx Clock Source is CLK4 */ |
| 961 | |
| 962 | #define CMXSCR_RS3CS_BRG1 0x00000000 /* SCC3 Rx Clock Source is BRG1 */ |
| 963 | #define CMXSCR_RS3CS_BRG2 0x00000800 /* SCC3 Rx Clock Source is BRG2 */ |
| 964 | #define CMXSCR_RS3CS_BRG3 0x00001000 /* SCC3 Rx Clock Source is BRG3 */ |
| 965 | #define CMXSCR_RS3CS_BRG4 0x00001800 /* SCC3 Rx Clock Source is BRG4 */ |
| 966 | #define CMXSCR_RS3CS_CLK5 0x00002000 /* SCC3 Rx Clock Source is CLK5 */ |
| 967 | #define CMXSCR_RS3CS_CLK6 0x00002800 /* SCC3 Rx Clock Source is CLK6 */ |
| 968 | #define CMXSCR_RS3CS_CLK7 0x00003000 /* SCC3 Rx Clock Source is CLK7 */ |
| 969 | #define CMXSCR_RS3CS_CLK8 0x00003800 /* SCC3 Rx Clock Source is CLK8 */ |
| 970 | |
| 971 | #define CMXSCR_TS3CS_BRG1 0x00000000 /* SCC3 Tx Clock Source is BRG1 */ |
| 972 | #define CMXSCR_TS3CS_BRG2 0x00000100 /* SCC3 Tx Clock Source is BRG2 */ |
| 973 | #define CMXSCR_TS3CS_BRG3 0x00000200 /* SCC3 Tx Clock Source is BRG3 */ |
| 974 | #define CMXSCR_TS3CS_BRG4 0x00000300 /* SCC3 Tx Clock Source is BRG4 */ |
| 975 | #define CMXSCR_TS3CS_CLK5 0x00000400 /* SCC3 Tx Clock Source is CLK5 */ |
| 976 | #define CMXSCR_TS3CS_CLK6 0x00000500 /* SCC3 Tx Clock Source is CLK6 */ |
| 977 | #define CMXSCR_TS3CS_CLK7 0x00000600 /* SCC3 Tx Clock Source is CLK7 */ |
| 978 | #define CMXSCR_TS3CS_CLK8 0x00000700 /* SCC3 Tx Clock Source is CLK8 */ |
| 979 | |
| 980 | #define CMXSCR_RS4CS_BRG1 0x00000000 /* SCC4 Rx Clock Source is BRG1 */ |
| 981 | #define CMXSCR_RS4CS_BRG2 0x00000008 /* SCC4 Rx Clock Source is BRG2 */ |
| 982 | #define CMXSCR_RS4CS_BRG3 0x00000010 /* SCC4 Rx Clock Source is BRG3 */ |
| 983 | #define CMXSCR_RS4CS_BRG4 0x00000018 /* SCC4 Rx Clock Source is BRG4 */ |
| 984 | #define CMXSCR_RS4CS_CLK5 0x00000020 /* SCC4 Rx Clock Source is CLK5 */ |
| 985 | #define CMXSCR_RS4CS_CLK6 0x00000028 /* SCC4 Rx Clock Source is CLK6 */ |
| 986 | #define CMXSCR_RS4CS_CLK7 0x00000030 /* SCC4 Rx Clock Source is CLK7 */ |
| 987 | #define CMXSCR_RS4CS_CLK8 0x00000038 /* SCC4 Rx Clock Source is CLK8 */ |
| 988 | |
| 989 | #define CMXSCR_TS4CS_BRG1 0x00000000 /* SCC4 Tx Clock Source is BRG1 */ |
| 990 | #define CMXSCR_TS4CS_BRG2 0x00000001 /* SCC4 Tx Clock Source is BRG2 */ |
| 991 | #define CMXSCR_TS4CS_BRG3 0x00000002 /* SCC4 Tx Clock Source is BRG3 */ |
| 992 | #define CMXSCR_TS4CS_BRG4 0x00000003 /* SCC4 Tx Clock Source is BRG4 */ |
| 993 | #define CMXSCR_TS4CS_CLK5 0x00000004 /* SCC4 Tx Clock Source is CLK5 */ |
| 994 | #define CMXSCR_TS4CS_CLK6 0x00000005 /* SCC4 Tx Clock Source is CLK6 */ |
| 995 | #define CMXSCR_TS4CS_CLK7 0x00000006 /* SCC4 Tx Clock Source is CLK7 */ |
| 996 | #define CMXSCR_TS4CS_CLK8 0x00000007 /* SCC4 Tx Clock Source is CLK8 */ |
| 997 | |
| 998 | /*----------------------------------------------------------------------- |
| 999 | * SIUMCR - SIU Module Configuration Register 4-31 |
| 1000 | */ |
| 1001 | #define SIUMCR_BBD 0x80000000 /* Bus Busy Disable */ |
| 1002 | #define SIUMCR_ESE 0x40000000 /* External Snoop Enable */ |
| 1003 | #define SIUMCR_PBSE 0x20000000 /* Parity Byte Select Enable */ |
| 1004 | #define SIUMCR_CDIS 0x10000000 /* Core Disable */ |
| 1005 | #define SIUMCR_DPPC00 0x00000000 /* Data Parity Pins Configuration*/ |
| 1006 | #define SIUMCR_DPPC01 0x04000000 /* - " - */ |
| 1007 | #define SIUMCR_DPPC10 0x08000000 /* - " - */ |
| 1008 | #define SIUMCR_DPPC11 0x0c000000 /* - " - */ |
| 1009 | #define SIUMCR_L2CPC00 0x00000000 /* L2 Cache Pins Configuration */ |
| 1010 | #define SIUMCR_L2CPC01 0x01000000 /* - " - */ |
| 1011 | #define SIUMCR_L2CPC10 0x02000000 /* - " - */ |
| 1012 | #define SIUMCR_L2CPC11 0x03000000 /* - " - */ |
| 1013 | #define SIUMCR_LBPC00 0x00000000 /* Local Bus Pins Configuration */ |
| 1014 | #define SIUMCR_LBPC01 0x00400000 /* - " - */ |
| 1015 | #define SIUMCR_LBPC10 0x00800000 /* - " - */ |
| 1016 | #define SIUMCR_LBPC11 0x00c00000 /* - " - */ |
| 1017 | #define SIUMCR_APPC00 0x00000000 /* Address Parity Pins Configuration*/ |
| 1018 | #define SIUMCR_APPC01 0x00100000 /* - " - */ |
| 1019 | #define SIUMCR_APPC10 0x00200000 /* - " - */ |
| 1020 | #define SIUMCR_APPC11 0x00300000 /* - " - */ |
| 1021 | #define SIUMCR_CS10PC00 0x00000000 /* CS10 Pin Configuration */ |
| 1022 | #define SIUMCR_CS10PC01 0x00040000 /* - " - */ |
| 1023 | #define SIUMCR_CS10PC10 0x00080000 /* - " - */ |
| 1024 | #define SIUMCR_CS10PC11 0x000c0000 /* - " - */ |
| 1025 | #define SIUMCR_BCTLC00 0x00000000 /* Buffer Control Configuration */ |
| 1026 | #define SIUMCR_BCTLC01 0x00010000 /* - " - */ |
| 1027 | #define SIUMCR_BCTLC10 0x00020000 /* - " - */ |
| 1028 | #define SIUMCR_BCTLC11 0x00030000 /* - " - */ |
| 1029 | #define SIUMCR_MMR00 0x00000000 /* Mask Masters Requests */ |
| 1030 | #define SIUMCR_MMR01 0x00004000 /* - " - */ |
| 1031 | #define SIUMCR_MMR10 0x00008000 /* - " - */ |
| 1032 | #define SIUMCR_MMR11 0x0000c000 /* - " - */ |
| 1033 | #define SIUMCR_LPBSE 0x00002000 /* LocalBus Parity Byte Select Enable*/ |
| 1034 | |
| 1035 | /*----------------------------------------------------------------------- |
| 1036 | * SCCR - System Clock Control Register 9-8 |
| 1037 | */ |
| 1038 | #define SCCR_PCI_MODE 0x00000100 /* PCI Mode */ |
| 1039 | #define SCCR_PCI_MODCK 0x00000080 /* Value of PCI_MODCK pin */ |
| 1040 | #define SCCR_PCIDF_MSK 0x00000078 /* PCI division factor */ |
| 1041 | #define SCCR_PCIDF_SHIFT 3 |
| 1042 | |
| 1043 | #ifndef CPM_IMMR_OFFSET |
| 1044 | #define CPM_IMMR_OFFSET 0x101a8 |
| 1045 | #endif |
| 1046 | |
| 1047 | #define FCC_PSMR_RMII ((uint)0x00020000) /* Use RMII interface */ |
| 1048 | |
| 1049 | /* FCC iop & clock configuration. BSP code is responsible to define Fx_RXCLK & Fx_TXCLK |
| 1050 | * in order to use clock-computing stuff below for the FCC x |
| 1051 | */ |
| 1052 | |
| 1053 | /* Automatically generates register configurations */ |
| 1054 | #define PC_CLK(x) ((uint)(1<<(x-1))) /* FCC CLK I/O ports */ |
| 1055 | |
| 1056 | #define CMXFCR_RF1CS(x) ((uint)((x-5)<<27)) /* FCC1 Receive Clock Source */ |
| 1057 | #define CMXFCR_TF1CS(x) ((uint)((x-5)<<24)) /* FCC1 Transmit Clock Source */ |
| 1058 | #define CMXFCR_RF2CS(x) ((uint)((x-9)<<19)) /* FCC2 Receive Clock Source */ |
| 1059 | #define CMXFCR_TF2CS(x) ((uint)((x-9)<<16)) /* FCC2 Transmit Clock Source */ |
| 1060 | #define CMXFCR_RF3CS(x) ((uint)((x-9)<<11)) /* FCC3 Receive Clock Source */ |
| 1061 | #define CMXFCR_TF3CS(x) ((uint)((x-9)<<8)) /* FCC3 Transmit Clock Source */ |
| 1062 | |
| 1063 | #define PC_F1RXCLK PC_CLK(F1_RXCLK) |
| 1064 | #define PC_F1TXCLK PC_CLK(F1_TXCLK) |
| 1065 | #define CMX1_CLK_ROUTE (CMXFCR_RF1CS(F1_RXCLK) | CMXFCR_TF1CS(F1_TXCLK)) |
| 1066 | #define CMX1_CLK_MASK ((uint)0xff000000) |
| 1067 | |
| 1068 | #define PC_F2RXCLK PC_CLK(F2_RXCLK) |
| 1069 | #define PC_F2TXCLK PC_CLK(F2_TXCLK) |
| 1070 | #define CMX2_CLK_ROUTE (CMXFCR_RF2CS(F2_RXCLK) | CMXFCR_TF2CS(F2_TXCLK)) |
| 1071 | #define CMX2_CLK_MASK ((uint)0x00ff0000) |
| 1072 | |
| 1073 | #define PC_F3RXCLK PC_CLK(F3_RXCLK) |
| 1074 | #define PC_F3TXCLK PC_CLK(F3_TXCLK) |
| 1075 | #define CMX3_CLK_ROUTE (CMXFCR_RF3CS(F3_RXCLK) | CMXFCR_TF3CS(F3_TXCLK)) |
| 1076 | #define CMX3_CLK_MASK ((uint)0x0000ff00) |
| 1077 | |
| 1078 | #define CPMUX_CLK_MASK (CMX3_CLK_MASK | CMX2_CLK_MASK) |
| 1079 | #define CPMUX_CLK_ROUTE (CMX3_CLK_ROUTE | CMX2_CLK_ROUTE) |
| 1080 | |
| 1081 | #define CLK_TRX (PC_F3TXCLK | PC_F3RXCLK | PC_F2TXCLK | PC_F2RXCLK) |
| 1082 | |
| 1083 | /* I/O Pin assignment for FCC1. I don't yet know the best way to do this, |
| 1084 | * but there is little variation among the choices. |
| 1085 | */ |
| 1086 | #define PA1_COL 0x00000001U |
| 1087 | #define PA1_CRS 0x00000002U |
| 1088 | #define PA1_TXER 0x00000004U |
| 1089 | #define PA1_TXEN 0x00000008U |
| 1090 | #define PA1_RXDV 0x00000010U |
| 1091 | #define PA1_RXER 0x00000020U |
| 1092 | #define PA1_TXDAT 0x00003c00U |
| 1093 | #define PA1_RXDAT 0x0003c000U |
| 1094 | #define PA1_PSORA0 (PA1_RXDAT | PA1_TXDAT) |
| 1095 | #define PA1_PSORA1 (PA1_COL | PA1_CRS | PA1_TXER | PA1_TXEN | \ |
| 1096 | PA1_RXDV | PA1_RXER) |
| 1097 | #define PA1_DIRA0 (PA1_RXDAT | PA1_CRS | PA1_COL | PA1_RXER | PA1_RXDV) |
| 1098 | #define PA1_DIRA1 (PA1_TXDAT | PA1_TXEN | PA1_TXER) |
| 1099 | |
| 1100 | |
| 1101 | /* I/O Pin assignment for FCC2. I don't yet know the best way to do this, |
| 1102 | * but there is little variation among the choices. |
| 1103 | */ |
| 1104 | #define PB2_TXER 0x00000001U |
| 1105 | #define PB2_RXDV 0x00000002U |
| 1106 | #define PB2_TXEN 0x00000004U |
| 1107 | #define PB2_RXER 0x00000008U |
| 1108 | #define PB2_COL 0x00000010U |
| 1109 | #define PB2_CRS 0x00000020U |
| 1110 | #define PB2_TXDAT 0x000003c0U |
| 1111 | #define PB2_RXDAT 0x00003c00U |
| 1112 | #define PB2_PSORB0 (PB2_RXDAT | PB2_TXDAT | PB2_CRS | PB2_COL | \ |
| 1113 | PB2_RXER | PB2_RXDV | PB2_TXER) |
| 1114 | #define PB2_PSORB1 (PB2_TXEN) |
| 1115 | #define PB2_DIRB0 (PB2_RXDAT | PB2_CRS | PB2_COL | PB2_RXER | PB2_RXDV) |
| 1116 | #define PB2_DIRB1 (PB2_TXDAT | PB2_TXEN | PB2_TXER) |
| 1117 | |
| 1118 | |
| 1119 | /* I/O Pin assignment for FCC3. I don't yet know the best way to do this, |
| 1120 | * but there is little variation among the choices. |
| 1121 | */ |
| 1122 | #define PB3_RXDV 0x00004000U |
| 1123 | #define PB3_RXER 0x00008000U |
| 1124 | #define PB3_TXER 0x00010000U |
| 1125 | #define PB3_TXEN 0x00020000U |
| 1126 | #define PB3_COL 0x00040000U |
| 1127 | #define PB3_CRS 0x00080000U |
| 1128 | #define PB3_TXDAT 0x0f000000U |
| 1129 | #define PC3_TXDAT 0x00000010U |
| 1130 | #define PB3_RXDAT 0x00f00000U |
| 1131 | #define PB3_PSORB0 (PB3_RXDAT | PB3_TXDAT | PB3_CRS | PB3_COL | \ |
| 1132 | PB3_RXER | PB3_RXDV | PB3_TXER | PB3_TXEN) |
| 1133 | #define PB3_PSORB1 0 |
| 1134 | #define PB3_DIRB0 (PB3_RXDAT | PB3_CRS | PB3_COL | PB3_RXER | PB3_RXDV) |
| 1135 | #define PB3_DIRB1 (PB3_TXDAT | PB3_TXEN | PB3_TXER) |
| 1136 | #define PC3_DIRC1 (PC3_TXDAT) |
| 1137 | |
| 1138 | /* Handy macro to specify mem for FCCs*/ |
| 1139 | #define FCC_MEM_OFFSET(x) (CPM_FCC_SPECIAL_BASE + (x*128)) |
| 1140 | #define FCC1_MEM_OFFSET FCC_MEM_OFFSET(0) |
| 1141 | #define FCC2_MEM_OFFSET FCC_MEM_OFFSET(1) |
| 1142 | #define FCC3_MEM_OFFSET FCC_MEM_OFFSET(2) |
| 1143 | |
| 1144 | /* Clocks and GRG's */ |
| 1145 | |
| 1146 | enum cpm_clk_dir { |
| 1147 | CPM_CLK_RX, |
| 1148 | CPM_CLK_TX, |
| 1149 | CPM_CLK_RTX |
| 1150 | }; |
| 1151 | |
| 1152 | enum cpm_clk_target { |
| 1153 | CPM_CLK_SCC1, |
| 1154 | CPM_CLK_SCC2, |
| 1155 | CPM_CLK_SCC3, |
| 1156 | CPM_CLK_SCC4, |
| 1157 | CPM_CLK_FCC1, |
| 1158 | CPM_CLK_FCC2, |
Scott Wood | 2652d4e | 2007-07-16 13:26:35 -0500 | [diff] [blame] | 1159 | CPM_CLK_FCC3, |
| 1160 | CPM_CLK_SMC1, |
| 1161 | CPM_CLK_SMC2, |
Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 1162 | }; |
| 1163 | |
| 1164 | enum cpm_clk { |
| 1165 | CPM_CLK_NONE = 0, |
| 1166 | CPM_BRG1, /* Baud Rate Generator 1 */ |
| 1167 | CPM_BRG2, /* Baud Rate Generator 2 */ |
| 1168 | CPM_BRG3, /* Baud Rate Generator 3 */ |
| 1169 | CPM_BRG4, /* Baud Rate Generator 4 */ |
| 1170 | CPM_BRG5, /* Baud Rate Generator 5 */ |
| 1171 | CPM_BRG6, /* Baud Rate Generator 6 */ |
| 1172 | CPM_BRG7, /* Baud Rate Generator 7 */ |
| 1173 | CPM_BRG8, /* Baud Rate Generator 8 */ |
| 1174 | CPM_CLK1, /* Clock 1 */ |
| 1175 | CPM_CLK2, /* Clock 2 */ |
| 1176 | CPM_CLK3, /* Clock 3 */ |
| 1177 | CPM_CLK4, /* Clock 4 */ |
| 1178 | CPM_CLK5, /* Clock 5 */ |
| 1179 | CPM_CLK6, /* Clock 6 */ |
| 1180 | CPM_CLK7, /* Clock 7 */ |
| 1181 | CPM_CLK8, /* Clock 8 */ |
| 1182 | CPM_CLK9, /* Clock 9 */ |
| 1183 | CPM_CLK10, /* Clock 10 */ |
| 1184 | CPM_CLK11, /* Clock 11 */ |
| 1185 | CPM_CLK12, /* Clock 12 */ |
| 1186 | CPM_CLK13, /* Clock 13 */ |
| 1187 | CPM_CLK14, /* Clock 14 */ |
| 1188 | CPM_CLK15, /* Clock 15 */ |
| 1189 | CPM_CLK16, /* Clock 16 */ |
| 1190 | CPM_CLK17, /* Clock 17 */ |
| 1191 | CPM_CLK18, /* Clock 18 */ |
| 1192 | CPM_CLK19, /* Clock 19 */ |
| 1193 | CPM_CLK20, /* Clock 20 */ |
| 1194 | CPM_CLK_DUMMY |
| 1195 | }; |
| 1196 | |
| 1197 | extern int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode); |
Scott Wood | 2652d4e | 2007-07-16 13:26:35 -0500 | [diff] [blame] | 1198 | extern int cpm2_smc_clk_setup(enum cpm_clk_target target, int clock); |
Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 1199 | |
Scott Wood | 7f21f52 | 2007-07-16 13:32:24 -0500 | [diff] [blame] | 1200 | #define CPM_PIN_INPUT 0 |
| 1201 | #define CPM_PIN_OUTPUT 1 |
| 1202 | #define CPM_PIN_PRIMARY 0 |
| 1203 | #define CPM_PIN_SECONDARY 2 |
| 1204 | #define CPM_PIN_GPIO 4 |
| 1205 | #define CPM_PIN_OPENDRAIN 8 |
| 1206 | |
| 1207 | void cpm2_set_pin(int port, int pin, int flags); |
| 1208 | |
Kumar Gala | 33d71d2 | 2007-08-20 08:50:28 -0500 | [diff] [blame] | 1209 | #endif /* __CPM2__ */ |
| 1210 | #endif /* __KERNEL__ */ |