[PATCH 12/22] ASoC: rsnd: Update SSI for RZ/G3E support

John Madieu posted 22 patches 2 weeks, 3 days ago
There is a newer version of this series
[PATCH 12/22] ASoC: rsnd: Update SSI for RZ/G3E support
Posted by John Madieu 2 weeks, 3 days ago
Add SSI support for the Renesas RZ/G3E SoC, which differs from earlier
generations in several ways:

 - The SSI block always operates in BUSIF mode; RZ/G3E does not implement
   the SSITDR/SSIRDR registers used by R-Car Gen2/Gen3/Gen4 for direct SSI
   DMA.
   Consequently, all audio data must pass through BUSIF.
 - Each SSI instance has its own reset line, exposed using per-SSI names
   such as "ssi0", "ssi1", etc., rather than a single shared reset.

To support these differences, update rsnd_ssi_use_busif() to always
return 1 on RZ/G3E, ensuring that the driver consistently selects the
BUSIF DMA path. Also update the reset acquisition logic to request the
appropriate per-SSI reset controller based on the SSI instance name.

Signed-off-by: John Madieu <john.madieu.xa@bp.renesas.com>
---
 sound/soc/renesas/rcar/ssi.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/sound/soc/renesas/rcar/ssi.c b/sound/soc/renesas/rcar/ssi.c
index c06cebb36170..e25a4dfae90c 100644
--- a/sound/soc/renesas/rcar/ssi.c
+++ b/sound/soc/renesas/rcar/ssi.c
@@ -123,8 +123,15 @@ int rsnd_ssi_use_busif(struct rsnd_dai_stream *io)
 {
 	struct rsnd_mod *mod = rsnd_io_to_mod_ssi(io);
 	struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
+	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
 	int use_busif = 0;
 
+	/*
+	 * RZ/G3E does not support PIO mode. Always use BUSIF.
+	 */
+	if (rsnd_flags_has(priv, RSND_SSI_ALWAYS_BUSIF))
+		return 1;
+
 	if (!rsnd_ssi_is_dma_mode(mod))
 		return 0;
 
@@ -865,6 +872,8 @@ static int rsnd_ssi_common_remove(struct rsnd_mod *mod,
 		rsnd_flags_del(ssi, RSND_SSI_PROBED);
 	}
 
+	rsnd_dma_detach(io, mod, &io->dma);
+
 	return 0;
 }
 
@@ -1158,6 +1167,7 @@ int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod)
 
 int rsnd_ssi_probe(struct rsnd_priv *priv)
 {
+	struct reset_control *rstc;
 	struct device_node *node;
 	struct device *dev = rsnd_priv_to_dev(priv);
 	struct rsnd_mod_ops *ops;
@@ -1207,6 +1217,16 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
 			goto rsnd_ssi_probe_done;
 		}
 
+		/*
+		 * RZ/G3E uses per-SSI reset controllers.
+		 * R-Car platforms typically don't have SSI reset controls.
+		 */
+		rstc = devm_reset_control_get_optional(dev, name);
+		if (IS_ERR(rstc)) {
+			ret = PTR_ERR(rstc);
+			goto rsnd_ssi_probe_done;
+		}
+
 		if (of_property_read_bool(np, "shared-pin"))
 			rsnd_flags_set(ssi, RSND_SSI_CLK_PIN_SHARE);
 
@@ -1225,7 +1245,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
 			ops = &rsnd_ssi_dma_ops;
 
 		ret = rsnd_mod_init(priv, rsnd_mod_get(ssi), ops, clk,
-				    NULL, RSND_MOD_SSI, i);
+				    rstc, RSND_MOD_SSI, i);
 		if (ret)
 			goto rsnd_ssi_probe_done;
 
-- 
2.25.1
Re: [PATCH 12/22] ASoC: rsnd: Update SSI for RZ/G3E support
Posted by Geert Uytterhoeven 1 week, 5 days ago
Hi John,

On Thu, 19 Mar 2026 at 16:56, John Madieu <john.madieu.xa@bp.renesas.com> wrote:
> Add SSI support for the Renesas RZ/G3E SoC, which differs from earlier
> generations in several ways:
>
>  - The SSI block always operates in BUSIF mode; RZ/G3E does not implement
>    the SSITDR/SSIRDR registers used by R-Car Gen2/Gen3/Gen4 for direct SSI
>    DMA.
>    Consequently, all audio data must pass through BUSIF.
>  - Each SSI instance has its own reset line, exposed using per-SSI names
>    such as "ssi0", "ssi1", etc., rather than a single shared reset.
>
> To support these differences, update rsnd_ssi_use_busif() to always
> return 1 on RZ/G3E, ensuring that the driver consistently selects the
> BUSIF DMA path. Also update the reset acquisition logic to request the
> appropriate per-SSI reset controller based on the SSI instance name.
>
> Signed-off-by: John Madieu <john.madieu.xa@bp.renesas.com>

Thanks for your patch!

