From: "Adivi, Sai Sree Kartheek" <s-adivi@ti.com>
To: "Markus Schneider-Pargmann (TI)" <msp@baylibre.com>,
Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
"tony@atomide.com" <tony@atomide.com>,
Daniel Mack <zonque@gmail.com>
Cc: "dmaengine@vger.kernel.org" <dmaengine@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Julien Panis <jpanis@baylibre.com>, "Mendez, Judith" <jm@ti.com>,
"Francis, Sebin" <sebin.francis@ti.com>
Subject: Re: [PATCH 4/4] dmaengine: ti: cppi41: Share register setup with resume
Date: Wed, 4 Nov 2026 09:02:19 +0000 [thread overview]
Message-ID: <406e1733-00a5-4a25-af88-a5304b4f4310@ti.com> (raw)
In-Reply-To: <20261103-v7-3-topic-am335lpm-cppi41-v1-4-d7213446c5f5@baylibre.com>
On 04/11/26 01:07, Markus Schneider-Pargmann (TI) wrote:
> Both probe and resume basically do the same thing and setup the
> registers. But resume has its own copy of the register writes. This will
> always lead to differences when changes are made.
>
> Create a separate function that is used by both probe and resume.
> Note that the ordering is slightly different but I didn't see or found
> any issues with the new order while testing.
>
> Signed-off-by: Markus Schneider-Pargmann (TI) <msp@baylibre.com>
Reviewed-by: Sai Sree Kartheek Adivi <s-adivi@ti.com>
> ---
> drivers/dma/ti/cppi41.c | 41 ++++++++++++++++++++---------------------
> 1 file changed, 20 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/dma/ti/cppi41.c b/drivers/dma/ti/cppi41.c
> index e2a089066c6d..b62a26c2659d 100644
> --- a/drivers/dma/ti/cppi41.c
> +++ b/drivers/dma/ti/cppi41.c
> @@ -873,9 +873,6 @@ static int init_descs(struct device *dev, struct cppi41_dd *cdd)
> &cdd->descs_phys, GFP_KERNEL);
> if (!cdd->cd)
> return -ENOMEM;
> -
> - cppi_writel(cdd->descs_phys, cdd->qmgr_mem + QMGR_MEMBASE(i));
> - cppi_writel(cppi41_memctrl(i), cdd->qmgr_mem + QMGR_MEMCTRL(i));
> }
> return 0;
> }
> @@ -903,6 +900,24 @@ static void init_sched(struct cppi41_dd *cdd)
> cppi_writel(reg, cdd->sched_mem + DMA_SCHED_CTRL);
> }
>
> +/* Program the registers, also used to restore the context on resume */
> +static void cppi41_init_hw(struct cppi41_dd *cdd)
> +{
> + int i;
> +
> + cppi_writel(cdd->scratch_phys, cdd->qmgr_mem + QMGR_LRAM0_BASE);
> + cppi_writel(TOTAL_DESCS_NUM, cdd->qmgr_mem + QMGR_LRAM_SIZE);
> + cppi_writel(0, cdd->qmgr_mem + QMGR_LRAM1_BASE);
> +
> + for (i = 0; i < DESCS_AREAS; i++) {
> + cppi_writel(cdd->descs_phys, cdd->qmgr_mem + QMGR_MEMBASE(i));
> + cppi_writel(cppi41_memctrl(i), cdd->qmgr_mem + QMGR_MEMCTRL(i));
> + }
> +
> + cppi_writel(cdd->td_queue.submit, cdd->ctrl_mem + DMA_TDFDQ);
> + init_sched(cdd);
> +}
> +
> static int init_cppi41(struct device *dev, struct cppi41_dd *cdd)
> {
> int ret;
> @@ -913,16 +928,11 @@ static int init_cppi41(struct device *dev, struct cppi41_dd *cdd)
> if (!cdd->qmgr_scratch)
> return -ENOMEM;
>
> - cppi_writel(cdd->scratch_phys, cdd->qmgr_mem + QMGR_LRAM0_BASE);
> - cppi_writel(TOTAL_DESCS_NUM, cdd->qmgr_mem + QMGR_LRAM_SIZE);
> - cppi_writel(0, cdd->qmgr_mem + QMGR_LRAM1_BASE);
> -
> ret = init_descs(dev, cdd);
> if (ret)
> goto err_td;
>
> - cppi_writel(cdd->td_queue.submit, cdd->ctrl_mem + DMA_TDFDQ);
> - init_sched(cdd);
> + cppi41_init_hw(cdd);
>
> return 0;
> err_td:
> @@ -1187,26 +1197,15 @@ static int __maybe_unused cppi41_resume(struct device *dev)
> {
> struct cppi41_dd *cdd = dev_get_drvdata(dev);
> struct cppi41_channel *c;
> - int i;
>
> if (pm_runtime_status_suspended(dev))
> return 0;
>
> - for (i = 0; i < DESCS_AREAS; i++) {
> - cppi_writel(cdd->descs_phys, cdd->qmgr_mem + QMGR_MEMBASE(i));
> - cppi_writel(cppi41_memctrl(i), cdd->qmgr_mem + QMGR_MEMCTRL(i));
> - }
> -
> list_for_each_entry(c, &cdd->ddev.channels, chan.device_node)
> if (!c->is_tx)
> cppi_writel(c->q_num, c->gcr_reg + RXHPCRA0);
>
> - init_sched(cdd);
> -
> - cppi_writel(cdd->td_queue.submit, cdd->ctrl_mem + DMA_TDFDQ);
> - cppi_writel(cdd->scratch_phys, cdd->qmgr_mem + QMGR_LRAM0_BASE);
> - cppi_writel(QMGR_SCRATCH_SIZE, cdd->qmgr_mem + QMGR_LRAM_SIZE);
> - cppi_writel(0, cdd->qmgr_mem + QMGR_LRAM1_BASE);
> + cppi41_init_hw(cdd);
>
> cdd->ctx_lost = false;
>
>
prev parent reply other threads:[~2026-11-04 9:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 19:37 [PATCH 0/4] dmaengine: ti: cppi41: Fix suspend/resume issues Markus Schneider-Pargmann (TI)
2026-11-03 19:37 ` [PATCH 1/4] dmaengine: ti: cppi41: Use td_queue to restore DMA_TDFDQ Markus Schneider-Pargmann (TI)
2026-11-04 8:56 ` Adivi, Sai Sree Kartheek
2026-11-03 19:37 ` [PATCH 2/4] dmaengine: ti: cppi41: Fix register access in suspend_late Markus Schneider-Pargmann (TI)
2026-11-04 8:58 ` Adivi, Sai Sree Kartheek
2026-11-03 19:37 ` [PATCH 3/4] dmaengine: ti: cppi41: Restore QMGR_MEMCTRL in resume Markus Schneider-Pargmann (TI)
2026-11-04 9:00 ` Adivi, Sai Sree Kartheek
2026-11-03 19:37 ` [PATCH 4/4] dmaengine: ti: cppi41: Share register setup with resume Markus Schneider-Pargmann (TI)
2026-11-04 9:02 ` Adivi, Sai Sree Kartheek [this message]
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=406e1733-00a5-4a25-af88-a5304b4f4310@ti.com \
--to=s-adivi@ti.com \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=jm@ti.com \
--cc=jpanis@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=msp@baylibre.com \
--cc=sebin.francis@ti.com \
--cc=tony@atomide.com \
--cc=vkoul@kernel.org \
--cc=zonque@gmail.com \
/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
all inboxes | Powered by JetHome®