devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 00/28] dmaengine: bcm2835: add BCM2711 and BCM2712 40-bit DMA support
@ 2026-11-23 14:56 Andrea della Porta
  2026-11-23 14:56 ` [PATCH v3 01/28] dmaengine: bcm2835: Fix coding style issues and a typo Andrea della Porta
                   ` (27 more replies)
  0 siblings, 28 replies; 36+ messages in thread
From: Andrea della Porta @ 2026-11-23 14:56 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Frank Li, dmaengine, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, devicetree, Florian Fainelli, Ray Jui,
	Scott Branden, Broadcom internal kernel review list,
	Saenz Julienne, Stefan Wahren, Dave Stevenson, Phil Elwell,
	Dom Cobley, Maxime Ripard, Robin Murphy, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, David Airlie, dri-devel,
	Jaroslav Kysela, Liam Girdwood, linux-mmc, linux-sound, linux-spi,
	Maarten Lankhorst, Maíra Canal, Mark Brown,
	Raspberry Pi Kernel Maintenance, Simona Vetter, Takashi Iwai,
	Thomas Zimmermann, Ulf Hansson

The BCM2711 has 4 DMA channels with a 40-bit address range, allowing them
to access the whole memory of a Pi 4, and the BCM2712 has 6 of them. This
series adds support for them to the bcm2835-dma driver, on top of the
platform abstraction from Stefan Wahren and some features from the
downstream Raspberry Pi kernel.

The main change since v2 is the handling of the slave (peripheral)
addresses, as requested in the v1/v2 discussions [1][2][3]: instead of
hardcoding the 0x4_0000_0000 offset of the 40-bit channels and relying on
clients passing pre-translated VideoCore bus addresses, the clients now
pass CPU physical addresses and the DMA driver translates them with
dma_map_resource(). Since the conversion of dma_map_resource() to
dma_map_phys() with DMA_ATTR_MMIO, the dma-direct implementation honours
the dma-ranges of the device, which was the open question raised by
Robin in [1].

To keep old device trees working (they only describe the RAM in
dma-ranges), the driver detects at probe time whether the peripheral
window is described in dma-ranges, by looking up its own registers, and
otherwise falls back to reverting the translation given by the ranges of
the parent bus, as suggested by Dave in [3]. Addresses outside of the
ranges are passed through, so that out of tree clients still providing
bus addresses keep working with old device trees. The same fallback
works for the BCM2712 40-bit channels, whose bus maps the peripherals
1:1, while the BCM2711 40-bit channels see the peripherals 16 GiB above
their VideoCore bus address, which cannot be derived from the ranges:
they require dma-ranges, which all the device trees describing them
(the downstream ones and the one added here) provide.

Structure of the series:

  1-5:   preparatory patches and features from downstream (per-channel
         flags, wide accesses, bursts, abort fixes)
  6-7:   generic dma-channel-mask property
  8-13:  hardware abstraction (Stefan Wahren)
  14-19: slave address translation with dma_map_resource(), conversion
         of the clients (spi, mmc, ASoC, vc4 HDMI) and dma-ranges
  20-23: BCM2711 40-bit channels
  24-26: BCM2712 40-bit channels
  27:    DMA flags for the HDMI audio of BCM283x
  28:    HDMI audio on BCM2712 through the 40-bit channels

Changes in v3:
- Drop the hardcoded addr_offset, translate slave addresses with
  dma_map_resource() in device_config() and unmap them on
  reconfiguration and when freeing the channel.
- Convert spi-bcm2835, mmc/bcm2835, bcm2835-i2s and vc4_hdmi to provide
  CPU physical addresses, and describe the peripheral window in the
  dma-ranges of the BCM283x/BCM2711 soc bus.
- Put the BCM2711 40-bit controller in its own bus, whose dma-ranges map
  the peripherals at 0x4_7c000000, instead of the scb bus, to not change
  the DMA configuration of PCIe and GENET and to avoid refactoring the
  entire DTS to fit the cell size.
- Fix the abort sequences, which were swapped between the legacy and the
  40-bit channels, breaking terminate_all on all the Raspberry Pis.
- Fix the interrupt acknowledge of the 40-bit channels, which used the
  INTEN bit of the TI register instead of the INT bit of CS.
- Make the abort sequence a platform callback, drop the CS/TI masks only
  used by it.
- Keep the period handling of bcm2835_dma_create_cb_set_length(), which
  v2 changed to flag every control block of cyclic transfers.
- Use the platform cb_append_extra() callback for every control block,
  and convert every control block address with to_cb_addr().
- Preserve the width and burst settings of SRCI/DESTI when setting the
  addresses of slave_sg transfers.
- Fix the argument order of cb_init() in the patch introducing it, to
  keep the series bisectable.
- Fix the free_irq() cookie, which did not match the request_irq() one.
- Derive the first channel of an instance from the physical register
  address instead of the ioremap()ed one, initialize all the IRQ array
  entries, and split this into its own patch.
