This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FEC - Cache & buffer descriptors fix


Index: devs/eth/powerpc/fec/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/eth/powerpc/fec/current/ChangeLog,v
retrieving revision 1.11
diff -u -5 -p -r1.11 ChangeLog
--- devs/eth/powerpc/fec/current/ChangeLog	11 Oct 2002 20:09:23 -0000	1.11
+++ devs/eth/powerpc/fec/current/ChangeLog	11 Oct 2002 20:23:50 -0000
@@ -1,5 +1,12 @@
+2002-10-11  Gary Thomas  <gthomas@ecoscentric.com> [inspired by]
+2002-10-11  Wolfgang Heppner <hep@iis.fhg.de>	
+
+	* src/if_fec.c: 
+	* cdl/fec_eth_drivers.cdl: Make buffer descriptor use configurable.
+	Also, fix some issues where cache state wasn't being honored.
+
 2002-10-11  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/if_fec.c: 
 	* cdl/fec_eth_drivers.cdl: Add control over PHY - when to reset
 	and how to configure the link.
Index: devs/eth/powerpc/fec/current/cdl/fec_eth_drivers.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/eth/powerpc/fec/current/cdl/fec_eth_drivers.cdl,v
retrieving revision 1.4
diff -u -5 -p -r1.4 fec_eth_drivers.cdl
--- devs/eth/powerpc/fec/current/cdl/fec_eth_drivers.cdl	11 Oct 2002 20:09:23 -0000	1.4
+++ devs/eth/powerpc/fec/current/cdl/fec_eth_drivers.cdl	11 Oct 2002 20:21:32 -0000
@@ -65,10 +65,19 @@ cdl_package CYGPKG_DEVS_ETH_POWERPC_FEC 
     include_files ; # none _exported_ whatsoever
 
     description   "Fast ethernet driver for PowerPC MPC8xxT boards."
     compile       -library=libextras.a if_fec.c
 
+    cdl_option CYGNUM_DEVS_ETH_POWERPC_FEC_BD_OFFSET {
+        display       "Buffer descriptors offset in PRAM"
+        flavor        data
+        default_value 0x2C00
+        description   "
+            This option specifies the address of the buffer descriptors
+            used by the PowerPC FEC/ethernet device."
+    }
+
     cdl_option CYGNUM_DEVS_ETH_POWERPC_FEC_BUFSIZE {
         display       "Buffer size"
         flavor        data
         default_value 1520
         description   "
Index: devs/eth/powerpc/fec/current/src/if_fec.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/eth/powerpc/fec/current/src/if_fec.c,v
retrieving revision 1.11
diff -u -5 -p -r1.11 if_fec.c
--- devs/eth/powerpc/fec/current/src/if_fec.c	11 Oct 2002 20:09:23 -0000	1.11
+++ devs/eth/powerpc/fec/current/src/if_fec.c	11 Oct 2002 20:21:45 -0000
@@ -157,10 +157,14 @@ static void          fec_eth_int(struct 
 
 #ifndef FEC_ETH_RESET_PHY
 #define FEC_ETH_RESET_PHY()
 #endif
 
+#ifndef FEC_EPPC_BD_OFFSET
+#define FEC_EPPC_BD_OFFSET CYGNUM_DEVS_ETH_POWERPC_FEC_BD_OFFSET
+#endif
+
 // LED activity [exclusive of hardware bits]
 #ifndef _get_led
 #define _get_led()  
 #define _set_led(v) 
 #endif
@@ -261,11 +265,12 @@ fec_eth_reset(struct eth_drv_sc *sc, uns
     // Make sure interrupts are off while we mess with the device
     HAL_DISABLE_INTERRUPTS(int_state);
 
     // Ensure consistent state between cache and what the FEC sees
     HAL_DCACHE_IS_ENABLED(cache_state);
-    HAL_DCACHE_SYNC();
+    if (cache_state)
+      HAL_DCACHE_SYNC();
     HAL_DCACHE_DISABLE();
 
     // Shut down ethernet controller, in case it is already running
     fec->eControl = eControl_RESET;
     i = 0;
@@ -283,11 +288,11 @@ fec_eth_reset(struct eth_drv_sc *sc, uns
     fec->iEvent = 0xFFFFFFFF; // Clear all interrupts
     fec->iVector = (1<<29);   // Caution - must match FEC_ETH_INT above
 
 #define ROUNDUP(b,s) (((unsigned long)(b) + (s-1)) & ~(s-1))
 #ifdef FEC_USE_EPPC_BD
-    txbd = (struct fec_bd *)(0x2C00 + (cyg_uint32)eppc);
+    txbd = (struct fec_bd *)(FEC_EPPC_BD_OFFSET + (cyg_uint32)eppc);
     rxbd = &txbd[CYGNUM_DEVS_ETH_POWERPC_FEC_TxNUM];
 #else
     txbd = fec_eth_txring;
     rxbd = fec_eth_rxring;
 #endif
@@ -396,11 +401,12 @@ fec_eth_init(struct cyg_netdevtab_entry 
     bool esa_ok, phy_ok;
     int phy_timeout = 5*1000;  // Wait 5 seconds max for link to clear
 
     // Ensure consistent state between cache and what the FEC sees
     HAL_DCACHE_IS_ENABLED(cache_state);
-    HAL_DCACHE_SYNC();
+    if (cache_state)
+      HAL_DCACHE_SYNC();
     HAL_DCACHE_DISABLE();
 
     qi->fec = fec;
     fec_eth_stop(sc);  // Make sure it's not running yet
 
@@ -518,10 +524,13 @@ fec_eth_init(struct cyg_netdevtab_entry 
 #endif // CYGSEM_DEVS_ETH_POWERPC_FEC_RESET_PHY
 
     // Initialize upper level driver
     (sc->funs->eth_drv->init)(sc, (unsigned char *)&enaddr);
     
+    if (cache_state)
+      HAL_DCACHE_ENABLE();
+
     return true;
 }
  
 //
 // This function is called to shut down the interface.


-- 
------------------------------------------------------------
Gary Thomas                  |
eCosCentric, Ltd.            |  
+1 (970) 229-1963            |  eCos & RedBoot experts
gthomas@ecoscentric.com      |
http://www.ecoscentric.com/  |
------------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]