.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
---|
1 | 2 | /** |
---|
2 | 3 | * drivers/net/phy/rockchip.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd |
---|
7 | 8 | * |
---|
8 | 9 | * 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 | | - * |
---|
15 | 10 | */ |
---|
16 | 11 | |
---|
17 | 12 | #include <linux/ethtool.h> |
---|
.. | .. |
---|
109 | 104 | |
---|
110 | 105 | static void rockchip_link_change_notify(struct phy_device *phydev) |
---|
111 | 106 | { |
---|
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 | | - |
---|
140 | 107 | /* |
---|
141 | 108 | * If mode switch happens from 10BT to 100BT, all DSP/AFE |
---|
142 | 109 | * registers are set to default values. So any AFE/DSP |
---|
143 | 110 | * registers have to be re-initialized in this case. |
---|
144 | 111 | */ |
---|
145 | | - if ((phydev->speed == SPEED_10) && (speed == SPEED_100)) { |
---|
| 112 | + if (phydev->state == PHY_RUNNING && phydev->speed == SPEED_100) { |
---|
146 | 113 | int ret = rockchip_integrated_phy_analog_init(phydev); |
---|
| 114 | + |
---|
147 | 115 | if (ret) |
---|
148 | 116 | phydev_err(phydev, "rockchip_integrated_phy_analog_init err: %d.\n", |
---|
149 | 117 | ret); |
---|
.. | .. |
---|
207 | 175 | .phy_id = INTERNAL_EPHY_ID, |
---|
208 | 176 | .phy_id_mask = 0xfffffff0, |
---|
209 | 177 | .name = "Rockchip integrated EPHY", |
---|
210 | | - .features = PHY_BASIC_FEATURES, |
---|
| 178 | + /* PHY_BASIC_FEATURES */ |
---|
211 | 179 | .flags = 0, |
---|
212 | 180 | .link_change_notify = rockchip_link_change_notify, |
---|
213 | 181 | .soft_reset = genphy_soft_reset, |
---|
.. | .. |
---|
229 | 197 | |
---|
230 | 198 | MODULE_AUTHOR("David Wu <david.wu@rock-chips.com>"); |
---|
231 | 199 | MODULE_DESCRIPTION("Rockchip Ethernet PHY driver"); |
---|
232 | | -MODULE_LICENSE("GPL v2"); |
---|
| 200 | +MODULE_LICENSE("GPL"); |
---|