Re: [PATCH net v2] net: bcmgenet: Clear ID_MODE_DIS in EXT_RGMII_OOB_CTRL when not needed

From: Marek Szyprowski
Date: Fri May 08 2020 - 02:38:42 EST


Hi Florian,

On 07.05.2020 17:54, Florian Fainelli wrote:
> On 5/7/2020 3:03 AM, Marek Szyprowski wrote:
>> On 07.05.2020 11:46, Marek Szyprowski wrote:
>>> On 25.02.2020 14:11, Nicolas Saenz Julienne wrote:
>>>> Outdated Raspberry Pi 4 firmware might configure the external PHY as
>>>> rgmii although the kernel currently sets it as rgmii-rxid. This makes
>>>> connections unreliable as ID_MODE_DIS is left enabled. To avoid this,
>>>> explicitly clear that bit whenever we don't need it.
>>>>
>>>> Fixes: da38802211cc ("net: bcmgenet: Add RGMII_RXID support")
>>>> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@xxxxxxx>
>>> I've finally bisected the network issue I have on my RPi4 used for
>>> testing mainline builds. The bisect pointed to this patch. Once it got
>>> applied in v5.7-rc1, the networking is broken on my RPi4 in ARM32bit
>>> mode and kernel compiled from bcm2835_defconfig. I'm using u-boot to
>>> tftp zImage/dtb/initrd there. After reverting this patch network is
>>> working fine again. The strange thing is that networking works fine if
>>> kernel is compiled from multi_v7_defconfig but I don't see any obvious
>>> difference there.
>>>
>>> I'm not sure if u-boot is responsible for this break, but kernel
>>> definitely should be able to properly reset the hardware to the valid
>>> state.
>>>
>>> ...
>> Okay, I've played a bit more with this and found that enabling
>> CONFIG_BROADCOM_PHY fixes this network issue. I wonder if Genet driver
>> should simply select CONFIG_BROADCOM_PHY the same way as it selects
>> CONFIG_BCM7XXX_PHY.
> Historically GENET has been deployed with an internal PHY and this is
> still 90% of the GENET users out there on classic Broadcom STB
> platforms, not counting the 2711. For external PHYs, there is a variety
> of options here, so selecting CONFIG_BROADCOM_PHY would be just one of
> the possibilities, I would rather fix this with the bcm2835_defconfig
> and multi_v7_defconfig update. Would that work for you?

Frankly I was surprised that the Genet driver successfully probed and
registered eth0 even when no proper PHY driver was available in the
system. It even reported the link status change, but then didn't
transfer any packets. I expected at least a runtime check and error or
warning if proper PHY is not available. If this is really not possible,
I would still advise to select proper potential PHY drivers, so users
won't be confused.

The Genet driver already selects CONFIG_BCM7XXX_PHY. How common is it?
Would it really hurt do the same for CONFIG_BROADCOM_PHY? I expect that
2711 will be quite popular SoC with it soon.

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland