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.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>

authored by Sergei Shtylyov and committed by Stephen Hemminger aedc0e52 8cd35da0

+19 -12
+19 -12
drivers/net/ne.c
··· 139 139 140 140 #if defined(CONFIG_PLAT_MAPPI) 141 141 # define DCR_VAL 0x4b 142 - #elif defined(CONFIG_PLAT_OAKS32R) 143 - # define DCR_VAL 0x48 142 + #elif defined(CONFIG_PLAT_OAKS32R) || \ 143 + defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) 144 + # define DCR_VAL 0x48 /* 8-bit mode */ 144 145 #else 145 146 # define DCR_VAL 0x49 146 147 #endif ··· 397 396 /* We must set the 8390 for word mode. */ 398 397 outb_p(DCR_VAL, ioaddr + EN0_DCFG); 399 398 start_page = NESM_START_PG; 400 - stop_page = NESM_STOP_PG; 399 + 400 + /* 401 + * Realtek RTL8019AS datasheet says that the PSTOP register 402 + * shouldn't exceed 0x60 in 8-bit mode. 403 + * This chip can be identified by reading the signature from 404 + * the remote byte count registers (otherwise write-only)... 405 + */ 406 + if ((DCR_VAL & 0x01) == 0 && /* 8-bit mode */ 407 + inb(ioaddr + EN0_RCNTLO) == 0x50 && 408 + inb(ioaddr + EN0_RCNTHI) == 0x70) 409 + stop_page = 0x60; 410 + else 411 + stop_page = NESM_STOP_PG; 401 412 } else { 402 413 start_page = NE1SM_START_PG; 403 - stop_page = NE1SM_STOP_PG; 414 + stop_page = NE1SM_STOP_PG; 404 415 } 405 416 406 417 #if defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R) ··· 522 509 ei_status.name = name; 523 510 ei_status.tx_start_page = start_page; 524 511 ei_status.stop_page = stop_page; 525 - #if defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) 526 - wordlength = 1; 527 - #endif 528 512 529 - #ifdef CONFIG_PLAT_OAKS32R 530 - ei_status.word16 = 0; 531 - #else 532 - ei_status.word16 = (wordlength == 2); 533 - #endif 513 + /* Use 16-bit mode only if this wasn't overridden by DCR_VAL */ 514 + ei_status.word16 = (wordlength == 2 && (DCR_VAL & 0x01)); 534 515 535 516 ei_status.rx_start_page = start_page + TX_PAGES; 536 517 #ifdef PACKETBUF_MEMSIZE