hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
....@@ -1101,6 +1101,55 @@
11011101 }
11021102 }
11031103
1104
+#if 0
1105
+static void rtl8211F_led_control(struct phy_device *phydev)
1106
+{
1107
+ printk("ben debug:rtl8211F_led_control...1 \n");
1108
+
1109
+ if(!phydev) return;
1110
+ if(phydev->phy_id!=0x001cc916) return; /* only for 8211E*/
1111
+
1112
+ /*switch to extension page44*/
1113
+ phy_write(phydev, 31, 0x0d04);
1114
+//add hc 1000M --> orange
1115
+// 100M --> green
1116
+ phy_write(phydev, 16, 0x6D02);
1117
+//add hc 1000M&100M --> green
1118
+// phy_write(phydev, 16, 0x6C0A);
1119
+ printk("ben debug:rtl8211F_led_control...2 \n");
1120
+}
1121
+#endif
1122
+#define RTL_8211F_PHY_ID 0x001cc916
1123
+#define RTL_8211F_PHY_ID_MASK 0x001fffff
1124
+#define RTL_8211F_PAGE_SELECT 0x1f
1125
+#define RTL_8211F_LCR_ADDR 0x10
1126
+
1127
+#define GREEN_LED 0
1128
+#define YELLOW0_LED 1
1129
+#define YELLOW1_LED 2
1130
+
1131
+static int rtl8211F_led_control(struct phy_device *phydev)
1132
+{
1133
+ unsigned int temp;
1134
+
1135
+ printk("<<<<<<ben test led ctrl start... %s\n",__FUNCTION__);
1136
+ if(!phydev) return 0;
1137
+ if(phydev->phy_id!=0x001cc916) return 0; /* only for 8211E*/
1138
+
1139
+ phy_write(phydev, 31, 0xd04);
1140
+ temp = 0x02 << (5 * GREEN_LED);
1141
+ temp |= 0x08 << (5 * YELLOW0_LED);
1142
+
1143
+ temp |= 0x1b << (5 * YELLOW1_LED);
1144
+ phy_write(phydev, 0x10, temp);
1145
+
1146
+ temp = 1 << (YELLOW1_LED + 1);
1147
+ phy_write(phydev, 0x11, 0x00);
1148
+ phy_write(phydev, 31, 0);
1149
+
1150
+ return 0;
1151
+}
1152
+
11041153 /**
11051154 * stmmac_init_phy - PHY initialization
11061155 * @dev: net device structure
....@@ -1115,28 +1164,43 @@
11151164 struct device_node *node;
11161165 int ret;
11171166
1167
+
1168
+ printk("ben stmmac_init_phy .. \n");
1169
+ mdelay(2000);
1170
+ printk("ben stmmac_init_phy delay .. \n");
11181171 if (priv->plat->integrated_phy_power)
11191172 ret = priv->plat->integrated_phy_power(priv->plat->bsp_priv, true);
11201173
11211174 node = priv->plat->phylink_node;
11221175
11231176 if (node)
1177
+ {
1178
+ //printk("ben ttt.. \n");
11241179 ret = phylink_of_phy_connect(priv->phylink, node, 0);
1180
+ //printk("ben ttt:%d \n", ret);
1181
+ }
11251182
11261183 /* Some DT bindings do not set-up the PHY handle. Let's try to
11271184 * manually parse it
11281185 */
1186
+ //printk("ben:stmmac_init_phy..1 \n");
11291187 if (!node || ret) {
1188
+ //if (1) {
11301189 int addr = priv->plat->phy_addr;
11311190 struct phy_device *phydev;
11321191
1192
+ //printk("ben:stmmac_init_phy..2 \n");
11331193 phydev = mdiobus_get_phy(priv->mii, addr);
11341194 if (!phydev) {
11351195 netdev_err(priv->dev, "no phy at addr %d\n", addr);
11361196 return -ENODEV;
11371197 }
11381198
1199
+ //rtl8211F_led_control(phydev);
1200
+
1201
+ //printk("ben:stmmac_init_phy..3 \n");
11391202 ret = phylink_connect_phy(priv->phylink, phydev);
1203
+ //rtl8211F_led_control(phydev);
11401204 }
11411205
11421206 if (!priv->plat->pmt) {
....@@ -1145,7 +1209,6 @@
11451209 phylink_ethtool_get_wol(priv->phylink, &wol);
11461210 device_set_wakeup_capable(priv->device, !!wol.supported);
11471211 }
1148
-
11491212 return ret;
11501213 }
11511214
....@@ -2345,7 +2408,8 @@
23452408 */
23462409 static void stmmac_check_ether_addr(struct stmmac_priv *priv)
23472410 {
2348
- if (!is_valid_ether_addr(priv->dev->dev_addr)) {
2411
+// if (!is_valid_ether_addr(priv->dev->dev_addr)) {
2412
+ if (1) {
23492413 stmmac_get_umac_addr(priv, priv->hw, priv->dev->dev_addr, 0);
23502414 if (likely(priv->plat->get_eth_addr))
23512415 priv->plat->get_eth_addr(priv->plat->bsp_priv,
....@@ -2866,6 +2930,7 @@
28662930 u32 chan;
28672931 int ret;
28682932
2933
+ //printk("ben:stmmac_open.. \n");
28692934 ret = pm_runtime_get_sync(priv->device);
28702935 if (ret < 0) {
28712936 pm_runtime_put_noidle(priv->device);
....@@ -2939,6 +3004,12 @@
29393004 goto init_error;
29403005 }
29413006 }
3007
+
3008
+
3009
+ #if 1
3010
+ printk("ben -------bootup add 2s delay time.\n");
3011
+ mdelay(2500);
3012
+ #endif
29423013
29433014 ret = stmmac_hw_setup(dev, true);
29443015 if (ret < 0) {
....@@ -5228,6 +5299,9 @@
52285299 */
52295300 pm_runtime_put(device);
52305301
5302
+ //add
5303
+ phy_register_fixup_for_uid(RTL_8211F_PHY_ID, RTL_8211F_PHY_ID_MASK, rtl8211F_led_control);
5304
+
52315305 return ret;
52325306
52335307 error_netdev_register:
....@@ -5439,6 +5513,12 @@
54395513 stmmac_free_tx_skbufs(priv);
54405514 stmmac_clear_descriptors(priv);
54415515
5516
+#if 1
5517
+ printk("ben -------resume add 2s delay time.\n");
5518
+ mdelay(2000);
5519
+
5520
+#endif
5521
+
54425522 stmmac_hw_setup(ndev, false);
54435523 stmmac_init_coalesce(priv);
54445524 stmmac_set_rx_mode(ndev);