* [PATCH net v2] net: phy: re-apply PHY fixups during phy_register_device
@ 2014-07-28 23:28 Florian Fainelli
2014-07-29 19:26 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2014-07-28 23:28 UTC (permalink / raw)
To: netdev; +Cc: davem, jogo, hauke, Florian Fainelli
Commit 87aa9f9c61ad ("net: phy: consolidate PHY reset in phy_init_hw()")
moved the call to phy_scan_fixups() in phy_init_hw() after a software
reset is performed.
By the time phy_init_hw() is called in phy_device_register(), no driver
has been bound to this PHY yet, so all the checks in phy_init_hw()
against the PHY driver and the PHY driver's config_init function will
return 0. We will therefore never call phy_scan_fixups() as we should.
Fix this by calling phy_scan_fixups() and check for its return value to
restore the intended functionality.
This broke PHY drivers which do register an early PHY fixup callback to
intercept the PHY probing and do things like changing the 32-bits unique
PHY identifier when a pseudo-PHY address has been used, as well as
board-specific PHY fixups that need to be applied during driver probe
time.
Reported-by: Hauke Merthens <hauke-m@hauke-m.de>
Reported-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v2:
- call phy_scan_fixups directly since this is what we are interested in
- check the phy_scan_fixups return value
Applicable for 3.14+
drivers/net/phy/phy_device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 74a82328dd49..22c57be4dfa0 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -355,7 +355,7 @@ int phy_device_register(struct phy_device *phydev)
phydev->bus->phy_map[phydev->addr] = phydev;
/* Run all of the fixups for this PHY */
- err = phy_init_hw(phydev);
+ err = phy_scan_fixups(phydev);
if (err) {
pr_err("PHY %d failed to initialize\n", phydev->addr);
goto out;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net v2] net: phy: re-apply PHY fixups during phy_register_device
2014-07-28 23:28 [PATCH net v2] net: phy: re-apply PHY fixups during phy_register_device Florian Fainelli
@ 2014-07-29 19:26 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-07-29 19:26 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev, jogo, hauke
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Mon, 28 Jul 2014 16:28:07 -0700
> Commit 87aa9f9c61ad ("net: phy: consolidate PHY reset in phy_init_hw()")
> moved the call to phy_scan_fixups() in phy_init_hw() after a software
> reset is performed.
>
> By the time phy_init_hw() is called in phy_device_register(), no driver
> has been bound to this PHY yet, so all the checks in phy_init_hw()
> against the PHY driver and the PHY driver's config_init function will
> return 0. We will therefore never call phy_scan_fixups() as we should.
>
> Fix this by calling phy_scan_fixups() and check for its return value to
> restore the intended functionality.
>
> This broke PHY drivers which do register an early PHY fixup callback to
> intercept the PHY probing and do things like changing the 32-bits unique
> PHY identifier when a pseudo-PHY address has been used, as well as
> board-specific PHY fixups that need to be applied during driver probe
> time.
>
> Reported-by: Hauke Merthens <hauke-m@hauke-m.de>
> Reported-by: Jonas Gorski <jogo@openwrt.org>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> Changes in v2:
> - call phy_scan_fixups directly since this is what we are interested in
> - check the phy_scan_fixups return value
>
> Applicable for 3.14+
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-29 19:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-28 23:28 [PATCH net v2] net: phy: re-apply PHY fixups during phy_register_device Florian Fainelli
2014-07-29 19:26 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).