* [PATCH net] net: phy: re-apply PHY fixups during phy_register_device
@ 2014-07-28 21:57 Florian Fainelli
2014-07-28 22:13 ` Jonas Gorski
0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2014-07-28 21:57 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.
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.
Reported-by: Hauke Mehrtens <hauke@hauke-m.de>
Reported-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
This changes is applicable to 3.14+ thanks!
drivers/net/phy/phy_device.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 74a82328dd49..1759d54682c8 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -355,6 +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 */
+ phy_scan_fixups(phydev);
err = phy_init_hw(phydev);
if (err) {
pr_err("PHY %d failed to initialize\n", phydev->addr);
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: phy: re-apply PHY fixups during phy_register_device
2014-07-28 21:57 [PATCH net] net: phy: re-apply PHY fixups during phy_register_device Florian Fainelli
@ 2014-07-28 22:13 ` Jonas Gorski
2014-07-28 22:14 ` Florian Fainelli
0 siblings, 1 reply; 3+ messages in thread
From: Jonas Gorski @ 2014-07-28 22:13 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, hauke
On Mon, 28 Jul 2014 14:57:25 -0700
Florian Fainelli <f.fainelli@gmail.com> wrote:
> 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.
>
> 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.
>
> Reported-by: Hauke Mehrtens <hauke@hauke-m.de>
> Reported-by: Jonas Gorski <jogo@openwrt.org>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> This changes is applicable to 3.14+ thanks!
>
> drivers/net/phy/phy_device.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 74a82328dd49..1759d54682c8 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -355,6 +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 */
> + phy_scan_fixups(phydev);
> err = phy_init_hw(phydev);
You can safely remove the call to phy_init_hw(), as it will do nothing:
int phy_init_hw(struct phy_device *phydev)
{
int ret = 0;
if (!phydev->drv || ...) <- always true at this point
return 0;
Also you should check the return value of phy_scan_fixups.
> if (err) {
> pr_err("PHY %d failed to initialize\n", phydev->addr);
So this can be actually hit.
Jonas
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: phy: re-apply PHY fixups during phy_register_device
2014-07-28 22:13 ` Jonas Gorski
@ 2014-07-28 22:14 ` Florian Fainelli
0 siblings, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2014-07-28 22:14 UTC (permalink / raw)
To: Jonas Gorski; +Cc: netdev, David Miller, Hauke Mehrtens
2014-07-28 15:13 GMT-07:00 Jonas Gorski <jogo@openwrt.org>:
> On Mon, 28 Jul 2014 14:57:25 -0700
> Florian Fainelli <f.fainelli@gmail.com> wrote:
>
>> 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.
>>
>> 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.
>>
>> Reported-by: Hauke Mehrtens <hauke@hauke-m.de>
>> Reported-by: Jonas Gorski <jogo@openwrt.org>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>> This changes is applicable to 3.14+ thanks!
>>
>> drivers/net/phy/phy_device.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
>> index 74a82328dd49..1759d54682c8 100644
>> --- a/drivers/net/phy/phy_device.c
>> +++ b/drivers/net/phy/phy_device.c
>> @@ -355,6 +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 */
>> + phy_scan_fixups(phydev);
>> err = phy_init_hw(phydev);
>
> You can safely remove the call to phy_init_hw(), as it will do nothing:
>
> int phy_init_hw(struct phy_device *phydev)
> {
> int ret = 0;
>
> if (!phydev->drv || ...) <- always true at this point
> return 0;
>
>
> Also you should check the return value of phy_scan_fixups.
>
>> if (err) {
>> pr_err("PHY %d failed to initialize\n", phydev->addr);
>
> So this can be actually hit.
Good catch, I will resubmit a v2 shortly, thanks!
--
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-28 22:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-28 21:57 [PATCH net] net: phy: re-apply PHY fixups during phy_register_device Florian Fainelli
2014-07-28 22:13 ` Jonas Gorski
2014-07-28 22:14 ` Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox