All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Possible Issue Setting the Delay Flags in the Marvell Net PHY Driver
@ 2021-06-28 19:28 Kurt Cancemi
  2021-06-28 19:28 ` [PATCH 1/1] net: phy: marvell: Fixed handing of delays with plain RGMII interface Kurt Cancemi
  0 siblings, 1 reply; 10+ messages in thread
From: Kurt Cancemi @ 2021-06-28 19:28 UTC (permalink / raw)
  To: netdev; +Cc: Kurt Cancemi

Hi,

I believe there is an issue setting the RX and TX delay flags in the Marvell
net PHY driver. This patch fixes the issue for me but I am not convinced that
this is the right way to fix the issue or that this patch will not cause side
effects for other models. Feedback and comments are greatly appreciated.

Backstory:

I have been troubleshooting getting ethernet to work on a board based off of
the NXP T2080RDB (with DPAA ethernet). It has a Marvell 88E1510 PHY chip.
When attempting to use ping to verify that the ethernet was working I was
only getting RX and TX errors. Upon further debugging I discovered that the
RX and TX delay flags were not being set.

I believe there is an issue because of the following:

* The DPAA memac driver correctly reports that the device tree ethernet
  "phy-connection-type" is set to "rgmii-id" and the of_get_phy_mode()
  function correctly returns 0x8 "PHY_INTERFACE_MODE_RGMII_ID"

* A similar fix for this same issue was incorporated into U-Boot back in 2018:
  https://github.com/u-boot/u-boot/commit/431be621c6cbc72efd1d45fa36686a682cbb470a

* The ethernet works with the attached patch.

Kurt

Kurt Cancemi (1):
  net: phy: marvell: Fixed handing of delays with plain RGMII interface

 drivers/net/phy/marvell.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.32.0


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

* [PATCH 1/1] net: phy: marvell: Fixed handing of delays with plain RGMII interface
  2021-06-28 19:28 [PATCH 0/1] Possible Issue Setting the Delay Flags in the Marvell Net PHY Driver Kurt Cancemi
@ 2021-06-28 19:28 ` Kurt Cancemi
  2021-06-28 22:49   ` Marek Behún
  0 siblings, 1 reply; 10+ messages in thread
From: Kurt Cancemi @ 2021-06-28 19:28 UTC (permalink / raw)
  To: netdev; +Cc: Kurt Cancemi

This patch changes the default behavior to enable RX and TX delays for
the PHY_INTERFACE_MODE_RGMII case by default.

Signed-off-by: Kurt Cancemi <kurt@x64architecture.com>
---
 drivers/net/phy/marvell.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index e6721c1c26c2..a5a9d76b6bab 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -546,7 +546,8 @@ static int m88e1121_config_aneg_rgmii_delays(struct phy_device *phydev)
 {
 	int mscr;
 
-	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
+	if (phydev->interface == PHY_INTERFACE_MODE_RGMII ||
+	    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
 		mscr = MII_88E1121_PHY_MSCR_RX_DELAY |
 		       MII_88E1121_PHY_MSCR_TX_DELAY;
 	else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
-- 
2.32.0


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

* Re: [PATCH 1/1] net: phy: marvell: Fixed handing of delays with plain RGMII interface
  2021-06-28 19:28 ` [PATCH 1/1] net: phy: marvell: Fixed handing of delays with plain RGMII interface Kurt Cancemi
@ 2021-06-28 22:49   ` Marek Behún
  2021-06-28 23:01     ` Marcin Wojtas
       [not found]     ` <CADujJWWoWRyW3S+f3F_Zhq9H90QZ1W4eu=5dyad3DeMLHFp2TA@mail.gmail.com>
  0 siblings, 2 replies; 10+ messages in thread
From: Marek Behún @ 2021-06-28 22:49 UTC (permalink / raw)
  To: Kurt Cancemi; +Cc: netdev

On Mon, 28 Jun 2021 15:28:26 -0400
Kurt Cancemi <kurt@x64architecture.com> wrote:

> This patch changes the default behavior to enable RX and TX delays for
> the PHY_INTERFACE_MODE_RGMII case by default.

And why would we want that? I was under the impression that we have the
_ID variants for enabling these delays.

Marek

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

* Re: [PATCH 1/1] net: phy: marvell: Fixed handing of delays with plain RGMII interface
  2021-06-28 22:49   ` Marek Behún
