From patchwork Wed Mar 13 14:08:25 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: 13591449 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 C6480C54E58 for ; Wed, 13 Mar 2024 14:09:14 +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: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:In-Reply-To:References: List-Owner; bh=nobhNZRtSbDWvpRx2kjXkq4dwT1J2qzs2F3fExFC9MM=; b=lbynv9EabvTLcD brhECblbQ4hK8hUgKgQJxORWY91uzYvLonyx3xcOs+9ai2cx7Ph5Tx2OW8aE/OCnbgy893ZJLID54 Nq+LVRIaLoGn5dfKx9QHAz2mu0k2+l8RErdsYLAEer5nbo/BrU5MXOQEZI834oRbf53bIWWi1W+9C ae163ebDbFKAHN2dqzTXYjr8CW22biui0gyf4YrCEghSbAx2XiAlzmgiaNpLrQuriZ08ezGKolsnV QIf0dMoqXJq4lUva/MBf7V5WMUc0QdLbkKhmtQmLuKBIzRqy0ddO5I3dKtvb4BnclM0cOMvdxYQs0 S5pgDAyBki6pKDVhbX8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkPHs-0000000AMBa-21SI; Wed, 13 Mar 2024 14:08:56 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkPHo-0000000AM7r-02Wt for linux-arm-kernel@lists.infradead.org; Wed, 13 Mar 2024 14:08:54 +0000 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-563cb3ba9daso7937534a12.3 for ; Wed, 13 Mar 2024 07:08:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1710338927; x=1710943727; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nFaFWSbAggIWNNRtL6qVwdZXd8rjrLSqMYNza7qT6dQ=; b=WkSZOPylm02P9WJkYeYdcQ/FP/hS88aD+a5TKZwrANhqFY8IdIyDr+bF2Lta5wimBg IwQqHzRM2q7R/Y28je4syH3mZYrQyyS0FxW9KGP9/V8tBrehCPkFfhqGb2lC2m9/1Uoo PN63+TNKG6Lzm0CgNLQpfMTRMtLYgVLPyDuXmmPzFcR4mFLD7GtJauX1wuYFPuNqr2FI neLb0j3nx+vttGglVVmYZ6ZPRUTOtWLPgre3Y6vk1AMyOLJF0gAUcJb+rNUvAycI87Lg wYvdvoFyMI+6oRXdXYcI9J1tr2IT6zKxc8Uamvy+vjq9M7/keMpyQZnxnqyPiBU6/Pa2 CqaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710338927; x=1710943727; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nFaFWSbAggIWNNRtL6qVwdZXd8rjrLSqMYNza7qT6dQ=; b=R5MU/Jp7KC/eybPmtT9Aee7jiQr/rcZphCgY5RHCNoSiWTZZm2yh7qNqcl1TyFktin fA/a0T2A/vXX/ojT8BuWhfvHhBo/CNlqEMHe9l7ayLkb8U3MH8Bi5J4CO/1/RI7I9E/Q cKkaIuXtbVvelF89SXxFUMvl353x064PZ1Fgy2ji1Dq1ySjHRsaF+yubGXf08ptJraZj uExpg2DpFaK3uKX/2+BYVd+phMmne0ZMsSoC94QfkSmSV7h5KwwI83wqRpAh1Pae9hkA C3veQiUcAb07jsZzgVkhi21zDilHPu5SYJEtNgac6+eU36u+s74h7EL2z5JbkymiGmtL aD3A== X-Forwarded-Encrypted: i=1; AJvYcCXtEyheebBdq1K/aa1IH6vfsuy52kt1dgLAzLwuXOkGVTlsx3PDjYus4lkzM0FkesNjgE811llrOrZqMWVnOUYaxCJt18eTCmOeYr9hY+efgq+fTjk= X-Gm-Message-State: AOJu0YzOceURUoMBGEMS7jAqgS1/QqUBpEXyeujgplggYP4DoWf6iVXT KlVbJXkUbR6NRj0Z09lnmzZyiID3gHmfaxmKt+VbvPlg3weglMciZl5VZhR70u0= X-Google-Smtp-Source: AGHT+IFGEupu0zEFftAf3tP8pRRB7sRV7oLyxGKsi3LTI6oxXj6mdWTOqk8zm4iCBRtSwIBCI2TX6w== X-Received: by 2002:a17:907:a801:b0:a45:94bf:18e6 with SMTP id vo1-20020a170907a80100b00a4594bf18e6mr10631233ejc.73.1710338926973; Wed, 13 Mar 2024 07:08:46 -0700 (PDT) Received: from localhost (host-82-56-173-172.retail.telecomitalia.it. [82.56.173.172]) by smtp.gmail.com with ESMTPSA id xe2-20020a170907318200b00a4666bfa979sm102216ejb.118.2024.03.13.07.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 07:08:46 -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 00/15] dmaengine: bcm2835: add BCM2711 40-bit DMA support Date: Wed, 13 Mar 2024 15:08:25 +0100 Message-ID: X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240313_070852_127219_3160BAC6 X-CRM114-Status: GOOD ( 20.82 ) 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 The BCM2711 has 4 DMA channels with a 40-bit address range, allowing them to access the full 4GB of memory on a Pi 4. This patchset aims to update the dma engine for BCM* chipset with respect to current advancements in downstream vendor tree. In particular, it supports the BCM2711 DMA engine in terms of extended DMA addressing to 40 bit. Changes with respect to the first version (see [1]) of this patchset: * dropped support of the new BCM2712. It will be the focus of a subsequent patch. * merged patchset from Stefan Wahren [2] to support newer chipset with a platform agnostic design, while also retaining the new features added from downstream [1], as follows: - patches from 1 to 5 are preparatory, adding some features and bugfix common to all chipsets. - patches from 6 to 12 add hw abstraction - patches 13 to 15 eventually add 40 bit and BCM2711 support * fixed a couple of bugs from [2] relative to address shifting on 40 bit support specific code * added the relevant entries in the dts and DT binding that was missing in the first patch * used FIELD_PREP() wherever appropriate as advised in [3] * of_match_node() has been replaced by the more generic device_get_match_data(), as per [4] * fixed several errors and warnings from checkpatch Please note that there is still a pending discussion around here [5]: this patch still use the current approach (used in both downstream code and in Stefan's redesigned patchset) of getting the address as it is (dma_addr_t) and just add the relevant offset when needed (on 40 bit channel, see .addr_offset in struct bcm2835_dma_cfg). This is not optimal but still deemed as less hacky than using DMA internals (see [6]). As soon as there will be guidelines for [5] or dma_map_resource() will take care of dma_ranges, a subsequent patch will adjust accordingly. Since there is an ongoing effort from Dave Stevenson to upstream a patchset with similar goals, I'm adding him to the email loop in order seek for collaboration. NOTE: I apologize to any of you that received an incomplete patchset: unfortunately I had some issues with internal imap server that prevent correct mail delivery. I'm resending the entire patchset again to be sure everyone is getting a copy. Again, apologize for the inconvenince. Many thanks, Andrea Links: [1] https://lore.kernel.org/linux-arm-kernel/cover.1706948717.git.andrea.porta@suse.com/ [2] https://lore.kernel.org/linux-arm-kernel/13ec386b-2305-27da-9765-8fa3ad71146c@i2se.com/T/ [3] https://lore.kernel.org/linux-arm-kernel/YguMW8n1q0ZV5tKH@matsya/ [4] https://lore.kernel.org/linux-arm-kernel/1e71c153-e482-409c-b229-9b9c0662b67e@arm.com/ [5] https://lore.kernel.org/all/CAPY8ntByJYzSv0kTAc1kY0Dp=vwrzcA0oWiPpyg7x7_BQwGSnA@mail.gmail.com/ [6] https://lkml.org/lkml/2024/2/5/1161 Andrea della Porta (11): dmaengine: bcm2835: Fix several spellos dmaengine: bcm2835: Support common dma-channel-mask dmaengine: bcm2835: move CB info generation into separate function dmaengine: bcm2835: move CB final extra info generation into function dmaengine: bcm2835: make address increment platform independent dmaengine: bcm2385: drop info parameters dmaengine: bcm2835: pass dma_chan to generic functions dmaengine: bcm2835: introduce multi platform support dt-bindings: dma: Added bcm2711-dma dmaengine: bcm2835: Add BCM2711 40-bit DMA support ARM: dts: bcm2711: add bcm2711-dma node Dom Cobley (2): dmaengine: bcm2835: Support dma flags for multi-beat burst dmaengine: bcm2835: Fixes for dma_abort Phil Elwell (2): dmaengine: bcm2835: Add support for per-channel flags dmaengine: bcm2835: Add NO_WAIT_RESP, DMA_WIDE_SOURCE and DMA_WIDE_DEST flag .../bindings/dma/brcm,bcm2835-dma.yaml | 4 +- arch/arm/boot/dts/broadcom/bcm2711.dtsi | 16 + drivers/dma/bcm2835-dma.c | 1084 +++++++++++++---- 3 files changed, 892 insertions(+), 212 deletions(-)