Skip to contentSkip to conversation

dmaengine: ti: k3-udma: Add glue layer for non DMAengine users

RFC New Peter Ujfalusi 1 participant 1 message Sep 24, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 5/5 dmaengine: ti: k3-udma: Add glue layer for non DMAengine users

From: Grygorii Strashko <[email protected]>

Certain users can not use right now the DMAengine API due to missing features in the core. Prime example is Networking.

These users can use the glue layer interface to avoid misuse of DMAengine API and when the core gains the needed features they can be converted to use generic API.

---
 drivers/dma/ti/Kconfig            |    9 +
 drivers/dma/ti/Makefile           |    1 +
 drivers/dma/ti/k3-navss-udma.c    | 1133 +++++++++++++++++++++++++++++
 drivers/dma/ti/k3-udma-private.c  |  123 ++++
 drivers/dma/ti/k3-udma.c          |    3 +
 drivers/dma/ti/k3-udma.h          |   30 +
 include/linux/dma/k3-navss-udma.h |  152 ++++
 7 files changed, 1451 insertions(+)
 create mode 100644 drivers/dma/ti/k3-navss-udma.c
 create mode 100644 drivers/dma/ti/k3-udma-private.c
 create mode 100644 include/linux/dma/k3-navss-udma.h
drivers/dma/ti/Kconfig +9 -0
index db73371de206..23df9e0a1597 100644
@@ -45,5 +45,14 @@ config TI_K3_NAVSS_UDMA
 	  Enable support for the TI UDMA (Unified DMA) controller. This
 	  DMA engine is used in AM65x.
 
+config TI_K3_NAVSS_UDMA_GLUE_LAYER
+	tristate "Texas Instruments UDMA Glue layer for non DMAengine users"
+	depends on ARCH_K3 || COMPILE_TEST
+	depends on TI_K3_NAVSS_UDMA
+	default y
+	help
+	  Say y here to support the K3 NAVSS DMA glue interface
+	  If unsure, say N.
+
 config TI_DMA_CROSSBAR
 	bool
drivers/dma/ti/Makefile +1 -0
index 911f7c723979..c2533360c0de 100644
@@ -3,4 +3,5 @@ obj-$(CONFIG_TI_CPPI41) += cppi41.o
 obj-$(CONFIG_TI_EDMA) += edma.o
 obj-$(CONFIG_DMA_OMAP) += omap-dma.o
 obj-$(CONFIG_TI_K3_NAVSS_UDMA) += k3-udma.o
+obj-$(CONFIG_TI_K3_NAVSS_UDMA_GLUE_LAYER) += k3-navss-udma.o
 obj-$(CONFIG_TI_DMA_CROSSBAR) += dma-crossbar.o
drivers/dma/ti/k3-navss-udma.c new file +1133 -0

1,133 lines not on this page · raw message

drivers/dma/ti/k3-udma-private.c new file +123 -0

123 lines not on this page · raw message

drivers/dma/ti/k3-udma.c +3 -0
index 2a2a2c8b1fc2..49d4c49b8139 100644
@@ -3617,6 +3617,9 @@ static struct platform_driver udma_driver = {
 
 module_platform_driver(udma_driver);
 
+/* Private interfaces to UDMA */
+#include "k3-udma-private.c"
+
 MODULE_ALIAS("platform:ti-udma");
 MODULE_DESCRIPTION("TI K3 DMA driver for CPPI 5.0 compliant devices");
 MODULE_AUTHOR("Peter Ujfalusi <[email protected]>");
drivers/dma/ti/k3-udma.h +30 -0
index 787b9feefe5d..2720d73ff3d3 100644
@@ -129,4 +129,34 @@ struct udma_tisci_rm {
 	struct ti_sci_resource *rm_ranges[RM_RANGE_LAST];
 };
 
+/* Direct access to UDMA resources */
+int xudma_navss_psil_pair(struct udma_dev *ud, u32 src_thread,u32 dst_thread);
+int xudma_navss_psil_unpair(struct udma_dev *ud, u32 src_thread,
+			    u32 dst_thread);
+
+struct udma_dev *of_xudma_dev_get(struct device_node *np, const char *property);
+void xudma_dev_put(struct udma_dev *ud);
+u32 xudma_dev_get_psil_base(struct udma_dev *ud);
+struct udma_tisci_rm *xudma_dev_get_tisci_rm(struct udma_dev *ud);
+
+int xudma_reserve_rflow_range(struct udma_dev *ud, int from, int cnt);
+int xudma_free_rflow_range(struct udma_dev *ud, int from, int cnt);
+
+struct udma_tchan *xudma_tchan_get(struct udma_dev *ud, int id);
+struct udma_rchan *xudma_rchan_get(struct udma_dev *ud, int id);
+struct udma_rflow *xudma_rflow_get(struct udma_dev *ud, int id);
+
+void xudma_tchan_put(struct udma_dev *ud, struct udma_tchan *p);
+void xudma_rchan_put(struct udma_dev *ud, struct udma_rchan *p);
+void xudma_rflow_put(struct udma_dev *ud, struct udma_rflow *p);
+
+int xudma_tchan_get_id(struct udma_tchan *p);
+int xudma_rchan_get_id(struct udma_rchan *p);
+int xudma_rflow_get_id(struct udma_rflow *p);
+
+u32 xudma_tchanrt_read(struct udma_tchan *tchan, int reg);
+void xudma_tchanrt_write(struct udma_tchan *tchan, int reg, u32 val);
+u32 xudma_rchanrt_read(struct udma_rchan *rchan, int reg);
+void xudma_rchanrt_write(struct udma_rchan *rchan, int reg, u32 val);
+
 #endif /* K3_UDMA_H_ */
include/linux/dma/k3-navss-udma.h new file +152 -0

152 lines not on this page · raw message