[realtek] Flash programming fix for rtl8139-diag
Mikkel Lauritsen
mlauritsen@nospam.dk
Wed, 22 Aug 2001 23:10:00 +0200
Donald Becker wrote:
--- snip ---
> Hmmm, the extra flash_out() steps look a little bogus to me.
> Are they really needed?
Well, after having tried out different versions the one below
seems to work as well on my box with two steps less. The next
time I hack things like this I need to cool my initial excite-
ment when things start working and check whether my solution
might be reduced a bit before submitting a patch :-)
I've had to experiment quite heavily to get things going so I
think it would be a good thing if somebody with different
hardware than mine tested this out before actually adding the
patch to the main code.
Oh, BTW - I've been unable to match the registers listed after
FlashReg (above 0x54) with those listed in the documentation
for the 8139 chip. This might be due to version differences as
well, I guess.
Thanks a lot for your feedback and your work on this -
regards,
Mikkel Lauritsen
--
--- rtl8139-diag.c.orig Tue Aug 21 17:37:15 2001
+++ rtl8139-diag.c Wed Aug 22 23:00:14 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,13 @@
#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((val<<24) | 0xa0000 | (offset & 0x1ffff), ioaddr + FlashAccess);
}
#endif