From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6052FC4828D for ; Wed, 7 Feb 2024 08:26:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mz4F/JrnMydZWpnwoM2/cOrcqWWKf5fS9JOaeA1ieS0=; b=AH8tJ1z1Ysc7MB oRb5hgIpVrbshuyxq0DqrcEY0R326z27csPTR9WFIcuYkHDUuwI/T2ziyTnQ8uI1pF+38KVBEOQxP rW3ZdcLynhkRICgvfKxtFlq7UtoLtMvHDdqVbp/a/J4wpRhDVblRnwBGe+F8h3DjngROHkJRtEIci qaI07eYlXfY8Uf9UbEJh3S+bnctZS8JKFDKM4ZtEAfZOV6fat+oUbTYOb2qov3oNcAytGDVKmQX0J 0c+H83qmJ3/IrtX+BoUFfhUomyn2MH53yKlhdhz3TPn0Z9p+KdlBX18NiXbrga10H5F68GzPKQsXc 5nXIXXewdICx69IKyewA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXdG4-0000000A25v-2mt2; Wed, 07 Feb 2024 08:26:16 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXdG2-0000000A25B-1PJP; Wed, 07 Feb 2024 08:26:15 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id B115BCE0B24; Wed, 7 Feb 2024 08:26:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45325C433F1; Wed, 7 Feb 2024 08:26:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707294371; bh=kk20eFR8A8AL7SqwOYmg4eexD2O3SgXOEqjTFOgwVRI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AWPrJ4RUBls+adUHSEXRulzNK+6ChFb4CV9ebbET9ywxL4dISfgLEPuKySzfXgvl9 c9RODstJiLO9yEDjcSuJV7vf4ILx+pJ+ogeREZ2Ccrrc7sWaoFsGPmOX8aZeC8wLDl vKfxzFRy8q5U5CQvpJyeQub4u6wwhmX/ya7hHUSVbiGOwjV6JWH/nPuWB2wpOsLEW7 xRjRWUyS5G+wxnkTW/OmWcc9JJd0L5AgYx88gpoFFZQ7w7Wuvmqlxb2rEgBnLKu3Oe mxfoY9ZjuY7XYZVD3C8yaKp1tsmwtyMvaow5utqWQAWPOGD5+5CUsjG9bIFXmzj9KV nhIkPAdK8CbYQ== Date: Wed, 7 Feb 2024 09:26:08 +0100 From: Vinod Koul To: Andrea della Porta Cc: Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , dmaengine@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Maxime Ripard , Dom Cobley , Phil Elwell Subject: Re: [PATCH 10/12] dmaengine: bcm2835: Support DMA-Lite channels Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240207_002614_739435_FBBB88E5 X-CRM114-Status: GOOD ( 21.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 04-02-24, 07:59, Andrea della Porta wrote: > From: Maxime Ripard > > 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 > Cc: Dom Cobley > Signed-off-by: Andrea della Porta > --- > 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