forked from Minki/linux
dmaengine: ti: New driver for K3 UDMA
Split patch for review containing: defines, structs, io and low level functions and interrupt callbacks. DMA driver for Texas Instruments K3 NAVSS Unified DMA – Peripheral Root Complex (UDMA-P) The UDMA-P is intended to perform similar (but significantly upgraded) functions as the packet-oriented DMA used on previous SoC devices. The UDMA-P module supports the transmission and reception of various packet types. The UDMA-P is architected to facilitate the segmentation and reassembly of SoC DMA data structure compliant packets to/from smaller data blocks that are natively compatible with the specific requirements of each connected peripheral. Multiple Tx and Rx channels are provided within the DMA which allow multiple segmentation or reassembly operations to be ongoing. The DMA controller maintains state information for each of the channels which allows packet segmentation and reassembly operations to be time division multiplexed between channels in order to share the underlying DMA hardware. An external DMA scheduler is used to control the ordering and rate at which this multiplexing occurs for Transmit operations. The ordering and rate of Receive operations is indirectly controlled by the order in which blocks are pushed into the DMA on the Rx PSI-L interface. The UDMA-P also supports acting as both a UTC and UDMA-C for its internal channels. Channels in the UDMA-P can be configured to be either Packet-Based or Third-Party channels on a channel by channel basis. The initial driver supports: - MEM_TO_MEM (TR mode) - DEV_TO_MEM (Packet / TR mode) - MEM_TO_DEV (Packet / TR mode) - Cyclic (Packet / TR mode) - Metadata for descriptors Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Keerthy <j-keerthy@ti.com> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com> Link: https://lore.kernel.org/r/20191223110458.30766-11-peter.ujfalusi@ti.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
d3cd299bb1
commit
25dcb5dd7b
@ -34,6 +34,19 @@ config DMA_OMAP
|
||||
Enable support for the TI sDMA (System DMA or DMA4) controller. This
|
||||
DMA engine is found on OMAP and DRA7xx parts.
|
||||
|
||||
config TI_K3_UDMA
|
||||
bool "Texas Instruments UDMA support"
|
||||
depends on ARCH_K3 || COMPILE_TEST
|
||||
depends on TI_SCI_PROTOCOL
|
||||
depends on TI_SCI_INTA_IRQCHIP
|
||||
select DMA_ENGINE
|
||||
select DMA_VIRTUAL_CHANNELS
|
||||
select TI_K3_RINGACC
|
||||
select TI_K3_PSIL
|
||||
help
|
||||
Enable support for the TI UDMA (Unified DMA) controller. This
|
||||
DMA engine is used in AM65x and j721e.
|
||||
|
||||
config TI_K3_PSIL
|
||||
bool
|
||||
|
||||
|
@ -2,5 +2,6 @@
|
||||
obj-$(CONFIG_TI_CPPI41) += cppi41.o
|
||||
obj-$(CONFIG_TI_EDMA) += edma.o
|
||||
obj-$(CONFIG_DMA_OMAP) += omap-dma.o
|
||||
obj-$(CONFIG_TI_K3_UDMA) += k3-udma.o
|
||||
obj-$(CONFIG_TI_K3_PSIL) += k3-psil.o k3-psil-am654.o k3-psil-j721e.o
|
||||
obj-$(CONFIG_TI_DMA_CROSSBAR) += dma-crossbar.o
|
||||
|
3371
drivers/dma/ti/k3-udma.c
Normal file
3371
drivers/dma/ti/k3-udma.c
Normal file
File diff suppressed because it is too large
Load Diff
120
drivers/dma/ti/k3-udma.h
Normal file
120
drivers/dma/ti/k3-udma.h
Normal file
@ -0,0 +1,120 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com
|
||||
*/
|
||||
|
||||
#ifndef K3_UDMA_H_
|
||||
#define K3_UDMA_H_
|
||||
|
||||
#include <linux/soc/ti/ti_sci_protocol.h>
|
||||
|
||||
/* Global registers */
|
||||
#define UDMA_REV_REG 0x0
|
||||
#define UDMA_PERF_CTL_REG 0x4
|
||||
#define UDMA_EMU_CTL_REG 0x8
|
||||
#define UDMA_PSIL_TO_REG 0x10
|
||||
#define UDMA_UTC_CTL_REG 0x1c
|
||||
#define UDMA_CAP_REG(i) (0x20 + ((i) * 4))
|
||||
#define UDMA_RX_FLOW_ID_FW_OES_REG 0x80
|
||||
#define UDMA_RX_FLOW_ID_FW_STATUS_REG 0x88
|
||||
|
||||
/* TX chan RT regs */
|
||||
#define UDMA_TCHAN_RT_CTL_REG 0x0
|
||||
#define UDMA_TCHAN_RT_SWTRIG_REG 0x8
|
||||
#define UDMA_TCHAN_RT_STDATA_REG 0x80
|
||||
|
||||
#define UDMA_TCHAN_RT_PEER_REG(i) (0x200 + ((i) * 0x4))
|
||||
#define UDMA_TCHAN_RT_PEER_STATIC_TR_XY_REG \
|
||||
UDMA_TCHAN_RT_PEER_REG(0) /* PSI-L: 0x400 */
|
||||
#define UDMA_TCHAN_RT_PEER_STATIC_TR_Z_REG \
|
||||
UDMA_TCHAN_RT_PEER_REG(1) /* PSI-L: 0x401 */
|
||||
#define UDMA_TCHAN_RT_PEER_BCNT_REG \
|
||||
UDMA_TCHAN_RT_PEER_REG(4) /* PSI-L: 0x404 */
|
||||
#define UDMA_TCHAN_RT_PEER_RT_EN_REG \
|
||||
UDMA_TCHAN_RT_PEER_REG(8) /* PSI-L: 0x408 */
|
||||
|
||||
#define UDMA_TCHAN_RT_PCNT_REG 0x400
|
||||
#define UDMA_TCHAN_RT_BCNT_REG 0x408
|
||||
#define UDMA_TCHAN_RT_SBCNT_REG 0x410
|
||||
|
||||
/* RX chan RT regs */
|
||||
#define UDMA_RCHAN_RT_CTL_REG 0x0
|
||||
#define UDMA_RCHAN_RT_SWTRIG_REG 0x8
|
||||
#define UDMA_RCHAN_RT_STDATA_REG 0x80
|
||||
|
||||
#define UDMA_RCHAN_RT_PEER_REG(i) (0x200 + ((i) * 0x4))
|
||||
#define UDMA_RCHAN_RT_PEER_STATIC_TR_XY_REG \
|
||||
UDMA_RCHAN_RT_PEER_REG(0) /* PSI-L: 0x400 */
|
||||
#define UDMA_RCHAN_RT_PEER_STATIC_TR_Z_REG \
|
||||
UDMA_RCHAN_RT_PEER_REG(1) /* PSI-L: 0x401 */
|
||||
#define UDMA_RCHAN_RT_PEER_BCNT_REG \
|
||||
UDMA_RCHAN_RT_PEER_REG(4) /* PSI-L: 0x404 */
|
||||
#define UDMA_RCHAN_RT_PEER_RT_EN_REG \
|
||||
UDMA_RCHAN_RT_PEER_REG(8) /* PSI-L: 0x408 */
|
||||
|
||||
#define UDMA_RCHAN_RT_PCNT_REG 0x400
|
||||
#define UDMA_RCHAN_RT_BCNT_REG 0x408
|
||||
#define UDMA_RCHAN_RT_SBCNT_REG 0x410
|
||||
|
||||
/* UDMA_TCHAN_RT_CTL_REG/UDMA_RCHAN_RT_CTL_REG */
|
||||
#define UDMA_CHAN_RT_CTL_EN BIT(31)
|
||||
#define UDMA_CHAN_RT_CTL_TDOWN BIT(30)
|
||||
#define UDMA_CHAN_RT_CTL_PAUSE BIT(29)
|
||||
#define UDMA_CHAN_RT_CTL_FTDOWN BIT(28)
|
||||
#define UDMA_CHAN_RT_CTL_ERROR BIT(0)
|
||||
|
||||
/* UDMA_TCHAN_RT_PEER_RT_EN_REG/UDMA_RCHAN_RT_PEER_RT_EN_REG (PSI-L: 0x408) */
|
||||
#define UDMA_PEER_RT_EN_ENABLE BIT(31)
|
||||
#define UDMA_PEER_RT_EN_TEARDOWN BIT(30)
|
||||
#define UDMA_PEER_RT_EN_PAUSE BIT(29)
|
||||
#define UDMA_PEER_RT_EN_FLUSH BIT(28)
|
||||
#define UDMA_PEER_RT_EN_IDLE BIT(1)
|
||||
|
||||
/*
|
||||
* UDMA_TCHAN_RT_PEER_STATIC_TR_XY_REG /
|
||||
* UDMA_RCHAN_RT_PEER_STATIC_TR_XY_REG
|
||||
*/
|
||||
#define PDMA_STATIC_TR_X_MASK GENMASK(26, 24)
|
||||
#define PDMA_STATIC_TR_X_SHIFT (24)
|
||||
#define PDMA_STATIC_TR_Y_MASK GENMASK(11, 0)
|
||||
#define PDMA_STATIC_TR_Y_SHIFT (0)
|
||||
|
||||
#define PDMA_STATIC_TR_Y(x) \
|
||||
(((x) << PDMA_STATIC_TR_Y_SHIFT) & PDMA_STATIC_TR_Y_MASK)
|
||||
#define PDMA_STATIC_TR_X(x) \
|
||||
(((x) << PDMA_STATIC_TR_X_SHIFT) & PDMA_STATIC_TR_X_MASK)
|
||||
|
||||
#define PDMA_STATIC_TR_XY_ACC32 BIT(30)
|
||||
#define PDMA_STATIC_TR_XY_BURST BIT(31)
|
||||
|
||||
/*
|
||||
* UDMA_TCHAN_RT_PEER_STATIC_TR_Z_REG /
|
||||
* UDMA_RCHAN_RT_PEER_STATIC_TR_Z_REG
|
||||
*/
|
||||
#define PDMA_STATIC_TR_Z(x, mask) ((x) & (mask))
|
||||
|
||||
struct udma_dev;
|
||||
struct udma_tchan;
|
||||
struct udma_rchan;
|
||||
struct udma_rflow;
|
||||
|
||||
enum udma_rm_range {
|
||||
RM_RANGE_TCHAN = 0,
|
||||
RM_RANGE_RCHAN,
|
||||
RM_RANGE_RFLOW,
|
||||
RM_RANGE_LAST,
|
||||
};
|
||||
|
||||
struct udma_tisci_rm {
|
||||
const struct ti_sci_handle *tisci;
|
||||
const struct ti_sci_rm_udmap_ops *tisci_udmap_ops;
|
||||
u32 tisci_dev_id;
|
||||
|
||||
/* tisci information for PSI-L thread pairing/unpairing */
|
||||
const struct ti_sci_rm_psil_ops *tisci_psil_ops;
|
||||
u32 tisci_navss_dev_id;
|
||||
|
||||
struct ti_sci_resource *rm_ranges[RM_RANGE_LAST];
|
||||
};
|
||||
|
||||
#endif /* K3_UDMA_H_ */
|
Loading…
Reference in New Issue
Block a user