Skip to contentSkip to conversation

tx49 Ether problems

PATCH In review Geoff Levand 4 participants 13 messages Apr 14, 2006 – May 8, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 4 lines · Geoff Levand

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

#2 lore raw
Quoted 7 lines · Atsushi Nemoto
Quoted 4 lines · Geoff Levand

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.

Quoted 8 lines

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

drivers/net/ne.c +3 -1
Index: 2.6.16.1/drivers/net/ne.c
===================================================================
@@ -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
#3 lore raw

Hello.

Quoted 33 lines · Geoff Levand
Quoted 8 lines
Quoted 4 lines · Geoff Levand

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.

Quoted 7 lines

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

drivers/net/ne.c +2 -1
@@ -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

drivers/net/ne.c line 522

Quoted 6 lines
drivers/net/ne.c +1 -0
@@ -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

#4 lore raw

Hello.

Quoted 8 lines · Sergei Shtylyov
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines · Geoff Levand

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.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

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.

Quoted 15 lines
Quoted 15 lines

Yes, this seems to fix the problem.

Index: 2.6.16.1/drivers/net/ne.c
===================================================================

drivers/net/ne.c 2006-04-14 16:27:51.000000000 -0700 renamed from drivers/net/ne.c 2006-04-14 15:54:41.000000000 -0700 +1 -1
@@ -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 */

Quoted 13 lines

drivers/net/ne.c 2006-04-14 16:27:51.000000000 -0700 line 522

Quoted 9 lines

#if defined(CONFIG_PLAT_MAPPI)
# define DCR_VAL 0x4b

drivers/net/ne.c 2006-04-14 16:27:51.000000000 -0700 renamed from drivers/net/ne.c 2006-04-14 15:54:41.000000000 -0700 +1 -0
@@ -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

drivers/net/ne.c +10 -10
index 08b218c..04b396b 100644
@@ -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
#5 lore raw
Quoted 7 lines · Sergei Shtylyov
Quoted 3 lines

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

#6 lore raw

Hello.

Quoted 11 lines · Atsushi Nemoto
Quoted 6 lines · Sergei Shtylyov
Quoted 2 lines

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

Quoted 3 lines

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

Quoted 2 lines

---
Atsushi Nemoto

WBR, Sergei

#7 lore raw
Quoted 6 lines · Sergei Shtylyov
Quoted 2 lines

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

Quoted 6 lines
Quoted 3 lines

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

#8 lore raw

Hello.

Quoted 11 lines · Atsushi Nemoto
Quoted 6 lines · Sergei Shtylyov
Quoted 2 lines

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:

Quoted 8 lines

#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. :-)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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. :-)

Quoted 5 lines
Quoted 2 lines

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. :-)

Quoted 2 lines

---
Atsushi Nemoto

WBR, Sergei

#9 lore raw

Hello.

Quoted 16 lines · Sergei Shtylyov
Quoted 15 lines · Sergei Shtylyov
Quoted 7 lines
Quoted 3 lines

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

Quoted 6 lines
Quoted 3 lines

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

Quoted 2 lines
Quoted 2 lines

---
Atsushi Nemoto

WBR, Sergei

#10 lore raw

PATCH 1/1 Fix RTL8019AS init for Toshiba RBTX49xx boards

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.

drivers/net/ne.c +19 -12
Index: 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
#11 lore raw

Re: [PATCH] Fix RTL8019AS init for Toshiba RBTX49xx boards

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

Quoted 73 lines · Sergei Shtylyov

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.

------------------------------------------------------------------------

Index: linus/drivers/net/ne.c
===================================================================

drivers/net/ne.c +19 -12
@@ -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
#12 lore raw

PATCH 1/1 Fix RTL8019AS init for Toshiba RBTX49xx boards

In reply to Sergei Shtylyov

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.

drivers/net/ne.c +19 -12
Index: 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