USB: usbcore get rid of the timer in usb_start_wait_urb()
[safe/jmp/linux-2.6] / drivers / net / r8169.c
index 0025b83..4c47c5b 100644 (file)
@@ -209,8 +209,8 @@ static const struct {
 
 static struct pci_device_id rtl8169_pci_tbl[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8129), 0, 0, RTL_CFG_0 },
-       { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8136), 0, 0, RTL_CFG_1 },
-       { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8167), 0, 0, RTL_CFG_1 },
+       { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8136), 0, 0, RTL_CFG_2 },
+       { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8167), 0, 0, RTL_CFG_0 },
        { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8168), 0, 0, RTL_CFG_2 },
        { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8169), 0, 0, RTL_CFG_0 },
        { PCI_DEVICE(PCI_VENDOR_ID_DLINK,       0x4300), 0, 0, RTL_CFG_0 },
@@ -1124,7 +1124,7 @@ static void rtl8169_get_strings(struct net_device *dev, u32 stringset, u8 *data)
 }
 
 
-static struct ethtool_ops rtl8169_ethtool_ops = {
+static const struct ethtool_ops rtl8169_ethtool_ops = {
        .get_drvinfo            = rtl8169_get_drvinfo,
        .get_regs_len           = rtl8169_get_regs_len,
        .get_link               = ethtool_op_get_link,
@@ -1475,6 +1475,32 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
                printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name);
 }
 
+static int rtl8169_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+{
+       struct rtl8169_private *tp = netdev_priv(dev);
+       struct mii_ioctl_data *data = if_mii(ifr);
+
+       if (!netif_running(dev))
+               return -ENODEV;
+
+       switch (cmd) {
+       case SIOCGMIIPHY:
+               data->phy_id = 32; /* Internal PHY */
+               return 0;
+
+       case SIOCGMIIREG:
+               data->val_out = mdio_read(tp->mmio_addr, data->reg_num & 0x1f);
+               return 0;
+
+       case SIOCSMIIREG:
+               if (!capable(CAP_NET_ADMIN))
+                       return -EPERM;
+               mdio_write(tp->mmio_addr, data->reg_num & 0x1f, data->val_in);
+               return 0;
+       }
+       return -EOPNOTSUPP;
+}
+
 static int __devinit
 rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
@@ -1639,6 +1665,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                tp->phy_reset_enable = rtl8169_xmii_reset_enable;
                tp->phy_reset_pending = rtl8169_xmii_reset_pending;
                tp->link_ok = rtl8169_xmii_link_ok;
+
+               dev->do_ioctl = rtl8169_ioctl;
        }
 
        /* Get MAC address.  FIXME: read EEPROM */
@@ -1876,10 +1904,15 @@ rtl8169_hw_start(struct net_device *dev)
         */
        RTL_W16(IntrMitigate, 0x0000);
 
-       RTL_W32(TxDescStartAddrLow, ((u64) tp->TxPhyAddr & DMA_32BIT_MASK));
+       /*
+        * Magic spell: some iop3xx ARM board needs the TxDescAddrHigh
+        * register to be written before TxDescAddrLow to work.
+        * Switching from MMIO to I/O access fixes the issue as well.
+        */
        RTL_W32(TxDescStartAddrHigh, ((u64) tp->TxPhyAddr >> 32));
-       RTL_W32(RxDescAddrLow, ((u64) tp->RxPhyAddr & DMA_32BIT_MASK));
+       RTL_W32(TxDescStartAddrLow, ((u64) tp->TxPhyAddr & DMA_32BIT_MASK));
        RTL_W32(RxDescAddrHigh, ((u64) tp->RxPhyAddr >> 32));
+       RTL_W32(RxDescAddrLow, ((u64) tp->RxPhyAddr & DMA_32BIT_MASK));
        RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
        RTL_W8(Cfg9346, Cfg9346_Lock);
 
@@ -2226,7 +2259,7 @@ static inline u32 rtl8169_tso_csum(struct sk_buff *skb, struct net_device *dev)
                if (mss)
                        return LargeSend | ((mss & MSSMask) << MSSShift);
        }
-       if (skb->ip_summed == CHECKSUM_HW) {
+       if (skb->ip_summed == CHECKSUM_PARTIAL) {
                const struct iphdr *ip = skb->nh.iph;
 
                if (ip->protocol == IPPROTO_TCP)
@@ -2880,7 +2913,7 @@ static struct pci_driver rtl8169_pci_driver = {
 static int __init
 rtl8169_init_module(void)
 {
-       return pci_module_init(&rtl8169_pci_driver);
+       return pci_register_driver(&rtl8169_pci_driver);
 }
 
 static void __exit