]> git.kernelconcepts.de Git - karo-tx-redboot.git/blobdiff - packages/devs/eth/cl/cs8900a/v2_0/src/if_cs8900a.c
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / devs / eth / cl / cs8900a / v2_0 / src / if_cs8900a.c
index c04899f749108bcffa0dcbd183ae0f97d982dd13..d4e84ff3e186f1cf00ff0702083cb507e5642769 100644 (file)
@@ -183,7 +183,7 @@ cs8900a_init(struct cyg_netdevtab_entry *tab)
 #ifdef CYGINT_IO_ETH_INT_SUPPORT_REQUIRED
     // Initialize environment, setup interrupt handler
     cyg_drv_interrupt_create(cpd->interrupt,
-                             0, // Priority - what goes here?
+                             cpd->priority,
                              (cyg_addrword_t)cpd, //  Data item passed to interrupt handler
                              (cyg_ISR_t *)cs8900a_isr,
                              (cyg_DSR_t *)cs8900a_dsr,
@@ -478,7 +478,6 @@ cs8900a_send(struct eth_drv_sc *sc, struct eth_drv_sg *sg_list, int sg_len,
     cyg_uint16 saved_data = 0, *sdata;
     cyg_uint16 stat;
     bool odd_byte = false;
-    int timeout = 50000;
 
     // Mark xmitter busy
     cpd->txbusy = true;
@@ -510,17 +509,26 @@ cs8900a_send(struct eth_drv_sc *sc, struct eth_drv_sg *sg_list, int sg_len,
 
     HAL_WRITE_UINT16(cpd->base+CS8900A_TxLEN, total_len);
     // Wait for controller ready signal
-    do {
-        stat = get_reg(base, PP_BusStat);
-        if (timeout-- < 0) {
+    {
+        // add timeout per cs8900a bugzilla report 1000281 */
+        int timeout = 1000;
+
+        do {
+            stat = get_reg(base, PP_BusStat);
+#if DEBUG & 1
+            if( stat & PP_BusStat_TxBid )
+                diag_printf( "cs8900a_send: Bid error!\n" );
+#endif
+        } while (!(stat & PP_BusStat_TxRDY) && --timeout);
+
+        if( !timeout ) {
+            // we might as well just return, since if we write the data it will
+            // just get thrown away
+            diag_printf("if_cs8900a.c:  PP_BusStat_TXRDY is not set. Cannot transmit packet\n");
             return;
         }
-    } while (!(stat & PP_BusStat_TxRDY));
-
-    if (timeout < 0) {
-        diag_printf("if_cs8900a.c:  PP_BusStat_TXRDY is not set. Cannot transmit packet\n");
-        return;
     }
+
     // Put data into buffer
     for (i = 0;  i < sg_len;  i++) {
         data = (cyg_uint8 *)sg_list[i].buf;