devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] fix macb phy probe failure if phy-reset is not handled
@ 2020-11-10 15:22 Sagar Shrikant Kadam
  2020-11-10 15:22 ` [PATCH v2 1/3] dts: phy: fix missing mdio device and probe failure of vsc8541-01 device Sagar Shrikant Kadam
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Sagar Shrikant Kadam @ 2020-11-10 15:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-riscv, devicetree, kernel, atish.patra, alistair.francis,
	anup, yash.shah, aou, palmer, paul.walmsley, robh+dt,
	Sagar Shrikant Kadam

HiFive Unleashed is having VSC8541-01 ethernet phy device and requires a
specific reset sequence of 0-1-0-1 in order to use it in unmanaged mode.
This series addresses a corner case where phy reset is not handled by boot
stages prior to linux.
Somewhat similar unreliable phy probe failure was reported and discussed
here [1].
The macb driver fails to detect the ethernet phy device if the bootloader
doesn't provide a proper reset sequence to the phy device or the phy itself
is in some invalid state. Currently, the FSBL or u-boot-spl is resetting
the phy device, and so there is no issue observed in the linux network
setup.

The series is based on linux-5.10-rc5.
Patch 1: Add the OUI to the phy dt node to fix issue of missing mdio device
Patch 2 and 3:
	Resetting phy needs GPIO support so add to dt and defconfig.

[1] https://lkml.org/lkml/2018/11/29/154

To reproduce the issue: 
Using FSBL:
1. Comment out VSC8541 reset sequence in fsbl/main.c
   from within the freedom-u540-c000-bootloader.
2. Build and flash fsbl.bin to micro sdcard.

Using u-boot:
1. Comment out VSC8541 reset sequence in board/sifive/fu540/spl.c
   from mainline u-boot source code.
2. Build and flash u-boot binaries to micro sdcard.

Boot the board and bootlog will show network setup failure messages as:

[  1.069474] libphy: MACB_mii_bus: probed
[  1.073092] mdio_bus 10090000.ethernet-ffffffff: MDIO device at address 0
	       is missing 
.....
[  1.979252] macb 10090000.ethernet eth0: Could not attach PHY (-19)

3. Now apply the series build, and boot kernel.
4. MACB and VSC8541 driver get successfully probed and the network is set
   without any failure.


So irrespective of whether the prior stages handle the phy reset sequence,
the probing is successful in both the cases of cold boot and warm boot.

Change History:
===============================
V2:
-Rebased v1 on linux kernel v5.10-rc3.

V1:
-Ignore 4th patch as suggested and so removed it from the series.
-Verified this series on 5.7-rc5.

V0: Base RFC patch. Verified on 5.7-rc2

Sagar Shrikant Kadam (3):
  dts: phy: fix missing mdio device and probe failure of vsc8541-01
    device
  dts: phy: add GPIO number and active state used for phy reset
  riscv: defconfig: enable gpio support for HiFive Unleashed

 arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts | 2 ++
 arch/riscv/configs/defconfig                        | 2 ++
 2 files changed, 4 insertions(+)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/3] dts: phy: fix missing mdio device and probe failure of vsc8541-01 device
  2020-11-10 15:22 [PATCH v2 0/3] fix macb phy probe failure if phy-reset is not handled Sagar Shrikant Kadam
@ 2020-11-10 15:22 ` Sagar Shrikant Kadam
  2020-11-10 15:22 ` [PATCH v2 2/3] dts: phy: add GPIO number and active state used for phy reset Sagar Shrikant Kadam
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Sagar Shrikant Kadam @ 2020-11-10 15:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-riscv, devicetree, kernel, atish.patra, alistair.francis,
	anup, yash.shah, aou, palmer, paul.walmsley, robh+dt,
	Sagar Shrikant Kadam

HiFive unleashed A00 board has VSC8541-01 ethernet phy, this device is
identified as a Revision B device as described in device identification
registers. In order to use this phy in the unmanaged mode, it requires
a specific reset sequence of logical 0-1-0-1 transition on the NRESET pin
as documented here [1].

Currently, the bootloader (fsbl or u-boot-spl) takes care of the phy reset.
If due to some reason the phy device hasn't received the reset by the prior
stages before the linux macb driver comes into the picture, the MACB mii
bus gets probed but the mdio scan fails and is not even able to read the
phy ID registers. It gives an error message:

"libphy: MACB_mii_bus: probed
mdio_bus 10090000.ethernet-ffffffff: MDIO device at address 0 is missing."

Thus adding the device OUI (Organizationally Unique Identifier) to the phy
device node helps to probe the phy device.

[1]: VSC8541-01 datasheet:
https://www.mouser.com/ds/2/523/Microsemi_VSC8541-01_Datasheet_10496_V40-1148034.pdf

Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
---
 arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
index 4a2729f..60846e8 100644
--- a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
+++ b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
@@ -88,6 +88,7 @@
 	phy-mode = "gmii";
 	phy-handle = <&phy0>;
 	phy0: ethernet-phy@0 {
+		compatible = "ethernet-phy-id0007.0771";
 		reg = <0>;
 	};
 };
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/3] dts: phy: add GPIO number and active state used for phy reset
  2020-11-10 15:22 [PATCH v2 0/3] fix macb phy probe failure if phy-reset is not handled Sagar Shrikant Kadam
  2020-11-10 15:22 ` [PATCH v2 1/3] dts: phy: fix missing mdio device and probe failure of vsc8541-01 device Sagar Shrikant Kadam
