From patchwork Wed Mar 13 14:08:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea della Porta X-Patchwork-Id: 13591458 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 16610C54E58 for ; Wed, 13 Mar 2024 14:10:55 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VOyP+pdjgznh+dGQJ/A0/J9F8WXem3SBgoOQTLOE0Oo=; b=ZbpIlp9Fdvk7hw 8Rbtkkl7Fc5eUF3MkMjdvFBEZ8DvwX9xoyw2iMaXujC1R36PuSmZQg3xACT0G482CIEyvdB2lO989 Y/O20QXYJ2k8aMnATXAAc/7u0q+7dISmskclkz3I5E9jESzVa6tPf9dZENIkKTEBTj2KUAwud/YEw wfQ9i+3cwvRODJECErm8GbDwVcRtffPpDHuxWtVl8PmahF8yjT33jy2md6amnv9+pqgznJh2mq5iJ UFh8cUaes7cJgQsK4YqDXvipcjuUEXML3r/9tDL4AgDQDB9frpusA1AmDN9rm5xeXUtgzjOpJ3HVt ZDtEEe0xeB8a4AoB5qpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkPJU-0000000ANEA-1Tl8; Wed, 13 Mar 2024 14:10:36 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkPHq-0000000AM9z-0yWV for linux-arm-kernel@lists.infradead.org; Wed, 13 Mar 2024 14:08:59 +0000 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5684c3313cdso4681151a12.3 for ; Wed, 13 Mar 2024 07:08:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1710338933; x=1710943733; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I53kioFtQ9+NV3RahDpOPJUiNDTHamWrrm2d7gZ/rPs=; b=SCxYUiHeXzNMEMfJcIj/HnX+dhdmCDjxYwHaOJWivUttlObSwv3lZV22pPk+PHkB+L 1QTaI1mCIIOJdRedzWyIsFg/kAcCg7SQAYrkTAnECXHfqhZoJubN1lAu0r5FvJj2FLmP z2dli5mdKUA3zXWJGt+hVr3iQldawzPngHphepiHjCow33stvxYwS3RbRnQiclm5bvAP KWrjdMctzyVYjC4wTAgq1lvR8JCP4V2X/VIxo3lvanM5wgAbXA34EccAuQ+saiuhIVBW fD9ZSc+hst0ACcFDcIVxtCCqv1azM4vMcp8EqdV7uy8HF8quVxCB70l21Fdri3StpXVt CtMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710338933; x=1710943733; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I53kioFtQ9+NV3RahDpOPJUiNDTHamWrrm2d7gZ/rPs=; b=vJa+7G5cZ03LG95KNPQilXD0lXXYGwKXoMjRDuoXOWynyy1vI0ee0QSVRVQ/mu8t6i 2vWQxpEsyTwhYRZQG89UrqlhjLygIYqcxuFLTQK2Ab4CC2yO7XT5/GMRruui/Jv1I1xi daojNMDwsDOM1sohfnkvukuU4uh0yJACcU0hdf0wxfC2MQ8JTgEhTJ7NMG6/Z63raa5K St0BsraVdFaS0o7t1Y3CBWAIhWbsW60YCnxRQY3kg0pWSQkwktex1OaEhUAOIkENCbG1 rLF0SkVicDEkG/OBi8sfU9IEbPE0IZsxNubtUBHyv7ltw8wkl9sbuDeb8vPC3sdCel2w 0vtQ== X-Forwarded-Encrypted: i=1; AJvYcCXsgvtFBkzz3VRHvoNvKxrMwkJhh6M8L9HnFInsqbp9uOm6EVq/9gq7TO1oW1aqunpLcMtXwN5cXshKVeIYqgSvT3S9+uGt6yEC5FOAKQoGzqp/rNg= X-Gm-Message-State: AOJu0Yw8vfKPimGf0QnacwgKwz7ZElH27wtRiGPydqlwOfKglExTta9l JLeg8c+YBJ3LkeH0Dbo9eJmAgnsw3NvMvHxsIE5ho8q4Jc5tPgPeQm3JppyjWXM= X-Google-Smtp-Source: AGHT+IHCQaImo5LItH4gVnqRjfNB/SPNM2IFdvzY8VY0xNFroLrYEX7IIpdpQjosUbug1fHTnON4rw== X-Received: by 2002:a50:9ee2:0:b0:566:131b:5b5f with SMTP id a89-20020a509ee2000000b00566131b5b5fmr8554418edf.26.1710338932962; Wed, 13 Mar 2024 07:08:52 -0700 (PDT) Received: from localhost (host-82-56-173-172.retail.telecomitalia.it. [82.56.173.172]) by smtp.gmail.com with ESMTPSA id co25-20020a0564020c1900b00567f6310010sm5081840edb.59.2024.03.13.07.08.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 07:08:52 -0700 (PDT) From: Andrea della Porta To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Saenz Julienne , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dave.stevenson@raspberrypi.com Cc: Phil Elwell , Maxime Ripard , Stefan Wahren , Dom Cobley , Andrea della Porta Subject: [PATCH v2 04/15] dmaengine: bcm2835: Support dma flags for multi-beat burst Date: Wed, 13 Mar 2024 15:08:29 +0100 Message-ID: <897f4540ad1268f3a560a48de8667a6327ce6b7f.1710226514.git.andrea.porta@suse.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240313_070854_718868_B57135C8 X-CRM114-Status: GOOD ( 14.07 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c index 69a77caf78cc..d442f8728c05 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c @@ -137,6 +137,7 @@ struct bcm2835_desc { #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_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 | \ @@ -160,6 +161,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) @@ -637,7 +643,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; @@ -668,8 +675,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; @@ -721,7 +728,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;