- Refuse to probe the 40-bit channels if dma_addr_t is 32-bit wide, and
  avoid shifting dma_addr_t by 32 bits.
- Include linux/bitfield.h, fixing COMPILE_TEST builds.
- Drop the unused bcm2835_dma_count_frames_for_sg(), resurrected by a
  rebase, and the dead code and duplicated defines of the 40-bit patch.
- Split out the style changes from the 40-bit patch (Stefan), reword the
  subject of the first patch (Florian).
- dt-bindings: sort the compatibles (Krzysztof), document the flags in
  the DREQ cell (Stefan), allow the generic dma-channel-mask, constrain
  the interrupts of the new compatibles. The Acked-by of v2 has been
  dropped because of the additional changes.
- Use the generic dma-channel-mask in the new nodes (Krzysztof).
- Use the DMA specifier flags for the HDMI audio channels of BCM283x,
  so that patches 2-4 have in-tree users (Stefan)
- Describe in the platform data which channels of the DMA block use its
  programming model and ignore the others, so that nodes describing
  channels with another model under the same compatible (as the
  downstream BCM2712 device tree does) are not driven with the wrong one.
- Add BCM2712 support.

Backward compatibility with installed device trees:
- Upstream device trees without the peripheral window in dma-ranges keep
  working through the ranges fallback, which yields the same bus
  addresses the clients used to provide.
- Downstream Raspberry Pi device trees already describe the peripheral
  window in dma-ranges (for both the soc and scb buses), and their
  40-bit controllers are handled through dma_map_resource().
- The node of the downstream BCM2712 device tree describing channels 0-5
  is rejected instead of being driven with the wrong programming model.
- The current upstream device trees do not describe any 40-bit DMA
  controller, so the new compatibles have no legacy to support. A
  brcm,bcm2711-dma node without dma-ranges makes the probe fail instead
  of programming wrong addresses.
- Older kernels booted with the new device trees are not affected: the
  extra dma-ranges entries do not change the DMA limits of the existing
  devices and the new nodes use compatibles unknown to them.

Not supported yet: No device tree consumer is converted to the 40-bit
channels either.

This patchset has been tested on Rpi3/4/5 with both downstream and
upstream DTBs. The upstream DTBs have been customized to allow for several
peripherals (SPI, I2S, HDMI audio, mem2mem) to be tested against dma40,
an example of which can be found in patch 28.
Future patches will convert said consumer nodes to use the new dma
controller.

This version has been prepared with the help of an AI coding assistant
(Claude Opus 5.5).

[1] https://lore.kernel.org/linux-arm-kernel/ee19a95d-fe1e-4f3f-bc81-bdef38475469@arm.com/
[2] https://lore.kernel.org/all/CAPY8ntCcz7ysTq_78Rb8ohLLETTYZeoZ3DXdPFvDLAkPc9jPWw@mail.gmail.com/
[3] https://lore.kernel.org/all/CAPY8ntByJYzSv0kTAc1kY0Dp=vwrzcA0oWiPpyg7x7_BQwGSnA@mail.gmail.com/

Previous versions:
v2: https://lore.kernel.org/all/cover.1710226514.git.andrea.porta@suse.com/
v1: https://lore.kernel.org/linux-arm-kernel/cover.1706948717.git.andrea.porta@suse.com/

Andrea della Porta (24):
  dmaengine: bcm2835: Fix coding style issues and a typo
  dt-bindings: dma: brcm,bcm2835-dma: Document dma-channel-mask and DREQ
    flags
  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: bcm2835: drop info parameters
  dmaengine: bcm2835: pass dma_chan to generic functions
  dmaengine: bcm2835: introduce multi platform support
  dmaengine: bcm2835: Use dma_map_resource() to translate slave
    addresses
  spi: bcm2835: Pass the CPU physical address of the FIFO to the DMA
    engine
  mmc: bcm2835: Pass the CPU physical address of SDDATA to the DMA
    engine
  ASoC: bcm2835-i2s: Pass the CPU physical address of the FIFO to the
    DMA engine
  drm/vc4: hdmi: Pass the CPU physical address of MAI_DATA to the DMA
    engine
  ARM: dts: broadcom: Describe the peripheral window in dma-ranges
  dmaengine: bcm2835: Support channel subsets in a controller instance
  dt-bindings: dma: brcm,bcm2835-dma: Add BCM2711 40-bit DMA
  dmaengine: bcm2835: Add BCM2711 40-bit DMA support
  ARM: dts: bcm2711: Add the 40-bit DMA controller
  dt-bindings: dma: brcm,bcm2835-dma: Add BCM2712 40-bit DMA
  dmaengine: bcm2835: Add BCM2712 40-bit DMA support
  arm64: dts: broadcom: bcm2712: Add the 40-bit DMA controller
  ARM: dts: broadcom: Set the DMA flags of the HDMI audio channel on
    BCM283x
  arm64: dts: broadcom: bcm2712: Enable HDMI audio

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        |   88 +-
 arch/arm/boot/dts/broadcom/bcm2711.dtsi       |   40 +-
 .../arm/boot/dts/broadcom/bcm2835-common.dtsi |    3 +-
 arch/arm/boot/dts/broadcom/bcm2835.dtsi       |    3 +-
 arch/arm/boot/dts/broadcom/bcm2836.dtsi       |    3 +-
 arch/arm/boot/dts/broadcom/bcm2837.dtsi       |    3 +-
 .../boot/dts/broadcom/bcm2712-d-rpi-5-b.dts   |    9 +
 arch/arm64/boot/dts/broadcom/bcm2712.dtsi     |   26 +
 drivers/dma/bcm2835-dma.c                     | 1229 ++++++++++++++---
 drivers/gpu/drm/vc4/vc4_hdmi.c                |   16 +-
 drivers/mmc/host/bcm2835.c                    |   20 +-
 drivers/spi/spi-bcm2835.c                     |   27 +-
 sound/soc/bcm/bcm2835-i2s.c                   |   19 +-
 13 files changed, 1229 insertions(+), 257 deletions(-)

