Re: tx49 Ether problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

Sergei Shtylyov wrote:

On Fri, 14 Apr 2006 08:38:00 -0700, Geoff Levand
<geoffrey.levand@xxxxxxxxxxx> wrote:

I seem to get a lot of problems with an nfs root fs
on tx4937 board.  I haven't looked at it closely yet,
but I guess its some problem with the ne2000 driver.
I wanted to know if you know anything about this.

Please look at:

http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=20060226.23054
1.75185772.anemo%40mba.ocn.ne.jp

With a quick glance of ne.c, it seems ei_status.stop_page should be
changed to 0x60 on the board.  Please confirm its value.

    Hm, all this is very, very strange -- SAPROM readback indicates 16-bit DCR
is set to 0x49 by the driver which means 16-bit mode but RTL8019's data bus on
Toshiba RBTX4938 board is 8-bit according to its manual. In 16-bit mode
stop_page value of 0x80 is legitimate, and I haven't heard of any problems so
far (until Geoff's report). However, even in 16-bit mode, 8-bit data I/O only
works (which is enforced by that late #if override below), and if I force
8-bit mode from the very beginning, everything works again -- I guess the
RTL8019AS chip senses the correct slot size at reset, and just ignores DCR.WTS
bit then. BUT, if I force NE1SM_START_PG and NE1SM_STOP_PG to be used as the
values start_page and stop_page, the driver doesn't work. RTL8019AS has 16 KB
of SRAM, so I guess they're mapped at address 0x4000 insternally, and the
start_page should be 0x40 indeed.
    I've also found out that SAPROM bytes 6..15 (after removing the
duplicates) contain the string "RBTX4938BB" which can be used for recognition
instead of the first 3 bytes of the Ethernet address.

Yes, this seems to fix the problem.

Index: 2.6.16.1/drivers/net/ne.c
===================================================================
--- 2.6.16.1.orig/drivers/net/ne.c    2006-04-14 15:54:41.000000000 -0700
+++ 2.6.16.1/drivers/net/ne.c    2006-04-14 16:27:51.000000000 -0700
@@ -140,7 +140,8 @@
 #define NE1SM_START_PG    0x20    /* First page of TX buffer */
 #define NE1SM_STOP_PG     0x40    /* Last page +1 of RX ring */
 #define NESM_START_PG    0x40    /* First page of TX buffer */
-#define NESM_STOP_PG    0x80    /* Last page +1 of RX ring */
+#define NESM_8_STOP_PG 0x60 /* Last page +1 of RX ring, RTL8019 8 bit mode */
+#define NESM_STOP_PG    0x80    /* Last page +1 of RX ring */

 #if defined(CONFIG_PLAT_MAPPI)
 #  define DCR_VAL 0x4b
@@ -516,6 +517,7 @@
     ei_status.tx_start_page = start_page;
     ei_status.stop_page = stop_page;
 #if defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938)
+    ei_status.stop_page = NESM_8_STOP_PG;
     wordlength = 1;
 #endif


This is really strange place for that #ifdef -- 'wordlength' is determined much earlier in this function (and stop_page is set to 0x40 for 8-bit case), shouldn't #ifdef be moved instead?

    What I think we actually need is more generic fix for RTL8019AS, not the
board specific hacks -- if this RX ring stop page value limitation *really*
needs to be enforced.

   I've cooked up a patch, please try it...

WBR, Sergei

diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index 08b218c..04b396b 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -139,7 +139,8 @@ bad_clone_list[] __initdata = {
 
 #if defined(CONFIG_PLAT_MAPPI)
 #  define DCR_VAL 0x4b
-#elif defined(CONFIG_PLAT_OAKS32R)
+#elif defined(CONFIG_PLAT_OAKS32R)  || \
+   defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938)
 #  define DCR_VAL 0x48
 #else
 #  define DCR_VAL 0x49
@@ -396,7 +397,13 @@ static int __init ne_probe1(struct net_d
 		/* We must set the 8390 for word mode. */
 		outb_p(DCR_VAL, ioaddr + EN0_DCFG);
 		start_page = NESM_START_PG;
-		stop_page = NESM_STOP_PG;
+
+		if (!(DCR_VAL & 0x01) &&
+		    inb(ioaddr + EN0_RCNTLO) == 0x50 &&
+		    inb(ioaddr + EN0_RCNTHI) == 0x70)
+			stop_page = 0x60;
+		else
+			stop_page = NESM_STOP_PG;
 	} else {
 		start_page = NE1SM_START_PG;
 		stop_page = NE1SM_STOP_PG;
@@ -509,15 +516,8 @@ static int __init ne_probe1(struct net_d
 	ei_status.name = name;
 	ei_status.tx_start_page = start_page;
 	ei_status.stop_page = stop_page;
-#if defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938)
-	wordlength = 1;
-#endif
 
-#ifdef CONFIG_PLAT_OAKS32R
-	ei_status.word16 = 0;
-#else
-	ei_status.word16 = (wordlength == 2);
-#endif
+	ei_status.word16 = ((DCR_VAL & 0x01) && wordlength == 2);
 
 	ei_status.rx_start_page = start_page + TX_PAGES;
 #ifdef PACKETBUF_MEMSIZE


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux