All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: phy: Fix rgmii-id phy reset timeout issue
@ 2022-03-29 14:05 Michal Simek
  2022-03-29 16:18 ` Bin Meng
  2022-04-05 13:11 ` Michal Simek
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Simek @ 2022-03-29 14:05 UTC (permalink / raw)
  To: u-boot, git
  Cc: T Karthik Reddy, Bin Meng, Joe Hershberger, Priyanka Jain,
	Radu Pirea (NXP OSS),
	Ramon Fried, Vladimir Oltean, Wolfgang Denk

From: T Karthik Reddy <t.karthik.reddy@xilinx.com>

While creating a phy device using phy_device_create(), we need to
provide a valid phyaddr instead of 0 causing phy address being
registered as 0 with mdio bus and shows mdio phy list as below

ZynqMP>  mdio list
eth0:
0 - TI DP83867 <--> ethernet@ff0b0000
eth1:
0 - TI DP83867 <--> ethernet@ff0c0000

Also PHY soft reset is being requested on 0 instead of valid
address causing "PHY reset timed out" error.

So add phyaddr argument to phy_connect_phy_id() and to its prototype
to create phy device with valid phyaddress.

Fixes: a744a284e354 ("net: phy: Add support for ethernet-phy-id with gpio reset")
Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/net/phy/ethernet_id.c | 4 ++--
 drivers/net/phy/phy.c         | 2 +-
 include/phy.h                 | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/ethernet_id.c b/drivers/net/phy/ethernet_id.c
index 5617ac3ad62f..44abc5bfb301 100644
--- a/drivers/net/phy/ethernet_id.c
+++ b/drivers/net/phy/ethernet_id.c
@@ -12,7 +12,7 @@
 #include <asm/gpio.h>
 
 struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev,
-				      phy_interface_t interface)
+				      int phyaddr, phy_interface_t interface)
 {
 	struct phy_device *phydev;
 	struct ofnode_phandle_args phandle_args;
@@ -61,7 +61,7 @@ struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev,
 	}
 
 	id =  vendor << 16 | device;
-	phydev = phy_device_create(bus, 0, id, false, interface);
+	phydev = phy_device_create(bus, phyaddr, id, false, interface);
 	if (phydev)
 		phydev->node = node;
 
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 08a37a344e65..690ed38ba622 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1049,7 +1049,7 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
 
 #ifdef CONFIG_PHY_ETHERNET_ID
 	if (!phydev)
-		phydev = phy_connect_phy_id(bus, dev, interface);
+		phydev = phy_connect_phy_id(bus, dev, addr, interface);
 #endif
 
 #ifdef CONFIG_PHY_XILINX_GMII2RGMII
diff --git a/include/phy.h b/include/phy.h
index 9ea4bd42db4d..5e3da4b01b6c 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -479,7 +479,7 @@ struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
  *			or NULL otherwise
  */
 struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev,
