[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240524182702.1317935-11-dave.stevenson@raspberrypi.com>
Date: Fri, 24 May 2024 19:26:54 +0100
From: Dave Stevenson <dave.stevenson@...pberrypi.com>
To: Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Florian Fainelli <florian.fainelli@...adcom.com>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
Ray Jui <rjui@...adcom.com>,
Scott Branden <sbranden@...adcom.com>,
Vinod Koul <vkoul@...nel.org>,
Maxime Ripard <mripard@...nel.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Ulf Hansson <ulf.hansson@...aro.org>,
Mark Brown <broonie@...nel.org>,
Christoph Hellwig <hch@....de>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>,
Liam Girdwood <lgirdwood@...il.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Vladimir Murzin <vladimir.murzin@....com>,
Phil Elwell <phil@...pberrypi.com>,
Stefan Wahren <wahrenst@....net>,
Serge Semin <Sergey.Semin@...kalelectronics.ru>
Cc: devicetree@...r.kernel.org,
linux-rpi-kernel@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
dmaengine@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
linux-mmc@...r.kernel.org,
linux-spi@...r.kernel.org,
iommu@...ts.linux.dev,
linux-sound@...r.kernel.org,
Dave Stevenson <dave.stevenson@...pberrypi.com>
Subject: [PATCH 10/18] dmaengine: bcm2835: Add backwards compatible handling until clients updated
bcm2835-dma has been (incorrectly) expecting dma addresses to be
passed in, not CPU physical addresses.
In order to fix this up, add temporary handling of clients still
passing in dma addresses until they are fixed up.
This will be reverted once all clients have been fixed.
Signed-off-by: Dave Stevenson <dave.stevenson@...pberrypi.com>
---
drivers/dma/bcm2835-dma.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
index ef1d95bae84e..9531c0b82071 100644
--- a/drivers/dma/bcm2835-dma.c
+++ b/drivers/dma/bcm2835-dma.c
@@ -283,9 +283,23 @@ static int bcm2835_dma_map_slave_addr(struct dma_chan *chan,
struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
struct bcm2835_dma_chan_map *map = &c->map;
- map->addr = dev_addr;
+ if ((dev_addr & 0xfe000000ULL) == 0x7e000000ULL) {
+ /*
+ * Address is already in the 0x7e... peripherals range.
+ * Assume this is an old client that hasn't been updated to
+ * correctly pass a cpu phys_addr to the DMA subsystem.
+ */
+ map->addr = dev_addr;
- return 0;
+ return 0;
+ }
+
+ /*
+ * This path will be updated to handle new clients, but currently should
+ * never be used.
+ */
+
+ return -EINVAL;
}
static void bcm2835_dma_free_cb_chain(struct bcm2835_desc *desc)
--
2.34.1
Powered by blists - more mailing lists