diff mbox series

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

Message ID 20220712160308.13253-2-arun.ramadoss@microchip.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: dsa: microchip: add support for phylink mac config and link up | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 36 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Arun Ramadoss July 12, 2022, 4:02 p.m. UTC
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@microchip.com>
---
 drivers/net/dsa/microchip/ksz_common.c | 16 ++++++++++++++++
 drivers/net/dsa/microchip/ksz_common.h |  2 ++
 2 files changed, 18 insertions(+)

Comments

Vladimir Oltean July 19, 2022, 10:28 a.m. UTC | #1
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@microchip.com>
> ---

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
>
Arun Ramadoss July 19, 2022, 3:58 p.m. UTC | #2
On Tue, 2022-07-19 at 13:28 +0300, Vladimir Oltean wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> 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@microchip.com>
> > ---
> 
> I think this patch should be squashed into the change that actually
> uses
> the parsed values.

Ok, I will Squash this patch.

> 
> >  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,s
> > ynclko-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
> >
diff mbox series

Patch

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 {