We will soon support asking the PHY at runtime to determine what features it supports, rather than forcing it to be compile time. But we should probe the PHY first. So probe the phy driver earlier.
Unified · Split
| @@ -2220,6 +2220,18 @@ static int phy_probe(struct device *dev) · 2219 unmodified lines | ||
| 2220 | 2220 | |
| 2221 | 2221 | mutex_lock(&phydev->lock); |
| 2222 | 2222 | |
| 2223 | + if (phydev->drv->probe) { | |
| 2224 | + /* Deassert the reset signal */ | |
| 2225 | + phy_device_reset(phydev, 0); | |
| 2226 | + | |
| 2227 | + err = phydev->drv->probe(phydev); | |
| 2228 | + if (err) { | |
| 2229 | + /* Assert the reset signal */ | |
| 2230 | + phy_device_reset(phydev, 1); | |
| 2231 | + goto out; | |
| 2232 | + } | |
| 2233 | + } | |
| 2234 | + | |
| 2223 | 2235 | /* Start out supporting everything. Eventually, |
| 2224 | 2236 | * a controller will attach, and may modify one |
| 2225 | 2237 | * or both of these values |
| @@ -2267,17 +2279,7 @@ static int phy_probe(struct device *dev) · 41 unmodified lines | ||
| 2267 | 2279 | /* Set the state to READY by default */ |
| 2268 | 2280 | phydev->state = PHY_READY; |
| 2269 | 2281 | |
| 2270 | − if (phydev->drv->probe) { | |
| 2271 | − /* Deassert the reset signal */ | |
| 2272 | − phy_device_reset(phydev, 0); | |
| 2273 | − | |
| 2274 | − err = phydev->drv->probe(phydev); | |
| 2275 | − if (err) { | |
| 2276 | − /* Assert the reset signal */ | |
| 2277 | − phy_device_reset(phydev, 1); | |
| 2278 | − } | |
| 2279 | − } | |
| 2280 | − | |
| 2282 | +out: | |
| 2281 | 2283 | mutex_unlock(&phydev->lock); |
| 2282 | 2284 | |
| 2283 | 2285 | return err; |