hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/drivers/net/phy/rockchip.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0+
12 /**
23 * drivers/net/phy/rockchip.c
34 *
....@@ -6,12 +7,6 @@
67 * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
78 *
89 * David Wu <david.wu@rock-chips.com>
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; either version 2 of the License, or
13
- * (at your option) any later version.
14
- *
1510 */
1611
1712 #include <linux/ethtool.h>
....@@ -109,41 +104,14 @@
109104
110105 static void rockchip_link_change_notify(struct phy_device *phydev)
111106 {
112
- int speed = SPEED_10;
113
-
114
- if (phydev->autoneg == AUTONEG_ENABLE) {
115
- int reg = phy_read(phydev, MII_SPECIAL_CONTROL_STATUS);
116
-
117
- if (reg < 0) {
118
- phydev_err(phydev, "phy_read err: %d.\n", reg);
119
- return;
120
- }
121
-
122
- if (reg & MII_SPEED_100)
123
- speed = SPEED_100;
124
- else if (reg & MII_SPEED_10)
125
- speed = SPEED_10;
126
- } else {
127
- int bmcr = phy_read(phydev, MII_BMCR);
128
-
129
- if (bmcr < 0) {
130
- phydev_err(phydev, "phy_read err: %d.\n", bmcr);
131
- return;
132
- }
133
-
134
- if (bmcr & BMCR_SPEED100)
135
- speed = SPEED_100;
136
- else
137
- speed = SPEED_10;
138
- }
139
-
140107 /*
141108 * If mode switch happens from 10BT to 100BT, all DSP/AFE
142109 * registers are set to default values. So any AFE/DSP
143110 * registers have to be re-initialized in this case.
144111 */
145
- if ((phydev->speed == SPEED_10) && (speed == SPEED_100)) {
112
+ if (phydev->state == PHY_RUNNING && phydev->speed == SPEED_100) {
146113 int ret = rockchip_integrated_phy_analog_init(phydev);
114
+
147115 if (ret)
148116 phydev_err(phydev, "rockchip_integrated_phy_analog_init err: %d.\n",
149117 ret);
....@@ -207,7 +175,7 @@
207175 .phy_id = INTERNAL_EPHY_ID,
208176 .phy_id_mask = 0xfffffff0,
209177 .name = "Rockchip integrated EPHY",
210
- .features = PHY_BASIC_FEATURES,
178
+ /* PHY_BASIC_FEATURES */
211179 .flags = 0,
212180 .link_change_notify = rockchip_link_change_notify,
213181 .soft_reset = genphy_soft_reset,
....@@ -229,4 +197,4 @@
229197
230198 MODULE_AUTHOR("David Wu <david.wu@rock-chips.com>");
231199 MODULE_DESCRIPTION("Rockchip Ethernet PHY driver");
232
-MODULE_LICENSE("GPL v2");
200
+MODULE_LICENSE("GPL");