From: John Madieu <john.madieu.xa@bp.renesas.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
Vinod Koul <vkoul@kernel.org>, Mark Brown <broonie@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Frank Li <Frank.Li@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Magnus Damm <magnus.damm@gmail.com>,
Thomas Gleixner <tglx@kernel.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
Biju Das <biju.das.jz@bp.renesas.com>,
Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
John Madieu <john.madieu@gmail.com>,
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 <john.madieu.xa@bp.renesas.com>
Subject: [PATCH v2 04/24] dma: sh: rz-dmac: Add DMA ACK signal routing support
Date: Thu, 2 Apr 2026 11:05:03 +0200 [thread overview]
Message-ID: <20260402090524.9137-5-john.madieu.xa@bp.renesas.com> (raw)
In-Reply-To: <20260402090524.9137-1-john.madieu.xa@bp.renesas.com>
Some peripherals on RZ/G3E SoCs (SSIU, SPDIF, SCU/SRC, DVC, PFC) require
explicit ACK signal routing through the ICU for level-based DMA handshaking.
Rather than extending the DT binding with an optional second #dma-cells
(which would require all DMA consumers to supply two cells even when ACK
routing is not needed), derive the ACK signal number directly from the
MID/RID request number using the linear mapping defined in RZ/G3E hardware
manual Table 4.6-28:
PFC external DMA pins (DREQ0..DREQ4):
req_no 0x000-0x004 -> ACK No. 84-88
SSIU BUSIFs (ssip00..ssip93):
req_no 0x161-0x198 -> ACK No. 28-83
SPDIF (CH0..CH2) + SCU SRC (sr0..sr9) + DVC (cmd0..cmd1):
req_no 0x199-0x1b4 -> ACK No. 0-27
ACK routing is programmed when a channel is prepared for transfer and
cleared when the channel is released or the transfer times out, following
the same pattern as MID/RID request routing.
Signed-off-by: John Madieu <john.madieu.xa@bp.renesas.com>
---
Changes:
v2:
- Drop DMA ACK second cell from DT specifier
- Derive ACK signal number in-driver from MID/RID using arithmetic formulas
per ICU Table 4.6-28 (3 linear peripheral groups)
drivers/dma/sh/rz-dmac.c | 72 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
index 95a89c9d2925..bde3da96b37e 100644
--- a/drivers/dma/sh/rz-dmac.c
+++ b/drivers/dma/sh/rz-dmac.c
@@ -97,6 +97,7 @@ struct rz_dmac_chan {
u32 chcfg;
u32 chctrl;
int mid_rid;
+ int dmac_ack;
struct {
u32 nxla;
@@ -124,6 +125,9 @@ struct rz_dmac_icu {
struct rz_dmac_info {
void (*icu_register_dma_req)(struct platform_device *icu_dev,
u8 dmac_index, u8 dmac_channel, u16 req_no);
+ void (*icu_register_dma_ack)(struct platform_device *icu_dev,
+ u8 dmac_index, u8 dmac_channel, u16 ack_no);
+ u16 default_dma_ack_no;
u16 default_dma_req_no;
};
@@ -362,6 +366,60 @@ static void rz_dmac_set_dma_req_no(struct rz_dmac *dmac, unsigned int index,
rz_dmac_set_dmars_register(dmac, index, req_no);
}
+/*
+ * Map MID/RID request number (bits[0:9] of DMA specifier) to the ICU
+ * DMA ACK signal number, per RZ/G3E hardware manual Table 4.6-28.
+ *
+ * Three peripheral groups cover all ACK-capable peripherals:
+ *
+ * PFC external DMA pins (DREQ0..DREQ4):
+ * req_no 0x000-0x004 -> ACK No. 84-88 (ack = req_no + 84)
+ *
+ * SSIU BUSIFs (ssip00..ssip93):
+ * req_no 0x161-0x198 -> ACK No. 28-83 (ack = req_no - 0x145)
+ *
+ * SPDIF (CH0..CH2) + SCU SRC (sr0..sr9) + DVC (cmd0..cmd1):
+ * req_no 0x199-0x1b4 -> ACK No. 0-27 (ack = req_no - 0x199)
+ */
+static int rz_dmac_get_ack_no(const struct rz_dmac_info *info, u16 req_no)
+{
+ if (!info->icu_register_dma_ack)
+ return -EINVAL;
+
+ switch (req_no) {
+ case 0x000 ... 0x004:
+ /* PFC external DMA pins: ACK No. 84-88 */
+ return req_no + 84;
+ case 0x161 ... 0x198:
+ /* SSIU BUSIFs: ACK No. 28-83 */
+ return req_no - 0x145;
+ case 0x199 ... 0x1b4:
+ /* SPDIF + SCU SRC + DVC: ACK No. 0-27 */
+ return req_no - 0x199;
+ default:
+ return -EINVAL;
+ }
+}
+
+static void rz_dmac_set_dma_ack_no(struct rz_dmac *dmac, unsigned int index,
+ int ack_no)
+{
+ if (ack_no < 0 || !dmac->info->icu_register_dma_ack)
+ return;
+
+ dmac->info->icu_register_dma_ack(dmac->icu.pdev, dmac->icu.dmac_index,
+ index, ack_no);
+}
+
+static void rz_dmac_reset_dma_ack_no(struct rz_dmac *dmac, int ack_no)
+{
+ if (ack_no < 0 || !dmac->info->icu_register_dma_ack)
+ return;
+
+ dmac->info->icu_register_dma_ack(dmac->icu.pdev, dmac->icu.dmac_index,
+ dmac->info->default_dma_ack_no, ack_no);
+}
+
static void rz_dmac_prepare_desc_for_memcpy(struct rz_dmac_chan *channel)
{
struct dma_chan *chan = &channel->vc.chan;
@@ -431,6 +489,7 @@ static void rz_dmac_prepare_descs_for_slave_sg(struct rz_dmac_chan *channel)
channel->lmdesc.tail = lmdesc;
rz_dmac_set_dma_req_no(dmac, channel->index, channel->mid_rid);
+ rz_dmac_set_dma_ack_no(dmac, channel->index, channel->dmac_ack);
}
static void rz_dmac_prepare_descs_for_cyclic(struct rz_dmac_chan *channel)
@@ -485,6 +544,7 @@ static void rz_dmac_prepare_descs_for_cyclic(struct rz_dmac_chan *channel)
channel->lmdesc.tail = lmdesc;
rz_dmac_set_dma_req_no(dmac, channel->index, channel->mid_rid);
+ rz_dmac_set_dma_ack_no(dmac, channel->index, channel->dmac_ack);
}
static int rz_dmac_xfer_desc(struct rz_dmac_chan *chan)
@@ -567,6 +627,9 @@ static void rz_dmac_free_chan_resources(struct dma_chan *chan)
channel->mid_rid = -EINVAL;
}
+ rz_dmac_reset_dma_ack_no(dmac, channel->dmac_ack);
+ channel->dmac_ack = -EINVAL;
+
spin_unlock_irqrestore(&channel->vc.lock, flags);
list_for_each_entry_safe(desc, _desc, &channel->ld_free, node) {
@@ -814,6 +877,7 @@ static void rz_dmac_device_synchronize(struct dma_chan *chan)
dev_warn(dmac->dev, "DMA Timeout");
rz_dmac_set_dma_req_no(dmac, channel->index, dmac->info->default_dma_req_no);
+ rz_dmac_reset_dma_ack_no(dmac, channel->dmac_ack);
}
static struct rz_lmdesc *
@@ -1164,6 +1228,8 @@ static bool rz_dmac_chan_filter(struct dma_chan *chan, void *arg)
channel->chcfg = CHCFG_FILL_TM(ch_cfg) | CHCFG_FILL_AM(ch_cfg) |
CHCFG_FILL_LVL(ch_cfg) | CHCFG_FILL_HIEN(ch_cfg);
+ channel->dmac_ack = rz_dmac_get_ack_no(dmac->info, channel->mid_rid);
+
return !test_and_set_bit(channel->mid_rid, dmac->modules);
}
@@ -1200,6 +1266,7 @@ static int rz_dmac_chan_probe(struct rz_dmac *dmac,
channel->index = index;
channel->mid_rid = -EINVAL;
+ channel->dmac_ack = -EINVAL;
/* Request the channel interrupt. */
scnprintf(pdev_irqname, sizeof(pdev_irqname), "ch%u", index);
@@ -1569,6 +1636,9 @@ static int rz_dmac_resume(struct device *dev)
guard(spinlock_irqsave)(&channel->vc.lock);
+ rz_dmac_set_dma_req_no(dmac, channel->index, channel->mid_rid);
+ rz_dmac_set_dma_ack_no(dmac, channel->index, channel->dmac_ack);
+
if (!(channel->status & BIT(RZ_DMAC_CHAN_STATUS_CYCLIC))) {
rz_dmac_ch_writel(&dmac->channels[i], CHCTRL_DEFAULT, CHCTRL, 1);
continue;
@@ -1601,6 +1671,8 @@ static const struct dev_pm_ops rz_dmac_pm_ops = {
static const struct rz_dmac_info rz_dmac_v2h_info = {
.icu_register_dma_req = rzv2h_icu_register_dma_req,
+ .icu_register_dma_ack = rzv2h_icu_register_dma_ack,
+ .default_dma_ack_no = RZV2H_ICU_DMAC_ACK_NO_DEFAULT,
.default_dma_req_no = RZV2H_ICU_DMAC_REQ_NO_DEFAULT,
};
--
2.25.1
next prev parent reply other threads:[~2026-04-02 9:07 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 9:04 [PATCH v2 00/24] ASoC: rsnd: Add audio support for the Renesas RZ/G3E SoC John Madieu
2026-04-02 9:05 ` [PATCH v2 01/24] dt-bindings: clock: renesas: Add audio clock inputs for RZ/V2H family John Madieu
2026-04-15 20:32 ` Rob Herring (Arm)
2026-04-02 9:05 ` [PATCH v2 02/24] clk: renesas: r9a09g047: Add audio clock and reset support John Madieu
2026-04-08 9:38 ` Geert Uytterhoeven
2026-04-09 16:12 ` John Madieu
2026-04-02 9:05 ` [PATCH v2 03/24] irqchip/renesas-rzv2h: Add DMA ACK signal routing support John Madieu
2026-04-02 9:05 ` John Madieu [this message]
2026-04-02 9:05 ` [PATCH v2 05/24] ASoC: dt-bindings: renesas,rsnd: Split into generic and SoC-specific parts John Madieu
2026-04-15 20:51 ` Rob Herring
2026-04-02 9:05 ` [PATCH v2 06/24] ASoC: dt-bindings: Add RZ/G3E (R9A09G047) sound binding John Madieu
2026-04-15 20:57 ` Rob Herring
2026-04-23 8:42 ` John Madieu
2026-04-02 9:05 ` [PATCH v2 07/24] ASoC: rsnd: Add reset controller support to rsnd_mod John Madieu
2026-04-02 9:05 ` [PATCH v2 08/24] ASoC: rsnd: Add RZ/G3E SoC probing and register map John Madieu
2026-04-02 9:05 ` [PATCH v2 09/24] ASoC: rsnd: Add audmacpp clock and reset support for RZ/G3E John Madieu
2026-04-02 9:05 ` [PATCH v2 10/24] ASoC: rsnd: Add RZ/G3E DMA address calculation support John Madieu
2026-04-02 9:05 ` [PATCH v2 11/24] ASoC: rsnd: ssui: Add RZ/G3E SSIU BUSIF support John Madieu
2026-04-02 9:05 ` [PATCH v2 12/24] ASoC: rsnd: Add SSI reset support for RZ/G3E platforms John Madieu
2026-04-02 9:05 ` [PATCH v2 13/24] ASoC: rsnd: Add ADG reset support for RZ/G3E John Madieu
2026-04-02 9:05 ` [PATCH v2 14/24] ASoC: rsnd: adg: Add per-SSI ADG and SSIF supply clock management John Madieu
2026-04-02 9:05 ` [PATCH v2 15/24] ASoC: rsnd: src: Add SRC reset and clock support for RZ/G3E John Madieu
2026-04-02 9:05 ` [PATCH v2 16/24] ASoC: rsnd: Add rsnd_adg_mod_get() for PM support John Madieu
2026-04-02 9:05 ` [PATCH v2 17/24] ASoC: rsnd: Export rsnd_ssiu_mod_get() " John Madieu
2026-04-02 9:05 ` [PATCH v2 18/24] ASoC: rsnd: Add system suspend/resume support John Madieu
2026-04-02 9:05 ` [PATCH v2 19/24] arm64: dts: renesas: rzv2h: Add audio clock inputs John Madieu
2026-04-02 9:05 ` [PATCH v2 20/24] arm64: dts: renesas: r9a09g047: Add R-Car Sound support John Madieu
2026-04-02 9:12 ` Biju Das
2026-04-02 9:05 ` [PATCH v2 21/24] arm64: dts: renesas: rzg3e-smarc-som: Add Versa3 clock generator John Madieu
2026-04-02 9:05 ` [PATCH v2 22/24] arm64: dts: renesas: rzg3e-smarc-som: Add I2C1 support John Madieu
2026-04-02 9:05 ` [PATCH v2 23/24] arm64: dts: renesas: rzg3e-smarc-som: add audio pinmux definitions John Madieu
2026-04-02 9:05 ` [PATCH v2 24/24] arm64: dts: renesas: r9a09g047e57-smarc: add DA7212 audio codec support John Madieu
2026-04-08 9:41 ` Geert Uytterhoeven
2026-04-09 16:14 ` John Madieu
2026-04-02 11:55 ` [PATCH v2 00/24] ASoC: rsnd: Add audio support for the Renesas RZ/G3E SoC Mark Brown
2026-04-02 15:30 ` John Madieu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260402090524.9137-5-john.madieu.xa@bp.renesas.com \
--to=john.madieu.xa@bp.renesas.com \
--cc=Frank.Li@kernel.org \
--cc=biju.das.jz@bp.renesas.com \
--cc=broonie@kernel.org \
--cc=claudiu.beznea@tuxon.dev \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=fabrizio.castro.jz@renesas.com \
--cc=geert+renesas@glider.be \
--cc=john.madieu@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mturquette@baylibre.com \
--cc=p.zabel@pengutronix.de \
--cc=perex@perex.cz \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=tglx@kernel.org \
--cc=tiwai@suse.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox