Index: c/src/ChangeLog
===================================================================
--- c/src/ChangeLog	(revision 37c0ccb23c89b0debf737ca5f6801e6356702553)
+++ c/src/ChangeLog	(revision 2174c66d4bb77b6c33159a20e8c4559efd062b68)
@@ -1,2 +1,15 @@
+2011-08-30	Peter Dufault <dufault@hda.com>
+
+	* libchip/network/smc91111.c: Modify to support the MPC5554 using new
+	exceptions.  Fix where the networking status is being dumped to a
+	single thousand-character line.  Add support for when the chip loaded
+	it's MAC address from a serial chip at reset (the
+	SMC91111_ENADDR_IS_SETUP option).  Call lan91cxx_start() every time
+	the the device is initialized.  Without this change the chip can not
+	be "upped" once it has been downed.
+	* c/src/libchip/network/smc91111.h: Change the "#ifdef expression" to
+	"#if expression".
+	* c/src/libchip/network/smc91111exp.h: Add support for new exceptions.
+
 2011-07-11	Sebastian Huber <sebastian.huber@embedded-brains.de>
 
Index: c/src/libchip/network/smc91111.c
===================================================================
--- c/src/libchip/network/smc91111.c	(revision 37c0ccb23c89b0debf737ca5f6801e6356702553)
+++ c/src/libchip/network/smc91111.c	(revision 2174c66d4bb77b6c33159a20e8c4559efd062b68)
@@ -6,20 +6,19 @@
 #include <errno.h>
 
+#include <bsp.h>
+
 /*
- *  This driver currently only supports architectures with the old style
- *  exception processing.  The following checks try to keep this
- *  from being compiled on systems which can't support this driver.
+ *  This driver currently only supports SPARC with the old style
+ *  exception processing and the Phytec Phycore MPC5554.
+ *  This test keeps it from being compiled on systems which haven't been
+ *  tested.
  *
- *  NOTE: As of 28 September 2005, this has only been tested on the SPARC,
- *        so that is all it is enabled for.
  */
 
-#if defined(__sparc__)
+#if defined(__sparc__) || defined(HAS_SMC91111)
   #define SMC91111_SUPPORTED
 #endif
 
 #if defined(SMC91111_SUPPORTED)
-
-#include <bsp.h>
 
 #include <stdlib.h>
@@ -28,4 +27,5 @@
 #include <rtems/error.h>
 #include <rtems/rtems_bsdnet.h>
+#include <rtems/irq-extension.h>
 
 #include <sys/param.h>
@@ -55,12 +55,17 @@
 /*#define DEBUG (-1 & ~(16))*/
 #define DEBUG (0)
+/*#define DEBUG (1)*/
 
 #include "smc91111config.h"
 #include <libchip/smc91111.h>
 
+#ifdef _OLD_EXCEPTIONS
 #if defined(__m68k__)
 extern m68k_isr_entry set_vector( rtems_isr_entry, rtems_vector_number, int );
 #else
 extern rtems_isr_entry set_vector( rtems_isr_entry, rtems_vector_number, int );
+#endif
+#else
+#include <rtems/irq-extension.h>
 #endif
 
@@ -796,31 +801,31 @@
 static void smc91111_stats(struct lan91cxx_priv_data *priv)
 {
-	printf("tx_good             :%-8d", priv->stats.tx_good);
-	printf("tx_max_collisions   :%-8d", priv->stats.tx_max_collisions);
-	printf("tx_late_collisions  :%-8d", priv->stats.tx_late_collisions);
-	printf("tx_underrun         :%-8d", priv->stats.tx_underrun);
-	printf("tx_carrier_loss     :%-8d", priv->stats.tx_carrier_loss);
-	printf("tx_deferred         :%-8d", priv->stats.tx_deferred);
-	printf("tx_sqetesterrors    :%-8d", priv->stats.tx_sqetesterrors);
-	printf("tx_single_collisions:%-8d", priv->stats.tx_single_collisions);
-	printf("tx_mult_collisions  :%-8d", priv->stats.tx_mult_collisions);
-	printf("tx_total_collisions :%-8d", priv->stats.tx_total_collisions);
-	printf("rx_good             :%-8d", priv->stats.rx_good);
-	printf("rx_crc_errors       :%-8d", priv->stats.rx_crc_errors);
-	printf("rx_align_errors     :%-8d", priv->stats.rx_align_errors);
-	printf("rx_resource_errors  :%-8d", priv->stats.rx_resource_errors);
-	printf("rx_overrun_errors   :%-8d", priv->stats.rx_overrun_errors);
-	printf("rx_collisions       :%-8d", priv->stats.rx_collisions);
-	printf("rx_short_frames     :%-8d", priv->stats.rx_short_frames);
-	printf("rx_too_long_frames  :%-8d", priv->stats.rx_too_long_frames);
-	printf("rx_symbol_errors    :%-8d", priv->stats.rx_symbol_errors);
-	printf("interrupts          :%-8d", priv->stats.interrupts);
-	printf("rx_count            :%-8d", priv->stats.rx_count);
-	printf("rx_deliver          :%-8d", priv->stats.rx_deliver);
-	printf("rx_resource         :%-8d", priv->stats.rx_resource);
-	printf("rx_restart          :%-8d", priv->stats.rx_restart);
-	printf("tx_count            :%-8d", priv->stats.tx_count);
-	printf("tx_complete         :%-8d", priv->stats.tx_complete);
-	printf("tx_dropped          :%-8d", priv->stats.tx_dropped);
+	printf("tx_good             :%-8d\n", priv->stats.tx_good);
+	printf("tx_max_collisions   :%-8d\n", priv->stats.tx_max_collisions);
+	printf("tx_late_collisions  :%-8d\n", priv->stats.tx_late_collisions);
+	printf("tx_underrun         :%-8d\n", priv->stats.tx_underrun);
+	printf("tx_carrier_loss     :%-8d\n", priv->stats.tx_carrier_loss);
+	printf("tx_deferred         :%-8d\n", priv->stats.tx_deferred);
+	printf("tx_sqetesterrors    :%-8d\n", priv->stats.tx_sqetesterrors);
+	printf("tx_single_collisions:%-8d\n", priv->stats.tx_single_collisions);
+	printf("tx_mult_collisions  :%-8d\n", priv->stats.tx_mult_collisions);
+	printf("tx_total_collisions :%-8d\n", priv->stats.tx_total_collisions);
+	printf("rx_good             :%-8d\n", priv->stats.rx_good);
+	printf("rx_crc_errors       :%-8d\n", priv->stats.rx_crc_errors);
+	printf("rx_align_errors     :%-8d\n", priv->stats.rx_align_errors);
+	printf("rx_resource_errors  :%-8d\n", priv->stats.rx_resource_errors);
+	printf("rx_overrun_errors   :%-8d\n", priv->stats.rx_overrun_errors);
+	printf("rx_collisions       :%-8d\n", priv->stats.rx_collisions);
+	printf("rx_short_frames     :%-8d\n", priv->stats.rx_short_frames);
+	printf("rx_too_long_frames  :%-8d\n", priv->stats.rx_too_long_frames);
+	printf("rx_symbol_errors    :%-8d\n", priv->stats.rx_symbol_errors);
+	printf("interrupts          :%-8d\n", priv->stats.interrupts);
+	printf("rx_count            :%-8d\n", priv->stats.rx_count);
+	printf("rx_deliver          :%-8d\n", priv->stats.rx_deliver);
+	printf("rx_resource         :%-8d\n", priv->stats.rx_resource);
+	printf("rx_restart          :%-8d\n", priv->stats.rx_restart);
+	printf("tx_count            :%-8d\n", priv->stats.tx_count);
+	printf("tx_complete         :%-8d\n", priv->stats.tx_complete);
+	printf("tx_dropped          :%-8d\n", priv->stats.tx_dropped);
 }
 