@ 2021-06-28 23:01     ` Marcin Wojtas
  2021-06-29  0:05       ` Kurt Cancemi
       [not found]     ` <CADujJWWoWRyW3S+f3F_Zhq9H90QZ1W4eu=5dyad3DeMLHFp2TA@mail.gmail.com>
  1 sibling, 1 reply; 10+ messages in thread
From: Marcin Wojtas @ 2021-06-28 23:01 UTC (permalink / raw)
  To: Kurt Cancemi; +Cc: netdev, Marek Behún

Hi Kurt,


wt., 29 cze 2021 o 00:50 Marek Behún <kabel@kernel.org> napisał(a):
>
> On Mon, 28 Jun 2021 15:28:26 -0400
> Kurt Cancemi <kurt@x64architecture.com> wrote:
>
> > This patch changes the default behavior to enable RX and TX delays for
> > the PHY_INTERFACE_MODE_RGMII case by default.
>
> And why would we want that? I was under the impression that we have the
> _ID variants for enabling these delays.
>

+1

From Documentation/devicetree/bindings/net/ethernet-controller.yaml

      # RGMII with internal RX and TX delays provided by the PHY,
      # the MAC should not add the RX or TX delays in this case
      - rgmii-id

I guess you should rather fix the hardware description of your board,
i.e. use `phy-mode = "rgmii-id"` instead of tweaking the PHY driver
itself.

Best regards,
Marcin

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

* Re: [PATCH 1/1] net: phy: marvell: Fixed handing of delays with plain RGMII interface
  2021-06-28 23:01     ` Marcin Wojtas
@ 2021-06-29  0:05       ` Kurt Cancemi
  2021-06-29  0:21         ` Marek Behún
  0 siblings, 1 reply; 10+ messages in thread
From: Kurt Cancemi @ 2021-06-29  0:05 UTC (permalink / raw)
  To: Marcin Wojtas; +Cc: netdev, Marek Behún

Well I'm sorry for the noise I was running into a lot of other DPAA
ethernet related issues and overlooked adding phy-mode = "rgmii-id";
that fixed the issue. I knew my patch was not correct (as I explained
in the cover email) but I was not sure why it was necessary but now I
see it was not necessary I just had "phy-connection-mode" instead of
"phy-mode".

May I ask what is the purpose of phy-connection-mode? And why did the
DPAA driver recognize the PHY interface mode as RGMII ID but the
Marvell PHY driver didn't?

On Mon, Jun 28, 2021 at 7:01 PM Marcin Wojtas <mw@semihalf.com> wrote:
>
> Hi Kurt,
>
>
> wt., 29 cze 2021 o 00:50 Marek Behún <kabel@kernel.org> napisał(a):
> >
> > On Mon, 28 Jun 2021 15:28:26 -0400
> > Kurt Cancemi <kurt@x64architecture.com> wrote:
> >
> > > This patch changes the default behavior to enable RX and TX delays for
> > > the PHY_INTERFACE_MODE_RGMII case by default.
> >
> > And why would we want that? I was under the impression that we have the
> > _ID variants for enabling these delays.
> >
>
> +1
>
> From Documentation/devicetree/bindings/net/ethernet-controller.yaml
>
>       # RGMII with internal RX and TX delays provided by the PHY,
>       # the MAC should not add the RX or TX delays in this case
>       - rgmii-id
>
> I guess you should rather fix the hardware description of your board,
> i.e. use `phy-mode = "rgmii-id"` instead of tweaking the PHY driver
> itself.
>
> Best regards,
> Marcin

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

* Re: [PATCH 1/1] net: phy: marvell: Fixed handing of delays with plain RGMII interface
  2021-06-29  0:05       ` Kurt Cancemi
@ 2021-06-29  0:21         ` Marek Behún
  0 siblings, 0 replies; 10+ messages in thread
From: Marek Behún @ 2021-06-29  0:21 UTC (permalink / raw)
  To: Kurt Cancemi; +Cc: Marcin Wojtas, netdev

On Mon, 28 Jun 2021 20:05:19 -0400
Kurt Cancemi <kurt@x64architecture.com> wrote:

