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 237F5C4828F for ; Wed, 7 Feb 2024 08:22:30 +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=OpI5J/XENUM9dowBluTaS0WplaqvnZRKJx3dr1DZuOA=; b=fKhq2v8ZM6HjsV C5vcydiYP9GNw8uOeOBIvgUquQBWlRef8PfucCXTjqKRiv54OuUudiC6ZbOYFekjX2rBI2ZZl4gbV qDuLVZP39USSeLY8Y0ws419aAvAZHPAYCUs6HIWQmISRLHhZ50USphowPokO5FIck2HrMuJ+eqw/8 YCIcHNPyIEOhireGqqK9IoUHFZB0FnD06hVEeeWuV3y9X3e+Mm4BUF7xA7GwvqTPZwojvu5pBHzpr bJIKwgrkE5rXybVP/jBoxTezdpfZo5UDfOAs4lJjUHOvd3dCct/4zj820ml1AXN5i4bFlvgfFICkS 6G+zF4Duh4xV1T7cbOOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXdCE-0000000A1f9-1BOv; Wed, 07 Feb 2024 08:22:18 +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 1rXdCB-0000000A1eU-2pVa; Wed, 07 Feb 2024 08:22:17 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 12BA7CE0AD2; Wed, 7 Feb 2024 08:22:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07C6DC433F1; Wed, 7 Feb 2024 08:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707294133; bh=ONyfgYZpeNqlc+twIxjgoeZr/daOvsSeNW0AuvuRyrg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jFRkqTVXJP/LrrxAulBnht89YU8gjhBMPmIBHvCcPhp6f6YxyBHeWezLZZE34gZOS IU2JCGkUciXPkSTswXwub4IzKzhzd1DPHhEYhS9lL07WYcfQPQos2JwatEHlP4z7rl xNqZjRWAzM/y2Q/LwzxU8/A2LVwVTo7+5gTnO23fxTHOYnUuay4gswThtob/U4pL6v NZ+PMrKh456IV1hTci6j6R0SU+5pjRnKp6kfTVXE4Mm1PkGm51v5Ls78JYshD5udqF xe4k/YM5hAuQRznHiJx4GdohNQef5dJLrXcyrrkcLKAl1YT1Pd44Nw/kY9A0r8O3W1 kTiprXynIGUwQ== Date: Wed, 7 Feb 2024 09:22:10 +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 07/12] bcm2835-dma: Support dma flags for multi-beat burst Message-ID: References: <570953f9532e2dc46568674d3c1348cdf26488b6.1706948717.git.andrea.porta@suse.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <570953f9532e2dc46568674d3c1348cdf26488b6.1706948717.git.andrea.porta@suse.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240207_002216_084512_7DE1CF75 X-CRM114-Status: GOOD ( 20.12 ) 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: Dom Cobley > > Add a control bit to enable a multi-beat burst on a DMA. > This improves DMA performance and is required for HDMI audio. > > Signed-off-by: Dom Cobley > Signed-off-by: Andrea della Porta > --- > drivers/dma/bcm2835-dma.c | 28 ++++++++++++++++++++-------- > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c > index d8d1f9ba2572..a20700a400a2 100644 > --- a/drivers/dma/bcm2835-dma.c > +++ b/drivers/dma/bcm2835-dma.c > @@ -156,7 +156,8 @@ struct bcm2835_desc { > #define BCM2835_DMA_S_WIDTH BIT(9) /* 128bit writes if set */ > #define BCM2835_DMA_S_DREQ BIT(10) /* enable SREQ for source */ > #define BCM2835_DMA_S_IGNORE BIT(11) /* ignore source reads - read 0 */ > -#define BCM2835_DMA_BURST_LENGTH(x) ((x & 15) << 12) > +#define BCM2835_DMA_BURST_LENGTH(x) (((x) & 15) << 12) why this changes, sounds like it does not belong here.. > +#define BCM2835_DMA_GET_BURST_LENGTH(x) (((x) >> 12) & 15) > #define BCM2835_DMA_CS_FLAGS(x) ((x) & (BCM2835_DMA_PRIORITY(15) | \ > BCM2835_DMA_PANIC_PRIORITY(15) | \ > BCM2835_DMA_WAIT_FOR_WRITES | \ > @@ -180,6 +181,11 @@ struct bcm2835_desc { > #define WIDE_DEST(x) (((x) & BCM2835_DMA_WIDE_DEST) ? \ > BCM2835_DMA_D_WIDTH : 0) > > +/* A fake bit to request that the driver requires multi-beat burst */ > +#define BCM2835_DMA_BURST BIT(30) > +#define BURST_LENGTH(x) (((x) & BCM2835_DMA_BURST) ? \ > + BCM2835_DMA_BURST_LENGTH(3) : 0) > + > /* debug register bits */ > #define BCM2835_DMA_DEBUG_LAST_NOT_SET_ERR BIT(0) > #define BCM2835_DMA_DEBUG_FIFO_ERR BIT(1) > @@ -282,7 +288,7 @@ struct bcm2835_desc { > /* the max dma length for different channels */ > #define MAX_DMA40_LEN SZ_1G > > -#define BCM2711_DMA40_BURST_LEN(x) ((min(x, 16) - 1) << 8) > +#define BCM2711_DMA40_BURST_LEN(x) (((x) & 15) << 8) > #define BCM2711_DMA40_INC BIT(12) > #define BCM2711_DMA40_SIZE_32 (0 << 13) > #define BCM2711_DMA40_SIZE_64 (1 << 13) > @@ -359,12 +365,16 @@ static inline uint32_t to_bcm2711_ti(uint32_t info) > > static inline uint32_t to_bcm2711_srci(uint32_t info) > { > - return ((info & BCM2835_DMA_S_INC) ? BCM2711_DMA40_INC : 0); > + return ((info & BCM2835_DMA_S_INC) ? BCM2711_DMA40_INC : 0) | > + ((info & BCM2835_DMA_S_WIDTH) ? BCM2711_DMA40_SIZE_128 : 0) | > + BCM2711_DMA40_BURST_LEN(BCM2835_DMA_GET_BURST_LENGTH(info)); > } > > static inline uint32_t to_bcm2711_dsti(uint32_t info) > { > - return ((info & BCM2835_DMA_D_INC) ? BCM2711_DMA40_INC : 0); > + return ((info & BCM2835_DMA_D_INC) ? BCM2711_DMA40_INC : 0) | > + ((info & BCM2835_DMA_D_WIDTH) ? BCM2711_DMA40_SIZE_128 : 0) | > + BCM2711_DMA40_BURST_LEN(BCM2835_DMA_GET_BURST_LENGTH(info)); > } > > static inline uint32_t to_bcm2711_cbaddr(dma_addr_t addr) > @@ -933,7 +943,8 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_memcpy( > struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); > struct bcm2835_desc *d; > u32 info = BCM2835_DMA_D_INC | BCM2835_DMA_S_INC | > - WAIT_RESP(c->dreq) | WIDE_SOURCE(c->dreq) | WIDE_DEST(c->dreq); > + WAIT_RESP(c->dreq) | WIDE_SOURCE(c->dreq) | > + WIDE_DEST(c->dreq) | BURST_LENGTH(c->dreq); > u32 extra = BCM2835_DMA_INT_EN; > size_t max_len = bcm2835_dma_max_frame_length(c); > size_t frames; > @@ -964,8 +975,8 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_slave_sg( > struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); > struct bcm2835_desc *d; > dma_addr_t src = 0, dst = 0; > - u32 info = WAIT_RESP(c->dreq) | > - WIDE_SOURCE(c->dreq) | WIDE_DEST(c->dreq); > + u32 info = WAIT_RESP(c->dreq) | WIDE_SOURCE(c->dreq) | > + WIDE_DEST(c->dreq) | BURST_LENGTH(c->dreq); > u32 extra = BCM2835_DMA_INT_EN; > size_t frames; > > @@ -1017,7 +1028,8 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( > struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); > struct bcm2835_desc *d; > dma_addr_t src, dst; > - u32 info = WAIT_RESP(c->dreq) | WIDE_SOURCE(c->dreq) | WIDE_DEST(c->dreq); > + u32 info = WAIT_RESP(c->dreq) | WIDE_SOURCE(c->dreq) | > + WIDE_DEST(c->dreq) | BURST_LENGTH(c->dreq); > u32 extra = 0; > size_t max_len = bcm2835_dma_max_frame_length(c); > size_t frames; > -- > 2.41.0 -- ~Vinod _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel