Index: c/src/lib/libbsp/m68k/uC5282/ChangeLog
===================================================================
--- c/src/lib/libbsp/m68k/uC5282/ChangeLog	(revision 12993b38fffe5e56a652c117ea6f79c2158b82ba)
+++ c/src/lib/libbsp/m68k/uC5282/ChangeLog	(revision 98653c677e2b3d7603789c1eff851ad8d1be1010)
@@ -1,2 +1,6 @@
+2005-02-02  Eric Norum <norume@aps.anl.gov>
+
+	* network/network.c: Lock FEC/PHYS at 100 Mbs, full-duplex
+
 2005-02-01  Eric Norum <norume@aps.anl.gov>
 
Index: c/src/lib/libbsp/m68k/uC5282/README
===================================================================
--- c/src/lib/libbsp/m68k/uC5282/README	(revision 12993b38fffe5e56a652c117ea6f79c2158b82ba)
+++ c/src/lib/libbsp/m68k/uC5282/README	(revision 98653c677e2b3d7603789c1eff851ad8d1be1010)
@@ -45,5 +45,5 @@
 VIDEO:              none
 SCSI:               none
-NETWORKING:         Internal 10/100MHz FEC
+NETWORKING:         Internal 10/100Mbs FEC, locked at 100 Mbs, full-duplex
 
 DRIVER INFORMATION
Index: c/src/lib/libbsp/m68k/uC5282/network/network.c
===================================================================
--- c/src/lib/libbsp/m68k/uC5282/network/network.c	(revision 12993b38fffe5e56a652c117ea6f79c2158b82ba)
+++ c/src/lib/libbsp/m68k/uC5282/network/network.c	(revision 98653c677e2b3d7603789c1eff851ad8d1be1010)
@@ -2,5 +2,4 @@
  * RTEMS/TCPIP driver for MCF5282 Fast Ethernet Controller
  *
- * TO DO: MII communications to set speed, full/half duplex, etc.
  * TO DO: Check network stack code -- force longword alignment of all tx mbufs?
  */
@@ -140,16 +139,47 @@
 }
 
+/*
+ * Read MII register
+ * Busy-waits, but transfer time should be short!
+ */
+static int
+getMII(int phyNumber, int regNumber)
+{
+    MCF5282_FEC_MMFR = (0x1 << 30)       |
+                       (0x2 << 28)       |
+                       (phyNumber << 23) |
+                       (regNumber << 18) |
+                       (0x2 << 16);
+    while ((MCF5282_FEC_EIR & MCF5282_FEC_EIR_MII) == 0);
+    MCF5282_FEC_EIR = MCF5282_FEC_EIR_MII;
+    return MCF5282_FEC_MMFR & 0xFFFF;
+}
+
+/*
+ * Write MII register
+ * Busy-waits, but transfer time should be short!
+ */
+static void
+setMII(int phyNumber, int regNumber, int value)
+{
+    MCF5282_FEC_MMFR = (0x1 << 30)       |
+                       (0x1 << 28)       |
+                       (phyNumber << 23) |
+                       (regNumber << 18) |
+                       (0x2 << 16)       |
+                       (value & 0xFFFF);
+    while ((MCF5282_FEC_EIR & MCF5282_FEC_EIR_MII) == 0);
+    MCF5282_FEC_EIR = MCF5282_FEC_EIR_MII;
+}
+
 static void
 mcf5282_fec_initialize_hardware(struct mcf5282_enet_struct *sc)
 {
     int i;
-    unsigned char *hwaddr;
+    const unsigned char *hwaddr;
     rtems_status_code status;
     rtems_isr_entry old_handler;
 	unsigned32 clock_speed = get_CPU_clock_speed();
 
-/*  extern struct rtems_bsdnet_ifconfig netdriver_config; */
-
-
     /*
      * Issue reset to FEC
@@ -157,4 +187,6 @@
     MCF5282_FEC_ECR = MCF5282_FEC_ECR_RESET;
     rtems_task_wake_after(1);
+    MCF5282_FEC_ECR = 0;
+
     /*
      * Configuration of I/O ports is done outside of this function
@@ -204,17 +236,16 @@
      *   Not promiscuous
      *   MII mode
-     *   Half duplex
+     *   Full duplex
      *   No loopback
      */
     MCF5282_FEC_RCR = MCF5282_FEC_RCR_MAX_FL(MAX_MTU_SIZE) | 
-                      MCF5282_FEC_RCR_MII_MODE             |
-                      MCF5282_FEC_RCR_DRT;
+                      MCF5282_FEC_RCR_MII_MODE;
 
     /*
      * Set up Transmit Control Register:
-     *   Half duplex
+     *   Full duplex
      *   No heartbeat
      */
-    MCF5282_FEC_TCR = 0;
+    MCF5282_FEC_TCR = MCF5282_FEC_TCR_FDEN;
 
     /*
@@ -230,18 +261,13 @@
 
     /*
-     * Set MII speed to <2.5 MHz
-     */
-    if (clock_speed <= 25000000)
-        MCF5282_FEC_MSCR = MCF5282_FEC_MSCR_MII_SPEED(0x5);
-    else if (clock_speed <= 33000000)
-        MCF5282_FEC_MSCR = MCF5282_FEC_MSCR_MII_SPEED(0x7);
-    else if (clock_speed <= 40000000)
-        MCF5282_FEC_MSCR = MCF5282_FEC_MSCR_MII_SPEED(0x8);
-    else if (clock_speed <= 50000000)
-        MCF5282_FEC_MSCR = MCF5282_FEC_MSCR_MII_SPEED(0xA);
-    else if (clock_speed <= 66000000)
-        MCF5282_FEC_MSCR = MCF5282_FEC_MSCR_MII_SPEED(0xD);
-    else
-        MCF5282_FEC_MSCR = MCF5282_FEC_MSCR_MII_SPEED(0xF);
+     * Set MII speed to <= 2.5 MHz
+     */
+    i = (clock_speed + 5000000 - 1) / 5000000;
+    MCF5282_FEC_MSCR = MCF5282_FEC_MSCR_MII_SPEED(i);
+
+    /*
+     * Set PHYS to 100 Mb/s, full duplex
+     */
+    setMII(1, 0, 0x2100);
 
     /*
