devices/8139too.c
changeset 98 f564d0929292
parent 97 e6264685dd7b
child 104 052bc82d5442
equal deleted inserted replaced
97:e6264685dd7b 98:f564d0929292
  1802 			dev->name, i, RTL_R32 (TxStatus0 + (i * 4)),
  1802 			dev->name, i, RTL_R32 (TxStatus0 + (i * 4)),
  1803 			i == tp->dirty_tx % NUM_TX_DESC ?
  1803 			i == tp->dirty_tx % NUM_TX_DESC ?
  1804 				" (queue head)" : "");
  1804 				" (queue head)" : "");
  1805 
  1805 
  1806 	tp->xstats.tx_timeouts++;
  1806 	tp->xstats.tx_timeouts++;
  1807 
  1807     printk(KERN_DEBUG "%s: tx_timeout\n", dev->name);
  1808         /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
       
  1809 
       
  1810         printk(KERN_DEBUG "%s: tx_timeout\n", dev->name);
       
  1811 
       
  1812         if (EtherCAT_dev_is_ec(rtl_ec_dev, dev))
       
  1813         {
       
  1814           EtherCAT_dev_state(rtl_ec_dev, EC_DEVICE_STATE_TIMEOUT);
       
  1815         }
       
  1816 
  1808 
  1817 	/* disable Tx ASAP, if not already */
  1809 	/* disable Tx ASAP, if not already */
  1818 	tmp8 = RTL_R8 (ChipCmd);
  1810 	tmp8 = RTL_R8 (ChipCmd);
  1819 	if (tmp8 & CmdTxEnb)
  1811 	if (tmp8 & CmdTxEnb)
  1820                 RTL_W8 (ChipCmd, CmdRxEnb);
  1812                 RTL_W8 (ChipCmd, CmdRxEnb);
       
  1813 
       
  1814     /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
       
  1815 
  1821 
  1816 
  1822         if (!EtherCAT_dev_is_ec(rtl_ec_dev, dev))
  1817         if (!EtherCAT_dev_is_ec(rtl_ec_dev, dev))
  1823         {
  1818         {
  1824                 spin_lock(&tp->rx_lock);
  1819                 spin_lock(&tp->rx_lock);
  1825 
  1820 
  1838                         rtl8139_hw_start (dev);
  1833                         rtl8139_hw_start (dev);
  1839                         netif_wake_queue (dev);
  1834                         netif_wake_queue (dev);
  1840                 }
  1835                 }
  1841 
  1836 
  1842                 spin_unlock(&tp->rx_lock);
  1837                 spin_unlock(&tp->rx_lock);
  1843 	}
  1838         }
  1844         else
  1839         else
  1845         {
  1840         {
  1846                 rtl8139_tx_clear (tp);
  1841                 rtl8139_tx_clear (tp);
  1847                 rtl8139_hw_start(dev);
  1842                 rtl8139_hw_start(dev);
  1848         }
  1843         }
  1949 			}
  1944 			}
  1950 			if (txstatus & TxCarrierLost)
  1945 			if (txstatus & TxCarrierLost)
  1951 				tp->stats.tx_carrier_errors++;
  1946 				tp->stats.tx_carrier_errors++;
  1952 			if (txstatus & TxOutOfWindow)
  1947 			if (txstatus & TxOutOfWindow)
  1953 				tp->stats.tx_window_errors++;
  1948 				tp->stats.tx_window_errors++;
  1954 
       
  1955                         /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
       
  1956 
       
  1957                         if (EtherCAT_dev_is_ec(rtl_ec_dev, dev))
       
  1958                             EtherCAT_dev_state(rtl_ec_dev, EC_DEVICE_STATE_ERROR);
       
  1959 
       
  1960                         /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
       
  1961 
       
  1962 		} else {
  1949 		} else {
  1963 			if (txstatus & TxUnderrun) {
  1950 			if (txstatus & TxUnderrun) {
  1964 				/* Add 64 to the Tx FIFO threshold. */
  1951 				/* Add 64 to the Tx FIFO threshold. */
  1965 				if (tp->tx_flag < 0x00300000)
  1952 				if (tp->tx_flag < 0x00300000)
  1966 					tp->tx_flag += 0x00020000;
  1953 					tp->tx_flag += 0x00020000;
  2030 		if (rx_status & RxCRCErr)
  2017 		if (rx_status & RxCRCErr)
  2031 			tp->stats.rx_crc_errors++;
  2018 			tp->stats.rx_crc_errors++;
  2032 	} else {
  2019 	} else {
  2033 		tp->xstats.rx_lost_in_ring++;
  2020 		tp->xstats.rx_lost_in_ring++;
  2034 	}
  2021 	}
  2035 
       
  2036         /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
       
  2037 
       
  2038         if (EtherCAT_dev_is_ec(rtl_ec_dev, dev))
       
  2039         {
       
  2040           EtherCAT_dev_state(rtl_ec_dev, EC_DEVICE_STATE_ERROR);
       
  2041         }
       
  2042 
       
  2043         /* EtherCAT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
       
  2044 
  2022 
  2045 #ifndef CONFIG_8139_OLD_RX_RESET
  2023 #ifndef CONFIG_8139_OLD_RX_RESET
  2046 	tmp8 = RTL_R8 (ChipCmd);
  2024 	tmp8 = RTL_R8 (ChipCmd);
  2047 	RTL_W8 (ChipCmd, tmp8 & ~CmdRxEnb);
  2025 	RTL_W8 (ChipCmd, tmp8 & ~CmdRxEnb);
  2048 	RTL_W8 (ChipCmd, tmp8);
  2026 	RTL_W8 (ChipCmd, tmp8);