summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNikita Shubin <nikita.shubin@maquefel.me>2024-09-09 10:11:03 +0200
committerArnd Bergmann <arnd@arndb.de>2024-09-12 16:33:12 +0200
commita015b1828653b591de0aa5303c0dbc4235935f94 (patch)
tree47a9502cd9afe738321de0665fc3b9b5399cf2a9 /drivers
parentASoC: cirrus: edb93xx: Delete driver (diff)
downloadlinux-a015b1828653b591de0aa5303c0dbc4235935f94.tar.xz
linux-a015b1828653b591de0aa5303c0dbc4235935f94.zip
dmaengine: cirrus: remove platform code
Remove DMA platform header, from now on we use device tree for DMA clients. Acked-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me> Tested-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dma/ep93xx_dma.c48
1 files changed, 46 insertions, 2 deletions
diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c
index 17c8e2badee2..43c4241af7f5 100644
--- a/drivers/dma/ep93xx_dma.c
+++ b/drivers/dma/ep93xx_dma.c
@@ -17,6 +17,7 @@
#include <linux/clk.h>
#include <linux/init.h>
#include <linux/interrupt.h>
+#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
@@ -25,8 +26,6 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
-#include <linux/platform_data/dma-ep93xx.h>
-
#include "dmaengine.h"
/* M2P registers */
@@ -106,6 +105,26 @@
#define DMA_MAX_CHAN_BYTES 0xffff
#define DMA_MAX_CHAN_DESCRIPTORS 32
+/*
+ * M2P channels.
+ *
+ * Note that these values are also directly used for setting the PPALLOC
+ * register.
+ */
+#define EP93XX_DMA_I2S1 0
+#define EP93XX_DMA_I2S2 1
+#define EP93XX_DMA_AAC1 2
+#define EP93XX_DMA_AAC2 3
+#define EP93XX_DMA_AAC3 4
+#define EP93XX_DMA_I2S3 5
+#define EP93XX_DMA_UART1 6
+#define EP93XX_DMA_UART2 7
+#define EP93XX_DMA_UART3 8
+#define EP93XX_DMA_IRDA 9
+/* M2M channels */
+#define EP93XX_DMA_SSP 10
+#define EP93XX_DMA_IDE 11
+
enum ep93xx_dma_type {
M2P_DMA,
M2M_DMA,
@@ -242,6 +261,31 @@ static struct ep93xx_dma_chan *to_ep93xx_dma_chan(struct dma_chan *chan)
return container_of(chan, struct ep93xx_dma_chan, chan);
}
+static inline bool ep93xx_dma_chan_is_m2p(struct dma_chan *chan)
+{
+ if (device_is_compatible(chan->device->dev, "cirrus,ep9301-dma-m2p"))
+ return true;
+
+ return !strcmp(dev_name(chan->device->dev), "ep93xx-dma-m2p");
+}
+
+/*
+ * ep93xx_dma_chan_direction - returns direction the channel can be used
+ *
+ * This function can be used in filter functions to find out whether the
+ * channel supports given DMA direction. Only M2P channels have such
+ * limitation, for M2M channels the direction is configurable.
+ */
+static inline enum dma_transfer_direction
+ep93xx_dma_chan_direction(struct dma_chan *chan)
+{
+ if (!ep93xx_dma_chan_is_m2p(chan))
+ return DMA_TRANS_NONE;
+
+ /* even channels are for TX, odd for RX */
+ return (chan->chan_id % 2 == 0) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+}
+
/**
* ep93xx_dma_set_active - set new active descriptor chain
* @edmac: channel