diff options
author | Francois Romieu <romieu@fr.zoreil.com> | 2012-03-08 03:59:04 -0500 |
---|---|---|
committer | Francois Romieu <romieu@fr.zoreil.com> | 2012-03-10 16:38:18 -0500 |
commit | 3b6cf25de260d5607fa1fe48ba1af0f6d057708e (patch) | |
tree | eb2762326561a48a77e8541abe9829b93dff4d2b /drivers/net/ethernet/realtek | |
parent | e27566ed370da09e3b812d3d76dce002915a5bdd (diff) |
r8169: move the driver probe method to the end of the driver file.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
Diffstat (limited to 'drivers/net/ethernet/realtek')
-rw-r--r-- | drivers/net/ethernet/realtek/r8169.c | 492 |
1 files changed, 246 insertions, 246 deletions
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index ef6ef604f17..3455d37a63a 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -4018,251 +4018,6 @@ static void rtl_hw_reset(struct rtl8169_private *tp) | |||
4018 | } | 4018 | } |
4019 | } | 4019 | } |
4020 | 4020 | ||
4021 | static int __devinit | ||
4022 | rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
4023 | { | ||
4024 | const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data; | ||
4025 | const unsigned int region = cfg->region; | ||
4026 | struct rtl8169_private *tp; | ||
4027 | struct mii_if_info *mii; | ||
4028 | struct net_device *dev; | ||
4029 | void __iomem *ioaddr; | ||
4030 | int chipset, i; | ||
4031 | int rc; | ||
4032 | |||
4033 | if (netif_msg_drv(&debug)) { | ||
4034 | printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n", | ||
4035 | MODULENAME, RTL8169_VERSION); | ||
4036 | } | ||
4037 | |||
4038 | dev = alloc_etherdev(sizeof (*tp)); | ||
4039 | if (!dev) { | ||
4040 | rc = -ENOMEM; | ||
4041 | goto out; | ||
4042 | } | ||
4043 | |||
4044 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
4045 | dev->netdev_ops = &rtl8169_netdev_ops; | ||
4046 | tp = netdev_priv(dev); | ||
4047 | tp->dev = dev; | ||
4048 | tp->pci_dev = pdev; | ||
4049 | tp->msg_enable = netif_msg_init(debug.msg_enable, R8169_MSG_DEFAULT); | ||
4050 | |||
4051 | mii = &tp->mii; | ||
4052 | mii->dev = dev; | ||
4053 | mii->mdio_read = rtl_mdio_read; | ||
4054 | mii->mdio_write = rtl_mdio_write; | ||
4055 | mii->phy_id_mask = 0x1f; | ||
4056 | mii->reg_num_mask = 0x1f; | ||
4057 | mii->supports_gmii = !!(cfg->features & RTL_FEATURE_GMII); | ||
4058 | |||
4059 | /* disable ASPM completely as that cause random device stop working | ||
4060 | * problems as well as full system hangs for some PCIe devices users */ | ||
4061 | pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 | | ||
4062 | PCIE_LINK_STATE_CLKPM); | ||
4063 | |||
4064 | /* enable device (incl. PCI PM wakeup and hotplug setup) */ | ||
4065 | rc = pci_enable_device(pdev); | ||
4066 | if (rc < 0) { | ||
4067 | netif_err(tp, probe, dev, "enable failure\n"); | ||
4068 | goto err_out_free_dev_1; | ||
4069 | } | ||
4070 | |||
4071 | if (pci_set_mwi(pdev) < 0) | ||
4072 | netif_info(tp, probe, dev, "Mem-Wr-Inval unavailable\n"); | ||
4073 | |||
4074 | /* make sure PCI base addr 1 is MMIO */ | ||
4075 | if (!(pci_resource_flags(pdev, region) & IORESOURCE_MEM)) { | ||
4076 | netif_err(tp, probe, dev, | ||
4077 | "region #%d not an MMIO resource, aborting\n", | ||
4078 | region); | ||
4079 | rc = -ENODEV; | ||
4080 | goto err_out_mwi_2; | ||
4081 | } | ||
4082 | |||
4083 | /* check for weird/broken PCI region reporting */ | ||
4084 | if (pci_resource_len(pdev, region) < R8169_REGS_SIZE) { | ||
4085 | netif_err(tp, probe, dev, | ||
4086 | "Invalid PCI region size(s), aborting\n"); | ||
4087 | rc = -ENODEV; | ||
4088 | goto err_out_mwi_2; | ||
4089 | } | ||
4090 | |||
4091 | rc = pci_request_regions(pdev, MODULENAME); | ||
4092 | if (rc < 0) { | ||
4093 | netif_err(tp, probe, dev, "could not request regions\n"); | ||
4094 | goto err_out_mwi_2; | ||
4095 | } | ||
4096 | |||
4097 | tp->cp_cmd = RxChkSum; | ||
4098 | |||
4099 | if ((sizeof(dma_addr_t) > 4) && | ||
4100 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { | ||
4101 | tp->cp_cmd |= PCIDAC; | ||
4102 | dev->features |= NETIF_F_HIGHDMA; | ||
4103 | } else { | ||
4104 | rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | ||
4105 | if (rc < 0) { | ||
4106 | netif_err(tp, probe, dev, "DMA configuration failed\n"); | ||
4107 | goto err_out_free_res_3; | ||
4108 | } | ||
4109 | } | ||
4110 | |||
4111 | /* ioremap MMIO region */ | ||
4112 | ioaddr = ioremap(pci_resource_start(pdev, region), R8169_REGS_SIZE); | ||
4113 | if (!ioaddr) { | ||
4114 | netif_err(tp, probe, dev, "cannot remap MMIO, aborting\n"); | ||
4115 | rc = -EIO; | ||
4116 | goto err_out_free_res_3; | ||
4117 | } | ||
4118 | tp->mmio_addr = ioaddr; | ||
4119 | |||
4120 | if (!pci_is_pcie(pdev)) | ||
4121 | netif_info(tp, probe, dev, "not PCI Express\n"); | ||
4122 | |||
4123 | /* Identify chip attached to board */ | ||
4124 | rtl8169_get_mac_version(tp, dev, cfg->default_ver); | ||
4125 | |||
4126 | rtl_init_rxcfg(tp); | ||
4127 | |||
4128 | rtl_irq_disable(tp); | ||
4129 | |||
4130 | rtl_hw_reset(tp); | ||
4131 | |||
4132 | rtl_ack_events(tp, 0xffff); | ||
4133 | |||
4134 | pci_set_master(pdev); | ||
4135 | |||
4136 | /* | ||
4137 | * Pretend we are using VLANs; This bypasses a nasty bug where | ||
4138 | * Interrupts stop flowing on high load on 8110SCd controllers. | ||
4139 | */ | ||
4140 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) | ||
4141 | tp->cp_cmd |= RxVlan; | ||
4142 | |||
4143 | rtl_init_mdio_ops(tp); | ||
4144 | rtl_init_pll_power_ops(tp); | ||
4145 | rtl_init_jumbo_ops(tp); | ||
4146 | |||
4147 | rtl8169_print_mac_version(tp); | ||
4148 | |||
4149 | chipset = tp->mac_version; | ||
4150 | tp->txd_version = rtl_chip_infos[chipset].txd_version; | ||
4151 | |||
4152 | RTL_W8(Cfg9346, Cfg9346_Unlock); | ||
4153 | RTL_W8(Config1, RTL_R8(Config1) | PMEnable); | ||
4154 | RTL_W8(Config5, RTL_R8(Config5) & PMEStatus); | ||
4155 | if ((RTL_R8(Config3) & (LinkUp | MagicPacket)) != 0) | ||
4156 | tp->features |= RTL_FEATURE_WOL; | ||
4157 | if ((RTL_R8(Config5) & (UWF | BWF | MWF)) != 0) | ||
4158 | tp->features |= RTL_FEATURE_WOL; | ||
4159 | tp->features |= rtl_try_msi(tp, cfg); | ||
4160 | RTL_W8(Cfg9346, Cfg9346_Lock); | ||
4161 | |||
4162 | if (rtl_tbi_enabled(tp)) { | ||
4163 | tp->set_speed = rtl8169_set_speed_tbi; | ||
4164 | tp->get_settings = rtl8169_gset_tbi; | ||
4165 | tp->phy_reset_enable = rtl8169_tbi_reset_enable; | ||
4166 | tp->phy_reset_pending = rtl8169_tbi_reset_pending; | ||
4167 | tp->link_ok = rtl8169_tbi_link_ok; | ||
4168 | tp->do_ioctl = rtl_tbi_ioctl; | ||
4169 | } else { | ||
4170 | tp->set_speed = rtl8169_set_speed_xmii; | ||
4171 | tp->get_settings = rtl8169_gset_xmii; | ||
4172 | tp->phy_reset_enable = rtl8169_xmii_reset_enable; | ||
4173 | tp->phy_reset_pending = rtl8169_xmii_reset_pending; | ||
4174 | tp->link_ok = rtl8169_xmii_link_ok; | ||
4175 | tp->do_ioctl = rtl_xmii_ioctl; | ||
4176 | } | ||
4177 | |||
4178 | mutex_init(&tp->wk.mutex); | ||
4179 | |||
4180 | /* Get MAC address */ | ||
4181 | for (i = 0; i < ETH_ALEN; i++) | ||
4182 | dev->dev_addr[i] = RTL_R8(MAC0 + i); | ||
4183 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
4184 | |||
4185 | SET_ETHTOOL_OPS(dev, &rtl8169_ethtool_ops); | ||
4186 | dev->watchdog_timeo = RTL8169_TX_TIMEOUT; | ||
4187 | dev->irq = pdev->irq; | ||
4188 | dev->base_addr = (unsigned long) ioaddr; | ||
4189 | |||
4190 | netif_napi_add(dev, &tp->napi, rtl8169_poll, R8169_NAPI_WEIGHT); | ||
4191 | |||
4192 | /* don't enable SG, IP_CSUM and TSO by default - it might not work | ||
4193 | * properly for all devices */ | ||
4194 | dev->features |= NETIF_F_RXCSUM | | ||
4195 | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | ||
4196 | |||
4197 | dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | | ||
4198 | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | ||
4199 | dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | | ||
4200 | NETIF_F_HIGHDMA; | ||
4201 | |||
4202 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) | ||
4203 | /* 8110SCd requires hardware Rx VLAN - disallow toggling */ | ||
4204 | dev->hw_features &= ~NETIF_F_HW_VLAN_RX; | ||
4205 | |||
4206 | dev->hw_features |= NETIF_F_RXALL; | ||
4207 | dev->hw_features |= NETIF_F_RXFCS; | ||
4208 | |||
4209 | tp->hw_start = cfg->hw_start; | ||
4210 | tp->event_slow = cfg->event_slow; | ||
4211 | |||
4212 | tp->opts1_mask = (tp->mac_version != RTL_GIGA_MAC_VER_01) ? | ||
4213 | ~(RxBOVF | RxFOVF) : ~0; | ||
4214 | |||
4215 | init_timer(&tp->timer); | ||
4216 | tp->timer.data = (unsigned long) dev; | ||
4217 | tp->timer.function = rtl8169_phy_timer; | ||
4218 | |||
4219 | tp->rtl_fw = RTL_FIRMWARE_UNKNOWN; | ||
4220 | |||
4221 | rc = register_netdev(dev); | ||
4222 | if (rc < 0) | ||
4223 | goto err_out_msi_4; | ||
4224 | |||
4225 | pci_set_drvdata(pdev, dev); | ||
4226 | |||
4227 | netif_info(tp, probe, dev, "%s at 0x%lx, %pM, XID %08x IRQ %d\n", | ||
4228 | rtl_chip_infos[chipset].name, dev->base_addr, dev->dev_addr, | ||
4229 | (u32)(RTL_R32(TxConfig) & 0x9cf0f8ff), dev->irq); | ||
4230 | if (rtl_chip_infos[chipset].jumbo_max != JUMBO_1K) { | ||
4231 | netif_info(tp, probe, dev, "jumbo features [frames: %d bytes, " | ||
4232 | "tx checksumming: %s]\n", | ||
4233 | rtl_chip_infos[chipset].jumbo_max, | ||
4234 | rtl_chip_infos[chipset].jumbo_tx_csum ? "ok" : "ko"); | ||
4235 | } | ||
4236 | |||
4237 | if (tp->mac_version == RTL_GIGA_MAC_VER_27 || | ||
4238 | tp->mac_version == RTL_GIGA_MAC_VER_28 || | ||
4239 | tp->mac_version == RTL_GIGA_MAC_VER_31) { | ||
4240 | rtl8168_driver_start(tp); | ||
4241 | } | ||
4242 | |||
4243 | device_set_wakeup_enable(&pdev->dev, tp->features & RTL_FEATURE_WOL); | ||
4244 | |||
4245 | if (pci_dev_run_wake(pdev)) | ||
4246 | pm_runtime_put_noidle(&pdev->dev); | ||
4247 | |||
4248 | netif_carrier_off(dev); | ||
4249 | |||
4250 | out: | ||
4251 | return rc; | ||
4252 | |||
4253 | err_out_msi_4: | ||
4254 | rtl_disable_msi(pdev, tp); | ||
4255 | iounmap(ioaddr); | ||
4256 | err_out_free_res_3: | ||
4257 | pci_release_regions(pdev); | ||
4258 | err_out_mwi_2: | ||
4259 | pci_clear_mwi(pdev); | ||
4260 | pci_disable_device(pdev); | ||
4261 | err_out_free_dev_1: | ||
4262 | free_netdev(dev); | ||
4263 | goto out; | ||
4264 | } | ||
4265 | |||
4266 | static void rtl_request_uncached_firmware(struct rtl8169_private *tp) | 4021 | static void rtl_request_uncached_firmware(struct rtl8169_private *tp) |
4267 | { | 4022 | { |
4268 | struct rtl_fw *rtl_fw; | 4023 | struct rtl_fw *rtl_fw; |
@@ -6316,10 +6071,255 @@ static void __devexit rtl_remove_one(struct pci_dev *pdev) | |||
6316 | pci_set_drvdata(pdev, NULL); | 6071 | pci_set_drvdata(pdev, NULL); |
6317 | } | 6072 | } |
6318 | 6073 | ||
6074 | static int __devinit | ||
6075 | rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
6076 | { | ||
6077 | const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data; | ||
6078 | const unsigned int region = cfg->region; | ||
6079 | struct rtl8169_private *tp; | ||
6080 | struct mii_if_info *mii; | ||
6081 | struct net_device *dev; | ||
6082 | void __iomem *ioaddr; | ||
6083 | int chipset, i; | ||
6084 | int rc; | ||
6085 | |||
6086 | if (netif_msg_drv(&debug)) { | ||
6087 | printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n", | ||
6088 | MODULENAME, RTL8169_VERSION); | ||
6089 | } | ||
6090 | |||
6091 | dev = alloc_etherdev(sizeof (*tp)); | ||
6092 | if (!dev) { | ||
6093 | rc = -ENOMEM; | ||
6094 | goto out; | ||
6095 | } | ||
6096 | |||
6097 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
6098 | dev->netdev_ops = &rtl8169_netdev_ops; | ||
6099 | tp = netdev_priv(dev); | ||
6100 | tp->dev = dev; | ||
6101 | tp->pci_dev = pdev; | ||
6102 | tp->msg_enable = netif_msg_init(debug.msg_enable, R8169_MSG_DEFAULT); | ||
6103 | |||
6104 | mii = &tp->mii; | ||
6105 | mii->dev = dev; | ||
6106 | mii->mdio_read = rtl_mdio_read; | ||
6107 | mii->mdio_write = rtl_mdio_write; | ||
6108 | mii->phy_id_mask = 0x1f; | ||
6109 | mii->reg_num_mask = 0x1f; | ||
6110 | mii->supports_gmii = !!(cfg->features & RTL_FEATURE_GMII); | ||
6111 | |||
6112 | /* disable ASPM completely as that cause random device stop working | ||
6113 | * problems as well as full system hangs for some PCIe devices users */ | ||
6114 | pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 | | ||
6115 | PCIE_LINK_STATE_CLKPM); | ||
6116 | |||
6117 | /* enable device (incl. PCI PM wakeup and hotplug setup) */ | ||
6118 | rc = pci_enable_device(pdev); | ||
6119 | if (rc < 0) { | ||
6120 | netif_err(tp, probe, dev, "enable failure\n"); | ||
6121 | goto err_out_free_dev_1; | ||
6122 | } | ||
6123 | |||
6124 | if (pci_set_mwi(pdev) < 0) | ||
6125 | netif_info(tp, probe, dev, "Mem-Wr-Inval unavailable\n"); | ||
6126 | |||
6127 | /* make sure PCI base addr 1 is MMIO */ | ||
6128 | if (!(pci_resource_flags(pdev, region) & IORESOURCE_MEM)) { | ||
6129 | netif_err(tp, probe, dev, | ||
6130 | "region #%d not an MMIO resource, aborting\n", | ||
6131 | region); | ||
6132 | rc = -ENODEV; | ||
6133 | goto err_out_mwi_2; | ||
6134 | } | ||
6135 | |||
6136 | /* check for weird/broken PCI region reporting */ | ||
6137 | if (pci_resource_len(pdev, region) < R8169_REGS_SIZE) { | ||
6138 | netif_err(tp, probe, dev, | ||
6139 | "Invalid PCI region size(s), aborting\n"); | ||
6140 | rc = -ENODEV; | ||
6141 | goto err_out_mwi_2; | ||
6142 | } | ||
6143 | |||
6144 | rc = pci_request_regions(pdev, MODULENAME); | ||
6145 | if (rc < 0) { | ||
6146 | netif_err(tp, probe, dev, "could not request regions\n"); | ||
6147 | goto err_out_mwi_2; | ||
6148 | } | ||
6149 | |||
6150 | tp->cp_cmd = RxChkSum; | ||
6151 | |||
6152 | if ((sizeof(dma_addr_t) > 4) && | ||
6153 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { | ||
6154 | tp->cp_cmd |= PCIDAC; | ||
6155 | dev->features |= NETIF_F_HIGHDMA; | ||
6156 | } else { | ||
6157 | rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | ||
6158 | if (rc < 0) { | ||
6159 | netif_err(tp, probe, dev, "DMA configuration failed\n"); | ||
6160 | goto err_out_free_res_3; | ||
6161 | } | ||
6162 | } | ||
6163 | |||
6164 | /* ioremap MMIO region */ | ||
6165 | ioaddr = ioremap(pci_resource_start(pdev, region), R8169_REGS_SIZE); | ||
6166 | if (!ioaddr) { | ||
6167 | netif_err(tp, probe, dev, "cannot remap MMIO, aborting\n"); | ||
6168 | rc = -EIO; | ||
6169 | goto err_out_free_res_3; | ||
6170 | } | ||
6171 | tp->mmio_addr = ioaddr; | ||
6172 | |||
6173 | if (!pci_is_pcie(pdev)) | ||
6174 | netif_info(tp, probe, dev, "not PCI Express\n"); | ||
6175 | |||
6176 | /* Identify chip attached to board */ | ||
6177 | rtl8169_get_mac_version(tp, dev, cfg->default_ver); | ||
6178 | |||
6179 | rtl_init_rxcfg(tp); | ||
6180 | |||
6181 | rtl_irq_disable(tp); | ||
6182 | |||
6183 | rtl_hw_reset(tp); | ||
6184 | |||
6185 | rtl_ack_events(tp, 0xffff); | ||
6186 | |||
6187 | pci_set_master(pdev); | ||
6188 | |||
6189 | /* | ||
6190 | * Pretend we are using VLANs; This bypasses a nasty bug where | ||
6191 | * Interrupts stop flowing on high load on 8110SCd controllers. | ||
6192 | */ | ||
6193 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) | ||
6194 | tp->cp_cmd |= RxVlan; | ||
6195 | |||
6196 | rtl_init_mdio_ops(tp); | ||
6197 | rtl_init_pll_power_ops(tp); | ||
6198 | rtl_init_jumbo_ops(tp); | ||
6199 | |||
6200 | rtl8169_print_mac_version(tp); | ||
6201 | |||
6202 | chipset = tp->mac_version; | ||
6203 | tp->txd_version = rtl_chip_infos[chipset].txd_version; | ||
6204 | |||
6205 | RTL_W8(Cfg9346, Cfg9346_Unlock); | ||
6206 | RTL_W8(Config1, RTL_R8(Config1) | PMEnable); | ||
6207 | RTL_W8(Config5, RTL_R8(Config5) & PMEStatus); | ||
6208 | if ((RTL_R8(Config3) & (LinkUp | MagicPacket)) != 0) | ||
6209 | tp->features |= RTL_FEATURE_WOL; | ||
6210 | if ((RTL_R8(Config5) & (UWF | BWF | MWF)) != 0) | ||
6211 | tp->features |= RTL_FEATURE_WOL; | ||
6212 | tp->features |= rtl_try_msi(tp, cfg); | ||
6213 | RTL_W8(Cfg9346, Cfg9346_Lock); | ||
6214 | |||
6215 | if (rtl_tbi_enabled(tp)) { | ||
6216 | tp->set_speed = rtl8169_set_speed_tbi; | ||
6217 | tp->get_settings = rtl8169_gset_tbi; | ||
6218 | tp->phy_reset_enable = rtl8169_tbi_reset_enable; | ||
6219 | tp->phy_reset_pending = rtl8169_tbi_reset_pending; | ||
6220 | tp->link_ok = rtl8169_tbi_link_ok; | ||
6221 | tp->do_ioctl = rtl_tbi_ioctl; | ||
6222 | } else { | ||
6223 | tp->set_speed = rtl8169_set_speed_xmii; | ||
6224 | tp->get_settings = rtl8169_gset_xmii; | ||
6225 | tp->phy_reset_enable = rtl8169_xmii_reset_enable; | ||
6226 | tp->phy_reset_pending = rtl8169_xmii_reset_pending; | ||
6227 | tp->link_ok = rtl8169_xmii_link_ok; | ||
6228 | tp->do_ioctl = rtl_xmii_ioctl; | ||
6229 | } | ||
6230 | |||
6231 | mutex_init(&tp->wk.mutex); | ||
6232 | |||
6233 | /* Get MAC address */ | ||
6234 | for (i = 0; i < ETH_ALEN; i++) | ||
6235 | dev->dev_addr[i] = RTL_R8(MAC0 + i); | ||
6236 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
6237 | |||
6238 | SET_ETHTOOL_OPS(dev, &rtl8169_ethtool_ops); | ||
6239 | dev->watchdog_timeo = RTL8169_TX_TIMEOUT; | ||
6240 | dev->irq = pdev->irq; | ||
6241 | dev->base_addr = (unsigned long) ioaddr; | ||
6242 | |||
6243 | netif_napi_add(dev, &tp->napi, rtl8169_poll, R8169_NAPI_WEIGHT); | ||
6244 | |||
6245 | /* don't enable SG, IP_CSUM and TSO by default - it might not work | ||
6246 | * properly for all devices */ | ||
6247 | dev->features |= NETIF_F_RXCSUM | | ||
6248 | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | ||
6249 | |||
6250 | dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | | ||
6251 | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | ||
6252 | dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | | ||
6253 | NETIF_F_HIGHDMA; | ||
6254 | |||
6255 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) | ||
6256 | /* 8110SCd requires hardware Rx VLAN - disallow toggling */ | ||
6257 | dev->hw_features &= ~NETIF_F_HW_VLAN_RX; | ||
6258 | |||
6259 | dev->hw_features |= NETIF_F_RXALL; | ||
6260 | dev->hw_features |= NETIF_F_RXFCS; | ||
6261 | |||
6262 | tp->hw_start = cfg->hw_start; | ||
6263 | tp->event_slow = cfg->event_slow; | ||
6264 | |||
6265 | tp->opts1_mask = (tp->mac_version != RTL_GIGA_MAC_VER_01) ? | ||
6266 | ~(RxBOVF | RxFOVF) : ~0; | ||
6267 | |||
6268 | init_timer(&tp->timer); | ||
6269 | tp->timer.data = (unsigned long) dev; | ||
6270 | tp->timer.function = rtl8169_phy_timer; | ||
6271 | |||
6272 | tp->rtl_fw = RTL_FIRMWARE_UNKNOWN; | ||
6273 | |||
6274 | rc = register_netdev(dev); | ||
6275 | if (rc < 0) | ||
6276 | goto err_out_msi_4; | ||
6277 | |||
6278 | pci_set_drvdata(pdev, dev); | ||
6279 | |||
6280 | netif_info(tp, probe, dev, "%s at 0x%lx, %pM, XID %08x IRQ %d\n", | ||
6281 | rtl_chip_infos[chipset].name, dev->base_addr, dev->dev_addr, | ||
6282 | (u32)(RTL_R32(TxConfig) & 0x9cf0f8ff), dev->irq); | ||
6283 | if (rtl_chip_infos[chipset].jumbo_max != JUMBO_1K) { | ||
6284 | netif_info(tp, probe, dev, "jumbo features [frames: %d bytes, " | ||
6285 | "tx checksumming: %s]\n", | ||
6286 | rtl_chip_infos[chipset].jumbo_max, | ||
6287 | rtl_chip_infos[chipset].jumbo_tx_csum ? "ok" : "ko"); | ||
6288 | } | ||
6289 | |||
6290 | if (tp->mac_version == RTL_GIGA_MAC_VER_27 || | ||
6291 | tp->mac_version == RTL_GIGA_MAC_VER_28 || | ||
6292 | tp->mac_version == RTL_GIGA_MAC_VER_31) { | ||
6293 | rtl8168_driver_start(tp); | ||
6294 | } | ||
6295 | |||
6296 | device_set_wakeup_enable(&pdev->dev, tp->features & RTL_FEATURE_WOL); | ||
6297 | |||
6298 | if (pci_dev_run_wake(pdev)) | ||
6299 | pm_runtime_put_noidle(&pdev->dev); | ||
6300 | |||
6301 | netif_carrier_off(dev); | ||
6302 | |||
6303 | out: | ||
6304 | return rc; | ||
6305 | |||
6306 | err_out_msi_4: | ||
6307 | rtl_disable_msi(pdev, tp); | ||
6308 | iounmap(ioaddr); | ||
6309 | err_out_free_res_3: | ||
6310 | pci_release_regions(pdev); | ||
6311 | err_out_mwi_2: | ||
6312 | pci_clear_mwi(pdev); | ||
6313 | pci_disable_device(pdev); | ||
6314 | err_out_free_dev_1: | ||
6315 | free_netdev(dev); | ||
6316 | goto out; | ||
6317 | } | ||
6318 | |||
6319 | static struct pci_driver rtl8169_pci_driver = { | 6319 | static struct pci_driver rtl8169_pci_driver = { |
6320 | .name = MODULENAME, | 6320 | .name = MODULENAME, |
6321 | .id_table = rtl8169_pci_tbl, | 6321 | .id_table = rtl8169_pci_tbl, |
6322 | .probe = rtl8169_init_one, | 6322 | .probe = rtl_init_one, |
6323 | .remove = __devexit_p(rtl_remove_one), | 6323 | .remove = __devexit_p(rtl_remove_one), |
6324 | .shutdown = rtl_shutdown, | 6324 | .shutdown = rtl_shutdown, |
6325 | .driver.pm = RTL8169_PM_OPS, | 6325 | .driver.pm = RTL8169_PM_OPS, |