@@ -949,4 +954,13 @@
 		memcpy(cpd->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN);
 	} else {
+#ifdef SMC91111_ENADDR_IS_SETUP
+        /* The address was put in the chip at reset time.  Retrieve it. */
+        int i;
+        for (i = 0; i < sizeof(cpd->enaddr); i += 2) {
+            unsigned short r = get_reg(cpd, LAN91CXX_IA01 + i / 2);
+            cpd->arpcom.ac_enaddr[i] = r;
+            cpd->arpcom.ac_enaddr[i+1] = r >> 8;
+        }
+#else
 		/* dummy default address */
 		cpd->arpcom.ac_enaddr[0] = 0x12;
@@ -956,4 +970,5 @@
 		cpd->arpcom.ac_enaddr[4] = 0x16;
 		cpd->arpcom.ac_enaddr[5] = 0x17;
+#endif
 	}
 
@@ -1021,4 +1036,6 @@
 		cpd->txDaemonTid =
 		    rtems_bsdnet_newproc("DCtx", 4096, smc91111_txDaemon, cpd);
+	} else {
+		lan91cxx_start(ifp);
 	}
 
@@ -1056,6 +1073,20 @@
 
 	/* install interrupt vector */
+#ifdef _OLD_EXCEPTIONS
 	db_printf("Install lan91cxx irqvector at %d\n", cpd->config.vector);
 	set_vector(lan91cxx_interrupt_handler, cpd->config.vector, 1);
+#else
+    {
+        int r;
+        if ((r = rtems_interrupt_handler_install(cpd->config.vector,
+        cpd->config.info,
+        cpd->config.options,
+        cpd->config.interrupt_wrapper,
+        cpd->config.arg) )) {
+                printf("rtems_interrupt_handler_install returned %d.\n", r);
+                return 0;
+        }
+    }
+#endif
 
 	/* Reset chip */
@@ -1623,6 +1654,4 @@
 }
 
-#endif
-
 #if 0
 void lan91cxx_print_bank(int bank){
@@ -1645,2 +1674,4 @@
 }
 #endif
+
+#endif
Index: c/src/libchip/network/smc91111.h
===================================================================
--- c/src/libchip/network/smc91111.h	(revision 37c0ccb23c89b0debf737ca5f6801e6356702553)
+++ c/src/libchip/network/smc91111.h	(revision 2174c66d4bb77b6c33159a20e8c4559efd062b68)
@@ -452,5 +452,5 @@
     /*rtems_interrupt_enable(Irql);*/
 
-#ifdef DEBUG & 32
+#if DEBUG & 32
     while ((c = dbg->reg) != -1) {
       if (c == regno) {
@@ -475,5 +475,5 @@
     uint32_t              Irql;
 
-#ifdef DEBUG & 32
+#if DEBUG & 32
     while ((c = dbg->reg) != -1) {
       if (c == regno) {
Index: c/src/libchip/network/smc91111exp.h
===================================================================
--- c/src/libchip/network/smc91111exp.h	(revision 37c0ccb23c89b0debf737ca5f6801e6356702553)
+++ c/src/libchip/network/smc91111exp.h	(revision 2174c66d4bb77b6c33159a20e8c4559efd062b68)
@@ -13,4 +13,12 @@
   unsigned int              ctl_rfduplx;
   unsigned int              ctl_autoneg;
+#ifndef _OLD_EXCEPTIONS
+  /* New arguments for the Interrupt Manager Extension:
+   */
+  const char *              info;
+  rtems_option              options;
+  rtems_interrupt_handler   interrupt_wrapper;
+  void *                    arg;
+#endif
 } scmv91111_configuration_t;
 