@ 2020-11-10 15:22 ` Sagar Shrikant Kadam
  2020-11-10 15:22 ` [PATCH v2 3/3] riscv: defconfig: enable gpio support for HiFive Unleashed Sagar Shrikant Kadam
  2021-01-14  5:01 ` [PATCH v2 0/3] fix macb phy probe failure if phy-reset is not handled Palmer Dabbelt
  3 siblings, 0 replies; 8+ messages in thread
From: Sagar Shrikant Kadam @ 2020-11-10 15:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-riscv, devicetree, kernel, atish.patra, alistair.francis,
	anup, yash.shah, aou, palmer, paul.walmsley, robh+dt,
	Sagar Shrikant Kadam

The GEMGXL_RST line on HiFive Unleashed is pulled low and is
using GPIO number 12. Add these reset-gpio details to dt-node
using which the linux phylib can reset the phy.

Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
---
 arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
index 60846e8..24d75a1 100644
--- a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
+++ b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
@@ -90,6 +90,7 @@
 	phy0: ethernet-phy@0 {
 		compatible = "ethernet-phy-id0007.0771";
 		reg = <0>;
+		reset-gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
 	};
 };
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/3] riscv: defconfig: enable gpio support for HiFive Unleashed
  2020-11-10 15:22 [PATCH v2 0/3] fix macb phy probe failure if phy-reset is not handled Sagar Shrikant Kadam
  2020-11-10 15:22 ` [PATCH v2 1/3] dts: phy: fix missing mdio device and probe failure of vsc8541-01 device Sagar Shrikant Kadam
  2020-11-10 15:22 ` [PATCH v2 2/3] dts: phy: add GPIO number and active state used for phy reset Sagar Shrikant Kadam
@ 2020-11-10 15:22 ` Sagar Shrikant Kadam
  2021-01-14  5:01 ` [PATCH v2 0/3] fix macb phy probe failure if phy-reset is not handled Palmer Dabbelt
  3 siblings, 0 replies; 8+ messages in thread
From: Sagar Shrikant Kadam @ 2020-11-10 15:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-riscv, devicetree, kernel, atish.patra, alistair.francis,
	anup, yash.shah, aou, palmer, paul.walmsley, robh+dt,
	Sagar Shrikant Kadam

Ethernet phy VSC8541-01 on HiFive Unleashed has its reset line
connected to a gpio, so enable GPIO driver's required to reset
the phy.

Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
---
 arch/riscv/configs/defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
index d222d35..8c3d1e4 100644
--- a/arch/riscv/configs/defconfig
+++ b/arch/riscv/configs/defconfig
@@ -64,6 +64,8 @@ CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_VIRTIO=y
 CONFIG_SPI=y
 CONFIG_SPI_SIFIVE=y
+CONFIG_GPIOLIB=y
+CONFIG_GPIO_SIFIVE=y
 # CONFIG_PTP_1588_CLOCK is not set
 CONFIG_POWER_RESET=y
 CONFIG_DRM=y
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/3] fix macb phy probe failure if phy-reset is not handled
  2020-11-10 15:22 [PATCH v2 0/3] fix macb phy probe failure if phy-reset is not handled Sagar Shrikant Kadam
                   ` (2 preceding siblings ...)
  2020-11-10 15:22 ` [PATCH v2 3/3] riscv: defconfig: enable gpio support for HiFive Unleashed Sagar Shrikant Kadam
@ 2021-01-14  5:01 ` Palmer Dabbelt
  2021-02-04 10:16   ` Andreas Schwab
  3 siblings, 1 reply; 8+ messages in thread
From: Palmer Dabbelt @ 2021-01-14  5:01 UTC (permalink / raw)
  To: sagar.kadam
  Cc: linux-kernel, linux-riscv, devicetree, kernel, Atish Patra,
	Alistair Francis, anup, yash.shah, aou, Paul Walmsley, robh+dt,
	sagar.kadam

On Tue, 10 Nov 2020 07:22:09 PST (-0800), sagar.kadam@sifive.com wrote:
> HiFive Unleashed is having VSC8541-01 ethernet phy device and requires a
> specific reset sequence of 0-1-0-1 in order to use it in unmanaged mode.
> This series addresses a corner case where phy reset is not handled by boot
> stages prior to linux.
> Somewhat similar unreliable phy probe failure was reported and discussed
> here [1].
> The macb driver fails to detect the ethernet phy device if the bootloader
> doesn't provide a proper reset sequence to the phy device or the phy itself
> is in some invalid state. Currently, the FSBL or u-boot-spl is resetting
> the phy device, and so there is no issue observed in the linux network
> setup.
>
> The series is based on linux-5.10-rc5.
> Patch 1: Add the OUI to the phy dt node to fix issue of missing mdio device
> Patch 2 and 3:
> 	Resetting phy needs GPIO support so add to dt and defconfig.
>
> [1] https://lkml.org/lkml/2018/11/29/154
>
> To reproduce the issue:
> Using FSBL:
> 1. Comment out VSC8541 reset sequence in fsbl/main.c
>    from within the freedom-u540-c000-bootloader.
> 2. Build and flash fsbl.bin to micro sdcard.
>
> Using u-boot:
> 1. Comment out VSC8541 reset sequence in board/sifive/fu540/spl.c
>    from mainline u-boot source code.
> 2. Build and flash u-boot binaries to micro sdcard.
>
> Boot the board and bootlog will show network setup failure messages as:
>
> [  1.069474] libphy: MACB_mii_bus: probed
> [  1.073092] mdio_bus 10090000.ethernet-ffffffff: MDIO device at address 0
> 	       is missing
> .....
> [  1.979252] macb 10090000.ethernet eth0: Could not attach PHY (-19)
>
> 3. Now apply the series build, and boot kernel.
> 4. MACB and VSC8541 driver get successfully probed and the network is set
>    without any failure.
>
>
> So irrespective of whether the prior stages handle the phy reset sequence,
> the probing is successful in both the cases of cold boot and warm boot.
>
> Change History:
> ===============================
> V2:
> -Rebased v1 on linux kernel v5.10-rc3.
>
> V1:
> -Ignore 4th patch as suggested and so removed it from the series.
> -Verified this series on 5.7-rc5.
>
> V0: Base RFC patch. Verified on 5.7-rc2
>
> Sagar Shrikant Kadam (3):
>   dts: phy: fix missing mdio device and probe failure of vsc8541-01
>     device
>   dts: phy: add GPIO number and active state used for phy reset
>   riscv: defconfig: enable gpio support for HiFive Unleashed
>
>  arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts | 2 ++
>  arch/riscv/configs/defconfig                        | 2 ++
>  2 files changed, 4 insertions(+)

David pointed out I missed these, they're on fixes.  Thanks!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/3] fix macb phy probe failure if phy-reset is not handled
  2021-01-14  5:01 ` [PATCH v2 0/3] fix macb phy probe failure if phy-reset is not handled Palmer Dabbelt
