lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 10 Dec 2013 18:36:49 +0100
From:	Rafał Miłecki <zajec5@...il.com>
To:	Florian Fainelli <f.fainelli@...il.com>
Cc:	netdev <netdev@...r.kernel.org>,
	"David S. Miller" <davem@...emloft.net>,
	Hauke Mehrtens <hauke@...ke-m.de>
Subject: Re: [PATCH 1/2] bgmac: drop duplicated PHY defines

2013/12/10 Florian Fainelli <f.fainelli@...il.com>:
> Hello Rafal
>
> 2013/12/10 Rafał Miłecki <zajec5@...il.com>:
>> Signed-off-by: Rafał Miłecki <zajec5@...il.com>
>> ---
>>  drivers/net/ethernet/broadcom/bgmac.c |    6 ++----
>>  drivers/net/ethernet/broadcom/bgmac.h |   21 ---------------------
>>  2 files changed, 2 insertions(+), 25 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
>> index 0452937..ad4b2f1 100644
>> --- a/drivers/net/ethernet/broadcom/bgmac.c
>> +++ b/drivers/net/ethernet/broadcom/bgmac.c
>> @@ -725,11 +725,9 @@ static void bgmac_phy_reset(struct bgmac *bgmac)
>>         if (bgmac->phyaddr == BGMAC_PHY_NOREGS)
>>                 return;
>>
>> -       bgmac_phy_write(bgmac, bgmac->phyaddr, BGMAC_PHY_CTL,
>> -                       BGMAC_PHY_CTL_RESET);
>> +       bgmac_phy_write(bgmac, bgmac->phyaddr, MII_BMCR, BMCR_RESET);
>>         udelay(100);
>> -       if (bgmac_phy_read(bgmac, bgmac->phyaddr, BGMAC_PHY_CTL) &
>> -           BGMAC_PHY_CTL_RESET)
>> +       if (bgmac_phy_read(bgmac, bgmac->phyaddr, MII_BMCR) & BMCR_RESET)
>>                 bgmac_err(bgmac, "PHY reset failed\n");
>>         bgmac_phy_init(bgmac);
>
> phy_init_hw() now issues a PHY reset through BMCR_RESET, you might
> want to use it instead of this here:
>
> - the 100 microseconds delay might not be sufficient for all PHYs out there
> - any PHY fixup (although there are none for BCM47xx yet) would be
> wiped out by this "wild" PHY reset
>
> This is quite new, so I do not expect you knew about this.

Thanks for pointing that! I was looking for BMCR_RESET usages with:
http://lxr.free-electrons.com/ident?v=3.12;i=BMCR_RESET
but it didn't find any interesting (because it uses 3.12 kernel sources).

This udelay is from specs based on Broadcom's code. What you have in
phy_poll_reset sounds indeed much more sane.

If you take a look at bgmac_phy_init, it actually has kind of fixups.
They are just programmed per-Broadcom chip id and not per PHY id as
you normally do that with phy_register_fixup_for_uid. But I think we
should be able to workaround that.

So I fully agree we should use phy_init_hw, but I think we should
implement that in a separated patch and on top of PHY cleanups I
recently did. Just to simplify bisecting potential regressions.

Are you OK with applying this patch as-is and working on another one
cleaning PHY reset/init in a nicer way?

-- 
Rafał
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