.. | .. |
---|
2098 | 2098 | /* Adjust EEE LED frequency */ |
---|
2099 | 2099 | if (tp->mac_version != RTL_GIGA_MAC_VER_38) |
---|
2100 | 2100 | RTL_W8(tp, EEE_LED, RTL_R8(tp, EEE_LED) & ~0x07); |
---|
| 2101 | + printk("r8169 EEE_LED value init: %x\n", RTL_R16(tp, 0x18)); |
---|
| 2102 | + RTL_W16(tp, 0x18, 0x0248); |
---|
| 2103 | + printk("r8169 EEE_LED write: %x\n", RTL_R16(tp, 0x18)); |
---|
2101 | 2104 | |
---|
2102 | 2105 | rtl_eri_set_bits(tp, 0x1b0, 0x0003); |
---|
2103 | 2106 | } |
---|
.. | .. |
---|
5298 | 5301 | u8 *mac_addr = dev->dev_addr; |
---|
5299 | 5302 | int rc; |
---|
5300 | 5303 | |
---|
| 5304 | + rtl_read_mac_address(tp, mac_addr); |
---|
| 5305 | + if (is_valid_ether_addr(mac_addr)) |
---|
| 5306 | + goto done; |
---|
| 5307 | + |
---|
| 5308 | + if (is_valid_ether_addr(mac_addr)) |
---|
| 5309 | + goto done; |
---|
| 5310 | + |
---|
5301 | 5311 | rc = eth_platform_get_mac_address(tp_to_dev(tp), mac_addr); |
---|
5302 | 5312 | if (!rc) |
---|
5303 | | - goto done; |
---|
5304 | | - |
---|
5305 | | - rtl_read_mac_address(tp, mac_addr); |
---|
5306 | | - if (is_valid_ether_addr(mac_addr)) |
---|
5307 | 5313 | goto done; |
---|
5308 | 5314 | |
---|
5309 | 5315 | rtl_read_mac_from_reg(tp, mac_addr, MAC0); |
---|
5310 | 5316 | if (is_valid_ether_addr(mac_addr)) |
---|
5311 | 5317 | goto done; |
---|
5312 | 5318 | |
---|
5313 | | - eth_hw_addr_random(dev); |
---|
| 5319 | + //eth_hw_addr_random(dev); |
---|
5314 | 5320 | dev_warn(tp_to_dev(tp), "can't read MAC address, setting random one\n"); |
---|
5315 | 5321 | done: |
---|
5316 | 5322 | rtl_rar_set(tp, mac_addr); |
---|
5317 | 5323 | } |
---|
5318 | 5324 | |
---|
| 5325 | +extern ssize_t at24_mac1_read(unsigned char* mac); |
---|
5319 | 5326 | static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
---|
5320 | 5327 | { |
---|
5321 | 5328 | struct rtl8169_private *tp; |
---|
5322 | | - int jumbo_max, region, rc; |
---|
| 5329 | + int jumbo_max, region, rc, i; |
---|
5323 | 5330 | enum mac_version chipset; |
---|
5324 | 5331 | struct net_device *dev; |
---|
5325 | 5332 | u16 xid; |
---|
| 5333 | + unsigned char mac[6]; |
---|
5326 | 5334 | |
---|
5327 | 5335 | dev = devm_alloc_etherdev(&pdev->dev, sizeof (*tp)); |
---|
5328 | 5336 | if (!dev) |
---|
.. | .. |
---|
5416 | 5424 | u64_stats_init(&tp->tx_stats.syncp); |
---|
5417 | 5425 | |
---|
5418 | 5426 | rtl_init_mac_address(tp); |
---|
| 5427 | + |
---|
| 5428 | + for (i = 0; i < ETH_ALEN; i++) |
---|
| 5429 | + dev->dev_addr[i] = RTL_R8(tp, MAC0 + i); |
---|
| 5430 | + memset(mac, 0x00, 6); |
---|
| 5431 | + at24_mac1_read(mac); |
---|
| 5432 | + |
---|
| 5433 | + if ((mac[0] == 0x68) && (mac[1] == 0xed)) |
---|
| 5434 | + { |
---|
| 5435 | + printk("rtl811h mac read from eeprom success!!\n"); |
---|
| 5436 | + for (i = 0; i < ETH_ALEN; i++) |
---|
| 5437 | + dev->dev_addr[i] = mac[i]; |
---|
| 5438 | + } |
---|
| 5439 | + else |
---|
| 5440 | + { |
---|
| 5441 | + printk("rtl811h mac read from eeprom error!!\n"); |
---|
| 5442 | + dev->dev_addr[0] = 0x66; |
---|
| 5443 | + dev->dev_addr[1] = 0xED; |
---|
| 5444 | + dev->dev_addr[2] = 0xB5; |
---|
| 5445 | + dev->dev_addr[3] = 0x64; |
---|
| 5446 | + dev->dev_addr[4] = 0x72; |
---|
| 5447 | + dev->dev_addr[5] = 0x2c; |
---|
| 5448 | + } |
---|
| 5449 | + |
---|
| 5450 | + rtl_rar_set(tp, dev->dev_addr); |
---|
5419 | 5451 | |
---|
5420 | 5452 | dev->ethtool_ops = &rtl8169_ethtool_ops; |
---|
5421 | 5453 | |
---|
.. | .. |
---|
5518 | 5550 | #endif |
---|
5519 | 5551 | }; |
---|
5520 | 5552 | |
---|
5521 | | -module_pci_driver(rtl8169_pci_driver); |
---|
| 5553 | +//module_pci_driver(rtl8169_pci_driver); |
---|
| 5554 | +module_pci_driver2(rtl8169_pci_driver); |
---|