@ 2021-02-04 10:16   ` Andreas Schwab
  2021-02-05  3:41     ` Palmer Dabbelt
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2021-02-04 10:16 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: sagar.kadam, devicetree, aou, kernel, anup, linux-kernel,
	Atish Patra, yash.shah, robh+dt, Alistair Francis, Paul Walmsley,
	linux-riscv

On Jan 13 2021, Palmer Dabbelt wrote:

> On Tue, 10 Nov 2020 07:22:09 PST (-0800), sagar.kadam@sifive.com wrote:
>> HiFive Unleashed is having VSC8541-01 ethernet phy device and requires a
>> specific reset sequence of 0-1-0-1 in order to use it in unmanaged mode.
>> This series addresses a corner case where phy reset is not handled by boot
>> stages prior to linux.
>> Somewhat similar unreliable phy probe failure was reported and discussed
>> here [1].
>> The macb driver fails to detect the ethernet phy device if the bootloader
>> doesn't provide a proper reset sequence to the phy device or the phy itself
>> is in some invalid state. Currently, the FSBL or u-boot-spl is resetting
>> the phy device, and so there is no issue observed in the linux network
>> setup.
>>
>> The series is based on linux-5.10-rc5.
>> Patch 1: Add the OUI to the phy dt node to fix issue of missing mdio device
>> Patch 2 and 3:
>> 	Resetting phy needs GPIO support so add to dt and defconfig.
>>
>> [1] https://lkml.org/lkml/2018/11/29/154
>>
>> To reproduce the issue:
>> Using FSBL:
>> 1. Comment out VSC8541 reset sequence in fsbl/main.c
>>    from within the freedom-u540-c000-bootloader.
>> 2. Build and flash fsbl.bin to micro sdcard.
>>
>> Using u-boot:
>> 1. Comment out VSC8541 reset sequence in board/sifive/fu540/spl.c
>>    from mainline u-boot source code.
>> 2. Build and flash u-boot binaries to micro sdcard.
>>
>> Boot the board and bootlog will show network setup failure messages as:
>>
>> [  1.069474] libphy: MACB_mii_bus: probed
>> [  1.073092] mdio_bus 10090000.ethernet-ffffffff: MDIO device at address 0
>> 	       is missing
>> .....
>> [  1.979252] macb 10090000.ethernet eth0: Could not attach PHY (-19)
>>
>> 3. Now apply the series build, and boot kernel.
>> 4. MACB and VSC8541 driver get successfully probed and the network is set
>>    without any failure.
>>
>>
>> So irrespective of whether the prior stages handle the phy reset sequence,
>> the probing is successful in both the cases of cold boot and warm boot.
>>
>> Change History:
>> ===============================
>> V2:
>> -Rebased v1 on linux kernel v5.10-rc3.
>>
>> V1:
>> -Ignore 4th patch as suggested and so removed it from the series.
>> -Verified this series on 5.7-rc5.
>>
>> V0: Base RFC patch. Verified on 5.7-rc2
>>
>> Sagar Shrikant Kadam (3):
>>   dts: phy: fix missing mdio device and probe failure of vsc8541-01
>>     device
>>   dts: phy: add GPIO number and active state used for phy reset
>>   riscv: defconfig: enable gpio support for HiFive Unleashed
>>
>>  arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts | 2 ++
>>  arch/riscv/configs/defconfig                        | 2 ++
>>  2 files changed, 4 insertions(+)
>
> David pointed out I missed these, they're on fixes.  Thanks!

