diff mbox series

[2/6] net: stmmac: Expand clock rate variables

Message ID AM9PR04MB85062693F5ACB16F411FD0CFE2BD2@AM9PR04MB8506.eurprd04.prod.outlook.com (mailing list archive)
State New, archived
Headers show
Series Add support for Synopsis DWMAC IP on NXP Automotive SoCs | expand

Commit Message

Jan Petrous Aug. 4, 2024, 8:49 p.m. UTC
The clock API clk_get_rate() returns unsigned long value.
Expand affected members of stmmac platform data.

Signed-off-by: Jan Petrous (OSS) <jan.petrous@oss.nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c   | 2 +-
 include/linux/stmmac.h                                  | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

Comments

Andrew Lunn Aug. 4, 2024, 11:12 p.m. UTC | #1
On Sun, Aug 04, 2024 at 08:49:49PM +0000, Jan Petrous (OSS) wrote:
> The clock API clk_get_rate() returns unsigned long value.
> Expand affected members of stmmac platform data.
> 
> Signed-off-by: Jan Petrous (OSS) <jan.petrous@oss.nxp.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Serge Semin Aug. 6, 2024, 10:17 a.m. UTC | #2
On Sun, Aug 04, 2024 at 08:49:49PM +0000, Jan Petrous (OSS) wrote:
> The clock API clk_get_rate() returns unsigned long value.
> Expand affected members of stmmac platform data.
> 
> Signed-off-by: Jan Petrous (OSS) <jan.petrous@oss.nxp.com>

Since you are fixing this anyway, please convert the
stmmac_clk_csr_set() and dwmac4_core_init() methods to defining the
unsigned long clk_rate local variables.

After taking the above into account feel free to add:
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>

-Serge(y)

> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +-
>  drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c   | 2 +-
>  include/linux/stmmac.h                                  | 6 +++---
>  3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> index 901a3c1959fa..2a5b38723635 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> @@ -777,7 +777,7 @@ static void ethqos_ptp_clk_freq_config(struct stmmac_priv *priv)
>  		netdev_err(priv->dev, "Failed to max out clk_ptp_ref: %d\n", err);
>  	plat_dat->clk_ptp_rate = clk_get_rate(plat_dat->clk_ptp_ref);
>  
> -	netdev_dbg(priv->dev, "PTP rate %d\n", plat_dat->clk_ptp_rate);
> +	netdev_dbg(priv->dev, "PTP rate %lu\n", plat_dat->clk_ptp_rate);
>  }
>  
>  static int qcom_ethqos_probe(struct platform_device *pdev)
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index ad868e8d195d..b1e4df1a86a0 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -639,7 +639,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
>  		dev_info(&pdev->dev, "PTP uses main clock\n");
>  	} else {
>  		plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref);
> -		dev_dbg(&pdev->dev, "PTP rate %d\n", plat->clk_ptp_rate);
> +		dev_dbg(&pdev->dev, "PTP rate %lu\n", plat->clk_ptp_rate);
>  	}
>  
>  	plat->stmmac_rst = devm_reset_control_get_optional(&pdev->dev,
> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
> index 7caaa5ae6674..47a763699916 100644
> --- a/include/linux/stmmac.h
> +++ b/include/linux/stmmac.h
> @@ -279,8 +279,8 @@ struct plat_stmmacenet_data {
>  	struct clk *stmmac_clk;
>  	struct clk *pclk;
>  	struct clk *clk_ptp_ref;
> -	unsigned int clk_ptp_rate;
> -	unsigned int clk_ref_rate;
> +	unsigned long clk_ptp_rate;
> +	unsigned long clk_ref_rate;
>  	unsigned int mult_fact_100ns;
>  	s32 ptp_max_adj;
>  	u32 cdc_error_adj;
> @@ -292,7 +292,7 @@ struct plat_stmmacenet_data {
>  	int mac_port_sel_speed;
>  	int has_xgmac;
>  	u8 vlan_fail_q;

> -	unsigned int eee_usecs_rate;
> +	unsigned long eee_usecs_rate;

Sigh... One another Intel clumsy stuff: this field is initialized by
the Intel glue-drivers and utilized in there only. Why on earth has it
been added to the generic plat_stmmacenet_data structure?.. The
only explanation is that the Intel developers were lazy to refactor
the glue-driver a bit so the to be able to reach the platform data at
the respective context.

-Serge(y)

>  	struct pci_dev *pdev;
>  	int int_snapshot_num;
>  	int msi_mac_vec;
> -- 
> 2.45.2
> 
>
Jan Petrous Aug. 18, 2024, 6:54 p.m. UTC | #3
> -----Original Message-----
> From: Serge Semin <fancer.lancer@gmail.com>
> Sent: Tuesday, 6 August, 2024 12:18
> To: Jan Petrous (OSS) <jan.petrous@oss.nxp.com>
> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>; Alexandre Torgue
> <alexandre.torgue@foss.st.com>; dl-S32 <S32@nxp.com>; linux-
> kernel@vger.kernel.org; linux-stm32@st-md-mailman.stormreply.com; linux-
> arm-kernel@lists.infradead.org; Claudiu Manoil <claudiu.manoil@nxp.com>;
> netdev@vger.kernel.org
> Subject: Re: [PATCH 2/6] net: stmmac: Expand clock rate variables
> 
> On Sun, Aug 04, 2024 at 08:49:49PM +0000, Jan Petrous (OSS) wrote:
> > The clock API clk_get_rate() returns unsigned long value.
> > Expand affected members of stmmac platform data.
> >
> > Signed-off-by: Jan Petrous (OSS) <jan.petrous@oss.nxp.com>
> 
> Since you are fixing this anyway, please convert the
> stmmac_clk_csr_set() and dwmac4_core_init() methods to defining the
> unsigned long clk_rate local variables.

OK, will add it to v2.

> 
> After taking the above into account feel free to add:
> Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
> 
> -Serge(y)
> 
> > ---
> >  drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +-
> >  drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c   | 2 +-
> >  include/linux/stmmac.h                                  | 6 +++---
> >  3 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> > index 901a3c1959fa..2a5b38723635 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> > @@ -777,7 +777,7 @@ static void ethqos_ptp_clk_freq_config(struct
> stmmac_priv *priv)
> >  		netdev_err(priv->dev, "Failed to max out clk_ptp_ref: %d\n",
> err);
> >  	plat_dat->clk_ptp_rate = clk_get_rate(plat_dat->clk_ptp_ref);
> >
> > -	netdev_dbg(priv->dev, "PTP rate %d\n", plat_dat->clk_ptp_rate);
> > +	netdev_dbg(priv->dev, "PTP rate %lu\n", plat_dat->clk_ptp_rate);
> >  }
> >
> >  static int qcom_ethqos_probe(struct platform_device *pdev)
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > index ad868e8d195d..b1e4df1a86a0 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > @@ -639,7 +639,7 @@ stmmac_probe_config_dt(struct platform_device
> *pdev, u8 *mac)
> >  		dev_info(&pdev->dev, "PTP uses main clock\n");
> >  	} else {
> >  		plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref);
> > -		dev_dbg(&pdev->dev, "PTP rate %d\n", plat->clk_ptp_rate);
> > +		dev_dbg(&pdev->dev, "PTP rate %lu\n", plat->clk_ptp_rate);
> >  	}
> >
> >  	plat->stmmac_rst = devm_reset_control_get_optional(&pdev->dev,
> > diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
> > index 7caaa5ae6674..47a763699916 100644
> > --- a/include/linux/stmmac.h
> > +++ b/include/linux/stmmac.h
> > @@ -279,8 +279,8 @@ struct plat_stmmacenet_data {
> >  	struct clk *stmmac_clk;
> >  	struct clk *pclk;
> >  	struct clk *clk_ptp_ref;
> > -	unsigned int clk_ptp_rate;
> > -	unsigned int clk_ref_rate;
> > +	unsigned long clk_ptp_rate;
> > +	unsigned long clk_ref_rate;
> >  	unsigned int mult_fact_100ns;
> >  	s32 ptp_max_adj;
> >  	u32 cdc_error_adj;
> > @@ -292,7 +292,7 @@ struct plat_stmmacenet_data {
> >  	int mac_port_sel_speed;
> >  	int has_xgmac;
> >  	u8 vlan_fail_q;
> 
> > -	unsigned int eee_usecs_rate;
> > +	unsigned long eee_usecs_rate;
> 
> Sigh... One another Intel clumsy stuff: this field is initialized by
> the Intel glue-drivers and utilized in there only. Why on earth has it
> been added to the generic plat_stmmacenet_data structure?.. The
> only explanation is that the Intel developers were lazy to refactor
> the glue-driver a bit so the to be able to reach the platform data at
> the respective context.

I guess it is home work for Intel developers, right?

Thanks for review.
/Jan
Serge Semin Aug. 19, 2024, 11:23 a.m. UTC | #4
Hi Jan

On Sun, Aug 18, 2024 at 06:54:01PM +0000, Jan Petrous (OSS) wrote:
> > -----Original Message-----
> > From: Serge Semin <fancer.lancer@gmail.com>
> > Sent: Tuesday, 6 August, 2024 12:18
> > To: Jan Petrous (OSS) <jan.petrous@oss.nxp.com>
> > Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>; Alexandre Torgue
> > <alexandre.torgue@foss.st.com>; dl-S32 <S32@nxp.com>; linux-
> > kernel@vger.kernel.org; linux-stm32@st-md-mailman.stormreply.com; linux-
> > arm-kernel@lists.infradead.org; Claudiu Manoil <claudiu.manoil@nxp.com>;
> > netdev@vger.kernel.org
> > Subject: Re: [PATCH 2/6] net: stmmac: Expand clock rate variables
> > 
> > On Sun, Aug 04, 2024 at 08:49:49PM +0000, Jan Petrous (OSS) wrote:
> > > The clock API clk_get_rate() returns unsigned long value.
> > > Expand affected members of stmmac platform data.
> > >
> > > Signed-off-by: Jan Petrous (OSS) <jan.petrous@oss.nxp.com>
> > 
> > Since you are fixing this anyway, please convert the
> > stmmac_clk_csr_set() and dwmac4_core_init() methods to defining the
> > unsigned long clk_rate local variables.
> 
> OK, will add it to v2.
> 
> > 
> > After taking the above into account feel free to add:
> > Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
> > 
> > -Serge(y)
> > 
> > > ---
> > >  drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +-
> > >  drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c   | 2 +-
> > >  include/linux/stmmac.h                                  | 6 +++---
> > >  3 files changed, 5 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> > b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> > > index 901a3c1959fa..2a5b38723635 100644
> > > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> > > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> > > @@ -777,7 +777,7 @@ static void ethqos_ptp_clk_freq_config(struct
> > stmmac_priv *priv)
> > >  		netdev_err(priv->dev, "Failed to max out clk_ptp_ref: %d\n",
> > err);
> > >  	plat_dat->clk_ptp_rate = clk_get_rate(plat_dat->clk_ptp_ref);
> > >
> > > -	netdev_dbg(priv->dev, "PTP rate %d\n", plat_dat->clk_ptp_rate);
> > > +	netdev_dbg(priv->dev, "PTP rate %lu\n", plat_dat->clk_ptp_rate);
> > >  }
> > >
> > >  static int qcom_ethqos_probe(struct platform_device *pdev)
> > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > > index ad868e8d195d..b1e4df1a86a0 100644
> > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > > @@ -639,7 +639,7 @@ stmmac_probe_config_dt(struct platform_device
> > *pdev, u8 *mac)
> > >  		dev_info(&pdev->dev, "PTP uses main clock\n");
> > >  	} else {
> > >  		plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref);
> > > -		dev_dbg(&pdev->dev, "PTP rate %d\n", plat->clk_ptp_rate);
> > > +		dev_dbg(&pdev->dev, "PTP rate %lu\n", plat->clk_ptp_rate);
> > >  	}
> > >
> > >  	plat->stmmac_rst = devm_reset_control_get_optional(&pdev->dev,
> > > diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
> > > index 7caaa5ae6674..47a763699916 100644
> > > --- a/include/linux/stmmac.h
> > > +++ b/include/linux/stmmac.h
> > > @@ -279,8 +279,8 @@ struct plat_stmmacenet_data {
> > >  	struct clk *stmmac_clk;
> > >  	struct clk *pclk;
> > >  	struct clk *clk_ptp_ref;
> > > -	unsigned int clk_ptp_rate;
> > > -	unsigned int clk_ref_rate;
> > > +	unsigned long clk_ptp_rate;
> > > +	unsigned long clk_ref_rate;
> > >  	unsigned int mult_fact_100ns;
> > >  	s32 ptp_max_adj;
> > >  	u32 cdc_error_adj;
> > > @@ -292,7 +292,7 @@ struct plat_stmmacenet_data {
> > >  	int mac_port_sel_speed;
> > >  	int has_xgmac;
> > >  	u8 vlan_fail_q;
> > 
> > > -	unsigned int eee_usecs_rate;
> > > +	unsigned long eee_usecs_rate;
> > 
> > Sigh... One another Intel clumsy stuff: this field is initialized by
> > the Intel glue-drivers and utilized in there only. Why on earth has it
> > been added to the generic plat_stmmacenet_data structure?.. The
> > only explanation is that the Intel developers were lazy to refactor
> > the glue-driver a bit so the to be able to reach the platform data at
> > the respective context.
> 

> I guess it is home work for Intel developers, right?

Mainly yes, plus to that it's a one more crying out loud from deep
inside my soul about another clumsy solution incorporated into the
poor STMMAC driver.)

-Serge(y)

> 
> Thanks for review.
> /Jan
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index 901a3c1959fa..2a5b38723635 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -777,7 +777,7 @@  static void ethqos_ptp_clk_freq_config(struct stmmac_priv *priv)
 		netdev_err(priv->dev, "Failed to max out clk_ptp_ref: %d\n", err);
 	plat_dat->clk_ptp_rate = clk_get_rate(plat_dat->clk_ptp_ref);
 
-	netdev_dbg(priv->dev, "PTP rate %d\n", plat_dat->clk_ptp_rate);
+	netdev_dbg(priv->dev, "PTP rate %lu\n", plat_dat->clk_ptp_rate);
 }
 
 static int qcom_ethqos_probe(struct platform_device *pdev)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index ad868e8d195d..b1e4df1a86a0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -639,7 +639,7 @@  stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
 		dev_info(&pdev->dev, "PTP uses main clock\n");
 	} else {
 		plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref);
-		dev_dbg(&pdev->dev, "PTP rate %d\n", plat->clk_ptp_rate);
+		dev_dbg(&pdev->dev, "PTP rate %lu\n", plat->clk_ptp_rate);
 	}
 
 	plat->stmmac_rst = devm_reset_control_get_optional(&pdev->dev,
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 7caaa5ae6674..47a763699916 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -279,8 +279,8 @@  struct plat_stmmacenet_data {
 	struct clk *stmmac_clk;
 	struct clk *pclk;
 	struct clk *clk_ptp_ref;
-	unsigned int clk_ptp_rate;
-	unsigned int clk_ref_rate;
+	unsigned long clk_ptp_rate;
+	unsigned long clk_ref_rate;
 	unsigned int mult_fact_100ns;
 	s32 ptp_max_adj;
 	u32 cdc_error_adj;
@@ -292,7 +292,7 @@  struct plat_stmmacenet_data {
 	int mac_port_sel_speed;
 	int has_xgmac;
 	u8 vlan_fail_q;
-	unsigned int eee_usecs_rate;
+	unsigned long eee_usecs_rate;
 	struct pci_dev *pdev;
 	int int_snapshot_num;
 	int msi_mac_vec;