]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
DM9000 fix status check fail 0x6d error for trizeps board
authorRemy Bohmer <linux@bohmer.net>
Thu, 5 Jun 2008 11:03:36 +0000 (13:03 +0200)
committerBen Warren <biggerbadderben@gmail.com>
Fri, 6 Jun 2008 06:47:28 +0000 (23:47 -0700)
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>
drivers/net/dm9000x.c

index 6f3ddf020dad1f643b853c86aa6f35b73a880428..c2144d9bc69c28738283c9e0dbaa00fb619a859a 100644 (file)
@@ -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) {