linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: Fix failing ethernet PHY detection on the LeMaker Banana Pi
@ 2014-11-09 13:28 Karsten Merker
  2014-11-09 13:28 ` [PATCH] ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator Karsten Merker
  2014-11-11 23:01 ` [PATCH V2 0/1] ARM: dts: Fix failing ethernet PHY detection on the LeMaker Banana Pi Karsten Merker
  0 siblings, 2 replies; 8+ messages in thread
From: Karsten Merker @ 2014-11-09 13:28 UTC (permalink / raw)
  To: linux-arm-kernel

While testing the daily builds of the Debian-Installer (d-i) on the
LeMaker Banana Pi (a small, Allwinner A20-based board), I found that
within the installer environment, the detection of the external Realtek
ethernet PHY connected to the Allwinner A20 GMAC fails upon first
loading of the stmmac driver:

[   77.235117] stmmaceth 1c50000.ethernet: no reset control found
[   77.235192]  Ring mode enabled
[   77.235202]  No HW DMA feature register supported
[   77.235211]  Normal descriptors
[   77.235219]  TX Checksum insertion supported
[   77.242678] libphy: stmmac: probed
[   77.242708] eth0: No PHY found

Just unloading the stmmac module and immediately afterwards 
modprobing it again results in proper detection of the PHY:

[  148.823456] stmmaceth 1c50000.ethernet: no reset control found
[  148.823487]  Ring mode enabled
[  148.823496]  No HW DMA feature register supported
[  148.823502]  Normal descriptors
[  148.823509]  TX Checksum insertion supported
[  148.854654] libphy: stmmac: probed
[  148.854683] eth0: PHY ID 001cc915 at 0 IRQ POLL (stmmac-0:00) active
[  148.854694] eth0: PHY ID 001cc915 at 1 IRQ POLL (stmmac-0:01)

On the Banana Pi, the PHY power supply is handled by a GPIO-controlled
regulator:

gmac: ethernet at 01c50000 {
        pinctrl-names = "default";
        pinctrl-0 = <&gmac_pins_rgmii_a>;
        phy = <&phy1>;
        phy-mode = "rgmii";
        phy-supply = <&reg_gmac_3v3>;
        status = "okay";

        phy1: ethernet-phy at 1 {
                reg = <1>;
        };
};

reg_gmac_3v3: gmac-3v3 {
        compatible = "regulator-fixed";
        pinctrl-names = "default";
        pinctrl-0 = <&gmac_power_pin_bananapi>;
        regulator-name = "gmac-3v3";
        regulator-min-microvolt = <3300000>;
        regulator-max-microvolt = <3300000>;
        startup-delay-us = <50000>;
        enable-active-high;
        gpio = <&pio 7 23 0>;
};

and this problem did not show up on the hardware-wise rather similar
Cubietech Cubietruck (same SoC, same external PHY, but no
GPIO-controlled regulator for the PHY).  Further tests have shown that
increasing the startup-delay for the regulator solves the problem.  The
current sun7i-a20-bananapi.dts file (in linux-next, intended to go into
kernel 3.19) sets startup-delay-us for the PHY's regulator to 50000.  On
my Banana Pi board, even with a value of 55000, the PHY detection does
usually not work on the first probing inside d-i.  Increasing the value
to 57500 results in a successful probing most of the time, but not
always; only setting it to 60000 results in a reliable PHY detection
for me.

I would therefore like to propose increasing the startup-delay in the
Banana Pi dts to a value of 60000.  Following is an according patch.

Regards,
Karsten



Karsten Merker (1):
  ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY
    regulator

 arch/arm/boot/dts/sun7i-a20-bananapi.dts |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.7.10.4

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

* [PATCH] ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator
  2014-11-09 13:28 [PATCH] ARM: dts: Fix failing ethernet PHY detection on the LeMaker Banana Pi Karsten Merker
