[realtek] Flash programming fix for rtl8139-diag

Mikkel Lauritsen mikkell@knus.dk
Tue, 21 Aug 2001 23:29:13 +0200


Hi all,

After having poked around a bit I've managed to make my
generic 8139C based NIC actually program an AT29C256-120
flash prom.

The patch below contains the not very documented changes
that I've made. Is this the right way to go about reporting
fixes like this? I haven't been able to test it with other
versions of the 8139, but at least it works for me.

Regards,
  Mikkel Lauritsen

--

--- rtl8139-diag.c.orig	Tue Aug 21 17:37:15 2001
+++ rtl8139-diag.c	Tue Aug 21 17:41:40 2001
@@ -488,7 +488,7 @@
  	FlashReg=0x54, GPPinData=0x58, GPPinDir=0x59, MII_SMI=0x5A, HltClk=0x5B,
  	MultiIntr=0x5C, TxSummary=0x60,
  	MII_BMCR=0x62, MII_BMSR=0x64, NWayAdvert=0x66, NWayLPAR=0x68,
- 
NWayExpansion=0x6A, FlashAccess=0x74,
+ 
NWayExpansion=0x6A, FlashAccess=0xD4,
  };

  /* Values read from the EEPROM, and a new image to write. */
@@ -501,11 +501,15 @@
  #ifdef LIBFLASH
  /* Support for Flash operations. */
  static int rtl_flash_in(long ioaddr, int offset) {
- 
outl(0x1C0000 | (offset & 0x1ffff), ioaddr + FlashAccess);
+ 
outl(0x1e0000, ioaddr + FlashAccess);
+ 
outl(0x60000 | (offset & 0x1ffff), ioaddr + FlashAccess);
  	return inl(ioaddr + FlashAccess) >> 24;
  }
  static void rtl_flash_out(long ioaddr, int offset, int val) {
- 
outl((val<<24) | 0x1a0000 | (offset & 0x1ffff), ioaddr + FlashAccess);
+ 
outl(0x1e0000, ioaddr + FlashAccess);
+ 
outl(0xe0000 | (offset & 0x1ffff), ioaddr + FlashAccess);
+ 
outl((val<<24) | 0xa0000 | (offset & 0x1ffff), ioaddr + FlashAccess);
+ 
outl(0x1c0000, ioaddr + FlashAccess);
  }
  #endif