All of lore.kernel.org
 help / color / mirror / Atom feed
* tx49 Ether problems
@ 2006-04-14 15:38 Geoff Levand
  2006-04-14 16:05 ` Atsushi Nemoto
  0 siblings, 1 reply; 13+ messages in thread
From: Geoff Levand @ 2006-04-14 15:38 UTC (permalink / raw)
  To: anemo; +Cc: linux-mips

Nemoto-san,

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.

-Geoff


nfs: server 192.168.1.10 not responding, still trying
nfs: server 192.168.1.10 not responding, still trying
nfs: server 192.168.1.10 not responding, still trying
nfs: server 192.168.1.10 OK
nfs: server 192.168.1.10 not responding, still trying
nfs: server 192.168.1.10 not responding, still trying
nfs: server 192.168.1.10 OK
nfs: server 192.168.1.10 not responding, still trying
nfs: server 192.168.1.10 not responding, still trying
nfs: server 192.168.1.10 not responding, still trying
nfs: server 192.168.1.10 OK

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: tx49 Ether problems
  2006-04-14 15:38 tx49 Ether problems Geoff Levand
@ 2006-04-14 16:05 ` Atsushi Nemoto
  2006-04-14 23:39   ` Geoff Levand
  0 siblings, 1 reply; 13+ messages in thread
From: Atsushi Nemoto @ 2006-04-14 16:05 UTC (permalink / raw)
  To: geoffrey.levand; +Cc: linux-mips

On Fri, 14 Apr 2006 08:38:00 -0700, Geoff Levand <geoffrey.levand@am.sony.com> 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.230541.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.

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: tx49 Ether problems
  2006-04-14 16:05 ` Atsushi Nemoto
@ 2006-04-14 23:39   ` Geoff Levand
  2006-04-15 20:52     ` Sergei Shtylyov
  0 siblings, 1 reply; 13+ messages in thread
From: Geoff Levand @ 2006-04-14 23:39 UTC (permalink / raw)
  To: Atsushi Nemoto, ralf; +Cc: Levand, Geoffrey, linux-mips

Atsushi Nemoto wrote:
> On Fri, 14 Apr 2006 08:38:00 -0700, Geoff Levand
> <geoffrey.levand@am.sony.com> 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.
> 

Yes, this seems to fix the problem.


-Geoff

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: tx49 Ether problems
  2006-04-14 23:39   ` Geoff Levand
@ 2006-04-15 20:52     ` Sergei Shtylyov
  2006-04-16 18:50       ` Sergei Shtylyov
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei Shtylyov @ 2006-04-15 20:52 UTC (permalink / raw)
  To: Geoff Levand; +Cc: Atsushi Nemoto, ralf, linux-mips

Hello.

Geoff Levand wrote:

>>On Fri, 14 Apr 2006 08:38:00 -0700, Geoff Levand
>><geoffrey.levand@am.sony.com> 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.

> 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?

WBR, Sergei

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: tx49 Ether problems
  2006-04-15 20:52     ` Sergei Shtylyov
@ 2006-04-16 18:50       ` Sergei Shtylyov
  2006-04-17  2:09         ` Atsushi Nemoto
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei Shtylyov @ 2006-04-16 18:50 UTC (permalink / raw)
  To: Geoff Levand, Atsushi Nemoto; +Cc: linux-mips