> Well I'm sorry for the noise I was running into a lot of other DPAA
> ethernet related issues and overlooked adding phy-mode = "rgmii-id";
> that fixed the issue. I knew my patch was not correct (as I explained
> in the cover email) but I was not sure why it was necessary but now I
> see it was not necessary I just had "phy-connection-mode" instead of
> "phy-mode".
> 
> May I ask what is the purpose of phy-connection-mode? And why did the

phy-connection-type, not mode

> DPAA driver recognize the PHY interface mode as RGMII ID but the
> Marvell PHY driver didn't?

phy-mode and phy-connection-type are synonyms. phy-mode takes
precedence. Look at drivers/of/of_net.c function of_get_phy_mode().

If your device tree declares both, it can lead to confusion. For
example if dtsi file says
  phy-mode = "rgmii";
and you include this dtsi file but than you say
  phy-connection-type = "rgmii-id";
the kernel code will use rgmii, not rgmii-id, because phy-mode takes
precedence over phy-connection-type.

Marek

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

* Re: [PATCH 1/1] net: phy: marvell: Fixed handing of delays with plain RGMII interface
       [not found]     ` <CADujJWWoWRyW3S+f3F_Zhq9H90QZ1W4eu=5dyad3DeMLHFp2TA@mail.gmail.com>
@ 2021-06-29  0:23       ` Marek Behún
  2021-06-29  1:12         ` Kurt Cancemi
  0 siblings, 1 reply; 10+ messages in thread
From: Marek Behún @ 2021-06-29  0:23 UTC (permalink / raw)
  To: Kurt Cancemi; +Cc: netdev

On Mon, 28 Jun 2021 19:09:49 -0400
Kurt Cancemi <kurt@x64architecture.com> wrote:

> I’m sorry if I proposed this wrong (I am new to the kernel mailing list), I
> acknowledge that this is probably not the way to fix the problem, I wanted
> to discuss why my fix is necessary. In the cover email I explained that I
> used (in the device tree) “rgmii-id” for the “phy-connection-type” and the
> DPAA memac correctly reports that the PHY type is “PHY_INTERFACE_MODE_RGMII_ID”
> but without my patch the RX and TX delay flags are not set on the
> underlying Marvell PHY and I receive RX and TX errors on every network
> request. Maybe there is some type of incompatibility between the Freescale
> DPAA1 Ethernet driver and the Marvell PHY?

Which driver again?
  drivers/net/ethernet/freescale/dpaa
or
  drivers/net/ethernet/freescale/dpaa2
?

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

* Re: [PATCH 1/1] net: phy: marvell: Fixed handing of delays with plain RGMII interface
  2021-06-29  0:23       ` Marek Behún
@ 2021-06-29  1:12         ` Kurt Cancemi
  2021-06-29 10:52           ` Marek Behún
  0 siblings, 1 reply; 10+ messages in thread
From: Kurt Cancemi @ 2021-06-29  1:12 UTC (permalink / raw)
  To: Marek Behún; +Cc: netdev

I am using drivers/net/ethernet/freescale/dpaa. This is a T2080 soc.

The following is where I added a dev_info statement for "phy_if", it
correctly returned -> PHY_INTERFACE_MODE_RGMII_ID.
https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/freescale/fman/mac.c#L774

I will clarify things better, I am using an almost verbatim device
tree "arch/powerpc/boot/dts/fsl/t2080rdb.dts" the only changes I made
are the following:

Doesn't Work (RX and TX errors on every packet):
--- t2080rdb.dts    2021-06-28 21:08:06.571758700 -0400
+++ t2080rdb-doesnt_work.dts    2021-06-28 21:08:10.704915200 -0400
@@ -68,7 +68,7 @@

         ethernet@e4000 {
             phy-handle = <&rgmii_phy1>;
-            phy-connection-type = "rgmii";
+            phy-connection-type = "rgmii-id";
         };

         ethernet@e6000 {

Works (Your suggestion):
--- t2080rdb.dts    2021-06-28 21:08:06.571758700 -0400
+++ t2080rdb-works.dts    2021-06-28 21:09:49.415971900 -0400
@@ -68,7 +68,7 @@

         ethernet@e4000 {
             phy-handle = <&rgmii_phy1>;
-            phy-connection-type = "rgmii";
+            phy-mode = "rgmii-id";
         };

         ethernet@e6000 {

On Mon, Jun 28, 2021 at 8:23 PM Marek Behún <kabel@kernel.org> wrote:
>
> On Mon, 28 Jun 2021 19:09:49 -0400
> Kurt Cancemi <kurt@x64architecture.com> wrote:
>
> > I’m sorry if I proposed this wrong (I am new to the kernel mailing list), I
> > acknowledge that this is probably not the way to fix the problem, I wanted
> > to discuss why my fix is necessary. In the cover email I explained that I
> > used (in the device tree) “rgmii-id” for the “phy-connection-type” and the
> > DPAA memac correctly reports that the PHY type is “PHY_INTERFACE_MODE_RGMII_ID”
> > but without my patch the RX and TX delay flags are not set on the
> > underlying Marvell PHY and I receive RX and TX errors on every network
> > request. Maybe there is some type of incompatibility between the Freescale
> > DPAA1 Ethernet driver and the Marvell PHY?
>
> Which driver again?
>   drivers/net/ethernet/freescale/dpaa
> or
>   drivers/net/ethernet/freescale/dpaa2
> ?

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

* Re: [PATCH 1/1] net: phy: marvell: Fixed handing of delays with plain RGMII interface
  2021-06-29  1:12         ` Kurt Cancemi
@ 2021-06-29 10:52           ` Marek Behún
  2021-06-29 15:08             ` Andrew Lunn
  0 siblings, 1 reply; 10+ messages in thread
From: Marek Behún @ 2021-06-29 10:52 UTC (permalink / raw)
  To: Kurt Cancemi; +Cc: netdev

On Mon, 28 Jun 2021 21:12:41 -0400
Kurt Cancemi <kurt@x64architecture.com> wrote:

> I am using drivers/net/ethernet/freescale/dpaa. This is a T2080 soc.
> 
> The following is where I added a dev_info statement for "phy_if", it
> correctly returned -> PHY_INTERFACE_MODE_RGMII_ID.
> https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/freescale/fman/mac.c#L774

It seem that dpaa / fman drivers do the same thing for both
"rgmii" and "rgmii-id". There should be code that enables the delays
for the "rgmii-id" variant...

Marek

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

* Re: [PATCH 1/1] net: phy: marvell: Fixed handing of delays with plain RGMII interface
  2021-06-29 10:52           ` Marek Behún
@ 2021-06-29 15:08             ` Andrew Lunn
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Lunn @ 2021-06-29 15:08 UTC (permalink / raw)
  To: Marek Behún; +Cc: Kurt Cancemi, netdev

On Tue, Jun 29, 2021 at 12:52:34PM +0200, Marek Behún wrote:
> On Mon, 28 Jun 2021 21:12:41 -0400
> Kurt Cancemi <kurt@x64architecture.com> wrote:
> 
> > I am using drivers/net/ethernet/freescale/dpaa. This is a T2080 soc.
> > 
> > The following is where I added a dev_info statement for "phy_if", it
> > correctly returned -> PHY_INTERFACE_MODE_RGMII_ID.
> > https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/freescale/fman/mac.c#L774
> 
> It seem that dpaa / fman drivers do the same thing for both
> "rgmii" and "rgmii-id". There should be code that enables the delays
> for the "rgmii-id" variant...

Generally, the MAC does nothing, and asks the PHY to do the delay. So
in the MAC driver there should be nothing, apart from pass phy-mode to
the PHY.

    Andrew

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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28 19:28 [PATCH 0/1] Possible Issue Setting the Delay Flags in the Marvell Net PHY Driver Kurt Cancemi
2021-06-28 19:28 ` [PATCH 1/1] net: phy: marvell: Fixed handing of delays with plain RGMII interface Kurt Cancemi
2021-06-28 22:49   ` Marek Behún
2021-06-28 23:01     ` Marcin Wojtas
2021-06-29  0:05       ` Kurt Cancemi
2021-06-29  0:21         ` Marek Behún
     [not found]     ` <CADujJWWoWRyW3S+f3F_Zhq9H90QZ1W4eu=5dyad3DeMLHFp2TA@mail.gmail.com>
2021-06-29  0:23       ` Marek Behún
2021-06-29  1:12         ` Kurt Cancemi
2021-06-29 10:52           ` Marek Behún
2021-06-29 15:08             ` Andrew Lunn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.