u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] TSEC Ethernet driver phy-mode changes
@ 2021-09-18 12:46 Vladimir Oltean
  2021-09-18 12:46 ` [PATCH 1/2] net: tsec: only call tsec_get_interface as fallback to DT-specified PHY mode Vladimir Oltean
  2021-09-18 12:46 ` [PATCH 2/2] net: tsec: read the phy-mode property as fallback to phy-connection-type Vladimir Oltean
  0 siblings, 2 replies; 7+ messages in thread
From: Vladimir Oltean @ 2021-09-18 12:46 UTC (permalink / raw)
  To: u-boot; +Cc: Joe Hershberger, Ramon Fried, Bin Meng

Make the Freescale/NXP TSEC driver listen to the phy-mode or
phy-connection-type OF property.

Currently there is an attempt to auto-determine the PHY mode, only do
that if the phy-mode string is not specified.

Also, be compatible with phy-mode, right now the driver only parses
phy-connection-type, both both are equivalent.

Vladimir Oltean (2):
  net: tsec: only call tsec_get_interface as fallback to DT-specified
    PHY mode
  net: tsec: read the phy-mode property as fallback to
    phy-connection-type

 drivers/net/tsec.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

-- 
2.25.1


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

* [PATCH 1/2] net: tsec: only call tsec_get_interface as fallback to DT-specified PHY mode
  2021-09-18 12:46 [PATCH 0/2] TSEC Ethernet driver phy-mode changes Vladimir Oltean
@ 2021-09-18 12:46 ` Vladimir Oltean
  2021-09-19  7:32   ` Bin Meng
  2021-09-18 12:46 ` [PATCH 2/2] net: tsec: read the phy-mode property as fallback to phy-connection-type Vladimir Oltean
  1 sibling, 1 reply; 7+ messages in thread
From: Vladimir Oltean @ 2021-09-18 12:46 UTC (permalink / raw)
  To: u-boot; +Cc: Joe Hershberger, Ramon Fried, Bin Meng

Currently the init_phy function may overwrite the priv->interface
property, since it calls tsec_get_interface which tries to determine it
dynamically based on default register values in ECNTRL.

Let's do that only if phy-connection-type happens to not be defined in
the device tree.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/tsec.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index ee820aae15ef..809cf7e432e6 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -701,8 +701,6 @@ static int init_phy(struct tsec_private *priv)
 	/* Assign a Physical address to the TBI */
 	out_be32(&regs->tbipa, priv->tbiaddr);
 
-	priv->interface = tsec_get_interface(priv);
-
 	if (priv->interface == PHY_INTERFACE_MODE_SGMII)
 		tsec_configure_serdes(priv);
 
@@ -888,10 +886,9 @@ int tsec_probe(struct udevice *dev)
 	phy_mode = dev_read_prop(dev, "phy-connection-type", NULL);
 	if (phy_mode)
 		pdata->phy_interface = phy_get_interface_by_name(phy_mode);
-	if (pdata->phy_interface == -1) {
-		printf("Invalid PHY interface '%s'\n", phy_mode);
-		return -EINVAL;
-	}
+	if (pdata->phy_interface == -1)
+		pdata->phy_interface = tsec_get_interface(priv);
+
 	priv->interface = pdata->phy_interface;
 
 	/* Check for speed limit, default is 1000Mbps */
-- 
2.25.1


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

* [PATCH 2/2] net: tsec: read the phy-mode property as fallback to phy-connection-type
  2021-09-18 12:46 [PATCH 0/2] TSEC Ethernet driver phy-mode changes Vladimir Oltean
  2021-09-18 12:46 ` [PATCH 1/2] net: tsec: only call tsec_get_interface as fallback to DT-specified PHY mode Vladimir Oltean
@ 2021-09-18 12:46 ` Vladimir Oltean
  2021-09-19  7:32   ` Bin Meng
  1 sibling, 1 reply; 7+ messages in thread
From: Vladimir Oltean @ 2021-09-18 12:46 UTC (permalink / raw)
  To: u-boot; +Cc: Joe Hershberger, Ramon Fried, Bin Meng

The two should be equivalent, but at the moment some platforms
(ls1021a-tsn.dts) use phy-mode only, which is not parsed.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/tsec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 809cf7e432e6..f0cf0a7559ab 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -884,6 +884,8 @@ int tsec_probe(struct udevice *dev)
 	priv->tbiaddr = tbiaddr;
 
 	phy_mode = dev_read_prop(dev, "phy-connection-type", NULL);