-- 
2.51.0


^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2026-11-23 15:21 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 14:56 [PATCH v3 00/28] dmaengine: bcm2835: add BCM2711 and BCM2712 40-bit DMA support Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 01/28] dmaengine: bcm2835: Fix coding style issues and a typo Andrea della Porta
2026-11-23 15:05   ` sashiko-bot
2026-11-23 14:56 ` [PATCH v3 02/28] dmaengine: bcm2835: Add support for per-channel flags Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 03/28] dmaengine: bcm2835: Add NO_WAIT_RESP, DMA_WIDE_SOURCE and DMA_WIDE_DEST flag Andrea della Porta
2026-11-23 15:09   ` sashiko-bot
2026-11-23 14:56 ` [PATCH v3 04/28] dmaengine: bcm2835: Support dma flags for multi-beat burst Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 05/28] dmaengine: bcm2835: Fixes for dma_abort Andrea della Porta
2026-11-23 15:08   ` sashiko-bot
2026-11-23 14:56 ` [PATCH v3 06/28] dt-bindings: dma: brcm,bcm2835-dma: Document dma-channel-mask and DREQ flags Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 07/28] dmaengine: bcm2835: Support common dma-channel-mask Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 08/28] dmaengine: bcm2835: move CB info generation into separate function Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 09/28] dmaengine: bcm2835: move CB final extra info generation into function Andrea della Porta
2026-11-23 15:01   ` sashiko-bot
2026-11-23 14:56 ` [PATCH v3 10/28] dmaengine: bcm2835: make address increment platform independent Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 11/28] dmaengine: bcm2835: drop info parameters Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 12/28] dmaengine: bcm2835: pass dma_chan to generic functions Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 13/28] dmaengine: bcm2835: introduce multi platform support Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 14/28] dmaengine: bcm2835: Use dma_map_resource() to translate slave addresses Andrea della Porta
2026-11-23 15:21   ` sashiko-bot
2026-11-23 14:56 ` [PATCH v3 15/28] spi: bcm2835: Pass the CPU physical address of the FIFO to the DMA engine Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 16/28] mmc: bcm2835: Pass the CPU physical address of SDDATA " Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 17/28] ASoC: bcm2835-i2s: Pass the CPU physical address of the FIFO " Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 18/28] drm/vc4: hdmi: Pass the CPU physical address of MAI_DATA " Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 19/28] ARM: dts: broadcom: Describe the peripheral window in dma-ranges Andrea della Porta
2026-11-23 15:17   ` sashiko-bot
2026-11-23 14:56 ` [PATCH v3 20/28] dmaengine: bcm2835: Support channel subsets in a controller instance Andrea della Porta
2026-11-23 14:56 ` [PATCH v3 21/28] dt-bindings: dma: brcm,bcm2835-dma: Add BCM2711 40-bit DMA Andrea della Porta
2026-11-23 14:57 ` [PATCH v3 22/28] dmaengine: bcm2835: Add BCM2711 40-bit DMA support Andrea della Porta
2026-11-23 15:09   ` sashiko-bot
2026-11-23 14:57 ` [PATCH v3 23/28] ARM: dts: bcm2711: Add the 40-bit DMA controller Andrea della Porta
2026-11-23 14:57 ` [PATCH v3 24/28] dt-bindings: dma: brcm,bcm2835-dma: Add BCM2712 40-bit DMA Andrea della Porta
2026-11-23 14:57 ` [PATCH v3 25/28] dmaengine: bcm2835: Add BCM2712 40-bit DMA support Andrea della Porta
2026-11-23 14:57 ` [PATCH v3 26/28] arm64: dts: broadcom: bcm2712: Add the 40-bit DMA controller Andrea della Porta
2026-11-23 14:57 ` [PATCH v3 27/28] ARM: dts: broadcom: Set the DMA flags of the HDMI audio channel on BCM283x Andrea della Porta
2026-11-23 14:57 ` [PATCH v3 28/28] arm64: dts: broadcom: bcm2712: Enable HDMI audio Andrea della Porta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).