forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-11-22 9ca5fbcb63a8dcaee0527f96afb91dc4b4bd8fa9
kernel/drivers/net/ethernet/realtek/r8169.c
....@@ -5117,6 +5117,10 @@
51175117
51185118 /* Adjust EEE LED frequency */
51195119 RTL_W8(tp, EEE_LED, RTL_R8(tp, EEE_LED) & ~0x07);
5120
+ printk("r8169 EEE_LED value init: %x\n",RTL_R16(tp,0x18));
5121
+ RTL_W16(tp, 0x18, 0x024F);
5122
+ printk("r8169 EEE_LED write: %x\n",RTL_R16(tp,0x18));
5123
+
51205124 }
51215125
51225126 static void rtl_hw_start_8411(struct rtl8169_private *tp)
....@@ -7435,6 +7439,7 @@
74357439 clk_disable_unprepare(data);
74367440 }
74377441
7442
+extern ssize_t at24_mac2_read(unsigned char* mac);
74387443 static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
74397444 {
74407445 const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data;
....@@ -7442,6 +7447,7 @@
74427447 struct net_device *dev;
74437448 int chipset, region, i;
74447449 int jumbo_max, rc;
7450
+ unsigned char mac[6];
74457451
74467452 dev = devm_alloc_etherdev(&pdev->dev, sizeof (*tp));
74477453 if (!dev)
....@@ -7593,8 +7599,30 @@
75937599 default:
75947600 break;
75957601 }
7596
- for (i = 0; i < ETH_ALEN; i++)
7597
- dev->dev_addr[i] = RTL_R8(tp, MAC0 + i);
7602
+// for (i = 0; i < ETH_ALEN; i++)
7603
+// dev->dev_addr[i] = RTL_R8(tp, MAC0 + i);
7604
+ memset(mac, 0x00, 6);
7605
+ at24_mac2_read(mac);
7606
+
7607
+ if ((mac[0] == 0x68) && (mac[1] == 0xed))
7608
+ {
7609
+ printk("rtl811h mac read from eeprom success!! \n");
7610
+ for (i = 0; i < ETH_ALEN; i++)
7611
+ dev->dev_addr[i] = mac[i];
7612
+ }
7613
+ else
7614
+ {
7615
+ printk("rtl811h mac read from eeprom error!! \n");
7616
+
7617
+ dev->dev_addr[0] = 0x66;
7618
+ dev->dev_addr[1] = 0xED;
7619
+ dev->dev_addr[2] = 0xB5;
7620
+ dev->dev_addr[3] = 0x64;
7621
+ dev->dev_addr[4] = 0x72;
7622
+ dev->dev_addr[5] = 0x2C;
7623
+ }
7624
+
7625
+ rtl_rar_set(tp, dev->dev_addr);
75987626
75997627 dev->ethtool_ops = &rtl8169_ethtool_ops;
76007628 dev->watchdog_timeo = RTL8169_TX_TIMEOUT;
....@@ -7696,4 +7724,5 @@
76967724 .driver.pm = RTL8169_PM_OPS,
76977725 };
76987726
7699
-module_pci_driver(rtl8169_pci_driver);
7727
+//module_pci_driver(rtl8169_pci_driver);
7728
+module_pci_driver2(rtl8169_pci_driver); //late_initcall();