From: Vinod Koul <vkoul@kernel.org>
To: Andrea della Porta <andrea.porta@suse.com>
Cc: Florian Fainelli <florian.fainelli@broadcom.com>,
Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
dmaengine@vger.kernel.org, linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Maxime Ripard <maxime@cerno.tech>,
Dom Cobley <popcornmix@gmail.com>,
Phil Elwell <phil@raspberrypi.com>
Subject: Re: [PATCH 10/12] dmaengine: bcm2835: Support DMA-Lite channels
Date: Wed, 7 Feb 2024 09:26:08 +0100 [thread overview]
Message-ID: <ZcM-oM2hySPlOcyp@matsya> (raw)
In-Reply-To: <ca956587595954525fca0b635a66ca78b7000bf4.1706948717.git.andrea.porta@suse.com>
On 04-02-24, 07:59, Andrea della Porta wrote:
> From: Maxime Ripard <maxime@cerno.tech>
>
> The BCM2712 has a DMA-Lite controller that is basically a BCM2835-style
> DMA controller that supports 40 bits DMA addresses.
>
> We need it for HDMI audio to work.
>
> Cc: Maxime Ripard <maxime@cerno.tech>
> Cc: Dom Cobley <popcornmix@gmail.com>
> Signed-off-by: Andrea della Porta <andrea.porta@suse.com>
> ---
> drivers/dma/bcm2835-dma.c | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
> index 548cf7343d83..055c558caa0e 100644
> --- a/drivers/dma/bcm2835-dma.c
> +++ b/drivers/dma/bcm2835-dma.c
> @@ -100,6 +100,7 @@ struct bcm2835_chan {
>
> bool is_lite_channel;
> bool is_40bit_channel;
> + bool is_2712;
why not use is_40bit_channel..? also this can be applicable for more
soc, make it generic flag if you cant reuse this one
> };
>
> struct bcm2835_desc {
> @@ -545,7 +546,11 @@ static struct bcm2835_desc *bcm2835_dma_create_cb_chain(
> control_block->info = info;
> control_block->src = src;
> control_block->dst = dst;
> - control_block->stride = 0;
> + if (c->is_2712)
> + control_block->stride = (upper_32_bits(dst) << 8) |
> + upper_32_bits(src);
> + else
> + control_block->stride = 0;
> control_block->next = 0;
> }
>
> @@ -570,7 +575,8 @@ static struct bcm2835_desc *bcm2835_dma_create_cb_chain(
> d->cb_list[frame - 1].cb)->next_cb =
> to_bcm2711_cbaddr(cb_entry->paddr);
> if (frame && !c->is_40bit_channel)
> - d->cb_list[frame - 1].cb->next = cb_entry->paddr;
> + d->cb_list[frame - 1].cb->next = c->is_2712 ?
> + to_bcm2711_cbaddr(cb_entry->paddr) : cb_entry->paddr;
>
> /* update src and dst and length */
> if (src && (info & BCM2835_DMA_S_INC)) {
> @@ -750,7 +756,10 @@ static void bcm2835_dma_start_desc(struct bcm2835_chan *c)
> writel(BCM2711_DMA40_ACTIVE | BCM2711_DMA40_PROT | BCM2711_DMA40_CS_FLAGS(c->dreq),
> c->chan_base + BCM2711_DMA40_CS);
> } else {
> - writel(d->cb_list[0].paddr, c->chan_base + BCM2835_DMA_ADDR);
> + writel(BIT(31), c->chan_base + BCM2835_DMA_CS);
> +
> + writel(c->is_2712 ? to_bcm2711_cbaddr(d->cb_list[0].paddr) : d->cb_list[0].paddr,
> + c->chan_base + BCM2835_DMA_ADDR);
> writel(BCM2835_DMA_ACTIVE | BCM2835_DMA_CS_FLAGS(c->dreq),
> c->chan_base + BCM2835_DMA_CS);
> }
> @@ -1119,7 +1128,8 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic(
> d->cb_list[frames - 1].cb)->next_cb =
> to_bcm2711_cbaddr(d->cb_list[0].paddr);
> else
> - d->cb_list[d->frames - 1].cb->next = d->cb_list[0].paddr;
> + d->cb_list[d->frames - 1].cb->next = c->is_2712 ?
> + to_bcm2711_cbaddr(d->cb_list[0].paddr) : d->cb_list[0].paddr;
>
> return vchan_tx_prep(&c->vc, &d->vd, flags);
> }
> @@ -1186,6 +1196,8 @@ static int bcm2835_dma_chan_init(struct bcm2835_dmadev *d, int chan_id,
> else if (readl(c->chan_base + BCM2835_DMA_DEBUG) &
> BCM2835_DMA_DEBUG_LITE)
> c->is_lite_channel = true;
> + if (d->cfg_data->dma_mask == DMA_BIT_MASK(40))
> + c->is_2712 = true;
>
> return 0;
> }
> --
> 2.41.0
--
~Vinod
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-02-07 8:26 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-04 6:59 [PATCH 00/12] Add support for BCM2712 DMA engine Andrea della Porta
2024-02-04 6:59 ` [PATCH 01/12] bcm2835-dma: Add support for per-channel flags Andrea della Porta
2024-02-04 6:59 ` [PATCH 02/12] bcm2835-dma: Add proper 40-bit DMA support Andrea della Porta
2024-02-05 18:50 ` Stefan Wahren
2024-02-06 16:31 ` Dave Stevenson
2024-02-06 18:08 ` Stefan Wahren
2024-02-06 18:11 ` Stefan Wahren
2024-02-04 6:59 ` [PATCH 03/12] bcm2835-dma: Add NO_WAIT_RESP, DMA_WIDE_SOURCE and DMA_WIDE_DEST flag Andrea della Porta
2024-02-04 6:59 ` [PATCH 04/12] bcm2835-dma: Advertise the full DMA range Andrea della Porta
2024-02-05 17:55 ` Robin Murphy
2024-03-01 13:55 ` Andrea della Porta
2024-02-05 18:25 ` Stefan Wahren
2024-02-04 6:59 ` [PATCH 05/12] bcm2835-dma: Derive slave DMA addresses correctly Andrea della Porta
2024-02-05 18:03 ` Robin Murphy
2024-02-04 6:59 ` [PATCH 06/12] dmaengine: bcm2835: Use to_bcm2711_cbaddr where relevant Andrea della Porta
2024-02-04 17:04 ` Florian Fainelli
2024-02-05 10:25 ` Andrea della Porta
2024-02-04 6:59 ` [PATCH 07/12] bcm2835-dma: Support dma flags for multi-beat burst Andrea della Porta
2024-02-07 8:22 ` Vinod Koul
2024-02-04 6:59 ` [PATCH 08/12] bcm2835-dma: Need to keep PROT bits set in CS on 40bit controller Andrea della Porta
2024-02-04 6:59 ` [PATCH 09/12] dmaengine: bcm2835: Add BCM2712 support Andrea della Porta
2024-02-04 6:59 ` [PATCH 10/12] dmaengine: bcm2835: Support DMA-Lite channels Andrea della Porta
2024-02-07 8:26 ` Vinod Koul [this message]
2024-02-04 6:59 ` [PATCH 11/12] dmaengine: bcm2835: Rename to_bcm2711_cbaddr to to_40bit_cbaddr Andrea della Porta
2024-02-04 6:59 ` [PATCH 12/12] bcm2835-dma: Fixes for dma_abort Andrea della Porta
2024-02-05 19:06 ` [PATCH 00/12] Add support for BCM2712 DMA engine Stefan Wahren
2024-02-07 8:19 ` Vinod Koul
2024-02-07 10:24 ` Andrea della Porta
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=ZcM-oM2hySPlOcyp@matsya \
--to=vkoul@kernel.org \
--cc=andrea.porta@suse.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dmaengine@vger.kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=maxime@cerno.tech \
--cc=phil@raspberrypi.com \
--cc=popcornmix@gmail.com \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.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;
as well as URLs for NNTP newsgroup(s).