From nobody Mon Apr 6 12:12:13 2026 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C3F13E9595; Thu, 19 Mar 2026 15:56:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773935790; cv=none; b=RnYLk86SvUezRSn8SeJiXR4AvEg8+j2PwdKU/XMAI+ZYHlNkw7Jh2xkv0fukvS4WIcLUMUKvA4M2bLwEObwMOhyFOOmsS3Qzz7YSJiSs/TRyDut6g0yQd8wM5aVkC7bdUeruGiWjtErEs53lBxiv3O0PwumiQ/0hJoXNY+CfUbo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773935790; c=relaxed/simple; bh=pxmwXqdfheRNmyRz29WVb8GdRzN1F9luVbETBgPCG8U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nIfe3x/Olnumq9crmcf3aXjkxFqJcIIBJjijzLqMIRVUeBe3HAaONq4NtcApjeyiXA3eM9zCyrBAXR2HliN/kjLdjE+pRZQnLp6ZbQHpcuF5BmC+N4eFWVpVosmzwrVIYGqTQkLaVPGc99jlmnc7NA9Dvbg1w6q6CTEUNnTrTiM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: zYrras1FTlOYwkS2lZaAYw== X-CSE-MsgGUID: 6utN6feGTsezMK4VWju+sA== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 20 Mar 2026 00:56:27 +0900 Received: from ubuntu.adwin.renesas.com (unknown [10.226.93.35]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id E665F401B641; Fri, 20 Mar 2026 00:56:18 +0900 (JST) From: John Madieu To: Geert Uytterhoeven , Kuninori Morimoto , Vinod Koul , Mark Brown , Rob Herring , Krzysztof Kozlowski Cc: Michael Turquette , Stephen Boyd , Conor Dooley , Frank Li , Liam Girdwood , Magnus Damm , Thomas Gleixner , Jaroslav Kysela , Takashi Iwai , Philipp Zabel , Claudiu Beznea , Biju Das , Fabrizio Castro , Lad Prabhakar , John Madieu , linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-sound@vger.kernel.org, John Madieu Subject: [PATCH 11/22] ASoC: rsnd: ssui: Add RZ/G3E SSIU BUSIF support Date: Thu, 19 Mar 2026 16:53:23 +0100 Message-ID: <20260319155334.51278-12-john.madieu.xa@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260319155334.51278-1-john.madieu.xa@bp.renesas.com> References: <20260319155334.51278-1-john.madieu.xa@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for the SSIU found on the Renesas RZ/G3E SoC, which provides a different BUSIF layout compared to earlier generations: - SSI0-SSI4: 4 BUSIF instances each (BUSIF0-3) - SSI5-SSI8: 1 BUSIF instance each (BUSIF0 only) - SSI9: 4 BUSIF instances (BUSIF0-3) - Total: 28 BUSIFs RZ/G3E also differs from Gen2/Gen3 implementations in that only two pairs of BUSIF error-status registers are available instead of four, and the SSI always operates in BUSIF mode with no PIO fallback. Rather than scattering SoC-specific checks across functional code, introduce two capability flags in the match data: - RSND_SSI_ALWAYS_BUSIF: the SSI has no PIO mode and always uses BUSIF. Used in rsnd_ssi_use_busif() and rsnd_ssiu_init() to skip SSI_MODE0 configuration. - RSND_SSIU_BUSIF_STATUS_COUNT_2: only two BUSIF error-status register pairs are present. Used in rsnd_ssiu_busif_err_irq_ctrl() and rsnd_ssiu_busif_err_status_clear() to limit register iteration. Future SoCs sharing these constraints can set the flags without requiring code changes. Signed-off-by: John Madieu --- sound/soc/renesas/rcar/core.c | 5 +++- sound/soc/renesas/rcar/rsnd.h | 3 +++ sound/soc/renesas/rcar/ssiu.c | 47 +++++++++++++++++++++-------------- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/sound/soc/renesas/rcar/core.c b/sound/soc/renesas/rcar/core.c index 2f9c32c647a6..6a25580b9c6a 100644 --- a/sound/soc/renesas/rcar/core.c +++ b/sound/soc/renesas/rcar/core.c @@ -107,7 +107,9 @@ static const struct of_device_id rsnd_of_match[] =3D { { .compatible =3D "renesas,rcar_sound-gen4", .data =3D (void *)RSND_GEN4 = }, /* Special Handling */ { .compatible =3D "renesas,rcar_sound-r8a77990", .data =3D (void *)(RSND_= GEN3 | RSND_SOC_E) }, - { .compatible =3D "renesas,rcar_sound-r9a09g047", .data =3D (void *)RSND_= RZG3E }, + { .compatible =3D "renesas,rcar_sound-r9a09g047", .data =3D (void *)(RSND= _RZG3E | + RSND_SSI_ALWAYS_BUSIF | + RSND_SSIU_BUSIF_STATUS_COUNT_2) }, {}, }; MODULE_DEVICE_TABLE(of, rsnd_of_match); @@ -1960,6 +1962,7 @@ static int rsnd_probe(struct platform_device *pdev) =20 priv->pdev =3D pdev; priv->flags =3D (unsigned long)of_device_get_match_data(dev); + priv->ssiu_busif_count =3D rsnd_flags_has(priv, RSND_SSIU_BUSIF_STATUS_CO= UNT_2) ? 2 : 4; spin_lock_init(&priv->lock); =20 /* diff --git a/sound/soc/renesas/rcar/rsnd.h b/sound/soc/renesas/rcar/rsnd.h index 8f3637904884..da377bca45a9 100644 --- a/sound/soc/renesas/rcar/rsnd.h +++ b/sound/soc/renesas/rcar/rsnd.h @@ -641,6 +641,7 @@ struct rsnd_priv { struct reset_control *rstc_audmac_pp; =20 spinlock_t lock; + unsigned int ssiu_busif_count; unsigned long flags; #define RSND_GEN_MASK (0xF << 0) #define RSND_GEN1 (1 << 0) @@ -650,6 +651,8 @@ struct rsnd_priv { #define RSND_RZG3E (5 << 0) #define RSND_SOC_MASK (0xFF << 4) #define RSND_SOC_E (1 << 4) /* E1/E2/E3 */ +#define RSND_SSI_ALWAYS_BUSIF BIT(12) /* SSI has no PIO mode, always uses = BUSIF */ +#define RSND_SSIU_BUSIF_STATUS_COUNT_2 BIT(13) /* Only 2 BUSIF error-statu= s register pairs */ =20 /* * below value will be filled on rsnd_gen_probe() diff --git a/sound/soc/renesas/rcar/ssiu.c b/sound/soc/renesas/rcar/ssiu.c index 0cfa84fe5ea8..f377d9414633 100644 --- a/sound/soc/renesas/rcar/ssiu.c +++ b/sound/soc/renesas/rcar/ssiu.c @@ -29,31 +29,32 @@ struct rsnd_ssiu { i++) =20 /* - * SSI Gen2 Gen3 Gen4 - * 0 BUSIF0-3 BUSIF0-7 BUSIF0-7 - * 1 BUSIF0-3 BUSIF0-7 - * 2 BUSIF0-3 BUSIF0-7 - * 3 BUSIF0 BUSIF0-7 - * 4 BUSIF0 BUSIF0-7 - * 5 BUSIF0 BUSIF0 - * 6 BUSIF0 BUSIF0 - * 7 BUSIF0 BUSIF0 - * 8 BUSIF0 BUSIF0 - * 9 BUSIF0-3 BUSIF0-7 - * total 22 52 8 + * SSI Gen2 Gen3 Gen4 RZ/G3E + * 0 BUSIF0-3 BUSIF0-7 BUSIF0-7 BUSIF0-3 + * 1 BUSIF0-3 BUSIF0-7 BUSIF0-3 + * 2 BUSIF0-3 BUSIF0-7 BUSIF0-3 + * 3 BUSIF0 BUSIF0-7 BUSIF0-3 + * 4 BUSIF0 BUSIF0-7 BUSIF0-3 + * 5 BUSIF0 BUSIF0 BUSIF0 + * 6 BUSIF0 BUSIF0 BUSIF0 + * 7 BUSIF0 BUSIF0 BUSIF0 + * 8 BUSIF0 BUSIF0 BUSIF0 + * 9 BUSIF0-3 BUSIF0-7 BUSIF0-3 + * total 22 52 8 28 */ static const int gen2_id[] =3D { 0, 4, 8, 12, 13, 14, 15, 16, 17, 18 }; static const int gen3_id[] =3D { 0, 8, 16, 24, 32, 40, 41, 42, 43, 44 }; static const int gen4_id[] =3D { 0 }; +static const int rzg3e_id[] =3D { 0, 4, 8, 12, 16, 20, 21, 22, 23, 24 }; =20 /* enable busif buffer over/under run interrupt. */ #define rsnd_ssiu_busif_err_irq_enable(mod) rsnd_ssiu_busif_err_irq_ctrl(= mod, 1) #define rsnd_ssiu_busif_err_irq_disable(mod) rsnd_ssiu_busif_err_irq_ctrl(= mod, 0) static void rsnd_ssiu_busif_err_irq_ctrl(struct rsnd_mod *mod, int enable) { + struct rsnd_priv *priv =3D rsnd_mod_to_priv(mod); int id =3D rsnd_mod_id(mod); int shift, offset; - int i; =20 switch (id) { case 0: @@ -72,7 +73,7 @@ static void rsnd_ssiu_busif_err_irq_ctrl(struct rsnd_mod = *mod, int enable) return; } =20 - for (i =3D 0; i < 4; i++) { + for (unsigned int i =3D 0; i < priv->ssiu_busif_count; i++) { enum rsnd_reg reg =3D SSI_SYS_INT_ENABLE((i * 2) + offset); u32 val =3D 0xf << (shift * 4); u32 sys_int_enable =3D rsnd_mod_read(mod, reg); @@ -87,10 +88,10 @@ static void rsnd_ssiu_busif_err_irq_ctrl(struct rsnd_mo= d *mod, int enable) =20 bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *mod) { + struct rsnd_priv *priv =3D rsnd_mod_to_priv(mod); bool error =3D false; int id =3D rsnd_mod_id(mod); int shift, offset; - int i; =20 switch (id) { case 0: @@ -109,7 +110,7 @@ bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *= mod) goto out; } =20 - for (i =3D 0; i < 4; i++) { + for (unsigned int i =3D 0; i < priv->ssiu_busif_count; i++) { u32 reg =3D SSI_SYS_STATUS(i * 2) + offset; u32 status =3D rsnd_mod_read(mod, reg); u32 val =3D 0xf << (shift * 4); @@ -160,7 +161,8 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod, /* * SSI_MODE0 */ - rsnd_mod_bset(mod, SSI_MODE0, (1 << id), !use_busif << id); + if (!rsnd_is_rzg3e(priv)) + rsnd_mod_bset(mod, SSI_MODE0, (1 << id), !use_busif << id); =20 /* * SSI_MODE1 / SSI_MODE2 @@ -510,6 +512,7 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv) { struct device *dev =3D rsnd_priv_to_dev(priv); struct device_node *node __free(device_node) =3D rsnd_ssiu_of_node(priv); + struct reset_control *rstc; struct rsnd_ssiu *ssiu; struct rsnd_mod_ops *ops; const int *list =3D NULL; @@ -558,12 +561,20 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv) } else if (rsnd_is_gen4(priv)) { list =3D gen4_id; nr =3D ARRAY_SIZE(gen4_id); + } else if (rsnd_is_rzg3e(priv)) { + list =3D rzg3e_id; + nr =3D ARRAY_SIZE(rzg3e_id); } else { dev_err(dev, "unknown SSIU\n"); return -ENODEV; } } =20 + /* Acquire shared reset once for all SSIU modules */ + rstc =3D devm_reset_control_get_optional_shared(dev, "ssi-all"); + if (IS_ERR(rstc)) + rstc =3D NULL; + for_each_rsnd_ssiu(ssiu, priv, i) { int ret; =20 @@ -586,7 +597,7 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv) } =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(ssiu), - ops, NULL, NULL, RSND_MOD_SSIU, i); + ops, NULL, rstc, RSND_MOD_SSIU, i); if (ret) return ret; } --=20 2.25.1