[-- Attachment #1: Type: text/plain, Size: 3226 bytes --]

Hello.

Sergei Shtylyov wrote:

>>> On Fri, 14 Apr 2006 08:38:00 -0700, Geoff Levand
>>> <geoffrey.levand@am.sony.com> 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


[-- Attachment #2: RTL8019AS-8bit-PSTOP-limitation.patch --]
[-- Type: text/plain, Size: 1405 bytes --]

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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: tx49 Ether problems
  2006-04-16 18:50       ` Sergei Shtylyov
@ 2006-04-17  2:09         ` Atsushi Nemoto
  2006-04-17 13:06           ` Sergei Shtylyov
  0 siblings, 1 reply; 13+ messages in thread
From: Atsushi Nemoto @ 2006-04-17  2:09 UTC (permalink / raw)
  To: sshtylyov; +Cc: geoffrey.levand, linux-mips

On Sun, 16 Apr 2006 22:50:17 +0400, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
> >    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 agree with you.  Then how about something like
CONFIG_NE2000_RTL8019_BYTEMODE?  Also, setting 0xbad value to mem_end
can skip the Product-ID checking without inflating bad_clone_list.
Just a thought...

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: tx49 Ether problems
  2006-04-17  2:09         ` Atsushi Nemoto
@ 2006-04-17 13:06           ` Sergei Shtylyov
  2006-04-17 15:09             ` Atsushi Nemoto
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei Shtylyov @ 2006-04-17 13:06 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: geoffrey.levand, linux-mips

Hello.

Atsushi Nemoto wrote:
> On Sun, 16 Apr 2006 22:50:17 +0400, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:

>>>   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 agree with you.  Then how about something like
> CONFIG_NE2000_RTL8019_BYTEMODE?

    Have you looked at the patch? RTL8019 is easily detectable at runtime, so 
the limitation is easily enforcable w/o extra Kconfig option, I think

>  Also, setting 0xbad value to mem_end
> can skip the Product-ID checking without inflating bad_clone_list.
> Just a thought...

    0xbad in dev->mem_end currently skips 8390 reset which is not a good thing 
for the clones for which it does work...

> ---
> Atsushi Nemoto

WBR, Sergei

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: tx49 Ether problems
  2006-04-17 13:06           ` Sergei Shtylyov
@ 2006-04-17 15:09             ` Atsushi Nemoto
  2006-04-17 16:07               ` Sergei Shtylyov
  0 siblings, 1 reply; 13+ messages in thread
From: Atsushi Nemoto @ 2006-04-17 15:09 UTC (permalink / raw)
  To: sshtylyov; +Cc: geoffrey.levand, linux-mips

On Mon, 17 Apr 2006 17:06:23 +0400, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
> > I agree with you.  Then how about something like
> > CONFIG_NE2000_RTL8019_BYTEMODE?
> 
>     Have you looked at the patch? RTL8019 is easily detectable at
> runtime, so the limitation is easily enforcable w/o extra Kconfig
> option, I think

Well, I meant something like:

#elif defined(CONFIG_NE2000_RTL8019_BYTEMODE)
#  define DCR_VAL 0x48
#else
#  define DCR_VAL 0x49

to avoid changing #elif line every time when we want to support a new
board with byte-mode RTL8019AS.  Of course, calculating DCR_VAL at
runtime would be much better but I'm not sure if we can do it ...

> >  Also, setting 0xbad value to mem_end
> > can skip the Product-ID checking without inflating bad_clone_list.
> > Just a thought...
> 
>     0xbad in dev->mem_end currently skips 8390 reset which is not a
> good thing for the clones for which it does work...

The 8390 reset will not skipped.  The difference is behavior _after_
detection of no reset ack, isn't it?

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: tx49 Ether problems
  2006-04-17 15:09             ` Atsushi Nemoto
@ 2006-04-17 16:07               ` Sergei Shtylyov
  2006-04-17 16:12                 ` Sergei Shtylyov
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei Shtylyov @ 2006-04-17 16:07 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

Hello.

Atsushi Nemoto wrote:
> On Mon, 17 Apr 2006 17:06:23 +0400, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:

>>>I agree with you.  Then how about something like
>>>CONFIG_NE2000_RTL8019_BYTEMODE?

>>    Have you looked at the patch? RTL8019 is easily detectable at
>>runtime, so the limitation is easily enforcable w/o extra Kconfig
>>option, I think

> Well, I meant something like:

> #elif defined(CONFIG_NE2000_RTL8019_BYTEMODE)
> #  define DCR_VAL 0x48
> #else
> #  define DCR_VAL 0x49

> to avoid changing #elif line every time when we want to support a new
> board with byte-mode RTL8019AS.  Of course, calculating DCR_VAL at
> runtime would be much better but I'm not sure if we can do it ...

    Hm, with only 3-4 known boards so far (all Toshiba RBTX49[23][78], 
RBTX4925 also has the chip but I see no 2.6 support for this board), I doubt 
that it's worth the effort. And the option sounds a bit "too specific", IMO. :-)

>>> Also, setting 0xbad value to mem_end
>>>can skip the Product-ID checking without inflating bad_clone_list.
>>>Just a thought...

    Er, calling RTL8019AS in 8-bit mode "NE2000" (as the driver would have 
done in case of RBTX49xx if we have used 0xbad), is not a correct thing. :-)

>>    0xbad in dev->mem_end currently skips 8390 reset which is not a
>>good thing for the clones for which it does work...

> The 8390 reset will not skipped.  The difference is behavior _after_
> detection of no reset ack, isn't it?

    Yes, I was too hasty and have overlooked this. :-)