@ 2014-11-09 13:28 ` Karsten Merker
  2014-11-09 21:05   ` Hans de Goede
  2014-11-11 23:01 ` [PATCH V2 0/1] ARM: dts: Fix failing ethernet PHY detection on the LeMaker Banana Pi Karsten Merker
  1 sibling, 1 reply; 8+ messages in thread
From: Karsten Merker @ 2014-11-09 13:28 UTC (permalink / raw)
  To: linux-arm-kernel

On the LeMaker Banana Pi, probing the external ethernet PHY connected
to the SoC's internal GMAC module sometimes fails.  The PHY power
supply is handled via a GPIO-controlled regulator, and the existing
regulator startup-delay of 50000us is too short to make sure that the
PHY is always fully powered up when it is queried by phylib.  To
guarantee a reliable PHY detection, the startup-delay has to be
increased to 60000us.

Signed-off-by: Karsten Merker <merker@debian.org>
---
 arch/arm/boot/dts/sun7i-a20-bananapi.dts |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sun7i-a20-bananapi.dts b/arch/arm/boot/dts/sun7i-a20-bananapi.dts
index 3de847d..36065d1 100644
--- a/arch/arm/boot/dts/sun7i-a20-bananapi.dts
+++ b/arch/arm/boot/dts/sun7i-a20-bananapi.dts
@@ -207,7 +207,7 @@
 		regulator-name = "gmac-3v3";
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
-		startup-delay-us = <50000>;
+		startup-delay-us = <60000>;
 		enable-active-high;
 		gpio = <&pio 7 23 0>;
 	};
-- 
1.7.10.4

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

* [PATCH] ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator
  2014-11-09 13:28 ` [PATCH] ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator Karsten Merker
@ 2014-11-09 21:05   ` Hans de Goede
  2014-11-11 17:34     ` Maxime Ripard
  0 siblings, 1 reply; 8+ messages in thread
From: Hans de Goede @ 2014-11-09 21:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 11/09/2014 02:28 PM, Karsten Merker wrote:
> On the LeMaker Banana Pi, probing the external ethernet PHY connected
> to the SoC's internal GMAC module sometimes fails.  The PHY power
> supply is handled via a GPIO-controlled regulator, and the existing
> regulator startup-delay of 50000us is too short to make sure that the
> PHY is always fully powered up when it is queried by phylib.  To
> guarantee a reliable PHY detection, the startup-delay has to be
> increased to 60000us.

We should probably just increase it to 100000us to be safe, otherwise:

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans

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

* [PATCH] ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator
  2014-11-09 21:05   ` Hans de Goede
@ 2014-11-11 17:34     ` Maxime Ripard
  2014-11-11 18:35       ` Hans de Goede
  0 siblings, 1 reply; 8+ messages in thread
From: Maxime Ripard @ 2014-11-11 17:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Nov 09, 2014 at 10:05:26PM +0100, Hans de Goede wrote:
> Hi,
> 
> On 11/09/2014 02:28 PM, Karsten Merker wrote:
> > On the LeMaker Banana Pi, probing the external ethernet PHY connected
> > to the SoC's internal GMAC module sometimes fails.  The PHY power
> > supply is handled via a GPIO-controlled regulator, and the existing
> > regulator startup-delay of 50000us is too short to make sure that the
> > PHY is always fully powered up when it is queried by phylib.  To
> > guarantee a reliable PHY detection, the startup-delay has to be
> > increased to 60000us.
> 
> We should probably just increase it to 100000us to be safe, otherwise:
> 
> Acked-by: Hans de Goede <hdegoede@redhat.com>

Soooo, should I merge it or will there be a v2?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141111/1aac765a/attachment.sig>

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

* [PATCH] ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator
  2014-11-11 17:34     ` Maxime Ripard
