[PATCH] net: gem: Add support for more PHYs on MDIO bus

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] net: gem: Add support for more PHYs on MDIO bus

Michal Simek-3
Find out MDIO bus and enable MDIO access to it if this is done via
different GEM controller. Only works across GEM instances.

Signed-off-by: Michal Simek <[hidden email]>
---

 drivers/net/zynq_gem.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index da4b6fba9ff6..8afec8bbfcff 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -758,6 +758,9 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
 
  if (!dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
  &phandle_args)) {
+ fdt_addr_t addr;
+ ofnode parent;
+
  debug("phy-handle does exist %s\n", dev->name);
  priv->phyaddr = ofnode_read_u32_default(phandle_args.node,
  "reg", -1);
@@ -765,6 +768,13 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
  priv->max_speed = ofnode_read_u32_default(phandle_args.node,
   "max-speed",
   SPEED_1000);
+
+ parent = ofnode_get_parent(phandle_args.node);
+ addr = ofnode_get_addr(parent);
+ if (addr != FDT_ADDR_T_NONE) {
+ debug("MDIO bus not found %s\n", dev->name);
+ priv->mdiobase = (struct zynq_gem_regs *)addr;
+ }
  }
 
  phy_mode = dev_read_prop(dev, "phy-mode", NULL);
--
2.28.0

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] net: gem: Add support for more PHYs on MDIO bus

Michal Simek-4
po 24. 8. 2020 v 13:45 odesílatel Michal Simek <[hidden email]> napsal:

>
> Find out MDIO bus and enable MDIO access to it if this is done via
> different GEM controller. Only works across GEM instances.
>
> Signed-off-by: Michal Simek <[hidden email]>
> ---
>
>  drivers/net/zynq_gem.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> index da4b6fba9ff6..8afec8bbfcff 100644
> --- a/drivers/net/zynq_gem.c
> +++ b/drivers/net/zynq_gem.c
> @@ -758,6 +758,9 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
>
>         if (!dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
>                                         &phandle_args)) {
> +               fdt_addr_t addr;
> +               ofnode parent;
> +
>                 debug("phy-handle does exist %s\n", dev->name);
>                 priv->phyaddr = ofnode_read_u32_default(phandle_args.node,
>                                                         "reg", -1);
> @@ -765,6 +768,13 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
>                 priv->max_speed = ofnode_read_u32_default(phandle_args.node,
>                                                           "max-speed",
>                                                           SPEED_1000);
> +
> +               parent = ofnode_get_parent(phandle_args.node);
> +               addr = ofnode_get_addr(parent);
> +               if (addr != FDT_ADDR_T_NONE) {
> +                       debug("MDIO bus not found %s\n", dev->name);
> +                       priv->mdiobase = (struct zynq_gem_regs *)addr;
> +               }
>         }
>
>         phy_mode = dev_read_prop(dev, "phy-mode", NULL);
> --
> 2.28.0
>

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