Skip to contentSkip to conversation

powerpc/kmcent2: update the ethernet devices' phy properties

PATCH In review Valentin Longchamp 3 participants 9 messages Jul 14, 2019 – Sep 14, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/kmcent2: update the ethernet devices' phy properties

Change all phy-connection-type properties to phy-mode that are better supported by the fman driver.

Use the more readable fixed-link node for the 2 sgmii links.

Change the RGMII link to rgmii-id as the clock delays are added by the phy.

---
 arch/powerpc/boot/dts/fsl/kmcent2.dts | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
arch/powerpc/boot/dts/fsl/kmcent2.dts +11 -5
index 48b7f9797124..c3e0741cafb1 100644
@@ -210,13 +210,19 @@
 
 		fman@400000 {
 			ethernet@e0000 {
-				fixed-link = <0 1 1000 0 0>;
-				phy-connection-type = "sgmii";
+				phy-mode = "sgmii";
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
 			};
 
 			ethernet@e2000 {
-				fixed-link = <1 1 1000 0 0>;
-				phy-connection-type = "sgmii";
+				phy-mode = "sgmii";
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
 			};
 
 			ethernet@e4000 {
@@ -229,7 +235,7 @@
 
 			ethernet@e8000 {
 				phy-handle = <&front_phy>;
-				phy-connection-type = "rgmii";
+				phy-mode = "rgmii-id";
 			};
 
 			mdio0: mdio@fc000 {
Signature · 1 line
2.17.1
#1 lore raw

Hi Scott, Kumar,

Looking at this patch I have realised that I had already submitted it to the mailing list nearly 2 years ago:
https://patchwork.ozlabs.org/patch/842944/

Could you please make sure that this one gets merged in the next window, so that I avoid forgetting such a patch a 2nd time ?

Thanks a lot

Quoted 54 lines · Valentin Longchamp

Change all phy-connection-type properties to phy-mode that are better supported by the fman driver.

Use the more readable fixed-link node for the 2 sgmii links.

Change the RGMII link to rgmii-id as the clock delays are added by the phy.

---
 arch/powerpc/boot/dts/fsl/kmcent2.dts | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
arch/powerpc/boot/dts/fsl/kmcent2.dts +11 -6
index 48b7f9797124..c3e0741cafb1 100644
@@ -210,13 +210,19 @@
 
                fman@400000 {
                        ethernet@e0000 {
-                               fixed-link = <0 1 1000 0 0>;
-                               phy-connection-type = "sgmii";
+                               phy-mode = "sgmii";
+                               fixed-link {
+                                       speed = <1000>;
+                                       full-duplex;
+                               };
                        };
 
                        ethernet@e2000 {
-                               fixed-link = <1 1 1000 0 0>;
-                               phy-connection-type = "sgmii";
+                               phy-mode = "sgmii";
+                               fixed-link {
+                                       speed = <1000>;
+                                       full-duplex;
+                               };
                        };
 
                        ethernet@e4000 {
@@ -229,7 +235,7 @@
 
                        ethernet@e8000 {
                                phy-handle = <&front_phy>;
-                               phy-connection-type = "rgmii";
+                               phy-mode = "rgmii-id";
                        };
 
                        mdio0: mdio@fc000 {
--

2.17.1

Signature · 4 lines
Valentin Longchamp
Rue de la Carrière 30, CH-1700 Fribourg
[email protected]
Mobile: +41 79 569 25 75
#2 lore raw
Quoted 10 lines · Valentin Longchamp

Hi Scott, Kumar,

Looking at this patch I have realised that I had already submitted it to the mailing list nearly 2 years ago:
https://patchwork.ozlabs.org/patch/842944/

Could you please make sure that this one gets merged in the next window, so that I avoid forgetting such a patch a 2nd time ?

Thanks a lot

I added it to my patchwork todo list; thanks for the reminder.

Quoted 6 lines
Quoted 4 lines · Valentin Longchamp

Change all phy-connection-type properties to phy-mode that are better supported by the fman driver.

Quoted 6 lines
Quoted 6 lines

Use the more readable fixed-link node for the 2 sgmii links.

Change the RGMII link to rgmii-id as the clock delays are added by the phy.

I don't see any other uses of phy-mode in arch/powerpc/boot/dts/fsl, and I see lots of phy-connection-type with fman. Madalin, does this patch look OK?

-Scott

Quoted 47 lines
Quoted 45 lines
---
 arch/powerpc/boot/dts/fsl/kmcent2.dts | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
arch/powerpc/boot/dts/fsl/kmcent2.dts +11 -6
index 48b7f9797124..c3e0741cafb1 100644
@@ -210,13 +210,19 @@
 
                fman@400000 {
                        ethernet@e0000 {
-                               fixed-link = <0 1 1000 0 0>;
-                               phy-connection-type = "sgmii";
+                               phy-mode = "sgmii";
+                               fixed-link {
+                                       speed = <1000>;
+                                       full-duplex;
+                               };
                        };
 
                        ethernet@e2000 {
-                               fixed-link = <1 1 1000 0 0>;
-                               phy-connection-type = "sgmii";
+                               phy-mode = "sgmii";
+                               fixed-link {
+                                       speed = <1000>;
+                                       full-duplex;
+                               };
                        };
 
                        ethernet@e4000 {
@@ -229,7 +235,7 @@
 
                        ethernet@e8000 {
                                phy-handle = <&front_phy>;
-                               phy-connection-type = "rgmii";
+                               phy-mode = "rgmii-id";
                        };
 
                        mdio0: mdio@fc000 {
--

2.17.1

#3 lore raw
Quoted 9 lines · Scott Wood
Quoted 8 lines · Valentin Longchamp
Quoted 6 lines · Valentin Longchamp

Change all phy-connection-type properties to phy-mode that are better supported by the fman driver.

Use the more readable fixed-link node for the 2 sgmii links.

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

Change the RGMII link to rgmii-id as the clock delays are added by the phy.

I don't see any other uses of phy-mode in arch/powerpc/boot/dts/fsl, and I see lots of phy-connection-type with fman. Madalin, does this patch look OK?

The fman driver (mac_probe()) calls of_get_phy_mode() which first looks for phy-mode, and then phy-connection-type. Both should be the same according to the device tree binding.

With some older kernels I remember we had issues with phy-connection-type but not phy-mode, but this is more than 2 years ago, I don't remember the details. phy-mode works well (tested ~2 weeks ago) with 4.14, 4.19 and 5.2, for sure.

Valentin

Quoted 51 lines

-Scott

Quoted 47 lines
Quoted 45 lines
---
 arch/powerpc/boot/dts/fsl/kmcent2.dts | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
arch/powerpc/boot/dts/fsl/kmcent2.dts +11 -6
index 48b7f9797124..c3e0741cafb1 100644
@@ -210,13 +210,19 @@
 
                fman@400000 {
                        ethernet@e0000 {
-                               fixed-link = <0 1 1000 0 0>;
-                               phy-connection-type = "sgmii";
+                               phy-mode = "sgmii";
+                               fixed-link {
+                                       speed = <1000>;
+                                       full-duplex;
+                               };
                        };
 
                        ethernet@e2000 {
-                               fixed-link = <1 1 1000 0 0>;
-                               phy-connection-type = "sgmii";
+                               phy-mode = "sgmii";
+                               fixed-link {
+                                       speed = <1000>;
+                                       full-duplex;
+                               };
                        };
 
                        ethernet@e4000 {
@@ -229,7 +235,7 @@
 
                        ethernet@e8000 {
                                phy-handle = <&front_phy>;
-                               phy-connection-type = "rgmii";
+                               phy-mode = "rgmii-id";
                        };
 
                        mdio0: mdio@fc000 {
--

2.17.1

#4 lore raw
In reply to Scott Wood
Quoted 35 lines

-----Original Message-----
From: Scott Wood <[email protected]>
Sent: Sunday, July 28, 2019 10:27 PM
To: Valentin Longchamp <[email protected]>; linuxppc- [email protected]; [email protected]
Cc: Madalin-cristian Bucur <[email protected]>
Subject: Re: [PATCH] powerpc/kmcent2: update the ethernet devices' phy properties

Quoted 11 lines · Valentin Longchamp

Hi Scott, Kumar,

Looking at this patch I have realised that I had already submitted it to the mailing list nearly 2 years ago:

https://patchwork.ozlabs.org/patch/842944/

Could you please make sure that this one gets merged in the next window, so that I avoid forgetting such a patch a 2nd time ?

Thanks a lot

I added it to my patchwork todo list; thanks for the reminder.

Quoted 11 lines
Quoted 9 lines · Valentin Longchamp

Change all phy-connection-type properties to phy-mode that are better supported by the fman driver.

Use the more readable fixed-link node for the 2 sgmii links.

Change the RGMII link to rgmii-id as the clock delays are added by the phy.

Quoted 6 lines
Quoted 1 line
Quoted 1 line

I don't see any other uses of phy-mode in arch/powerpc/boot/dts/fsl, and I see lots of phy-connection-type with fman. Madalin, does this patch look OK?

-Scott

Hi,

we are using "phy-connection-type" not "phy-mode" for the NXP (former Freescale) DPAA platforms. While the two seem to be interchangeable ("phy-mode" seems to be more recent, looking at the device tree bindings), the driver code in Linux seems to use one or the other, not both so one should stick with the variant the driver is using. To make things more complex, there may be dependencies in bootloaders, I see code in u-boot using only "phy-connection-type" or only "phy-mode".

I'd leave "phy-connection-type" as is.

Madalin

Quoted 47 lines
Quoted 47 lines
Quoted 45 lines
---
 arch/powerpc/boot/dts/fsl/kmcent2.dts | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
arch/powerpc/boot/dts/fsl/kmcent2.dts +11 -6
index 48b7f9797124..c3e0741cafb1 100644
@@ -210,13 +210,19 @@
 
                fman@400000 {
                        ethernet@e0000 {
-                               fixed-link = <0 1 1000 0 0>;
-                               phy-connection-type = "sgmii";
+                               phy-mode = "sgmii";
+                               fixed-link {
+                                       speed = <1000>;
+                                       full-duplex;
+                               };
                        };
 
                        ethernet@e2000 {
-                               fixed-link = <1 1 1000 0 0>;
-                               phy-connection-type = "sgmii";
+                               phy-mode = "sgmii";
+                               fixed-link {
+                                       speed = <1000>;
+                                       full-duplex;
+                               };
                        };
 
                        ethernet@e4000 {
@@ -229,7 +235,7 @@
 
                        ethernet@e8000 {
                                phy-handle = <&front_phy>;
-                               phy-connection-type = "rgmii";
+                               phy-mode = "rgmii-id";
                        };
 
                        mdio0: mdio@fc000 {
--

2.17.1

#5 lore raw
Quoted 23 lines · Madalin-cristian Bucur
Quoted 14 lines

-----Original Message-----

Quoted 11 lines
Quoted 9 lines · Valentin Longchamp

Change all phy-connection-type properties to phy-mode that are better supported by the fman driver.

Use the more readable fixed-link node for the 2 sgmii links.

Change the RGMII link to rgmii-id as the clock delays are added by the phy.

Quoted 6 lines
Quoted 1 line
Quoted 1 line

I don't see any other uses of phy-mode in arch/powerpc/boot/dts/fsl, and I see lots of phy-connection-type with fman. Madalin, does this patch look OK?

-Scott

Hi,

Quoted 8 lines

we are using "phy-connection-type" not "phy-mode" for the NXP (former Freescale) DPAA platforms. While the two seem to be interchangeable ("phy-mode" seems to be more recent, looking at the device tree bindings), the driver code in Linux seems to use one or the other, not both so one should stick with the variant the driver is using. To make things more complex, there may be dependencies in bootloaders, I see code in u-boot using only "phy-connection-type" or only "phy-mode".

I'd leave "phy-connection-type" as is.

So I have finally had time to have a look and now I understand what happens. You are right, there are bootloader dependencies: u-boot calls fdt_fixup_phy_connection() that somehow in our case adds (or changes if already in the device tree) the phy-connection-type property to a wrong value ! By having a phy-mode in the device tree, that is not changed by u-boot and by chance picked up by the kernel fman driver (of_get_phy_mode() ) over phy-connection-mode, the below patch fixes it for us.

I agree with you, it's not correct to have both phy-connection-type and phy-mode. Ideally, u-boot on the board should be reworked so that it does not perform the above wrong fixup. However, in an "unfixed" .dtb (I have disabled fdt_fixup_phy_connection), the device tree in the end only has either phy-connection-type or phy-mode, according to what was chosen in the .dts file. And the fman driver works well with both (thanks to the call to of_get_phy_mode() ). I would therefore argue that even if all other DPAA platforms use phy-connection-type, phy-mode is valid as well. (Furthermore we already have hundreds of such boards in the field and we don't really support "remote" u-boot update, so the u-boot fix is going to be difficult for us to pull).

Valentin

Quoted 51 lines

Madalin

Quoted 47 lines
Quoted 47 lines
Quoted 45 lines
---
 arch/powerpc/boot/dts/fsl/kmcent2.dts | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
arch/powerpc/boot/dts/fsl/kmcent2.dts +11 -6
index 48b7f9797124..c3e0741cafb1 100644
@@ -210,13 +210,19 @@
 
                fman@400000 {
                        ethernet@e0000 {
-                               fixed-link = <0 1 1000 0 0>;
-                               phy-connection-type = "sgmii";
+                               phy-mode = "sgmii";
+                               fixed-link {
+                                       speed = <1000>;
+                                       full-duplex;
+                               };
                        };
 
                        ethernet@e2000 {
-                               fixed-link = <1 1 1000 0 0>;
-                               phy-connection-type = "sgmii";
+                               phy-mode = "sgmii";
+                               fixed-link {
+                                       speed = <1000>;
+                                       full-duplex;
+                               };
                        };
 
                        ethernet@e4000 {
@@ -229,7 +235,7 @@
 
                        ethernet@e8000 {
                                phy-handle = <&front_phy>;
-                               phy-connection-type = "rgmii";
+                               phy-mode = "rgmii-id";
                        };
 
                        mdio0: mdio@fc000 {
--

2.17.1

#6 lore raw
Quoted 64 lines · Valentin Longchamp
Quoted 39 lines · Madalin-cristian Bucur
Quoted 16 lines

-----Original Message-----

Quoted 13 lines
Quoted 11 lines · Valentin Longchamp

Change all phy-connection-type properties to phy-mode that are better
supported by the fman driver.

Use the more readable fixed-link node for the 2 sgmii links.

Change the RGMII link to rgmii-id as the clock delays are added by the
phy.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

I don't see any other uses of phy-mode in arch/powerpc/boot/dts/fsl, and I see
lots of phy-connection-type with fman. Madalin, does this patch look OK?

-Scott

Hi,

we are using "phy-connection-type" not "phy-mode" for the NXP (former Freescale)
DPAA platforms. While the two seem to be interchangeable ("phy-mode" seems to be
more recent, looking at the device tree bindings), the driver code in Linux seems
to use one or the other, not both so one should stick with the variant the driver
is using. To make things more complex, there may be dependencies in bootloaders,
I see code in u-boot using only "phy-connection-type" or only "phy-mode".

Quoted 1 line

I'd leave "phy-connection-type" as is.

So I have finally had time to have a look and now I understand what happens. You are right, there are bootloader dependencies: u-boot calls fdt_fixup_phy_connection() that somehow in our case adds (or changes if already in the device tree) the phy-connection-type property to a wrong value ! By having a phy-mode in the device tree, that is not changed by u-boot and by chance picked up by the kernel fman driver (of_get_phy_mode() ) over phy-connection-mode, the below patch fixes it for us.

I agree with you, it's not correct to have both phy-connection-type and phy-mode. Ideally, u-boot on the board should be reworked so that it does not perform the above wrong fixup. However, in an "unfixed" .dtb (I have disabled fdt_fixup_phy_connection), the device tree in the end only has either phy-connection-type or phy-mode, according to what was chosen in the .dts file. And the fman driver works well with both (thanks to the call to of_get_phy_mode() ). I would therefore argue that even if all other DPAA platforms use phy-connection-type, phy-mode is valid as well. (Furthermore we already have hundreds of such boards in the field and we don't really support "remote" u-boot update, so the u-boot fix is going to be difficult for us to pull).

Quoted 1 line

Valentin

Madalin, are you OK with the patch given this explanation?

-Scott

#7 lore raw
Quoted 81 lines

-----Original Message-----
From: Scott Wood <[email protected]>
Sent: Wednesday, August 28, 2019 7:19 AM
To: Valentin Longchamp <[email protected]>; Madalin-cristian Bucur <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] powerpc/kmcent2: update the ethernet devices' phy properties

Quoted 8 lines · Valentin Longchamp
Quoted 6 lines · Madalin-cristian Bucur
Quoted 6 lines

-----Original Message-----

Quoted 3 lines
Quoted 1 line · Valentin Longchamp
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Change all phy-connection-type properties to phy-mode that are better
supported by the fman driver.

Use the more readable fixed-link node for the 2 sgmii links.

Change the RGMII link to rgmii-id as the clock delays are added

by

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines

the
phy.

I don't see any other uses of phy-mode in arch/powerpc/boot/dts/fsl,

and

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I see
lots of phy-connection-type with fman. Madalin, does this patch

look

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

OK?

-Scott

Hi,

we are using "phy-connection-type" not "phy-mode" for the NXP (former Freescale)
DPAA platforms. While the two seem to be interchangeable ("phy-mode"

seems

Quoted 4 lines
Quoted 4 lines

to be
more recent, looking at the device tree bindings), the driver code in Linux seems
to use one or the other, not both so one should stick with the variant

the

Quoted 4 lines
Quoted 4 lines

driver
is using. To make things more complex, there may be dependencies in bootloaders,
I see code in u-boot using only "phy-connection-type" or only "phy-

mode".

Quoted 24 lines
Quoted 2 lines

I'd leave "phy-connection-type" as is.

So I have finally had time to have a look and now I understand what happens. You are right, there are bootloader dependencies: u-boot calls fdt_fixup_phy_connection() that somehow in our case adds (or changes if already in the device tree) the phy-connection-type property to a wrong value ! By having a phy-mode in the device tree, that is not changed by u-boot and by chance picked up by the kernel fman driver (of_get_phy_mode() ) over phy-connection-mode, the below patch fixes it for us.

I agree with you, it's not correct to have both phy-connection-type and phy-mode. Ideally, u-boot on the board should be reworked so that it does not perform the above wrong fixup. However, in an "unfixed" .dtb (I have disabled fdt_fixup_phy_connection), the device tree in the end only has either phy-connection-type or phy-mode, according to what was chosen in the .dts file. And the fman driver works well with both (thanks to the call to of_get_phy_mode() ). I would therefore argue that even if all other DPAA platforms use phy-connection-type, phy-mode is valid as well. (Furthermore we already have hundreds of such boards in the field and we don't really support "remote" u-boot update, so the u-boot fix is going to be difficult for us to pull).

Quoted 6 lines
Quoted 1 line

Valentin

Madalin, are you OK with the patch given this explanation?

-Scott

Yes, I understand that it's the only option they have, given the inability to upgrade u-boot (this may prove to be an issue in the future, in other situations).

Acked-by
#8 lore raw
Quoted 91 lines · Madalin-cristian Bucur
Quoted 91 lines

-----Original Message-----
From: Scott Wood <[email protected]>
Sent: Wednesday, August 28, 2019 7:19 AM
To: Valentin Longchamp <[email protected]>; Madalin-cristian Bucur <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] powerpc/kmcent2: update the ethernet devices' phy properties

Quoted 8 lines · Valentin Longchamp
Quoted 6 lines · Madalin-cristian Bucur
Quoted 6 lines

-----Original Message-----

Quoted 3 lines
Quoted 1 line · Valentin Longchamp
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Change all phy-connection-type properties to phy-mode that are better
supported by the fman driver.

Use the more readable fixed-link node for the 2 sgmii links.

Change the RGMII link to rgmii-id as the clock delays are added

by

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines

the
phy.

I don't see any other uses of phy-mode in arch/powerpc/boot/dts/fsl,

and

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I see
lots of phy-connection-type with fman. Madalin, does this patch

look

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

OK?

-Scott

Hi,

we are using "phy-connection-type" not "phy-mode" for the NXP (former Freescale)
DPAA platforms. While the two seem to be interchangeable ("phy-mode"

seems

Quoted 4 lines
Quoted 4 lines

to be
more recent, looking at the device tree bindings), the driver code in Linux seems
to use one or the other, not both so one should stick with the variant

the

Quoted 4 lines
Quoted 4 lines

driver
is using. To make things more complex, there may be dependencies in bootloaders,
I see code in u-boot using only "phy-connection-type" or only "phy-

mode".

Quoted 24 lines
Quoted 2 lines

I'd leave "phy-connection-type" as is.

So I have finally had time to have a look and now I understand what happens. You are right, there are bootloader dependencies: u-boot calls fdt_fixup_phy_connection() that somehow in our case adds (or changes if already in the device tree) the phy-connection-type property to a wrong value ! By having a phy-mode in the device tree, that is not changed by u-boot and by chance picked up by the kernel fman driver (of_get_phy_mode() ) over phy-connection-mode, the below patch fixes it for us.

I agree with you, it's not correct to have both phy-connection-type and phy-mode. Ideally, u-boot on the board should be reworked so that it does not perform the above wrong fixup. However, in an "unfixed" .dtb (I have disabled fdt_fixup_phy_connection), the device tree in the end only has either phy-connection-type or phy-mode, according to what was chosen in the .dts file. And the fman driver works well with both (thanks to the call to of_get_phy_mode() ). I would therefore argue that even if all other DPAA platforms use phy-connection-type, phy-mode is valid as well. (Furthermore we already have hundreds of such boards in the field and we don't really support "remote" u-boot update, so the u-boot fix is going to be difficult for us to pull).

Quoted 1 line

Valentin

Madalin, are you OK with the patch given this explanation?

Quoted 8 lines
Quoted 2 lines

-Scott

Yes, I understand that it's the only option they have, given the inability to upgrade u-boot (this may prove to be an issue in the future, in other situations).

-Scott