From patchwork Wed Mar 13 14:08:28 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: 13591451 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 3DE24C54E58 for ; Wed, 13 Mar 2024 14:09:33 +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=DjCMG6AUgDPZKmCsffG5xdjtR2EBhY9HoZrNjaqFiuA=; b=cnSEvUHf2c2obA 2ALro/qgZsWwfSRNVY5RWNF9JFi/TMLtM25oqZU3ljSjijCxI7saIraDAgyRcMyDMTae1OySJEnnm MVy58ay0wqFg6IL22x0VKt2AePYIqBQtYia92hjKXjjvSKSMwraZmiv948qhu2bfeo8GdZqqE1trT 0QNJAUoBl3ZcXZ60VEOeb/VUqoKyPZipSEVxdNPFmDESSQP6LaxWJd9r8KjVYXlSbRFhyH3QnBIVN ISij6aUEfYQwOacjGvjWkL6vXMVvXaxcw9ZQb3DTwH9KPpICgqS8OlVWpS3nmbl8sMvuSNKD042XK eE4UROHwbOt8gt4IK2yQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkPIH-0000000AMSR-3ye1; Wed, 13 Mar 2024 14:09:21 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkPHp-0000000AM8J-38BL for linux-arm-kernel@lists.infradead.org; Wed, 13 Mar 2024 14:08:58 +0000 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a2f22bfb4e6so994054766b.0 for ; Wed, 13 Mar 2024 07:08:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1710338931; x=1710943731; 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=7L2vUwfipr2gKOB26ZSV+Vf7Bi2o+2MhICmn4R7KPa0=; b=KglAargy+iEW/a0NiEcZKHxAltmS3E6O5rDkIKEXaQhnBuOgnEmEgGgUroGwfzcfS9 nPvZrAGTunsISWiSIN51iYxK0TgxNB4pThU/I4BOSGW6jTg1kCbEWWS9/ckCyqCGiK4o pAYwACLeO9QcJVR1UxlDbFKjUH0AilywYMPvZ5kV+vJl/TUq0nUbFlkif7eih3Kygars gmIXs6a2DRzamKeoDrOX7CQR31SFyvwJEaBdhkBBZsGFTlztiCBPlRdU20KSH8XeGeG6 OlA2z2nDSQAdEPGFlUqFf/pkG3YwnlKPQiCpSyNwvfw+pT14X3uELSAeQmLOkS7zc84S oQ+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710338931; x=1710943731; 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=7L2vUwfipr2gKOB26ZSV+Vf7Bi2o+2MhICmn4R7KPa0=; b=IjTM4tBgtb0D8oQ4rGRDoStmXD5lRc4wx3Yea7jf3wqKat9Keb9956gOxv1EfHaTWX fUiHZC91R8BizjVzvQtGWgM+yGA0nUEFOxNKIRhoUE9GYm/HunYQ2MdsgqJqF2dvX9Mn MLBB6B7yNeDX25X++XinQG/mCx9PFSQaMWjVPZmnA1jo+BTJXNmSGDSmBpgTBF89zYmh GxZ/tBhYx1JAsWWAWD2C+mxBOxybTLdsqt43BZDw24q8EBgoof3RaJv8ciQ5qtdJpL+T P+FH6EQq4oWwAvpFtE1fuIc91Y0L4Qz/8v1Tm0Wrr8qRfWgF9hDUzeDi02z7rEttB5/3 mwfw== X-Forwarded-Encrypted: i=1; AJvYcCWa0+b9d/BhUSvpuGEDou+PLSEweumjQzdPgiV1g6rZVSTTVHlsAGpRj4gwP64EfcK94EGkZ/ZENFN40AOC62Dg5qZ8SPb4sBtlICXYDrX4+EUinCM= X-Gm-Message-State: AOJu0YyKGOoiS9p0x8Ejfi8g0n4UEV9FuldBOlR8h/q54sQMuk8TUDEV svy4O6pUx7xDBQUX3/6gXmkuM+/4Pliywn96MhQmiSWN3KNgucqJsl5rrnumOa8= X-Google-Smtp-Source: AGHT+IFuoxBmQfVemyQzXiLcXvQk5/Bj3gVOpZYZDujxntAraTAYvlG61Hp66sCW3jmCCSgQmgCMXA== X-Received: by 2002:a17:906:c784:b0:a46:61ef:2846 with SMTP id cw4-20020a170906c78400b00a4661ef2846mr871027ejb.66.1710338931040; Wed, 13 Mar 2024 07:08:51 -0700 (PDT) Received: from localhost (host-82-56-173-172.retail.telecomitalia.it. [82.56.173.172]) by smtp.gmail.com with ESMTPSA id a21-20020a170906469500b00a4667190a35sm88005ejr.37.2024.03.13.07.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 07:08:50 -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 , Phil Elwell , Andrea della Porta Subject: [PATCH v2 03/15] dmaengine: bcm2835: Add NO_WAIT_RESP, DMA_WIDE_SOURCE and DMA_WIDE_DEST flag Date: Wed, 13 Mar 2024 15:08:28 +0100 Message-ID: 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_070853_967102_6B2EC8D3 X-CRM114-Status: GOOD ( 15.80 ) 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: Phil Elwell Use bit 27 of the dreq value (the second cell of the DT DMA descriptor) to request that the WAIT_RESP bit is not set. Use (reserved) bits 24 and 25 of the dreq value (the second cell of the DT DMA descriptor) to request that wide source reads or wide dest writes are required Originally-by: Dom Cobley Originally-by: Phil Elwell Signed-off-by: Andrea della Porta --- drivers/dma/bcm2835-dma.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c index 3d9973dd041d..69a77caf78cc 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c @@ -145,6 +145,21 @@ struct bcm2835_desc { #define BCM2835_DMA_WAIT(x) (((x) & 31) << 21) /* add DMA-wait cycles */ #define BCM2835_DMA_NO_WIDE_BURSTS BIT(26) /* no 2 beat write bursts */ +/* A fake bit to request that the driver doesn't set the WAIT_RESP bit. */ +#define BCM2835_DMA_NO_WAIT_RESP BIT(27) +#define WAIT_RESP(x) (((x) & BCM2835_DMA_NO_WAIT_RESP) ? \ + 0 : BCM2835_DMA_WAIT_RESP) + +/* A fake bit to request that the driver requires wide reads */ +#define BCM2835_DMA_WIDE_SOURCE BIT(24) +#define WIDE_SOURCE(x) (((x) & BCM2835_DMA_WIDE_SOURCE) ? \ + BCM2835_DMA_S_WIDTH : 0) + +/* A fake bit to request that the driver requires wide writes */ +#define BCM2835_DMA_WIDE_DEST BIT(25) +#define WIDE_DEST(x) (((x) & BCM2835_DMA_WIDE_DEST) ? \ + BCM2835_DMA_D_WIDTH : 0) + /* debug register bits */ #define BCM2835_DMA_DEBUG_LAST_NOT_SET_ERR BIT(0) #define BCM2835_DMA_DEBUG_FIFO_ERR BIT(1) @@ -621,8 +636,9 @@ 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; - u32 extra = BCM2835_DMA_INT_EN | BCM2835_DMA_WAIT_RESP; + u32 info = BCM2835_DMA_D_INC | BCM2835_DMA_S_INC | + WAIT_RESP(c->dreq) | WIDE_SOURCE(c->dreq) | WIDE_DEST(c->dreq); + u32 extra = BCM2835_DMA_INT_EN; size_t max_len = bcm2835_dma_max_frame_length(c); size_t frames; @@ -652,7 +668,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 = BCM2835_DMA_WAIT_RESP; + u32 info = WAIT_RESP(c->dreq) | + WIDE_SOURCE(c->dreq) | WIDE_DEST(c->dreq); u32 extra = BCM2835_DMA_INT_EN; size_t frames; @@ -704,7 +721,7 @@ 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 = BCM2835_DMA_WAIT_RESP; + u32 info = WAIT_RESP(c->dreq) | WIDE_SOURCE(c->dreq) | WIDE_DEST(c->dreq); u32 extra = 0; size_t max_len = bcm2835_dma_max_frame_length(c); size_t frames;