-				      phy_interface_t interface);
+				      int phyaddr, phy_interface_t interface);
 
 static inline ofnode phy_get_ofnode(struct phy_device *phydev)
 {
-- 
2.35.1


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

* Re: [PATCH] net: phy: Fix rgmii-id phy reset timeout issue
  2022-03-29 14:05 [PATCH] net: phy: Fix rgmii-id phy reset timeout issue Michal Simek
@ 2022-03-29 16:18 ` Bin Meng
  2022-04-05 13:11 ` Michal Simek
  1 sibling, 0 replies; 3+ messages in thread
From: Bin Meng @ 2022-03-29 16:18 UTC (permalink / raw)
  To: Michal Simek
  Cc: U-Boot Mailing List, git, T Karthik Reddy, Joe Hershberger,
	Priyanka Jain, Radu Pirea (NXP OSS),
	Ramon Fried, Vladimir Oltean, Wolfgang Denk

On Tue, Mar 29, 2022 at 10:06 PM Michal Simek <michal.simek@xilinx.com> wrote:
>
> From: T Karthik Reddy <t.karthik.reddy@xilinx.com>
>
> While creating a phy device using phy_device_create(), we need to
> provide a valid phyaddr instead of 0 causing phy address being
> registered as 0 with mdio bus and shows mdio phy list as below
>
> ZynqMP>  mdio list
> eth0:
> 0 - TI DP83867 <--> ethernet@ff0b0000
> eth1:
> 0 - TI DP83867 <--> ethernet@ff0c0000
>
> Also PHY soft reset is being requested on 0 instead of valid
> address causing "PHY reset timed out" error.
>
> So add phyaddr argument to phy_connect_phy_id() and to its prototype
> to create phy device with valid phyaddress.
>
> Fixes: a744a284e354 ("net: phy: Add support for ethernet-phy-id with gpio reset")
> Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  drivers/net/phy/ethernet_id.c | 4 ++--
>  drivers/net/phy/phy.c         | 2 +-
>  include/phy.h                 | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
>

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

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

* Re: [PATCH] net: phy: Fix rgmii-id phy reset timeout issue
  2022-03-29 14:05 [PATCH] net: phy: Fix rgmii-id phy reset timeout issue Michal Simek
  2022-03-29 16:18 ` Bin Meng
@ 2022-04-05 13:11 ` Michal Simek
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Simek @ 2022-04-05 13:11 UTC (permalink / raw)
  To: U-Boot, git
  Cc: T Karthik Reddy, Bin Meng, Joe Hershberger, Priyanka Jain,
	Radu Pirea (NXP OSS),
	Ramon Fried, Vladimir Oltean, Wolfgang Denk

út 29. 3. 2022 v 16:06 odesílatel Michal Simek <michal.simek@xilinx.com> napsal:
>
> From: T Karthik Reddy <t.karthik.reddy@xilinx.com>
>
> While creating a phy device using phy_device_create(), we need to
> provide a valid phyaddr instead of 0 causing phy address being
> registered as 0 with mdio bus and shows mdio phy list as below
>
> ZynqMP>  mdio list
> eth0:
> 0 - TI DP83867 <--> ethernet@ff0b0000
> eth1:
> 0 - TI DP83867 <--> ethernet@ff0c0000
>
> Also PHY soft reset is being requested on 0 instead of valid
> address causing "PHY reset timed out" error.
>
> So add phyaddr argument to phy_connect_phy_id() and to its prototype
> to create phy device with valid phyaddress.
>
> Fixes: a744a284e354 ("net: phy: Add support for ethernet-phy-id with gpio reset")
> Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  drivers/net/phy/ethernet_id.c | 4 ++--
>  drivers/net/phy/phy.c         | 2 +-
>  include/phy.h                 | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/phy/ethernet_id.c b/drivers/net/phy/ethernet_id.c
> index 5617ac3ad62f..44abc5bfb301 100644
> --- a/drivers/net/phy/ethernet_id.c
> +++ b/drivers/net/phy/ethernet_id.c
> @@ -12,7 +12,7 @@
>  #include <asm/gpio.h>
>
>  struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev,
> -                                     phy_interface_t interface)
> +                                     int phyaddr, phy_interface_t interface)
>  {
>         struct phy_device *phydev;
>         struct ofnode_phandle_args phandle_args;
> @@ -61,7 +61,7 @@ struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev,
>         }
>
>         id =  vendor << 16 | device;
> -       phydev = phy_device_create(bus, 0, id, false, interface);
> +       phydev = phy_device_create(bus, phyaddr, id, false, interface);
>         if (phydev)
>                 phydev->node = node;
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 08a37a344e65..690ed38ba622 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -1049,7 +1049,7 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
>
>  #ifdef CONFIG_PHY_ETHERNET_ID
>         if (!phydev)
> -               phydev = phy_connect_phy_id(bus, dev, interface);
> +               phydev = phy_connect_phy_id(bus, dev, addr, interface);
>  #endif
>
>  #ifdef CONFIG_PHY_XILINX_GMII2RGMII
> diff --git a/include/phy.h b/include/phy.h
> index 9ea4bd42db4d..5e3da4b01b6c 100644
> --- a/include/phy.h
> +++ b/include/phy.h
> @@ -479,7 +479,7 @@ struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
>   *                     or NULL otherwise
>   */
>  struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev,
> -                                     phy_interface_t interface);
> +                                     int phyaddr, phy_interface_t interface);
>
>  static inline ofnode phy_get_ofnode(struct phy_device *phydev)
>  {
> --
> 2.35.1
>

Applied.
M

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

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

end of thread, other threads:[~2022-04-05 13:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-29 14:05 [PATCH] net: phy: Fix rgmii-id phy reset timeout issue Michal Simek
2022-03-29 16:18 ` Bin Meng
2022-04-05 13:11 ` Michal Simek

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.