devices/r8169-3.4-ethercat.c
branchstable-1.5
changeset 2533 a1c25aee3112
parent 2495 7c83194a309f
child 2534 a0e787e196cd
equal deleted inserted replaced
2532:bdadf6da4914 2533:a1c25aee3112
     1 /*
     1 /*
     2 * r8169.c: RealTek 8169/8168/8101 ethernet driver.
     2  * r8169.c: RealTek 8169/8168/8101 ethernet driver.
     3 *
     3  *
     4 * Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
     4  * Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
     5 * Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
     5  * Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
     6 * Copyright (c) a lot of people too. Please respect their work.
     6  * Copyright (c) a lot of people too. Please respect their work.
     7  *
     7  *
     8  * See MAINTAINERS file for support contact information.
     8  * See MAINTAINERS file for support contact information.
     9  */
     9  */
    10 
    10 
    11 #include <linux/module.h>
    11 #include <linux/module.h>
    29 #include <linux/pci-aspm.h>
    29 #include <linux/pci-aspm.h>
    30 #include <linux/prefetch.h>
    30 #include <linux/prefetch.h>
    31 
    31 
    32 #include <asm/io.h>
    32 #include <asm/io.h>
    33 #include <asm/irq.h>
    33 #include <asm/irq.h>
       
    34 
    34 #include "../globals.h"
    35 #include "../globals.h"
    35 #include "ecdev.h"
    36 #include "ecdev.h"
    36 
    37 
    37 #define RTL8169_VERSION "2.3LK-NAPI"
    38 #define RTL8169_VERSION "2.3LK-NAPI"
    38 #define MODULENAME "ec_r8169"
    39 #define MODULENAME "ec_r8169"
   742 	unsigned features;
   743 	unsigned features;
   743 
   744 
   744 	struct mii_if_info mii;
   745 	struct mii_if_info mii;
   745 	struct rtl8169_counters counters;
   746 	struct rtl8169_counters counters;
   746 	u32 saved_wolopts;
   747 	u32 saved_wolopts;
   747 
       
   748 	ec_device_t *ecdev;
       
   749 	unsigned long ec_watchdog_jiffies;
       
   750 	u32 opts1_mask;
   748 	u32 opts1_mask;
   751 
   749 
   752 	struct rtl_fw {
   750 	struct rtl_fw {
   753 		const struct firmware *fw;
   751 		const struct firmware *fw;
   754 
   752 
   760 			__le32 *code;
   758 			__le32 *code;
   761 			size_t size;
   759 			size_t size;
   762 		} phy_action;
   760 		} phy_action;
   763 	} *rtl_fw;
   761 	} *rtl_fw;
   764 #define RTL_FIRMWARE_UNKNOWN	ERR_PTR(-EAGAIN)
   762 #define RTL_FIRMWARE_UNKNOWN	ERR_PTR(-EAGAIN)
       
   763 
       
   764 	ec_device_t *ecdev;
       
   765 	unsigned long ec_watchdog_jiffies;
   765 };
   766 };
   766 
   767 
   767 MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>");
   768 MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>");
   768 MODULE_DESCRIPTION("RealTek RTL-8169 Gigabit Ethernet driver (EtherCAT)");
   769 MODULE_DESCRIPTION("RealTek RTL-8169 Gigabit Ethernet driver (EtherCAT)");
   769 module_param(use_dac, int, 0);
   770 module_param(use_dac, int, 0);
  5546 	u16 status;
  5547 	u16 status;
  5547 
  5548 
  5548 	status = rtl_get_events(tp) & tp->event_slow;
  5549 	status = rtl_get_events(tp) & tp->event_slow;
  5549 	rtl_ack_events(tp, status);
  5550 	rtl_ack_events(tp, status);
  5550 
  5551 
  5551 	if (unlikely(!tp->ecdev && status & RxFIFOOver)) {
  5552 	if (unlikely(!tp->ecdev && (status & RxFIFOOver))) {
  5552 		switch (tp->mac_version) {
  5553 		switch (tp->mac_version) {
  5553 		/* Work around for rx fifo overflow */
  5554 		/* Work around for rx fifo overflow */
  5554 		case RTL_GIGA_MAC_VER_11:
  5555 		case RTL_GIGA_MAC_VER_11:
  5555 			netif_stop_queue(dev);
  5556 			netif_stop_queue(dev);
  5556 			/* XXX - Hack alert. See rtl_task(). */
  5557 			/* XXX - Hack alert. See rtl_task(). */
  5558 		default:
  5559 		default:
  5559 			break;
  5560 			break;
  5560 		}
  5561 		}
  5561 	}
  5562 	}
  5562 
  5563 
  5563 	if (unlikely(!tp->ecdev && status & SYSErr))
  5564 	if (unlikely(!tp->ecdev && (status & SYSErr)))
  5564 		rtl8169_pcierr_interrupt(dev);
  5565 		rtl8169_pcierr_interrupt(dev);
  5565 
  5566 
  5566 	if (status & LinkChg)
  5567 	if (status & LinkChg)
  5567 		__rtl8169_check_link_status(dev, tp, tp->mmio_addr, true);
  5568 		__rtl8169_check_link_status(dev, tp, tp->mmio_addr, true);
  5568 
  5569