@ 2014-11-11 18:35       ` Hans de Goede
  0 siblings, 0 replies; 8+ messages in thread
From: Hans de Goede @ 2014-11-11 18:35 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 11/11/2014 06:34 PM, Maxime Ripard wrote:
> On Sun, Nov 09, 2014 at 10:05:26PM +0100, Hans de Goede wrote:
>> Hi,
>>
>> On 11/09/2014 02:28 PM, Karsten Merker wrote:
>>> On the LeMaker Banana Pi, probing the external ethernet PHY connected
>>> to the SoC's internal GMAC module sometimes fails.  The PHY power
>>> supply is handled via a GPIO-controlled regulator, and the existing
>>> regulator startup-delay of 50000us is too short to make sure that the
>>> PHY is always fully powered up when it is queried by phylib.  To
>>> guarantee a reliable PHY detection, the startup-delay has to be
>>> increased to 60000us.
>>
>> We should probably just increase it to 100000us to be safe, otherwise:
>>
>> Acked-by: Hans de Goede <hdegoede@redhat.com>
> 
> Soooo, should I merge it or will there be a v2?

It might be easiest if you merge it with the delay increased to 100000 us,
assuming you agree that it is a good idea to add some extra safety margin.

Regards,

Hans

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

* [PATCH V2 0/1] ARM: dts: Fix failing ethernet PHY detection on the LeMaker Banana Pi
  2014-11-09 13:28 [PATCH] ARM: dts: Fix failing ethernet PHY detection on the LeMaker Banana Pi Karsten Merker
  2014-11-09 13:28 ` [PATCH] ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator Karsten Merker
@ 2014-11-11 23:01 ` Karsten Merker
  2014-11-11 23:01   ` [PATCH V2 1/1] ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator Karsten Merker
  1 sibling, 1 reply; 8+ messages in thread
From: Karsten Merker @ 2014-11-11 23:01 UTC (permalink / raw)
  To: linux-arm-kernel

While testing the daily builds of the Debian-Installer (d-i) on the
LeMaker Banana Pi (a small, Allwinner A20-based board), I found that
within the installer environment, the detection of the external Realtek
ethernet PHY connected to the Allwinner A20 GMAC fails upon first
loading of the stmmac driver:

[   77.235117] stmmaceth 1c50000.ethernet: no reset control found
[   77.235192]  Ring mode enabled
[   77.235202]  No HW DMA feature register supported
[   77.235211]  Normal descriptors
[   77.235219]  TX Checksum insertion supported
[   77.242678] libphy: stmmac: probed
[   77.242708] eth0: No PHY found

Just unloading the stmmac module and immediately afterwards 
modprobing it again results in proper detection of the PHY:

[  148.823456] stmmaceth 1c50000.ethernet: no reset control found
[  148.823487]  Ring mode enabled
[  148.823496]  No HW DMA feature register supported
[  148.823502]  Normal descriptors
[  148.823509]  TX Checksum insertion supported
[  148.854654] libphy: stmmac: probed
[  148.854683] eth0: PHY ID 001cc915 at 0 IRQ POLL (stmmac-0:00) active
[  148.854694] eth0: PHY ID 001cc915 at 1 IRQ POLL (stmmac-0:01)

On the Banana Pi, the PHY power supply is handled by a GPIO-controlled
regulator:

gmac: ethernet at 01c50000 {
        pinctrl-names = "default";
        pinctrl-0 = <&gmac_pins_rgmii_a>;
        phy = <&phy1>;
        phy-mode = "rgmii";
        phy-supply = <&reg_gmac_3v3>;
        status = "okay";

        phy1: ethernet-phy at 1 {
                reg = <1>;
        };
};

reg_gmac_3v3: gmac-3v3 {
        compatible = "regulator-fixed";
        pinctrl-names = "default";
        pinctrl-0 = <&gmac_power_pin_bananapi>;
        regulator-name = "gmac-3v3";
        regulator-min-microvolt = <3300000>;
        regulator-max-microvolt = <3300000>;
        startup-delay-us = <50000>;
        enable-active-high;
        gpio = <&pio 7 23 0>;
};

and this problem did not show up on the hardware-wise rather similar
Cubietech Cubietruck (same SoC, same external PHY, but no
GPIO-controlled regulator for the PHY).  Further tests have shown that
increasing the startup-delay for the regulator solves the problem.  The
current sun7i-a20-bananapi.dts file (in linux-next, intended to go into
kernel 3.19) sets startup-delay-us for the PHY's regulator to 50000.  On
my Banana Pi board, even with a value of 55000, the PHY detection does
usually not work on the first probing inside d-i.  Increasing the value
to 57500 results in a successful probing most of the time, but not
always; only setting it to 60000 results in a reliable PHY detection
for me.