This is now on 5.10.12, and breaks ethernet on the Hifive Unleashed:

[   12.777976] macb 10090000.ethernet: Registered clk switch 'sifive-gemgxl-mgmt'
[   12.784559] macb 10090000.ethernet: GEM doesn't support hardware ptp.
[   12.791629] libphy: MACB_mii_bus: probed
[   12.919728] MACsec IEEE 802.1AE
[   12.984676] macb 10090000.ethernet eth0: Cadence GEM rev 0x10070109 at 0x10090000 irq 16 (70:b3:d5:92:f1:07)
[   14.030319] Microsemi VSC8541 SyncE 10090000.ethernet-ffffffff:00: phy_poll_reset failed: -110
[   14.038986] macb 10090000.ethernet eth0: Could not attach PHY (-110)

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/3] fix macb phy probe failure if phy-reset is not handled
  2021-02-04 10:16   ` Andreas Schwab
@ 2021-02-05  3:41     ` Palmer Dabbelt
  2021-02-06 10:27       ` David Abdurachmanov
  0 siblings, 1 reply; 8+ messages in thread
From: Palmer Dabbelt @ 2021-02-05  3:41 UTC (permalink / raw)
  To: schwab
  Cc: sagar.kadam, devicetree, aou, kernel, anup, linux-kernel,
	Atish Patra, yash.shah, robh+dt, Alistair Francis, Paul Walmsley,
	linux-riscv

On Thu, 04 Feb 2021 02:16:54 PST (-0800), schwab@linux-m68k.org wrote:
> On Jan 13 2021, Palmer Dabbelt wrote:
>
>> On Tue, 10 Nov 2020 07:22:09 PST (-0800), sagar.kadam@sifive.com wrote:
>>> HiFive Unleashed is having VSC8541-01 ethernet phy device and requires a
>>> specific reset sequence of 0-1-0-1 in order to use it in unmanaged mode.
>>> This series addresses a corner case where phy reset is not handled by boot
>>> stages prior to linux.
>>> Somewhat similar unreliable phy probe failure was reported and discussed
>>> here [1].
>>> The macb driver fails to detect the ethernet phy device if the bootloader
>>> doesn't provide a proper reset sequence to the phy device or the phy itself
>>> is in some invalid state. Currently, the FSBL or u-boot-spl is resetting
>>> the phy device, and so there is no issue observed in the linux network
>>> setup.
>>>
>>> The series is based on linux-5.10-rc5.
>>> Patch 1: Add the OUI to the phy dt node to fix issue of missing mdio device
>>> Patch 2 and 3:
>>> 	Resetting phy needs GPIO support so add to dt and defconfig.
>>>
>>> [1] https://lkml.org/lkml/2018/11/29/154
>>>
>>> To reproduce the issue:
>>> Using FSBL:
>>> 1. Comment out VSC8541 reset sequence in fsbl/main.c
>>>    from within the freedom-u540-c000-bootloader.
>>> 2. Build and flash fsbl.bin to micro sdcard.
>>>
>>> Using u-boot:
>>> 1. Comment out VSC8541 reset sequence in board/sifive/fu540/spl.c
>>>    from mainline u-boot source code.
>>> 2. Build and flash u-boot binaries to micro sdcard.
>>>
>>> Boot the board and bootlog will show network setup failure messages as:
>>>
>>> [  1.069474] libphy: MACB_mii_bus: probed
>>> [  1.073092] mdio_bus 10090000.ethernet-ffffffff: MDIO device at address 0
>>> 	       is missing
>>> .....
>>> [  1.979252] macb 10090000.ethernet eth0: Could not attach PHY (-19)
>>>
>>> 3. Now apply the series build, and boot kernel.
>>> 4. MACB and VSC8541 driver get successfully probed and the network is set
>>>    without any failure.
>>>
>>>
>>> So irrespective of whether the prior stages handle the phy reset sequence,
>>> the probing is successful in both the cases of cold boot and warm boot.
>>>
>>> Change History:
>>> ===============================
>>> V2:
>>> -Rebased v1 on linux kernel v5.10-rc3.
>>>
>>> V1:
>>> -Ignore 4th patch as suggested and so removed it from the series.
>>> -Verified this series on 5.7-rc5.
>>>
>>> V0: Base RFC patch. Verified on 5.7-rc2
>>>
>>> Sagar Shrikant Kadam (3):
>>>   dts: phy: fix missing mdio device and probe failure of vsc8541-01
>>>     device
>>>   dts: phy: add GPIO number and active state used for phy reset
>>>   riscv: defconfig: enable gpio support for HiFive Unleashed
>>>
>>>  arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts | 2 ++
>>>  arch/riscv/configs/defconfig                        | 2 ++
>>>  2 files changed, 4 insertions(+)
>>
>> David pointed out I missed these, they're on fixes.  Thanks!
>
> This is now on 5.10.12, and breaks ethernet on the Hifive Unleashed:
>
> [   12.777976] macb 10090000.ethernet: Registered clk switch 'sifive-gemgxl-mgmt'
> [   12.784559] macb 10090000.ethernet: GEM doesn't support hardware ptp.
> [   12.791629] libphy: MACB_mii_bus: probed
> [   12.919728] MACsec IEEE 802.1AE
> [   12.984676] macb 10090000.ethernet eth0: Cadence GEM rev 0x10070109 at 0x10090000 irq 16 (70:b3:d5:92:f1:07)
> [   14.030319] Microsemi VSC8541 SyncE 10090000.ethernet-ffffffff:00: phy_poll_reset failed: -110
> [   14.038986] macb 10090000.ethernet eth0: Could not attach PHY (-110)

Sorry about that.  Looks like we forgot to add the special reset sequence to
the VSC8541, which the driver doesn't yet support (there's a thread about it,
but I guess I forgot to clean up the patch).  IIUC this should manifest on
master as well, so my guess is that nobody is testing the HiFive Unleashed any
more (probably a bad sign).

I'll send out a revert.  I looked at the GPIO driver and can't tell if it's
twiddling GPIO lines when probed, in which case just enabling the GPIO would
break the ethernet.  Hopefully we're OK with the GPIO driver enabled.

Thanks for testing this.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/3] fix macb phy probe failure if phy-reset is not handled
  2021-02-05  3:41     ` Palmer Dabbelt
@ 2021-02-06 10:27       ` David Abdurachmanov
  0 siblings, 0 replies; 8+ messages in thread
From: David Abdurachmanov @ 2021-02-06 10:27 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: Andreas Schwab, devicetree, Albert Ou, kernel, Anup Patel,
	linux-kernel@vger.kernel.org List, Atish Patra, Yash Shah,
	robh+dt, Alistair Francis, sagar.kadam, Paul Walmsley,
	linux-riscv

On Fri, Feb 5, 2021 at 5:42 AM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Thu, 04 Feb 2021 02:16:54 PST (-0800), schwab@linux-m68k.org wrote:
> > On Jan 13 2021, Palmer Dabbelt wrote:
> >
> >> On Tue, 10 Nov 2020 07:22:09 PST (-0800), sagar.kadam@sifive.com wrote:
> >>> HiFive Unleashed is having VSC8541-01 ethernet phy device and requires a
> >>> specific reset sequence of 0-1-0-1 in order to use it in unmanaged mode.
> >>> This series addresses a corner case where phy reset is not handled by boot
> >>> stages prior to linux.
> >>> Somewhat similar unreliable phy probe failure was reported and discussed
> >>> here [1].
> >>> The macb driver fails to detect the ethernet phy device if the bootloader
> >>> doesn't provide a proper reset sequence to the phy device or the phy itself
> >>> is in some invalid state. Currently, the FSBL or u-boot-spl is resetting
> >>> the phy device, and so there is no issue observed in the linux network
> >>> setup.
> >>>
> >>> The series is based on linux-5.10-rc5.
> >>> Patch 1: Add the OUI to the phy dt node to fix issue of missing mdio device
> >>> Patch 2 and 3:
> >>>     Resetting phy needs GPIO support so add to dt and defconfig.
> >>>
> >>> [1] https://lkml.org/lkml/2018/11/29/154
> >>>
> >>> To reproduce the issue:
> >>> Using FSBL:
> >>> 1. Comment out VSC8541 reset sequence in fsbl/main.c
> >>>    from within the freedom-u540-c000-bootloader.
> >>> 2. Build and flash fsbl.bin to micro sdcard.
> >>>
> >>> Using u-boot:
> >>> 1. Comment out VSC8541 reset sequence in board/sifive/fu540/spl.c
> >>>    from mainline u-boot source code.
> >>> 2. Build and flash u-boot binaries to micro sdcard.
> >>>
> >>> Boot the board and bootlog will show network setup failure messages as:
> >>>
> >>> [  1.069474] libphy: MACB_mii_bus: probed
> >>> [  1.073092] mdio_bus 10090000.ethernet-ffffffff: MDIO device at address 0
> >>>            is missing
> >>> .....
> >>> [  1.979252] macb 10090000.ethernet eth0: Could not attach PHY (-19)
> >>>
> >>> 3. Now apply the series build, and boot kernel.
> >>> 4. MACB and VSC8541 driver get successfully probed and the network is set
> >>>    without any failure.
> >>>
> >>>
> >>> So irrespective of whether the prior stages handle the phy reset sequence,
> >>> the probing is successful in both the cases of cold boot and warm boot.
> >>>
> >>> Change History:
> >>> ===============================
> >>> V2:
> >>> -Rebased v1 on linux kernel v5.10-rc3.
> >>>
> >>> V1:
> >>> -Ignore 4th patch as suggested and so removed it from the series.
> >>> -Verified this series on 5.7-rc5.
> >>>
> >>> V0: Base RFC patch. Verified on 5.7-rc2
> >>>
> >>> Sagar Shrikant Kadam (3):
> >>>   dts: phy: fix missing mdio device and probe failure of vsc8541-01
> >>>     device
> >>>   dts: phy: add GPIO number and active state used for phy reset
> >>>   riscv: defconfig: enable gpio support for HiFive Unleashed
> >>>
> >>>  arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts | 2 ++
> >>>  arch/riscv/configs/defconfig                        | 2 ++
> >>>  2 files changed, 4 insertions(+)
> >>
> >> David pointed out I missed these, they're on fixes.  Thanks!
> >
> > This is now on 5.10.12, and breaks ethernet on the Hifive Unleashed:
> >
> > [   12.777976] macb 10090000.ethernet: Registered clk switch 'sifive-gemgxl-mgmt'
> > [   12.784559] macb 10090000.ethernet: GEM doesn't support hardware ptp.
> > [   12.791629] libphy: MACB_mii_bus: probed
> > [   12.919728] MACsec IEEE 802.1AE
> > [   12.984676] macb 10090000.ethernet eth0: Cadence GEM rev 0x10070109 at 0x10090000 irq 16 (70:b3:d5:92:f1:07)
> > [   14.030319] Microsemi VSC8541 SyncE 10090000.ethernet-ffffffff:00: phy_poll_reset failed: -110
> > [   14.038986] macb 10090000.ethernet eth0: Could not attach PHY (-110)
>
> Sorry about that.  Looks like we forgot to add the special reset sequence to
> the VSC8541, which the driver doesn't yet support (there's a thread about it,
> but I guess I forgot to clean up the patch).  IIUC this should manifest on
> master as well, so my guess is that nobody is testing the HiFive Unleashed any
> more (probably a bad sign).

BayLibre has Unleashed connected to KernelCI. I did notice:

[..]
08:24:37.572482  <3>[    2.022855] Microsemi VSC8541 SyncE
10090000.ethernet-ffffffff:00: phy_poll_reset failed: -110
08:24:37.574273  <3>[    2.031882] macb 10090000.ethernet eth0: Could
not attach PHY (-110)
08:24:37.575304  <3>[    2.037772] IP-Config: Failed to open eth0
08:24:37.576087  <3>[    2.042087] IP-Config: No network devices available
08:24:37.576863  <6>[    2.053662] Freeing unused kernel memory: 2144K
08:24:37.577412  <6>[    2.057794] Run /init as init process
[..]

in KCIDB.

I don't use KernelCI extensively, but today at FOSDEM I was told that
KernelCI also incl. "including maintainer ones".

I guess the idea would be to check and ensure that all relevant trees
are tested in KernelCI.


>
> I'll send out a revert.  I looked at the GPIO driver and can't tell if it's
> twiddling GPIO lines when probed, in which case just enabling the GPIO would
> break the ethernet.  Hopefully we're OK with the GPIO driver enabled.
>
> Thanks for testing this.
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-02-06 10:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 15:22 [PATCH v2 0/3] fix macb phy probe failure if phy-reset is not handled Sagar Shrikant Kadam
2020-11-10 15:22 ` [PATCH v2 1/3] dts: phy: fix missing mdio device and probe failure of vsc8541-01 device Sagar Shrikant Kadam
2020-11-10 15:22 ` [PATCH v2 2/3] dts: phy: add GPIO number and active state used for phy reset Sagar Shrikant Kadam
2020-11-10 15:22 ` [PATCH v2 3/3] riscv: defconfig: enable gpio support for HiFive Unleashed Sagar Shrikant Kadam
2021-01-14  5:01 ` [PATCH v2 0/3] fix macb phy probe failure if phy-reset is not handled Palmer Dabbelt
2021-02-04 10:16   ` Andreas Schwab
2021-02-05  3:41     ` Palmer Dabbelt
2021-02-06 10:27       ` David Abdurachmanov

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).