[U-Boot-Users] [PATCH] 1/1: fix for SMSC91111 driver

Robert Schwebel robert at schwebel.de
Wed Apr 2 18:49:12 CEST 2003


Hi, 

attached is a fix for the recently reported problem with the SMSC91111
ethernet driver. It looks like it was a combination of two bugs. The
patch was tested on a PXA250 system (Innokom) here and on a SA1110 based
DNP (thanks to Rolf Offermanns) and it seems to be a proper fix
(although we still don't understand all of the symptoms). 

Please apply. 

Robert
-- 
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Braunschweiger Str. 79,  31134 Hildesheim, Germany
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
-------------- next part --------------
diff -x CVS -x ptx-patches -urN u-boot/drivers/smc91111.c u-boot-ptx/drivers/smc91111.c
--- u-boot/drivers/smc91111.c	2003-03-31 08:35:06.000000000 +0200
+++ u-boot-ptx/drivers/smc91111.c	2003-04-02 15:13:17.000000000 +0200
@@ -317,6 +317,17 @@
 	return 0;
 }
 
+/* Only one release command at a time, please */
+static inline void smc_wait_mmu_release_complete(void)
+{
+	int count = 0;
+	/* assume bank 2 selected */
+	while ( SMC_inw(MMU_CMD_REG) & MC_BUSY ) {
+		udelay(1); // Wait until not busy
+		if( ++count > 200) break;
+	}
+}
+
 /*
  . Function: smc_reset( void )
  . Purpose:
@@ -374,6 +385,7 @@
 
 	/* Reset the MMU */
 	SMC_SELECT_BANK( 2 );
+	smc_wait_mmu_release_complete();
 	SMC_outw( MC_RESET, MMU_CMD_REG );
 	while ( SMC_inw( MMU_CMD_REG ) & MC_BUSY )
 		udelay(1); /* Wait until not busy */
@@ -674,6 +686,8 @@
 /*	SMC_SELECT_BANK(0); */
 /*	SMC_outw(0, RPC_REG); */
 
+	SMC_SELECT_BANK(1);
+
 #ifdef USE_32_BIT
 	for ( i = 0; i < 6; i += 2 ) {
 		word address;
diff -x CVS -x ptx-patches -urN u-boot/drivers/smc91111.h u-boot-ptx/drivers/smc91111.h
--- u-boot/drivers/smc91111.h	2002-11-03 01:53:02.000000000 +0100
+++ u-boot-ptx/drivers/smc91111.h	2003-04-02 14:11:27.000000000 +0200
@@ -80,7 +80,7 @@
 #define	SMC_inw(r) 	(*((volatile word *)(SMC_BASE_ADDRESS+(r))))
 #define SMC_inb(p)	({ \
 	unsigned int __p = (unsigned int)(SMC_BASE_ADDRESS + (p)); \
-	unsigned int __v = *(volatile unsigned short *)((SMC_BASE_ADDRESS + __p) & ~1); \
+	unsigned int __v = *(volatile unsigned short *)((__p) & ~1); \
 	if (__p & 1) __v >>= 8; \
 	else __v &= 0xff; \
 	__v; })


More information about the U-Boot mailing list