Following is a patch to increase the startup delay in the Banana Pi dts.

Regards,
Karsten

Karsten Merker (1):
  ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY
    regulator

 arch/arm/boot/dts/sun7i-a20-bananapi.dts |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Changes since V1:
- increased the delay from 60000us to 100000us to have a certain
  safety margin and cater for manufacturing variations as proposed
  by Hans de Goede.

-- 
1.7.10.4

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

* [PATCH V2 1/1] ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator
  2014-11-11 23:01 ` [PATCH V2 0/1] ARM: dts: Fix failing ethernet PHY detection on the LeMaker Banana Pi Karsten Merker
@ 2014-11-11 23:01   ` Karsten Merker
  2014-11-12 13:37     ` Maxime Ripard
  0 siblings, 1 reply; 8+ messages in thread
From: Karsten Merker @ 2014-11-11 23:01 UTC (permalink / raw)
  To: linux-arm-kernel

On the LeMaker Banana Pi, probing the external ethernet PHY connected
to the SoC's internal GMAC module sometimes fails. The PHY power
supply is handled via a GPIO-controlled regulator, and the existing
regulator startup-delay of 50000us is too short to make sure that the
PHY is always fully powered up when it is queried by phylib. Tests
have shown that to provide a reliable PHY detection, the startup-delay
has to be increased to at least 60000us. To have a certain safety margin
and to cater for manufacturing variations between different boards,
the delay gets set to 100000us as discussed on the linux-arm-kernel
mailinglist.

Signed-off-by: Karsten Merker <merker@debian.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
---
 arch/arm/boot/dts/sun7i-a20-bananapi.dts |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sun7i-a20-bananapi.dts b/arch/arm/boot/dts/sun7i-a20-bananapi.dts
index 3de847d..1cf1214 100644
--- a/arch/arm/boot/dts/sun7i-a20-bananapi.dts
+++ b/arch/arm/boot/dts/sun7i-a20-bananapi.dts
@@ -207,7 +207,7 @@
 		regulator-name = "gmac-3v3";
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
-		startup-delay-us = <50000>;
+		startup-delay-us = <100000>;
 		enable-active-high;
 		gpio = <&pio 7 23 0>;
 	};
-- 
1.7.10.4

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

* [PATCH V2 1/1] ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator
  2014-11-11 23:01   ` [PATCH V2 1/1] ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator Karsten Merker
@ 2014-11-12 13:37     ` Maxime Ripard
  0 siblings, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2014-11-12 13:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 12, 2014 at 12:01:46AM +0100, Karsten Merker wrote:
> On the LeMaker Banana Pi, probing the external ethernet PHY connected
> to the SoC's internal GMAC module sometimes fails. The PHY power
> supply is handled via a GPIO-controlled regulator, and the existing
> regulator startup-delay of 50000us is too short to make sure that the
> PHY is always fully powered up when it is queried by phylib. Tests
> have shown that to provide a reliable PHY detection, the startup-delay
> has to be increased to at least 60000us. To have a certain safety margin
> and to cater for manufacturing variations between different boards,
> the delay gets set to 100000us as discussed on the linux-arm-kernel
> mailinglist.
> 
> Signed-off-by: Karsten Merker <merker@debian.org>
> Acked-by: Hans de Goede <hdegoede@redhat.com>

Merged, thanks.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141112/40e14133/attachment.sig>

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

end of thread, other threads:[~2014-11-12 13:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-09 13:28 [PATCH] ARM: dts: Fix failing ethernet PHY detection on the LeMaker Banana Pi Karsten Merker
2014-11-09 13:28 ` [PATCH] ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator Karsten Merker
2014-11-09 21:05   ` Hans de Goede
2014-11-11 17:34     ` Maxime Ripard
2014-11-11 18:35       ` Hans de Goede
2014-11-11 23:01 ` [PATCH V2 0/1] ARM: dts: Fix failing ethernet PHY detection on the LeMaker Banana Pi Karsten Merker
2014-11-11 23:01   ` [PATCH V2 1/1] ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator Karsten Merker
2014-11-12 13:37     ` Maxime Ripard

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