The mdiobus_scan logic is currently hardcoded to only work with c22 devices. This works fairly well in most cases, but its possible that a c45 device doesn't respond despite being a standard phy. If the parent hardware is capable, it makes sense to scan for c22 devices before falling back to c45. As we want this to reflect the capabilities of the STA, lets add a field to the mii_bus structure to represent the capability. That way devices can opt into the extended scanning. Existing users should continue to default to c22 only scanning as long as they are zero'ing the structure before use.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -298,6 +298,14 @@ struct mii_bus { · 297 unmodified lines | |||
| 298 | /* RESET GPIO descriptor pointer */ | 298 | /* RESET GPIO descriptor pointer */ |
| 299 | struct gpio_desc *reset_gpiod; | 299 | struct gpio_desc *reset_gpiod; |
| 300 | 300 | ||
| 301 | /* bus capabilities, used for probing */ | ||
| 302 | enum { | ||
| 303 | MDIOBUS_NO_CAP = 0, | ||
| 304 | MDIOBUS_C22, | ||
| 305 | MDIOBUS_C45, | ||
| 306 | MDIOBUS_C22_C45, | ||
| 307 | } probe_capabilities; | ||
| 308 | |||
| 301 | /* protect access to the shared element */ | 309 | /* protect access to the shared element */ |
| 302 | struct mutex shared_lock; | 310 | struct mutex shared_lock; |
| 303 | 311 | ||