> ---
> Atsushi Nemoto

WBR, Sergei

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: tx49 Ether problems
  2006-04-17 16:07               ` Sergei Shtylyov
@ 2006-04-17 16:12                 ` Sergei Shtylyov
  2006-05-08 20:00                   ` [PATCH] Fix RTL8019AS init for Toshiba RBTX49xx boards Sergei Shtylyov
  2006-05-08 20:58                   ` Sergei Shtylyov
  0 siblings, 2 replies; 13+ messages in thread
From: Sergei Shtylyov @ 2006-04-17 16:12 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

Hello.

Sergei Shtylyov wrote:

>> On Mon, 17 Apr 2006 17:06:23 +0400, Sergei Shtylyov 
>> <sshtylyov@ru.mvista.com> wrote:

>>>> I agree with you.  Then how about something like
>>>> CONFIG_NE2000_RTL8019_BYTEMODE?

>>>    Have you looked at the patch? RTL8019 is easily detectable at
>>> runtime, so the limitation is easily enforcable w/o extra Kconfig
>>> option, I think

>> Well, I meant something like:

>> #elif defined(CONFIG_NE2000_RTL8019_BYTEMODE)
>> #  define DCR_VAL 0x48
>> #else
>> #  define DCR_VAL 0x49

>> to avoid changing #elif line every time when we want to support a new
>> board with byte-mode RTL8019AS.  Of course, calculating DCR_VAL at
>> runtime would be much better but I'm not sure if we can do it ...

>    Hm, with only 3-4 known boards so far (all Toshiba RBTX49[23][78], 
> RBTX4925 also has the chip but I see no 2.6 support for this board), I 
> doubt that it's worth the effort. And the option sounds a bit "too 
> specific", IMO. :-)

    Especially given the fact that it can't be attributed to RTL8019 only. 
Historically, there was CONFIG_NE2000_8BIT option but it's been eliminated 
long ago. Maybe it's worth reviving it indeed...

>> ---
>> Atsushi Nemoto

WBR, Sergei

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] Fix RTL8019AS init for Toshiba RBTX49xx boards
  2006-04-17 16:12                 ` Sergei Shtylyov
@ 2006-05-08 20:00                   ` Sergei Shtylyov
  2006-05-08 20:55                     ` Auke Kok
  2006-05-08 20:58                   ` Sergei Shtylyov
  1 sibling, 1 reply; 13+ messages in thread
From: Sergei Shtylyov @ 2006-05-08 20:00 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-mips, linux-net