+	if (!phy_mode)
+		phy_mode = dev_read_prop(dev, "phy-mode", NULL);
 	if (phy_mode)
 		pdata->phy_interface = phy_get_interface_by_name(phy_mode);
 	if (pdata->phy_interface == -1)
-- 
2.25.1


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

* Re: [PATCH 1/2] net: tsec: only call tsec_get_interface as fallback to DT-specified PHY mode
  2021-09-18 12:46 ` [PATCH 1/2] net: tsec: only call tsec_get_interface as fallback to DT-specified PHY mode Vladimir Oltean
@ 2021-09-19  7:32   ` Bin Meng
  2021-09-28 13:30     ` Ramon Fried
  0 siblings, 1 reply; 7+ messages in thread
From: Bin Meng @ 2021-09-19  7:32 UTC (permalink / raw)
  To: Vladimir Oltean; +Cc: U-Boot Mailing List, Joe Hershberger, Ramon Fried

On Sat, Sep 18, 2021 at 8:47 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
>
> Currently the init_phy function may overwrite the priv->interface
> property, since it calls tsec_get_interface which tries to determine it
> dynamically based on default register values in ECNTRL.
>
> Let's do that only if phy-connection-type happens to not be defined in
> the device tree.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  drivers/net/tsec.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

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

* Re: [PATCH 2/2] net: tsec: read the phy-mode property as fallback to phy-connection-type
  2021-09-18 12:46 ` [PATCH 2/2] net: tsec: read the phy-mode property as fallback to phy-connection-type Vladimir Oltean
@ 2021-09-19  7:32   ` Bin Meng
  2021-09-28 13:30     ` Ramon Fried
  0 siblings, 1 reply; 7+ messages in thread
From: Bin Meng @ 2021-09-19  7:32 UTC (permalink / raw)
  To: Vladimir Oltean; +Cc: U-Boot Mailing List, Joe Hershberger, Ramon Fried

On Sat, Sep 18, 2021 at 8:47 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
>
> The two should be equivalent, but at the moment some platforms
> (ls1021a-tsn.dts) use phy-mode only, which is not parsed.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  drivers/net/tsec.c | 2 ++
>  1 file changed, 2 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

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

* Re: [PATCH 1/2] net: tsec: only call tsec_get_interface as fallback to DT-specified PHY mode
  2021-09-19  7:32   ` Bin Meng
@ 2021-09-28 13:30     ` Ramon Fried
  0 siblings, 0 replies; 7+ messages in thread
From: Ramon Fried @ 2021-09-28 13:30 UTC (permalink / raw)
  To: Bin Meng; +Cc: Vladimir Oltean, U-Boot Mailing List, Joe Hershberger

On Sun, Sep 19, 2021 at 10:32 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Sat, Sep 18, 2021 at 8:47 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
> >
> > Currently the init_phy function may overwrite the priv->interface
> > property, since it calls tsec_get_interface which tries to determine it
> > dynamically based on default register values in ECNTRL.
> >
> > Let's do that only if phy-connection-type happens to not be defined in
> > the device tree.
> >
> > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> > ---
> >  drivers/net/tsec.c | 9 +++------
> >  1 file changed, 3 insertions(+), 6 deletions(-)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

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

* Re: [PATCH 2/2] net: tsec: read the phy-mode property as fallback to phy-connection-type
  2021-09-19  7:32   ` Bin Meng
@ 2021-09-28 13:30     ` Ramon Fried
  0 siblings, 0 replies; 7+ messages in thread
From: Ramon Fried @ 2021-09-28 13:30 UTC (permalink / raw)
  To: Bin Meng; +Cc: Vladimir Oltean, U-Boot Mailing List, Joe Hershberger

On Sun, Sep 19, 2021 at 10:32 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Sat, Sep 18, 2021 at 8:47 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
> >
> > The two should be equivalent, but at the moment some platforms
> > (ls1021a-tsn.dts) use phy-mode only, which is not parsed.
> >
> > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> > ---
> >  drivers/net/tsec.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

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

end of thread, other threads:[~2021-09-28 13:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-18 12:46 [PATCH 0/2] TSEC Ethernet driver phy-mode changes Vladimir Oltean
2021-09-18 12:46 ` [PATCH 1/2] net: tsec: only call tsec_get_interface as fallback to DT-specified PHY mode Vladimir Oltean
2021-09-19  7:32   ` Bin Meng
2021-09-28 13:30     ` Ramon Fried
2021-09-18 12:46 ` [PATCH 2/2] net: tsec: read the phy-mode property as fallback to phy-connection-type Vladimir Oltean
2021-09-19  7:32   ` Bin Meng
2021-09-28 13:30     ` Ramon Fried

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