wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 1 | /* |
| 2 | * File: scc.c |
| 3 | * Description: |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 4 | * Basic ET HW initialization and packet RX/TX routines |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 5 | * |
| 6 | * NOTE <<<IMPORTANT: PLEASE READ>>>: |
| 7 | * Do not cache Rx/Tx buffers! |
| 8 | */ |
| 9 | |
| 10 | /* |
| 11 | * MPC823 <-> MC68160 Connections: |
| 12 | * |
| 13 | * Setup MPC823 to work with MC68160 Enhanced Ethernet |
| 14 | * Serial Tranceiver as follows: |
| 15 | * |
| 16 | * MPC823 Signal MC68160 Comments |
| 17 | * ------ ------ ------- -------- |
| 18 | * PA-12 ETHTX --------> TX Eth. Port Transmit Data |
| 19 | * PB-18 E_TENA --------> TENA Eth. Transmit Port Enable |
| 20 | * PA-5 ETHTCK <-------- TCLK Eth. Port Transmit Clock |
| 21 | * PA-13 ETHRX <-------- RX Eth. Port Receive Data |
| 22 | * PC-8 E_RENA <-------- RENA Eth. Receive Enable |
| 23 | * PA-6 ETHRCK <-------- RCLK Eth. Port Receive Clock |
| 24 | * PC-9 E_CLSN <-------- CLSN Eth. Port Collision Indication |
| 25 | * |
| 26 | * FADS Board Signal MC68160 Comments |
| 27 | * ----------------- ------- -------- |
| 28 | * (BCSR1) ETHEN* --------> CS2 Eth. Port Enable |
| 29 | * (BSCR4) TPSQEL* --------> TPSQEL Twisted Pair Signal Quality Error Test Enable |
| 30 | * (BCSR4) TPFLDL* --------> TPFLDL Twisted Pair Full-Duplex |
| 31 | * (BCSR4) ETHLOOP --------> LOOP Eth. Port Diagnostic Loop-Back |
| 32 | * |
| 33 | */ |
| 34 | |
| 35 | #include <common.h> |
| 36 | #include <malloc.h> |
| 37 | #include <commproc.h> |
| 38 | #include <net.h> |
| 39 | #include <command.h> |
| 40 | |
Jon Loeliger | 526e5ce | 2007-07-09 19:06:00 -0500 | [diff] [blame] | 41 | #if defined(CONFIG_CMD_NET) && defined(SCC_ENET) |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 42 | |
| 43 | /* Ethernet Transmit and Receive Buffers */ |
| 44 | #define DBUF_LENGTH 1520 |
| 45 | |
| 46 | #define TX_BUF_CNT 2 |
| 47 | |
wdenk | 6c59edc | 2004-05-03 20:45:30 +0000 | [diff] [blame] | 48 | #define TOUT_LOOP 10000 /* 10 ms to have a packet sent */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 49 | |
| 50 | static char txbuf[DBUF_LENGTH]; |
| 51 | |
| 52 | static uint rxIdx; /* index of the current RX buffer */ |
| 53 | static uint txIdx; /* index of the current TX buffer */ |
| 54 | |
| 55 | /* |
| 56 | * SCC Ethernet Tx and Rx buffer descriptors allocated at the |
| 57 | * immr->udata_bd address on Dual-Port RAM |
| 58 | * Provide for Double Buffering |
| 59 | */ |
| 60 | |
| 61 | typedef volatile struct CommonBufferDescriptor { |
| 62 | cbd_t rxbd[PKTBUFSRX]; /* Rx BD */ |
| 63 | cbd_t txbd[TX_BUF_CNT]; /* Tx BD */ |
| 64 | } RTXBD; |
| 65 | |
| 66 | static RTXBD *rtx; |
| 67 | |
Wolfgang Denk | eba0fe3 | 2012-05-20 21:14:54 +0000 | [diff] [blame] | 68 | static int scc_send(struct eth_device *dev, void *packet, int length); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 69 | static int scc_recv(struct eth_device* dev); |
| 70 | static int scc_init (struct eth_device* dev, bd_t * bd); |
| 71 | static void scc_halt(struct eth_device* dev); |
| 72 | |
| 73 | int scc_initialize(bd_t *bis) |
| 74 | { |
| 75 | struct eth_device* dev; |
| 76 | |
| 77 | dev = (struct eth_device*) malloc(sizeof *dev); |
wdenk | 1272e23 | 2002-11-10 22:06:23 +0000 | [diff] [blame] | 78 | memset(dev, 0, sizeof *dev); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 79 | |
Heiko Schocher | c5e8405 | 2010-07-20 17:45:02 +0200 | [diff] [blame] | 80 | sprintf(dev->name, "SCC"); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 81 | dev->iobase = 0; |
| 82 | dev->priv = 0; |
| 83 | dev->init = scc_init; |
| 84 | dev->halt = scc_halt; |
| 85 | dev->send = scc_send; |
| 86 | dev->recv = scc_recv; |
| 87 | |
| 88 | eth_register(dev); |
| 89 | |
| 90 | return 1; |
| 91 | } |
| 92 | |
Wolfgang Denk | eba0fe3 | 2012-05-20 21:14:54 +0000 | [diff] [blame] | 93 | static int scc_send(struct eth_device *dev, void *packet, int length) |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 94 | { |
| 95 | int i, j=0; |
| 96 | #if 0 |
| 97 | volatile char *in, *out; |
| 98 | #endif |
| 99 | |
| 100 | /* section 16.9.23.3 |
| 101 | * Wait for ready |
| 102 | */ |
| 103 | #if 0 |
| 104 | while (rtx->txbd[txIdx].cbd_sc & BD_ENET_TX_READY); |
| 105 | out = (char *)(rtx->txbd[txIdx].cbd_bufaddr); |
| 106 | in = packet; |
| 107 | for(i = 0; i < length; i++) { |
| 108 | *out++ = *in++; |
| 109 | } |
| 110 | rtx->txbd[txIdx].cbd_datlen = length; |
| 111 | rtx->txbd[txIdx].cbd_sc |= (BD_ENET_TX_READY | BD_ENET_TX_LAST); |
| 112 | while (rtx->txbd[txIdx].cbd_sc & BD_ENET_TX_READY) j++; |
| 113 | |
| 114 | #ifdef ET_DEBUG |
| 115 | printf("cycles: %d status: %x\n", j, rtx->txbd[txIdx].cbd_sc); |
| 116 | #endif |
| 117 | i = (rtx->txbd[txIdx++].cbd_sc & BD_ENET_TX_STATS) /* return only status bits */; |
| 118 | |
| 119 | /* wrap around buffer index when necessary */ |
| 120 | if (txIdx >= TX_BUF_CNT) txIdx = 0; |
| 121 | #endif |
| 122 | |
| 123 | while ((rtx->txbd[txIdx].cbd_sc & BD_ENET_TX_READY) && (j<TOUT_LOOP)) { |
| 124 | udelay (1); /* will also trigger Wd if needed */ |
| 125 | j++; |
| 126 | } |
| 127 | if (j>=TOUT_LOOP) printf("TX not ready\n"); |
| 128 | rtx->txbd[txIdx].cbd_bufaddr = (uint)packet; |
| 129 | rtx->txbd[txIdx].cbd_datlen = length; |
| 130 | rtx->txbd[txIdx].cbd_sc |= (BD_ENET_TX_READY | BD_ENET_TX_LAST |BD_ENET_TX_WRAP); |
| 131 | while ((rtx->txbd[txIdx].cbd_sc & BD_ENET_TX_READY) && (j<TOUT_LOOP)) { |
| 132 | udelay (1); /* will also trigger Wd if needed */ |
| 133 | j++; |
| 134 | } |
| 135 | if (j>=TOUT_LOOP) printf("TX timeout\n"); |
| 136 | #ifdef ET_DEBUG |
| 137 | printf("cycles: %d status: %x\n", j, rtx->txbd[txIdx].cbd_sc); |
| 138 | #endif |
| 139 | i = (rtx->txbd[txIdx].cbd_sc & BD_ENET_TX_STATS) /* return only status bits */; |
| 140 | return i; |
| 141 | } |
| 142 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 143 | static int scc_recv (struct eth_device *dev) |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 144 | { |
| 145 | int length; |
| 146 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 147 | for (;;) { |
| 148 | /* section 16.9.23.2 */ |
| 149 | if (rtx->rxbd[rxIdx].cbd_sc & BD_ENET_RX_EMPTY) { |
| 150 | length = -1; |
| 151 | break; /* nothing received - leave for() loop */ |
| 152 | } |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 153 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 154 | length = rtx->rxbd[rxIdx].cbd_datlen; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 155 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 156 | if (rtx->rxbd[rxIdx].cbd_sc & 0x003f) { |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 157 | #ifdef ET_DEBUG |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 158 | printf ("err: %x\n", rtx->rxbd[rxIdx].cbd_sc); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 159 | #endif |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 160 | } else { |
| 161 | /* Pass the packet up to the protocol layers. */ |
| 162 | NetReceive (NetRxPackets[rxIdx], length - 4); |
| 163 | } |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 164 | |
| 165 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 166 | /* Give the buffer back to the SCC. */ |
| 167 | rtx->rxbd[rxIdx].cbd_datlen = 0; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 168 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 169 | /* wrap around buffer index when necessary */ |
| 170 | if ((rxIdx + 1) >= PKTBUFSRX) { |
| 171 | rtx->rxbd[PKTBUFSRX - 1].cbd_sc = |
| 172 | (BD_ENET_RX_WRAP | BD_ENET_RX_EMPTY); |
| 173 | rxIdx = 0; |
| 174 | } else { |
| 175 | rtx->rxbd[rxIdx].cbd_sc = BD_ENET_RX_EMPTY; |
| 176 | rxIdx++; |
| 177 | } |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 178 | } |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 179 | return length; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 180 | } |
| 181 | |
| 182 | /************************************************************** |
| 183 | * |
| 184 | * SCC Ethernet Initialization Routine |
| 185 | * |
| 186 | *************************************************************/ |
| 187 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 188 | static int scc_init (struct eth_device *dev, bd_t * bis) |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 189 | { |
| 190 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 191 | int i; |
| 192 | scc_enet_t *pram_ptr; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 193 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 194 | volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 195 | |
wdenk | 7ac1610 | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 196 | #if defined(CONFIG_LWMON) |
| 197 | reset_phy(); |
| 198 | #endif |
| 199 | |
wdenk | 2bb1105 | 2003-07-17 23:16:40 +0000 | [diff] [blame] | 200 | #ifdef CONFIG_FADS |
| 201 | #if defined(CONFIG_MPC86xADS) || defined(CONFIG_MPC860T) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 202 | /* The MPC86xADS/FADS860T don't use the MODEM_EN or DATA_VOICE signals. */ |
| 203 | *((uint *) BCSR4) &= ~BCSR4_ETHLOOP; |
| 204 | *((uint *) BCSR4) |= BCSR4_TFPLDL | BCSR4_TPSQEL; |
| 205 | *((uint *) BCSR1) &= ~BCSR1_ETHEN; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 206 | #else |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 207 | *((uint *) BCSR4) &= ~(BCSR4_ETHLOOP | BCSR4_MODEM_EN); |
| 208 | *((uint *) BCSR4) |= BCSR4_TFPLDL | BCSR4_TPSQEL | BCSR4_DATA_VOICE; |
| 209 | *((uint *) BCSR1) &= ~BCSR1_ETHEN; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 210 | #endif |
| 211 | #endif |
| 212 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 213 | pram_ptr = (scc_enet_t *) & (immr->im_cpm.cp_dparam[PROFF_ENET]); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 214 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 215 | rxIdx = 0; |
| 216 | txIdx = 0; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 217 | |
Wolfgang Denk | b824a1e | 2008-09-22 22:23:06 +0200 | [diff] [blame] | 218 | if (!rtx) { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 219 | #ifdef CONFIG_SYS_ALLOC_DPRAM |
Wolfgang Denk | b824a1e | 2008-09-22 22:23:06 +0200 | [diff] [blame] | 220 | rtx = (RTXBD *) (immr->im_cpm.cp_dpmem + |
| 221 | dpram_alloc_align (sizeof (RTXBD), 8)); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 222 | #else |
Wolfgang Denk | b824a1e | 2008-09-22 22:23:06 +0200 | [diff] [blame] | 223 | rtx = (RTXBD *) (immr->im_cpm.cp_dpmem + CPM_SCC_BASE); |
| 224 | #endif |
| 225 | } |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 226 | |
| 227 | #if (defined(PA_ENET_RXD) && defined(PA_ENET_TXD)) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 228 | /* Configure port A pins for Txd and Rxd. |
| 229 | */ |
| 230 | immr->im_ioport.iop_papar |= (PA_ENET_RXD | PA_ENET_TXD); |
| 231 | immr->im_ioport.iop_padir &= ~(PA_ENET_RXD | PA_ENET_TXD); |
| 232 | immr->im_ioport.iop_paodr &= ~PA_ENET_TXD; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 233 | #elif (defined(PB_ENET_RXD) && defined(PB_ENET_TXD)) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 234 | /* Configure port B pins for Txd and Rxd. |
| 235 | */ |
| 236 | immr->im_cpm.cp_pbpar |= (PB_ENET_RXD | PB_ENET_TXD); |
| 237 | immr->im_cpm.cp_pbdir &= ~(PB_ENET_RXD | PB_ENET_TXD); |
| 238 | immr->im_cpm.cp_pbodr &= ~PB_ENET_TXD; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 239 | #else |
| 240 | #error Configuration Error: exactly ONE of PA_ENET_[RT]XD, PB_ENET_[RT]XD must be defined |
| 241 | #endif |
| 242 | |
| 243 | #if defined(PC_ENET_LBK) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 244 | /* Configure port C pins to disable External Loopback |
| 245 | */ |
| 246 | immr->im_ioport.iop_pcpar &= ~PC_ENET_LBK; |
| 247 | immr->im_ioport.iop_pcdir |= PC_ENET_LBK; |
| 248 | immr->im_ioport.iop_pcso &= ~PC_ENET_LBK; |
| 249 | immr->im_ioport.iop_pcdat &= ~PC_ENET_LBK; /* Disable Loopback */ |
| 250 | #endif /* PC_ENET_LBK */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 251 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 252 | /* Configure port C pins to enable CLSN and RENA. |
| 253 | */ |
| 254 | immr->im_ioport.iop_pcpar &= ~(PC_ENET_CLSN | PC_ENET_RENA); |
| 255 | immr->im_ioport.iop_pcdir &= ~(PC_ENET_CLSN | PC_ENET_RENA); |
| 256 | immr->im_ioport.iop_pcso |= (PC_ENET_CLSN | PC_ENET_RENA); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 257 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 258 | /* Configure port A for TCLK and RCLK. |
| 259 | */ |
| 260 | immr->im_ioport.iop_papar |= (PA_ENET_TCLK | PA_ENET_RCLK); |
| 261 | immr->im_ioport.iop_padir &= ~(PA_ENET_TCLK | PA_ENET_RCLK); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 262 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 263 | /* |
| 264 | * Configure Serial Interface clock routing -- see section 16.7.5.3 |
| 265 | * First, clear all SCC bits to zero, then set the ones we want. |
| 266 | */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 267 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 268 | immr->im_cpm.cp_sicr &= ~SICR_ENET_MASK; |
| 269 | immr->im_cpm.cp_sicr |= SICR_ENET_CLKRT; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 270 | |
| 271 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 272 | /* |
| 273 | * Initialize SDCR -- see section 16.9.23.7 |
| 274 | * SDMA configuration register |
| 275 | */ |
| 276 | immr->im_siu_conf.sc_sdcr = 0x01; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 277 | |
| 278 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 279 | /* |
| 280 | * Setup SCC Ethernet Parameter RAM |
| 281 | */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 282 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 283 | pram_ptr->sen_genscc.scc_rfcr = 0x18; /* Normal Operation and Mot byte ordering */ |
| 284 | pram_ptr->sen_genscc.scc_tfcr = 0x18; /* Mot byte ordering, Normal access */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 285 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 286 | pram_ptr->sen_genscc.scc_mrblr = DBUF_LENGTH; /* max. ET package len 1520 */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 287 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 288 | pram_ptr->sen_genscc.scc_rbase = (unsigned int) (&rtx->rxbd[0]); /* Set RXBD tbl start at Dual Port */ |
| 289 | pram_ptr->sen_genscc.scc_tbase = (unsigned int) (&rtx->txbd[0]); /* Set TXBD tbl start at Dual Port */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 290 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 291 | /* |
| 292 | * Setup Receiver Buffer Descriptors (13.14.24.18) |
| 293 | * Settings: |
| 294 | * Empty, Wrap |
| 295 | */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 296 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 297 | for (i = 0; i < PKTBUFSRX; i++) { |
| 298 | rtx->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY; |
| 299 | rtx->rxbd[i].cbd_datlen = 0; /* Reset */ |
| 300 | rtx->rxbd[i].cbd_bufaddr = (uint) NetRxPackets[i]; |
| 301 | } |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 302 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 303 | rtx->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 304 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 305 | /* |
| 306 | * Setup Ethernet Transmitter Buffer Descriptors (13.14.24.19) |
| 307 | * Settings: |
| 308 | * Add PADs to Short FRAMES, Wrap, Last, Tx CRC |
| 309 | */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 310 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 311 | for (i = 0; i < TX_BUF_CNT; i++) { |
| 312 | rtx->txbd[i].cbd_sc = |
| 313 | (BD_ENET_TX_PAD | BD_ENET_TX_LAST | BD_ENET_TX_TC); |
| 314 | rtx->txbd[i].cbd_datlen = 0; /* Reset */ |
| 315 | rtx->txbd[i].cbd_bufaddr = (uint) (&txbuf[0]); |
| 316 | } |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 317 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 318 | rtx->txbd[TX_BUF_CNT - 1].cbd_sc |= BD_ENET_TX_WRAP; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 319 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 320 | /* |
| 321 | * Enter Command: Initialize Rx Params for SCC |
| 322 | */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 323 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 324 | do { /* Spin until ready to issue command */ |
| 325 | __asm__ ("eieio"); |
| 326 | } while (immr->im_cpm.cp_cpcr & CPM_CR_FLG); |
| 327 | /* Issue command */ |
| 328 | immr->im_cpm.cp_cpcr = |
| 329 | ((CPM_CR_INIT_RX << 8) | (CPM_CR_ENET << 4) | CPM_CR_FLG); |
| 330 | do { /* Spin until command processed */ |
| 331 | __asm__ ("eieio"); |
| 332 | } while (immr->im_cpm.cp_cpcr & CPM_CR_FLG); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 333 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 334 | /* |
| 335 | * Ethernet Specific Parameter RAM |
| 336 | * see table 13-16, pg. 660, |
| 337 | * pg. 681 (example with suggested settings) |
| 338 | */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 339 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 340 | pram_ptr->sen_cpres = ~(0x0); /* Preset CRC */ |
| 341 | pram_ptr->sen_cmask = 0xdebb20e3; /* Constant Mask for CRC */ |
| 342 | pram_ptr->sen_crcec = 0x0; /* Error Counter CRC (unused) */ |
| 343 | pram_ptr->sen_alec = 0x0; /* Alignment Error Counter (unused) */ |
| 344 | pram_ptr->sen_disfc = 0x0; /* Discard Frame Counter (unused) */ |
| 345 | pram_ptr->sen_pads = 0x8888; /* Short Frame PAD Characters */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 346 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 347 | pram_ptr->sen_retlim = 15; /* Retry Limit Threshold */ |
| 348 | pram_ptr->sen_maxflr = 1518; /* MAX Frame Length Register */ |
| 349 | pram_ptr->sen_minflr = 64; /* MIN Frame Length Register */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 350 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 351 | pram_ptr->sen_maxd1 = DBUF_LENGTH; /* MAX DMA1 Length Register */ |
| 352 | pram_ptr->sen_maxd2 = DBUF_LENGTH; /* MAX DMA2 Length Register */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 353 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 354 | pram_ptr->sen_gaddr1 = 0x0; /* Group Address Filter 1 (unused) */ |
| 355 | pram_ptr->sen_gaddr2 = 0x0; /* Group Address Filter 2 (unused) */ |
| 356 | pram_ptr->sen_gaddr3 = 0x0; /* Group Address Filter 3 (unused) */ |
| 357 | pram_ptr->sen_gaddr4 = 0x0; /* Group Address Filter 4 (unused) */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 358 | |
| 359 | #define ea eth_get_dev()->enetaddr |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 360 | pram_ptr->sen_paddrh = (ea[5] << 8) + ea[4]; |
| 361 | pram_ptr->sen_paddrm = (ea[3] << 8) + ea[2]; |
| 362 | pram_ptr->sen_paddrl = (ea[1] << 8) + ea[0]; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 363 | #undef ea |
| 364 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 365 | pram_ptr->sen_pper = 0x0; /* Persistence (unused) */ |
| 366 | pram_ptr->sen_iaddr1 = 0x0; /* Individual Address Filter 1 (unused) */ |
| 367 | pram_ptr->sen_iaddr2 = 0x0; /* Individual Address Filter 2 (unused) */ |
| 368 | pram_ptr->sen_iaddr3 = 0x0; /* Individual Address Filter 3 (unused) */ |
| 369 | pram_ptr->sen_iaddr4 = 0x0; /* Individual Address Filter 4 (unused) */ |
| 370 | pram_ptr->sen_taddrh = 0x0; /* Tmp Address (MSB) (unused) */ |
| 371 | pram_ptr->sen_taddrm = 0x0; /* Tmp Address (unused) */ |
| 372 | pram_ptr->sen_taddrl = 0x0; /* Tmp Address (LSB) (unused) */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 373 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 374 | /* |
| 375 | * Enter Command: Initialize Tx Params for SCC |
| 376 | */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 377 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 378 | do { /* Spin until ready to issue command */ |
| 379 | __asm__ ("eieio"); |
| 380 | } while (immr->im_cpm.cp_cpcr & CPM_CR_FLG); |
| 381 | /* Issue command */ |
| 382 | immr->im_cpm.cp_cpcr = |
| 383 | ((CPM_CR_INIT_TX << 8) | (CPM_CR_ENET << 4) | CPM_CR_FLG); |
| 384 | do { /* Spin until command processed */ |
| 385 | __asm__ ("eieio"); |
| 386 | } while (immr->im_cpm.cp_cpcr & CPM_CR_FLG); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 387 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 388 | /* |
| 389 | * Mask all Events in SCCM - we use polling mode |
| 390 | */ |
| 391 | immr->im_cpm.cp_scc[SCC_ENET].scc_sccm = 0; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 392 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 393 | /* |
| 394 | * Clear Events in SCCE -- Clear bits by writing 1's |
| 395 | */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 396 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 397 | immr->im_cpm.cp_scc[SCC_ENET].scc_scce = ~(0x0); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 398 | |
| 399 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 400 | /* |
| 401 | * Initialize GSMR High 32-Bits |
| 402 | * Settings: Normal Mode |
| 403 | */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 404 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 405 | immr->im_cpm.cp_scc[SCC_ENET].scc_gsmrh = 0; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 406 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 407 | /* |
| 408 | * Initialize GSMR Low 32-Bits, but do not Enable Transmit/Receive |
| 409 | * Settings: |
| 410 | * TCI = Invert |
| 411 | * TPL = 48 bits |
| 412 | * TPP = Repeating 10's |
| 413 | * MODE = Ethernet |
| 414 | */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 415 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 416 | immr->im_cpm.cp_scc[SCC_ENET].scc_gsmrl = (SCC_GSMRL_TCI | |
| 417 | SCC_GSMRL_TPL_48 | |
| 418 | SCC_GSMRL_TPP_10 | |
| 419 | SCC_GSMRL_MODE_ENET); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 420 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 421 | /* |
| 422 | * Initialize the DSR -- see section 13.14.4 (pg. 513) v0.4 |
| 423 | */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 424 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 425 | immr->im_cpm.cp_scc[SCC_ENET].scc_dsr = 0xd555; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 426 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 427 | /* |
| 428 | * Initialize the PSMR |
| 429 | * Settings: |
| 430 | * CRC = 32-Bit CCITT |
| 431 | * NIB = Begin searching for SFD 22 bits after RENA |
| 432 | * FDE = Full Duplex Enable |
| 433 | * LPB = Loopback Enable (Needed when FDE is set) |
| 434 | * BRO = Reject broadcast packets |
| 435 | * PROMISCOUS = Catch all packets regardless of dest. MAC adress |
| 436 | */ |
| 437 | immr->im_cpm.cp_scc[SCC_ENET].scc_psmr = SCC_PSMR_ENCRC | |
| 438 | SCC_PSMR_NIB22 | |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 439 | #if defined(CONFIG_SCC_ENET_FULL_DUPLEX) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 440 | SCC_PSMR_FDE | SCC_PSMR_LPB | |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 441 | #endif |
| 442 | #if defined(CONFIG_SCC_ENET_NO_BROADCAST) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 443 | SCC_PSMR_BRO | |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 444 | #endif |
| 445 | #if defined(CONFIG_SCC_ENET_PROMISCOUS) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 446 | SCC_PSMR_PRO | |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 447 | #endif |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 448 | 0; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 449 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 450 | /* |
| 451 | * Configure Ethernet TENA Signal |
| 452 | */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 453 | |
| 454 | #if (defined(PC_ENET_TENA) && !defined(PB_ENET_TENA)) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 455 | immr->im_ioport.iop_pcpar |= PC_ENET_TENA; |
| 456 | immr->im_ioport.iop_pcdir &= ~PC_ENET_TENA; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 457 | #elif (defined(PB_ENET_TENA) && !defined(PC_ENET_TENA)) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 458 | immr->im_cpm.cp_pbpar |= PB_ENET_TENA; |
| 459 | immr->im_cpm.cp_pbdir |= PB_ENET_TENA; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 460 | #else |
| 461 | #error Configuration Error: exactly ONE of PB_ENET_TENA, PC_ENET_TENA must be defined |
| 462 | #endif |
| 463 | |
| 464 | #if defined(CONFIG_ADS) && defined(CONFIG_MPC860) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 465 | /* |
| 466 | * Port C is used to control the PHY,MC68160. |
| 467 | */ |
| 468 | immr->im_ioport.iop_pcdir |= |
| 469 | (PC_ENET_ETHLOOP | PC_ENET_TPFLDL | PC_ENET_TPSQEL); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 470 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 471 | immr->im_ioport.iop_pcdat |= PC_ENET_TPFLDL; |
| 472 | immr->im_ioport.iop_pcdat &= ~(PC_ENET_ETHLOOP | PC_ENET_TPSQEL); |
| 473 | *((uint *) BCSR1) &= ~BCSR1_ETHEN; |
| 474 | #endif /* MPC860ADS */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 475 | |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 476 | #ifdef CONFIG_RPXCLASSIC |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 477 | *((uchar *) BCSR0) &= ~BCSR0_ETHLPBK; |
| 478 | *((uchar *) BCSR0) |= (BCSR0_ETHEN | BCSR0_COLTEST | BCSR0_FULLDPLX); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 479 | #endif |
| 480 | |
| 481 | #ifdef CONFIG_RPXLITE |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 482 | *((uchar *) BCSR0) |= BCSR0_ETHEN; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 483 | #endif |
| 484 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 485 | #if defined(CONFIG_QS860T) |
| 486 | /* |
| 487 | * PB27=FDE-, set output low for full duplex |
| 488 | * PB26=Link Test Enable, normally high output |
| 489 | */ |
| 490 | immr->im_cpm.cp_pbdir |= 0x00000030; |
| 491 | immr->im_cpm.cp_pbdat |= 0x00000020; |
| 492 | immr->im_cpm.cp_pbdat &= ~0x00000010; |
| 493 | #endif /* QS860T */ |
| 494 | |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 495 | #ifdef CONFIG_MBX |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 496 | board_ether_init (); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 497 | #endif |
| 498 | |
| 499 | #if defined(CONFIG_NETVIA) |
wdenk | 70764a3 | 2003-06-26 22:04:09 +0000 | [diff] [blame] | 500 | #if defined(PA_ENET_PDN) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 501 | immr->im_ioport.iop_papar &= ~PA_ENET_PDN; |
| 502 | immr->im_ioport.iop_padir |= PA_ENET_PDN; |
| 503 | immr->im_ioport.iop_padat |= PA_ENET_PDN; |
wdenk | 70764a3 | 2003-06-26 22:04:09 +0000 | [diff] [blame] | 504 | #elif defined(PB_ENET_PDN) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 505 | immr->im_cpm.cp_pbpar &= ~PB_ENET_PDN; |
| 506 | immr->im_cpm.cp_pbdir |= PB_ENET_PDN; |
| 507 | immr->im_cpm.cp_pbdat |= PB_ENET_PDN; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 508 | #elif defined(PC_ENET_PDN) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 509 | immr->im_ioport.iop_pcpar &= ~PC_ENET_PDN; |
| 510 | immr->im_ioport.iop_pcdir |= PC_ENET_PDN; |
| 511 | immr->im_ioport.iop_pcdat |= PC_ENET_PDN; |
wdenk | 70764a3 | 2003-06-26 22:04:09 +0000 | [diff] [blame] | 512 | #elif defined(PD_ENET_PDN) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 513 | immr->im_ioport.iop_pdpar &= ~PD_ENET_PDN; |
| 514 | immr->im_ioport.iop_pddir |= PD_ENET_PDN; |
| 515 | immr->im_ioport.iop_pddat |= PD_ENET_PDN; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 516 | #endif |
| 517 | #endif |
| 518 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 519 | /* |
| 520 | * Set the ENT/ENR bits in the GSMR Low -- Enable Transmit/Receive |
| 521 | */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 522 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 523 | immr->im_cpm.cp_scc[SCC_ENET].scc_gsmrl |= |
| 524 | (SCC_GSMRL_ENR | SCC_GSMRL_ENT); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 525 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 526 | /* |
| 527 | * Work around transmit problem with first eth packet |
| 528 | */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 529 | #if defined (CONFIG_FADS) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 530 | udelay (10000); /* wait 10 ms */ |
Wolfgang Denk | 9032676 | 2012-10-24 02:36:15 +0000 | [diff] [blame] | 531 | #elif defined(CONFIG_RPXCLASSIC) |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 532 | udelay (100000); /* wait 100 ms */ |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 533 | #endif |
| 534 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 535 | return 1; |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 536 | } |
| 537 | |
| 538 | |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 539 | static void scc_halt (struct eth_device *dev) |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 540 | { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 541 | volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 542 | |
| 543 | immr->im_cpm.cp_scc[SCC_ENET].scc_gsmrl &= |
| 544 | ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); |
wdenk | 7ac1610 | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 545 | |
| 546 | immr->im_ioport.iop_pcso &= ~(PC_ENET_CLSN | PC_ENET_RENA); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 547 | } |
| 548 | |
| 549 | #if 0 |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 550 | void restart (void) |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 551 | { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 552 | volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; |
wdenk | 174e0e5 | 2003-12-07 22:27:15 +0000 | [diff] [blame] | 553 | |
| 554 | immr->im_cpm.cp_scc[SCC_ENET].scc_gsmrl |= |
| 555 | (SCC_GSMRL_ENR | SCC_GSMRL_ENT); |
wdenk | ed247f4 | 2002-10-07 21:58:02 +0000 | [diff] [blame] | 556 | } |
| 557 | #endif |
Jon Loeliger | 07efe2a | 2007-07-10 10:27:39 -0500 | [diff] [blame] | 558 | #endif |