diff mbox

[v3,2/9] ARM64: dts: meson-gxbb-p200: add the ethernet PHY's reset GPIO

Message ID 20170120152232.13943-3-martin.blumenstingl@googlemail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Martin Blumenstingl Jan. 20, 2017, 3:22 p.m. UTC
This resets the ethernet PHY during boot to get the PHY into a "clean"
state.
While here also specify the phy-handle of the ethmac node to make the
PHY configuration similar to the one we have on GXL devices. This will
allow us to specify OF-properties for the PHY itself.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Andrew Lunn Jan. 20, 2017, 4:18 p.m. UTC | #1
On Fri, Jan 20, 2017 at 04:22:25PM +0100, Martin Blumenstingl wrote:
> This resets the ethernet PHY during boot to get the PHY into a "clean"
> state.
> While here also specify the phy-handle of the ethmac node to make the
> PHY configuration similar to the one we have on GXL devices. This will
> allow us to specify OF-properties for the PHY itself.
> 
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
>  arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
> index 03e3d76626dd..fa0f84cfeaa9 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
> +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
> @@ -51,6 +51,30 @@
>  	model = "Amlogic Meson GXBB P200 Development Board";
>  };
>  
> +&ethmac {
> +	status = "okay";
> +	pinctrl-0 = <&eth_rgmii_pins>;
> +	pinctrl-names = "default";
> +	phy-handle = <&eth_phy0>;
> +	phy-mode = "rgmii";
> +
> +	snps,reset-gpio = <&gpio GPIOZ_14 0>;
> +	snps,reset-delays-us = <0 10000 1000000>;
> +	snps,reset-active-low;
> +
> +	mdio {
> +		compatible = "snps,dwmac-mdio";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		eth_phy0: ethernet-phy@0 {

Hi Martin

ethernet-phy@3, because of the reg property.


> +			compatible = "ethernet-phy-id0022.1620",
> +				     "ethernet-phy-ieee802.3-c22";
> +			reg = <3>;

  Andrew
Andrew Lunn Jan. 20, 2017, 4:21 p.m. UTC | #2
On Fri, Jan 20, 2017 at 04:22:25PM +0100, Martin Blumenstingl wrote:
> This resets the ethernet PHY during boot to get the PHY into a "clean"
> state.
> While here also specify the phy-handle of the ethmac node to make the
> PHY configuration similar to the one we have on GXL devices. This will
> allow us to specify OF-properties for the PHY itself.
> 
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
>  arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
> index 03e3d76626dd..fa0f84cfeaa9 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
> +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
> @@ -51,6 +51,30 @@
>  	model = "Amlogic Meson GXBB P200 Development Board";
>  };
>  
> +&ethmac {
> +	status = "okay";
> +	pinctrl-0 = <&eth_rgmii_pins>;
> +	pinctrl-names = "default";
> +	phy-handle = <&eth_phy0>;
> +	phy-mode = "rgmii";
> +
> +	snps,reset-gpio = <&gpio GPIOZ_14 0>;
> +	snps,reset-delays-us = <0 10000 1000000>;
> +	snps,reset-active-low;
> +
> +	mdio {
> +		compatible = "snps,dwmac-mdio";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		eth_phy0: ethernet-phy@0 {
> +			compatible = "ethernet-phy-id0022.1620",

Hi Martin

You don't need to specify the PHY ID. You really only need this when
the PHY is reporting no ID, or a wrong ID. In fact, if a new revision
of the board is made, with a different PHY, you might have a problem,
the wrong PHY driver is loaded.

   Andrew
Neil Armstrong Jan. 20, 2017, 4:23 p.m. UTC | #3
On 01/20/2017 04:22 PM, Martin Blumenstingl wrote:
> This resets the ethernet PHY during boot to get the PHY into a "clean"
> state.
> While here also specify the phy-handle of the ethmac node to make the
> PHY configuration similar to the one we have on GXL devices. This will
> allow us to specify OF-properties for the PHY itself.
> 
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
>  arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
> index 03e3d76626dd..fa0f84cfeaa9 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
> +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
> @@ -51,6 +51,30 @@
>  	model = "Amlogic Meson GXBB P200 Development Board";
>  };
>  
> +&ethmac {
> +	status = "okay";
> +	pinctrl-0 = <&eth_rgmii_pins>;
> +	pinctrl-names = "default";
> +	phy-handle = <&eth_phy0>;
> +	phy-mode = "rgmii";
> +
> +	snps,reset-gpio = <&gpio GPIOZ_14 0>;
> +	snps,reset-delays-us = <0 10000 1000000>;
> +	snps,reset-active-low;
> +
> +	mdio {
> +		compatible = "snps,dwmac-mdio";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		eth_phy0: ethernet-phy@0 {
> +			compatible = "ethernet-phy-id0022.1620",
> +				     "ethernet-phy-ieee802.3-c22";
> +			reg = <3>;
> +		};
> +	};
> +};
> +
>  &i2c_B {
>  	status = "okay";
>  	pinctrl-0 = <&i2c_b_pins>;
> 

On Amlogic p200 :
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
Martin Blumenstingl Jan. 20, 2017, 5:07 p.m. UTC | #4
Hi Andrew,

On Fri, Jan 20, 2017 at 5:21 PM, Andrew Lunn <andrew@lunn.ch> wrote:
> On Fri, Jan 20, 2017 at 04:22:25PM +0100, Martin Blumenstingl wrote:
>> This resets the ethernet PHY during boot to get the PHY into a "clean"
>> state.
>> While here also specify the phy-handle of the ethmac node to make the
>> PHY configuration similar to the one we have on GXL devices. This will
>> allow us to specify OF-properties for the PHY itself.
>>
>> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
>> ---
>>  arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts | 24 ++++++++++++++++++++++++
>>  1 file changed, 24 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
>> index 03e3d76626dd..fa0f84cfeaa9 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
>> +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
>> @@ -51,6 +51,30 @@
>>       model = "Amlogic Meson GXBB P200 Development Board";
>>  };
>>
>> +&ethmac {
>> +     status = "okay";
>> +     pinctrl-0 = <&eth_rgmii_pins>;
>> +     pinctrl-names = "default";
>> +     phy-handle = <&eth_phy0>;
>> +     phy-mode = "rgmii";
>> +
>> +     snps,reset-gpio = <&gpio GPIOZ_14 0>;
>> +     snps,reset-delays-us = <0 10000 1000000>;
>> +     snps,reset-active-low;
>> +
>> +     mdio {
>> +             compatible = "snps,dwmac-mdio";
>> +             #address-cells = <1>;
>> +             #size-cells = <0>;
>> +
>> +             eth_phy0: ethernet-phy@0 {
>> +                     compatible = "ethernet-phy-id0022.1620",
>
> Hi Martin
>
> You don't need to specify the PHY ID. You really only need this when
> the PHY is reporting no ID, or a wrong ID. In fact, if a new revision
> of the board is made, with a different PHY, you might have a problem,
> the wrong PHY driver is loaded.
>
>    Andrew
I though that this is good practice - the documentation doesn't say
that it should only be added in specific cases: [0]
my intention behind adding the PHY ID was to make it easier to see
which devices uses which PHY. this is especially useful for devices
with RTL8211F PHY (basically all devices with RGMII PHY except the
P200) as these may need similar fixes than [1]

regarding your other mail: you're absolutely right that ethernet-phy@0
should be ethernet-phy@3.


[0] http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/net/phy.txt
[1] https://patchwork.kernel.org/patch/9528915/
Andrew Lunn Jan. 20, 2017, 5:46 p.m. UTC | #5
On Fri, Jan 20, 2017 at 06:07:20PM +0100, Martin Blumenstingl wrote:
> I though that this is good practice - the documentation doesn't say
> that it should only be added in specific cases: [0]

Agreed, the text should be better, listing when it is appropriate to
use.

> my intention behind adding the PHY ID was to make it easier to see
> which devices uses which PHY. this is especially useful for devices
> with RTL8211F PHY (basically all devices with RGMII PHY except the
> P200) as these may need similar fixes than [1]

I would not say it is wrong to list the PHY ID, it just has
consequences if the PHY ever changes.

	     Andrew
Martin Blumenstingl Jan. 22, 2017, 4:48 p.m. UTC | #6
On Fri, Jan 20, 2017 at 6:46 PM, Andrew Lunn <andrew@lunn.ch> wrote:
> On Fri, Jan 20, 2017 at 06:07:20PM +0100, Martin Blumenstingl wrote:
>> I though that this is good practice - the documentation doesn't say
>> that it should only be added in specific cases: [0]
>
> Agreed, the text should be better, listing when it is appropriate to
> use.
>
>> my intention behind adding the PHY ID was to make it easier to see
>> which devices uses which PHY. this is especially useful for devices
>> with RTL8211F PHY (basically all devices with RGMII PHY except the
>> P200) as these may need similar fixes than [1]
>
> I would not say it is wrong to list the PHY ID, it just has
> consequences if the PHY ever changes.
thanks for pointing this out again, I'll re-spin this series and
remove the PHY's "compatible" property from all patches.
I also sent a patch which hopefully makes the documentation a bit more
clear: [0]

Regards,
Martin


[0] http://marc.info/?l=linux-netdev&m=148510331812986&w=2
diff mbox

Patch

diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
index 03e3d76626dd..fa0f84cfeaa9 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts
@@ -51,6 +51,30 @@ 
 	model = "Amlogic Meson GXBB P200 Development Board";
 };
 
+&ethmac {
+	status = "okay";
+	pinctrl-0 = <&eth_rgmii_pins>;
+	pinctrl-names = "default";
+	phy-handle = <&eth_phy0>;
+	phy-mode = "rgmii";
+
+	snps,reset-gpio = <&gpio GPIOZ_14 0>;
+	snps,reset-delays-us = <0 10000 1000000>;
+	snps,reset-active-low;
+
+	mdio {
+		compatible = "snps,dwmac-mdio";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		eth_phy0: ethernet-phy@0 {
+			compatible = "ethernet-phy-id0022.1620",
+				     "ethernet-phy-ieee802.3-c22";
+			reg = <3>;
+		};
+	};
+};
+
 &i2c_B {
 	status = "okay";
 	pinctrl-0 = <&i2c_b_pins>;