Re: [RFC Patch net-next 01/10] net: dsa: microchip: lan937x: read rgmii delay from device tree

From: Vladimir Oltean
Date: Tue Jul 19 2022 - 06:28:14 EST


On Tue, Jul 12, 2022 at 09:32:59PM +0530, Arun Ramadoss wrote:
> This patch read the rgmii tx and rx delay from device tree and stored it
> in the ksz_port.
>
> Signed-off-by: Arun Ramadoss <arun.ramadoss@xxxxxxxxxxxxx>
> ---

I think this patch should be squashed into the change that actually uses
the parsed values.

> drivers/net/dsa/microchip/ksz_common.c | 16 ++++++++++++++++
> drivers/net/dsa/microchip/ksz_common.h | 2 ++
> 2 files changed, 18 insertions(+)
>
> diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
> index 28d7cb2ce98f..4bc6277b4361 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -1499,6 +1499,7 @@ int ksz_switch_register(struct ksz_device *dev)
> struct device_node *port, *ports;
> phy_interface_t interface;
> unsigned int port_num;
> + u32 *value;
> int ret;
> int i;
>
> @@ -1589,6 +1590,21 @@ int ksz_switch_register(struct ksz_device *dev)
> }
> of_get_phy_mode(port,
> &dev->ports[port_num].interface);
> +
> + if (!dev->info->supports_rgmii[port_num])
> + continue;
> +
> + value = &dev->ports[port_num].rgmii_rx_val;
> + if (of_property_read_u32(port,
> + "rx-internal-delay-ps",
> + value))
> + *value = 0;
> +
> + value = &dev->ports[port_num].rgmii_tx_val;
> + if (of_property_read_u32(port,
> + "tx-internal-delay-ps",
> + value))
> + *value = 0;
> }
> dev->synclko_125 = of_property_read_bool(dev->dev->of_node,
> "microchip,synclko-125");
> diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
> index d5dddb7ec045..41fe6388af9e 100644
> --- a/drivers/net/dsa/microchip/ksz_common.h
> +++ b/drivers/net/dsa/microchip/ksz_common.h
> @@ -77,6 +77,8 @@ struct ksz_port {
> struct ksz_port_mib mib;
> phy_interface_t interface;
> u16 max_frame;
> + u32 rgmii_tx_val;
> + u32 rgmii_rx_val;
> };
>
> struct ksz_device {
> --
> 2.36.1
>