From nobody Mon Apr 6 12:13:30 2026 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E4FB325726; Thu, 2 Apr 2026 09:08:43 +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=1775120926; cv=none; b=TR6PZXntkTlsvbNeeqitevJDtxYDeC67uIWDtU8stQ5ClQ/2xSsuuHmWtJS3OkTcDSja3K5ndfVsFke1dmlNy5izyN8JkuwbGHttVjduBk41hBWL84IARdVanv7tbvDXRtovaQmhTNIHamxEJV1HZVmsP9gZ7CJygmXpWucuLAA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775120926; c=relaxed/simple; bh=q2REPX9lMerG1AwBlnRjSDEATo20OJniHJRtzXzBgdc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TALGTSfesT6DtoRKGlrkH8rP9456I0srBO0LSFiCdMulzAg7AK3OQelvSov8eYlkuwYKUrUPEpU/ePF6exV/nEEbedPu1N85qVFFvN03WxxZjXNRWj/I6NnJa/kU/5IGe2tagGYSiH0BUveKRyYeihU50OK9jh3dAPe45MwPcfI= 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: pCgk4duqR3S7dzt3HJjJ5Q== X-CSE-MsgGUID: veQlOBuIRfGX9QEc5QUotA== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 02 Apr 2026 18:08:43 +0900 Received: from ubuntu.adwin.renesas.com (unknown [10.226.92.136]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 45022413EA85; Thu, 2 Apr 2026 18:08:34 +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 v2 11/24] ASoC: rsnd: ssui: Add RZ/G3E SSIU BUSIF support Date: Thu, 2 Apr 2026 11:05:10 +0200 Message-ID: <20260402090524.9137-12-john.madieu.xa@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260402090524.9137-1-john.madieu.xa@bp.renesas.com> References: <20260402090524.9137-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 an extra capability flags in the match data: - 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 --- Changes: v2: - Droped RSND_SSI_ALWAYS_BUSIF flag; PIO is only enabled explicitly, so no guard needed; use direct rsnd_is_rzg3e() check for skipping SSI_MODE0 instead sound/soc/renesas/rcar/core.c | 4 ++- sound/soc/renesas/rcar/rsnd.h | 2 ++ sound/soc/renesas/rcar/ssiu.c | 47 +++++++++++++++++++++-------------- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/sound/soc/renesas/rcar/core.c b/sound/soc/renesas/rcar/core.c index 8d0c5440cb70..d85c614af598 100644 --- a/sound/soc/renesas/rcar/core.c +++ b/sound/soc/renesas/rcar/core.c @@ -107,7 +107,8 @@ 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,r9a09g047-sound", .data =3D (void *)(RSND_RZ3 = | RSND_RZG3E) }, + { .compatible =3D "renesas,r9a09g047-sound", .data =3D (void *)(RSND_RZ3 = | RSND_RZG3E | + RSND_SSIU_BUSIF_STATUS_COUNT_2) }, {}, }; MODULE_DEVICE_TABLE(of, rsnd_of_match); @@ -1960,6 +1961,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 4ff410a96336..5c5be0f64cb1 100644 --- a/sound/soc/renesas/rcar/rsnd.h +++ b/sound/soc/renesas/rcar/rsnd.h @@ -631,6 +631,7 @@ struct rsnd_priv { struct reset_control *audmapp_rstc; =20 spinlock_t lock; + unsigned int ssiu_busif_count; unsigned long flags; #define RSND_GEN_MASK (0xF << 0) #define RSND_GEN1 (1 << 0) @@ -642,6 +643,7 @@ struct rsnd_priv { #define RSND_RZ_MASK (0xFF << 8) #define RSND_RZ3 (3 << 8) #define RSND_RZG3E (1 << 12) +#define RSND_SSIU_BUSIF_STATUS_COUNT_2 BIT(16) /* Only 2 BUSIF error-statu= s register pairs */ /* * 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