[-- Attachment #1: Type: text/plain, Size: 336 bytes --]

    Ensure that 8-bit mode is selected for the on-board Realtek RTL8019AS chip 
on Toshiba RBHMA4x00, get rid of the duplicate #ifdef's when setting
ei_status.word16.
    The chip's datasheet says that the PSTOP register shouldn't exceed 0x60 in
8-bit mode -- ensure this too.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>


[-- Attachment #2: RBTX49xx-RTL8019AS-init-fix.patch --]
[-- Type: text/plain, Size: 1927 bytes --]

Index: linus/drivers/net/ne.c
===================================================================
--- linus.orig/drivers/net/ne.c
+++ linus/drivers/net/ne.c
@@ -139,8 +139,9 @@ bad_clone_list[] __initdata = {
 
 #if defined(CONFIG_PLAT_MAPPI)
 #  define DCR_VAL 0x4b
-#elif defined(CONFIG_PLAT_OAKS32R)
-#  define DCR_VAL 0x48
+#elif defined(CONFIG_PLAT_OAKS32R)  || \
+   defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938)
+#  define DCR_VAL 0x48		/* 8-bit mode */
 #else
 #  define DCR_VAL 0x49
 #endif
@@ -396,10 +397,22 @@ 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;
+
+		/*
+		 * Realtek RTL8019AS datasheet says that the PSTOP register
+		 * shouldn't exceed 0x60 in 8-bit mode.
+		 * This chip can be identified by reading the signature from
+		 * the  remote byte count registers (otherwise write-only)...
+		 */
+		if ((DCR_VAL & 0x01) == 0 &&		/* 8-bit mode */
+		    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;
+		stop_page  = NE1SM_STOP_PG;
 	}
 
 #if  defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R)
@@ -509,15 +522,9 @@ 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
+	/* Use 16-bit mode only if this wasn't overridden by DCR_VAL */
+	ei_status.word16 = (wordlength == 2 && (DCR_VAL & 0x01));
 
 	ei_status.rx_start_page = start_page + TX_PAGES;
 #ifdef PACKETBUF_MEMSIZE



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Fix RTL8019AS init for Toshiba RBTX49xx boards
  2006-05-08 20:00                   ` [PATCH] Fix RTL8019AS init for Toshiba RBTX49xx boards Sergei Shtylyov
@ 2006-05-08 20:55                     ` Auke Kok
  0 siblings, 0 replies; 13+ messages in thread
From: Auke Kok @ 2006-05-08 20:55 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Jeff Garzik, linux-mips, linux-net

Hi,

this won't work - first of all patches need to go to netdev and second jeff 
Garzik is offline for another week. Stephan Hemminger is covering for the net 
tree.

Please repost and add these people.

Auke


Sergei Shtylyov wrote:
>    Ensure that 8-bit mode is selected for the on-board Realtek RTL8019AS 
> chip on Toshiba RBHMA4x00, get rid of the duplicate #ifdef's when setting
> ei_status.word16.
>    The chip's datasheet says that the PSTOP register shouldn't exceed 
> 0x60 in
> 8-bit mode -- ensure this too.
> 
> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> 
> 
> ------------------------------------------------------------------------
> 
> Index: linus/drivers/net/ne.c
> ===================================================================
> --- linus.orig/drivers/net/ne.c
> +++ linus/drivers/net/ne.c
> @@ -139,8 +139,9 @@ bad_clone_list[] __initdata = {
>  
>  #if defined(CONFIG_PLAT_MAPPI)
>  #  define DCR_VAL 0x4b
> -#elif defined(CONFIG_PLAT_OAKS32R)
> -#  define DCR_VAL 0x48
> +#elif defined(CONFIG_PLAT_OAKS32R)  || \
> +   defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938)
> +#  define DCR_VAL 0x48		/* 8-bit mode */
>  #else
>  #  define DCR_VAL 0x49
>  #endif
> @@ -396,10 +397,22 @@ 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;
> +
> +		/*
> +		 * Realtek RTL8019AS datasheet says that the PSTOP register
> +		 * shouldn't exceed 0x60 in 8-bit mode.
> +		 * This chip can be identified by reading the signature from
> +		 * the  remote byte count registers (otherwise write-only)...
> +		 */
> +		if ((DCR_VAL & 0x01) == 0 &&		/* 8-bit mode */
> +		    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;
> +		stop_page  = NE1SM_STOP_PG;
>  	}
>  
>  #if  defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R)
> @@ -509,15 +522,9 @@ 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
> +	/* Use 16-bit mode only if this wasn't overridden by DCR_VAL */
> +	ei_status.word16 = (wordlength == 2 && (DCR_VAL & 0x01));
>  
>  	ei_status.rx_start_page = start_page + TX_PAGES;
>  #ifdef PACKETBUF_MEMSIZE
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] Fix RTL8019AS init for Toshiba RBTX49xx boards
  2006-04-17 16:12                 ` Sergei Shtylyov
  2006-05-08 20:00                   ` [PATCH] Fix RTL8019AS init for Toshiba RBTX49xx boards Sergei Shtylyov
@ 2006-05-08 20:58                   ` Sergei Shtylyov
  1 sibling, 0 replies; 13+ messages in thread
From: Sergei Shtylyov @ 2006-05-08 20:58 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

    Ensure that 8-bit mode is selected for the on-board Realtek RTL8019AS chip
on Toshiba RBHMA4x00, get rid of the duplicate #ifdef's when setting
ei_status.word16.
    The chip's datasheet says that the PSTOP register shouldn't exceed 0x60 in
8-bit mode -- ensure this too.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>


[-- Attachment #2: RBTX49xx-RTL8019AS-init-fix.patch --]
[-- Type: text/plain, Size: 1928 bytes --]

Index: linus/drivers/net/ne.c
===================================================================
--- linus.orig/drivers/net/ne.c
+++ linus/drivers/net/ne.c
@@ -139,8 +139,9 @@ bad_clone_list[] __initdata = {
 
 #if defined(CONFIG_PLAT_MAPPI)
 #  define DCR_VAL 0x4b
-#elif defined(CONFIG_PLAT_OAKS32R)
-#  define DCR_VAL 0x48
+#elif defined(CONFIG_PLAT_OAKS32R)  || \
+   defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938)
+#  define DCR_VAL 0x48		/* 8-bit mode */
 #else
 #  define DCR_VAL 0x49
 #endif
@@ -396,10 +397,22 @@ 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;
+
+		/*
+		 * Realtek RTL8019AS datasheet says that the PSTOP register
+		 * shouldn't exceed 0x60 in 8-bit mode.
+		 * This chip can be identified by reading the signature from
+		 * the  remote byte count registers (otherwise write-only)...
+		 */
+		if ((DCR_VAL & 0x01) == 0 &&		/* 8-bit mode */
+		    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;
+		stop_page  = NE1SM_STOP_PG;
 	}
 
 #if  defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R)
@@ -509,15 +522,9 @@ 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
+	/* Use 16-bit mode only if this wasn't overridden by DCR_VAL */
+	ei_status.word16 = (wordlength == 2 && (DCR_VAL & 0x01));
 
 	ei_status.rx_start_page = start_page + TX_PAGES;
 #ifdef PACKETBUF_MEMSIZE




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2006-05-08 20:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-14 15:38 tx49 Ether problems Geoff Levand
2006-04-14 16:05 ` Atsushi Nemoto
2006-04-14 23:39   ` Geoff Levand
2006-04-15 20:52     ` Sergei Shtylyov
2006-04-16 18:50       ` Sergei Shtylyov
2006-04-17  2:09         ` Atsushi Nemoto
2006-04-17 13:06           ` Sergei Shtylyov
2006-04-17 15:09             ` Atsushi Nemoto
2006-04-17 16:07               ` Sergei Shtylyov
2006-04-17 16:12                 ` Sergei Shtylyov
2006-05-08 20:00                   ` [PATCH] Fix RTL8019AS init for Toshiba RBTX49xx boards Sergei Shtylyov
2006-05-08 20:55                     ` Auke Kok
2006-05-08 20:58                   ` Sergei Shtylyov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.