[PATCH v2 4/4] can: rcar_canfd: Add RZ/T2H support

Prabhakar posted 4 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH v2 4/4] can: rcar_canfd: Add RZ/T2H support
Posted by Prabhakar 1 month, 1 week ago
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

The CAN-FD IP on the RZ/T2H SoC is similar to R-Car Gen4, but differs in
the AFLPN and CFTML bits and supports two channels with eight interrupts.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v1->v2:
- No changes made.
---
 drivers/net/can/rcar/rcar_canfd.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 4a653d8978ba..eaf8cac78038 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -670,6 +670,23 @@ static const struct rcar_canfd_hw_info r9a09g047_hw_info = {
 	.external_clk = 0,
 };
 
+static const struct rcar_canfd_hw_info r9a09g077_hw_info = {
+	.nom_bittiming = &rcar_canfd_gen4_nom_bittiming_const,
+	.data_bittiming = &rcar_canfd_gen4_data_bittiming_const,
+	.tdc_const = &rcar_canfd_gen4_tdc_const,
+	.regs = &rcar_gen4_regs,
+	.sh = &rcar_gen4_shift_data,
+	.rnc_field_width = 16,
+	.max_aflpn = 15,
+	.max_cftml = 31,
+	.max_channels = 2,
+	.postdiv = 1,
+	.multi_channel_irqs = 1,
+	.ch_interface_mode = 1,
+	.shared_can_regs = 1,
+	.external_clk = 1,
+};
+
 /* Helper functions */
 static inline void rcar_canfd_update(u32 mask, u32 val, u32 __iomem *reg)
 {
@@ -2345,6 +2362,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(rcar_canfd_pm_ops, rcar_canfd_suspend,
 static const __maybe_unused struct of_device_id rcar_canfd_of_table[] = {
 	{ .compatible = "renesas,r8a779a0-canfd", .data = &rcar_gen4_hw_info },
 	{ .compatible = "renesas,r9a09g047-canfd", .data = &r9a09g047_hw_info },
+	{ .compatible = "renesas,r9a09g077-canfd", .data = &r9a09g077_hw_info },
 	{ .compatible = "renesas,rcar-gen3-canfd", .data = &rcar_gen3_hw_info },
 	{ .compatible = "renesas,rcar-gen4-canfd", .data = &rcar_gen4_hw_info },
 	{ .compatible = "renesas,rzg2l-canfd", .data = &rzg2l_hw_info },
-- 
2.52.0
Re: [PATCH v2 4/4] can: rcar_canfd: Add RZ/T2H support
Posted by Geert Uytterhoeven 1 month ago
Hi Prabhakar,

On Tue, 30 Dec 2025 at 12:58, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> The CAN-FD IP on the RZ/T2H SoC is similar to R-Car Gen4, but differs in
> the AFLPN and CFTML bits and supports two channels with eight interrupts.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Thanks for your patch!

LGTM, so
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

However, compared to other SoCs, CFDCnNCFG.NSJW[6:0] has:

    0x00: Setting prohibited

Perhaps this is a documentation issue, as the same limitation was
dropped in RZ/V2H Hardware User Manual Rev.1.30?
Linux also has no can_bittiming_const.sjw_min field.

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
Re: [PATCH v2 4/4] can: rcar_canfd: Add RZ/T2H support
Posted by Lad, Prabhakar 3 weeks, 4 days ago
Hi Geert,

On Wed, Jan 7, 2026 at 4:37 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> On Tue, 30 Dec 2025 at 12:58, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > The CAN-FD IP on the RZ/T2H SoC is similar to R-Car Gen4, but differs in
> > the AFLPN and CFTML bits and supports two channels with eight interrupts.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Thanks for your patch!
>
> LGTM, so
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> However, compared to other SoCs, CFDCnNCFG.NSJW[6:0] has:
>
>     0x00: Setting prohibited
>
> Perhaps this is a documentation issue, as the same limitation was
> dropped in RZ/V2H Hardware User Manual Rev.1.30?
>
I got confirmation from the HW team that it's a typo. Similar to
RZ/V2H, setting it to 0x00 results in 1 Tq and this shall be reflected
in the next UM update.

Cheers,
Prabhakar
Re: [PATCH v2 4/4] can: rcar_canfd: Add RZ/T2H support
Posted by Lad, Prabhakar 1 month ago
Hi Geert,

Thank you for the review.

On Wed, Jan 7, 2026 at 4:37 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> On Tue, 30 Dec 2025 at 12:58, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > The CAN-FD IP on the RZ/T2H SoC is similar to R-Car Gen4, but differs in
> > the AFLPN and CFTML bits and supports two channels with eight interrupts.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Thanks for your patch!
>
> LGTM, so
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> However, compared to other SoCs, CFDCnNCFG.NSJW[6:0] has:
>
>     0x00: Setting prohibited
>
Sharp eye!

> Perhaps this is a documentation issue, as the same limitation was
> dropped in RZ/V2H Hardware User Manual Rev.1.30?
> Linux also has no can_bittiming_const.sjw_min field.
>
I've notified the HW team to get it clarified.

Cheers,
Prabhakar

> 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
Re: [PATCH v2 4/4] can: rcar_canfd: Add RZ/T2H support
Posted by Geert Uytterhoeven 1 month ago
Hi Prabhakar,

On Thu, 8 Jan 2026 at 11:13, Lad, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> On Wed, Jan 7, 2026 at 4:37 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Tue, 30 Dec 2025 at 12:58, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > >
> > > The CAN-FD IP on the RZ/T2H SoC is similar to R-Car Gen4, but differs in
> > > the AFLPN and CFTML bits and supports two channels with eight interrupts.
> > >
> > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > Thanks for your patch!
> >
> > LGTM, so
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >
> > However, compared to other SoCs, CFDCnNCFG.NSJW[6:0] has:
> >
> >     0x00: Setting prohibited
> >
> Sharp eye!

I knew what I had to look for ;-)

This one was indeed hard to compare with other SoCs, as the structure
is completely different. For e.g. RZ/V2H and RZ/G3E, I could just use
diffpdf, restricted to the pages I am interested in.

Still need to enhance diffpdf with shift up/down buttons, so I don't
have to adjust the page numbers manually when a few lines are suddenly
moved to a new page...

> > Perhaps this is a documentation issue, as the same limitation was
> > dropped in RZ/V2H Hardware User Manual Rev.1.30?
> > Linux also has no can_bittiming_const.sjw_min field.
> >
> I've notified the HW team to get it clarified.

Thanks!

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
Re: [PATCH v2 4/4] can: rcar_canfd: Add RZ/T2H support
Posted by Lad, Prabhakar 1 month ago
Hi Geert,

On Thu, Jan 8, 2026 at 10:21 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> On Thu, 8 Jan 2026 at 11:13, Lad, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> > On Wed, Jan 7, 2026 at 4:37 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > On Tue, 30 Dec 2025 at 12:58, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> > > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > >
> > > > The CAN-FD IP on the RZ/T2H SoC is similar to R-Car Gen4, but differs in
> > > > the AFLPN and CFTML bits and supports two channels with eight interrupts.
> > > >
> > > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > >
> > > Thanks for your patch!
> > >
> > > LGTM, so
> > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > >
> > > However, compared to other SoCs, CFDCnNCFG.NSJW[6:0] has:
> > >
> > >     0x00: Setting prohibited
> > >
> > Sharp eye!
>
> I knew what I had to look for ;-)
>
;-)

> This one was indeed hard to compare with other SoCs, as the structure
> is completely different. For e.g. RZ/V2H and RZ/G3E, I could just use
> diffpdf, restricted to the pages I am interested in.
>
Yes, the T2H manual is different as compared to G3E/V2H.

> Still need to enhance diffpdf with shift up/down buttons, so I don't
> have to adjust the page numbers manually when a few lines are suddenly
> moved to a new page...
diffpdf was insightful, I wasn't aware such a tool existed this will
be quite handy. Thank you for the pointer.

Cheers,
Prabhakar