hc
2023-11-22 d0a428a6556ea5a006e22e28b0b1cd037885fe20
add gmac0 read mac form eeprom,pcie30x1
4 files modified
88 ■■■■ changed files
kernel/arch/arm64/boot/dts/rockchip/NK-R36S0.dtsi 20 ●●●● patch | view | raw | blame | history
kernel/drivers/misc/eeprom/at24.c 27 ●●●●● patch | view | raw | blame | history
kernel/drivers/net/ethernet/realtek/r8169.c 4 ●●●● patch | view | raw | blame | history
kernel/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c 37 ●●●● patch | view | raw | blame | history
kernel/arch/arm64/boot/dts/rockchip/NK-R36S0.dtsi
....@@ -146,6 +146,11 @@
146146 gpio_function = <0>;
147147 };
148148
149
+ m2_wifi_pwr {
150
+ gpio_num = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>;//WIFI_PWREN_GPIO3_C6_1V8
151
+ gpio_function = <0>;
152
+ };
153
+
149154
150155 #if 0
151156 do1 {
....@@ -388,7 +393,9 @@
388393 rx_delay = <0x2f>;
389394
390395 phy-handle = <&rgmii_phy0>;
391
- status = "disabled";
396
+
397
+ status = "okay";
398
+
392399 };
393400
394401 &gmac1 {
....@@ -533,7 +540,7 @@
533540 };
534541
535542 &pcie30phy {
536
- status = "disabled";
543
+ status = "okay";
537544 };
538545
539546 &pcie2x1 {
....@@ -543,7 +550,14 @@
543550 };
544551
545552 &pcie3x2 {
546
- reset-gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_HIGH>;
553
+ reset-gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_HIGH>;
554
+ vpcie3v3-supply = <&vcc3v3_pcie>;
555
+ status = "disabled";
556
+};
557
+
558
+&pcie3x1 {
559
+ rockchip,bifurcation;
560
+ reset-gpios = <&gpio3 RK_PA1 GPIO_ACTIVE_HIGH>;
547561 vpcie3v3-supply = <&vcc3v3_pcie>;
548562 status = "okay";
549563 };
kernel/drivers/misc/eeprom/at24.c
....@@ -564,6 +564,33 @@
564564 }
565565 EXPORT_SYMBOL(at24_mac1_read);
566566
567
+ssize_t at24_mac2_read(unsigned char* mac)
568
+{
569
+ char buf[20];
570
+ char buf_tmp[12];
571
+ ssize_t ret;
572
+ if (at24_private == NULL)
573
+ {
574
+ printk("zcl: at24_mac_read at24_private==null error");
575
+ return 0;
576
+ }
577
+ memset(buf, 0x00, 20);
578
+ memset(buf_tmp, 0x00, 12);
579
+ ret = at24_read_private(at24_private, buf, 0x20, 6);
580
+ if (ret > 0)
581
+ {
582
+ *mac = buf[0];
583
+ *(mac + 1) = buf[1];
584
+ *(mac + 2) = buf[2];
585
+ *(mac + 3) = buf[3];
586
+ *(mac + 4) = buf[4];
587
+ *(mac + 5) = buf[5];
588
+ }
589
+ printk("at24_mac2_read ...............\n");
590
+ return ret;
591
+}
592
+EXPORT_SYMBOL(at24_mac2_read);
593
+
567594 static int at24_write(void *priv, unsigned int off, void *val, size_t count)
568595 {
569596 struct at24_data *at24;
kernel/drivers/net/ethernet/realtek/r8169.c
....@@ -7439,7 +7439,7 @@
74397439 clk_disable_unprepare(data);
74407440 }
74417441
7442
-extern ssize_t at24_mac1_read(unsigned char* mac);
7442
+extern ssize_t at24_mac2_read(unsigned char* mac);
74437443 static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
74447444 {
74457445 const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data;
....@@ -7602,7 +7602,7 @@
76027602 // for (i = 0; i < ETH_ALEN; i++)
76037603 // dev->dev_addr[i] = RTL_R8(tp, MAC0 + i);
76047604 memset(mac, 0x00, 6);
7605
- at24_mac1_read(mac);
7605
+ at24_mac2_read(mac);
76067606
76077607 if ((mac[0] == 0x68) && (mac[1] == 0xed))
76087608 {
kernel/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
....@@ -2349,12 +2349,14 @@
23492349
23502350 static unsigned char macaddr[6];
23512351 extern ssize_t at24_mac_read(unsigned char* addr);
2352
+extern ssize_t at24_mac1_read(unsigned char* addr);
23522353 void rk_get_eth_addr(void *priv, unsigned char *addr)
23532354 {
23542355 struct rk_priv_data *bsp_priv = priv;
23552356 struct device *dev = &bsp_priv->pdev->dev;
23562357 unsigned char ethaddr[ETH_ALEN * MAX_ETH] = {0};
23572358 int ret,i, id = bsp_priv->bus_id;
2359
+ printk("troy test id : %d\n",id);
23582360 #if 0
23592361 rk_devinfo_get_eth_mac(addr);
23602362 if (is_valid_ether_addr(addr))
....@@ -2388,19 +2390,32 @@
23882390 }
23892391 #endif
23902392 #if 1
2391
- if (at24_mac_read(macaddr) > 0) {
2392
- printk("ben %s: at24_mac_read Success!! \n", __func__);
2393
- memcpy(addr, macaddr, 6);
2394
-
2395
- printk("Read the Ethernet MAC address from :");
2396
- for (i = 0; i < 5; i++)
2397
- printk("%2.2x:", addr[i]);
2398
-
2399
- printk("%2.2x\n", addr[i]);
2400
- } else {
2393
+ if (id == 1 ){
2394
+ if (at24_mac_read(macaddr) > 0) {
2395
+ printk("ben %s: at24_mac_read Success!! \n", __func__);
2396
+ memcpy(addr, macaddr, 6);
2397
+ printk("Read the Ethernet MAC address from :");
2398
+ for (i = 0; i < 5; i++)
2399
+ printk("%2.2x:", addr[i]);
2400
+ } else {
24012401 printk("ben %s: at24_mac_read Failed!! \n", __func__);
24022402 goto out;
2403
- }
2403
+ }
2404
+ }
2405
+ else
2406
+ {
2407
+ if (at24_mac1_read(macaddr) > 0) {
2408
+ printk("ben %s: at24_mac_read Success!! \n", __func__);
2409
+ memcpy(addr, macaddr, 6);
2410
+ printk("Read the Ethernet MAC address from :");
2411
+ for (i = 0; i < 5; i++)
2412
+ printk("%2.2x:", addr[i]);
2413
+ } else {
2414
+ printk("ben %s: at24_mac_read Failed!! \n", __func__);
2415
+ goto out;
2416
+ }
2417
+ }
2418
+
24042419 #endif
24052420
24062421 out: