diff options
author | Remy Bohmer <linux@bohmer.net> | 2008-06-05 11:03:36 (GMT) |
---|---|---|
committer | Ben Warren <biggerbadderben@gmail.com> | 2008-06-06 06:47:28 (GMT) |
commit | 0e38c938ed4bcadb4f4fc1419a541431e94fc202 (patch) | |
tree | 9f4bb909b9b43c08e9e73b31ead3473092384943 /drivers/net/dm9000x.c | |
parent | 6b52cfe16cd539935e32bd8cf19146522e462a4d (diff) | |
download | u-boot-fsl-qoriq-0e38c938ed4bcadb4f4fc1419a541431e94fc202.tar.xz |
DM9000 fix status check fail 0x6d error for trizeps board
According to the Application Notes of the DM9000, only the 2 bits 0:1 of
the status byte need to be checked to identify a valid packet in the fifo
But, The several different Application Notes do not all speak the same
language on these bits. They do not disagree, but only 1 Application Note
noted explicitly that only these 2 bits need to be checked.
Even the datasheets do not mention anything about these 2 bits.
Because the old code, and the kernel check the whole byte, I left this piece
untouched.
However, I tested all board/DM9000[A|E|EP] devices with this 2 bit check, so
it should work.
Notice, that the 2nd iteration through this receive loop (when a 2nd packet is
in the fifo) is much shorter now, compared to the older U-boot driver code,
so that we can maybe run into a hardware condition now that was never seen
before, or maybe was seen very unfrequently.
Additionaly added a cleanup of a stack variable.
Signed-off-by: Remy Bohmer <linux@bohmer.net>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Diffstat (limited to 'drivers/net/dm9000x.c')
-rw-r--r-- | drivers/net/dm9000x.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c index 6f3ddf0..c2144d9 100644 --- a/drivers/net/dm9000x.c +++ b/drivers/net/dm9000x.c @@ -113,7 +113,7 @@ typedef struct board_info { u8 device_wait_reset; /* device state */ u8 nic_type; /* NIC type */ unsigned char srom[128]; - void (*outblk)(void *data_ptr, int count); + void (*outblk)(volatile void *data_ptr, int count); void (*inblk)(void *data_ptr, int count); void (*rx_status)(u16 *RxStatus, u16 *RxLen); } board_info_t; @@ -161,14 +161,14 @@ dump_regs(void) } #endif -static void dm9000_outblk_8bit(void *data_ptr, int count) +static void dm9000_outblk_8bit(volatile void *data_ptr, int count) { int i; for (i = 0; i < count; i++) DM9000_outb((((u8 *) data_ptr)[i] & 0xff), DM9000_DATA); } -static void dm9000_outblk_16bit(void *data_ptr, int count) +static void dm9000_outblk_16bit(volatile void *data_ptr, int count) { int i; u32 tmplen = (count + 1) / 2; @@ -176,7 +176,7 @@ static void dm9000_outblk_16bit(void *data_ptr, int count) for (i = 0; i < tmplen; i++) DM9000_outw(((u16 *) data_ptr)[i], DM9000_DATA); } -static void dm9000_outblk_32bit(void *data_ptr, int count) +static void dm9000_outblk_32bit(volatile void *data_ptr, int count) { int i; u32 tmplen = (count + 3) / 4; @@ -551,7 +551,6 @@ eth_init(bd_t * bd) int eth_send(volatile void *packet, int length) { - char *data_ptr; int tmo; struct board_info *db = &dm9000_info; @@ -560,11 +559,10 @@ eth_send(volatile void *packet, int length) DM9000_iow(DM9000_ISR, IMR_PTM); /* Clear Tx bit in ISR */ /* Move data to DM9000 TX RAM */ - data_ptr = (char *) packet; DM9000_outb(DM9000_MWCMD, DM9000_IO); /* Prepare for TX-data */ /* push the data to the TX-fifo */ - (db->outblk)(data_ptr, length); + (db->outblk)(packet, length); /* Set TX length to DM9000 */ DM9000_iow(DM9000_TXPLL, length & 0xff); @@ -625,8 +623,9 @@ eth_rx(void) for (;;) { DM9000_ior(DM9000_MRCMDX); /* Dummy read */ - /* Get most updated data */ - rxbyte = DM9000_inb(DM9000_DATA); + /* Get most updated data, + only look at bits 0:1, See application notes DM9000 */ + rxbyte = DM9000_inb(DM9000_DATA) & 0x03; /* Status check: this byte must be 0 or 1 */ if (rxbyte > DM9000_PKT_RDY) { |