diff mbox series

[net-next,4/5] net: ethernet: renesas: rcar_gen4_ptp: Add V4H clock setting

Message ID 20231117164332.354443-5-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series net: ethernet: renesas: rcar_gen4_ptp: Add V4H support | expand

Commit Message

Niklas Söderlund Nov. 17, 2023, 4:43 p.m. UTC
The gPTP clock is different between R-Car S4 and R-Car V4H. In
preparation of adding R-Car V4H support define the clock setting.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/net/ethernet/renesas/rcar_gen4_ptp.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Wolfram Sang Nov. 17, 2023, 6 p.m. UTC | #1
> +#define RCAR_GEN4_PTP_CLOCK_V4H		PTPTIVC_INIT_200MHZ

Is this easier right now or could it be added together with the TSN
driver?
Niklas Söderlund Nov. 17, 2023, 6:51 p.m. UTC | #2
Hi Wolfram,

Thanks for your review.

On 2023-11-17 13:00:42 -0500, Wolfram Sang wrote:
> 
> > +#define RCAR_GEN4_PTP_CLOCK_V4H		PTPTIVC_INIT_200MHZ
> 
> Is this easier right now or could it be added together with the TSN
> driver?
> 

I could not make up my mind, I think ether is fine. I opted to put it in 
this series to group all gPTP changes in one series. If you think it's 
better moved to the upcoming TSN series I can move it there.
Wolfram Sang Nov. 17, 2023, 9:21 p.m. UTC | #3
> I could not make up my mind, I think ether is fine. I opted to put it in 
> this series to group all gPTP changes in one series. If you think it's 
> better moved to the upcoming TSN series I can move it there.

No, I also think either is fine.
Geert Uytterhoeven Nov. 18, 2023, 11:16 a.m. UTC | #4
Hi Niklas,

On Fri, Nov 17, 2023 at 5:45 PM Niklas Söderlund
<niklas.soderlund+renesas@ragnatech.se> wrote:
> The gPTP clock is different between R-Car S4 and R-Car V4H. In
> preparation of adding R-Car V4H support define the clock setting.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Thanks for your patch!

> --- a/drivers/net/ethernet/renesas/rcar_gen4_ptp.h
> +++ b/drivers/net/ethernet/renesas/rcar_gen4_ptp.h
> @@ -9,8 +9,12 @@
>
>  #include <linux/ptp_clock_kernel.h>
>
> -#define PTPTIVC_INIT                   0x19000000      /* 320MHz */
> -#define RCAR_GEN4_PTP_CLOCK_S4         PTPTIVC_INIT
> +#define PTPTIVC_INIT_200MHZ            0x28000000      /* 200MHz */
> +#define PTPTIVC_INIT_320MHZ            0x19000000      /* 320MHz */
> +
> +#define RCAR_GEN4_PTP_CLOCK_S4         PTPTIVC_INIT_320MHZ
> +#define RCAR_GEN4_PTP_CLOCK_V4H                PTPTIVC_INIT_200MHZ

I think the gPTP Timer Increment Value Configuration value should be
calculated from the module clock rate instead (rsw2 runs at 320 MHz
on R-Car S4, S0D4_HSC and tsn run at 200 MHz on R-Car V4H).

Gr{oetje,eeting}s,

                        Geert
Niklas Söderlund Nov. 18, 2023, 3:56 p.m. UTC | #5
Hi Geert,

Thanks for your review.

On 2023-11-18 12:16:51 +0100, Geert Uytterhoeven wrote:
> Hi Niklas,
> 
> On Fri, Nov 17, 2023 at 5:45 PM Niklas Söderlund
> <niklas.soderlund+renesas@ragnatech.se> wrote:
> > The gPTP clock is different between R-Car S4 and R-Car V4H. In
> > preparation of adding R-Car V4H support define the clock setting.
> >
> > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> 
> Thanks for your patch!
> 
> > --- a/drivers/net/ethernet/renesas/rcar_gen4_ptp.h
> > +++ b/drivers/net/ethernet/renesas/rcar_gen4_ptp.h
> > @@ -9,8 +9,12 @@
> >
> >  #include <linux/ptp_clock_kernel.h>
> >
> > -#define PTPTIVC_INIT                   0x19000000      /* 320MHz */
> > -#define RCAR_GEN4_PTP_CLOCK_S4         PTPTIVC_INIT
> > +#define PTPTIVC_INIT_200MHZ            0x28000000      /* 200MHz */
> > +#define PTPTIVC_INIT_320MHZ            0x19000000      /* 320MHz */
> > +
> > +#define RCAR_GEN4_PTP_CLOCK_S4         PTPTIVC_INIT_320MHZ
> > +#define RCAR_GEN4_PTP_CLOCK_V4H                PTPTIVC_INIT_200MHZ
> 
> I think the gPTP Timer Increment Value Configuration value should be
> calculated from the module clock rate instead (rsw2 runs at 320 MHz
> on R-Car S4, S0D4_HSC and tsn run at 200 MHz on R-Car V4H).

This is a great idea, I will do so for v2.

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
diff mbox series

Patch

diff --git a/drivers/net/ethernet/renesas/rcar_gen4_ptp.h b/drivers/net/ethernet/renesas/rcar_gen4_ptp.h
index 35664d1dc472..b83a209e9845 100644
--- a/drivers/net/ethernet/renesas/rcar_gen4_ptp.h
+++ b/drivers/net/ethernet/renesas/rcar_gen4_ptp.h
@@ -9,8 +9,12 @@ 
 
 #include <linux/ptp_clock_kernel.h>
 
-#define PTPTIVC_INIT			0x19000000	/* 320MHz */
-#define RCAR_GEN4_PTP_CLOCK_S4		PTPTIVC_INIT
+#define PTPTIVC_INIT_200MHZ		0x28000000	/* 200MHz */
+#define PTPTIVC_INIT_320MHZ		0x19000000	/* 320MHz */
+
+#define RCAR_GEN4_PTP_CLOCK_S4		PTPTIVC_INIT_320MHZ
+#define RCAR_GEN4_PTP_CLOCK_V4H		PTPTIVC_INIT_200MHZ
+
 #define RCAR_GEN4_GPTP_OFFSET_S4	0x00018000
 
 enum rcar_gen4_ptp_reg_layout {