> --- a/sound/soc/renesas/rcar/ssi.c
> +++ b/sound/soc/renesas/rcar/ssi.c
> @@ -123,8 +123,15 @@ int rsnd_ssi_use_busif(struct rsnd_dai_stream *io)
>  {
>         struct rsnd_mod *mod = rsnd_io_to_mod_ssi(io);
>         struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
> +       struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
>         int use_busif = 0;
>
> +       /*
> +        * RZ/G3E does not support PIO mode. Always use BUSIF.
> +        */
> +       if (rsnd_flags_has(priv, RSND_SSI_ALWAYS_BUSIF))
> +               return 1;
> +
>         if (!rsnd_ssi_is_dma_mode(mod))
>                 return 0;
>
> @@ -865,6 +872,8 @@ static int rsnd_ssi_common_remove(struct rsnd_mod *mod,
>                 rsnd_flags_del(ssi, RSND_SSI_PROBED);
>         }
>
> +       rsnd_dma_detach(io, mod, &io->dma);

This goes BOOM on R-Car Gen3 and Gen4:

    Unable to handle kernel NULL pointer dereference at virtual
address 0000000000000004
    Mem abort info:
      ESR = 0x0000000096000004
      EC = 0x25: DABT (current EL), IL = 32 bits
      SET = 0, FnV = 0
      EA = 0, S1PTW = 0
      FSC = 0x04: level 0 translation fault
    Data abort info:
      ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
      CM = 0, WnR = 0, TnD = 0, TagAccess = 0
      GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
    [0000000000000004] user address but active_mm is swapper
    Internal error: Oops: 0000000096000004 [#1]  SMP
    CPU: 1 UID: 0 PID: 1 Comm: swapper/0 Not tainted
7.0.0-rc5-arm64-renesas-07233-g377893124b8a #3530 PREEMPT
    Hardware name: Renesas Gray Hawk Single board based on r8a779h0 (DT)
    pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    pc : rsnd_dma_detach+0x10/0x20
    lr : rsnd_ssi_common_remove+0x48/0x74
    sp : ffff8000818ebac0
    x29: ffff8000818ebac0 x28: ffff000441c02938 x27: ffff0004408a8410
    x26: 000000000000000d x25: 0000000000000000 x24: ffff8000817b9970
    x23: 0000000000000000 x22: 000000000000000c x21: 00000000fffffdfb
    x20: ffff000441c02938 x19: ffff0004402bc080 x18: 00000000ffffffff
    x17: ffff000440ba6600 x16: ffff000440ba6a00 x15: ffff8000818eb700
    x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000030
    x11: 0101010101010101 x10: ffff800080fa7670 x9 : 1fffe00088052d21
    x8 : 0101010101010101 x7 : 7f7f7f7f7f7f7f7f x6 : feff636d746e722d
    x5 : 000000000000003c x4 : ffff800080a9dcc4 x3 : ffff0004402be800
    x2 : ffff000441c029b8 x1 : ffff000441c02938 x0 : 0000000000000000
    Call trace:
     rsnd_dma_detach+0x10/0x20 (P)
     rsnd_ssi_common_remove+0x48/0x74
     rsnd_probe+0x2d0/0x448
     platform_probe+0x58/0x90
     really_probe+0xb8/0x294
     __driver_probe_device+0x74/0x124
     driver_probe_device+0x3c/0x158
     __driver_attach+0xe0/0x1b4
     bus_for_each_dev+0x78/0xd4
     driver_attach+0x20/0x28
     bus_add_driver+0xe0/0x1e0
     driver_register+0x58/0x114
     __platform_driver_register+0x20/0x28
     rsnd_driver_init+0x18/0x20
     do_one_initcall+0x7c/0x184
     kernel_init_freeable+0x200/0x2e0
     kernel_init+0x20/0x1cc
     ret_from_fork+0x10/0x20
    Code: a9bf7bfd aa0003e1 910003fd f9400040 (b9400402)
    ---[ end trace 0000000000000000 ]---

> +
>         return 0;
>  }
>

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 12/22] ASoC: rsnd: Update SSI for RZ/G3E support
Posted by Kuninori Morimoto 2 weeks ago
Hi John

> Add SSI support for the Renesas RZ/G3E SoC, which differs from earlier
> generations in several ways:
> 
>  - The SSI block always operates in BUSIF mode; RZ/G3E does not implement
>    the SSITDR/SSIRDR registers used by R-Car Gen2/Gen3/Gen4 for direct SSI
>    DMA.
>    Consequently, all audio data must pass through BUSIF.
>  - Each SSI instance has its own reset line, exposed using per-SSI names
>    such as "ssi0", "ssi1", etc., rather than a single shared reset.
> 
> To support these differences, update rsnd_ssi_use_busif() to always
> return 1 on RZ/G3E, ensuring that the driver consistently selects the
> BUSIF DMA path. Also update the reset acquisition logic to request the
> appropriate per-SSI reset controller based on the SSI instance name.
> 
> Signed-off-by: John Madieu <john.madieu.xa@bp.renesas.com>
> ---
(snip)
> @@ -865,6 +872,8 @@ static int rsnd_ssi_common_remove(struct rsnd_mod *mod,
>  		rsnd_flags_del(ssi, RSND_SSI_PROBED);
>  	}
>  
> +	rsnd_dma_detach(io, mod, &io->dma);
> +
>  	return 0;
>  }

Why do we need it ?

> @@ -1207,6 +1217,16 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
>  			goto rsnd_ssi_probe_done;
>  		}
>  
> +		/*
> +		 * RZ/G3E uses per-SSI reset controllers.
> +		 * R-Car platforms typically don't have SSI reset controls.
> +		 */
> +		rstc = devm_reset_control_get_optional(dev, name);
> +		if (IS_ERR(rstc)) {
> +			ret = PTR_ERR(rstc);
> +			goto rsnd_ssi_probe_done;
> +		}

So, all R-Car platforms will be handled as error ?

Thank you for your help !!

Best regards
---
Kuninori Morimoto