162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci// (C) 2017-2018 Synopsys, Inc. (www.synopsys.com) 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci/* 562306a36Sopenharmony_ci * Synopsys DesignWare AXI DMA Controller driver. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Author: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#ifndef _AXI_DMA_PLATFORM_H 1162306a36Sopenharmony_ci#define _AXI_DMA_PLATFORM_H 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#include <linux/bitops.h> 1462306a36Sopenharmony_ci#include <linux/clk.h> 1562306a36Sopenharmony_ci#include <linux/device.h> 1662306a36Sopenharmony_ci#include <linux/dmaengine.h> 1762306a36Sopenharmony_ci#include <linux/types.h> 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci#include "../virt-dma.h" 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci#define DMAC_MAX_CHANNELS 16 2262306a36Sopenharmony_ci#define DMAC_MAX_MASTERS 2 2362306a36Sopenharmony_ci#define DMAC_MAX_BLK_SIZE 0x200000 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_cistruct dw_axi_dma_hcfg { 2662306a36Sopenharmony_ci u32 nr_channels; 2762306a36Sopenharmony_ci u32 nr_masters; 2862306a36Sopenharmony_ci u32 m_data_width; 2962306a36Sopenharmony_ci u32 block_size[DMAC_MAX_CHANNELS]; 3062306a36Sopenharmony_ci u32 priority[DMAC_MAX_CHANNELS]; 3162306a36Sopenharmony_ci /* maximum supported axi burst length */ 3262306a36Sopenharmony_ci u32 axi_rw_burst_len; 3362306a36Sopenharmony_ci /* Register map for DMAX_NUM_CHANNELS <= 8 */ 3462306a36Sopenharmony_ci bool reg_map_8_channels; 3562306a36Sopenharmony_ci bool restrict_axi_burst_len; 3662306a36Sopenharmony_ci bool use_cfg2; 3762306a36Sopenharmony_ci}; 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_cistruct axi_dma_chan { 4062306a36Sopenharmony_ci struct axi_dma_chip *chip; 4162306a36Sopenharmony_ci void __iomem *chan_regs; 4262306a36Sopenharmony_ci u8 id; 4362306a36Sopenharmony_ci u8 hw_handshake_num; 4462306a36Sopenharmony_ci atomic_t descs_allocated; 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci struct dma_pool *desc_pool; 4762306a36Sopenharmony_ci struct virt_dma_chan vc; 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci struct axi_dma_desc *desc; 5062306a36Sopenharmony_ci struct dma_slave_config config; 5162306a36Sopenharmony_ci enum dma_transfer_direction direction; 5262306a36Sopenharmony_ci bool cyclic; 5362306a36Sopenharmony_ci /* these other elements are all protected by vc.lock */ 5462306a36Sopenharmony_ci bool is_paused; 5562306a36Sopenharmony_ci}; 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_cistruct dw_axi_dma { 5862306a36Sopenharmony_ci struct dma_device dma; 5962306a36Sopenharmony_ci struct dw_axi_dma_hcfg *hdata; 6062306a36Sopenharmony_ci struct device_dma_parameters dma_parms; 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci /* channels */ 6362306a36Sopenharmony_ci struct axi_dma_chan *chan; 6462306a36Sopenharmony_ci}; 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_cistruct axi_dma_chip { 6762306a36Sopenharmony_ci struct device *dev; 6862306a36Sopenharmony_ci int irq; 6962306a36Sopenharmony_ci void __iomem *regs; 7062306a36Sopenharmony_ci void __iomem *apb_regs; 7162306a36Sopenharmony_ci struct clk *core_clk; 7262306a36Sopenharmony_ci struct clk *cfgr_clk; 7362306a36Sopenharmony_ci struct dw_axi_dma *dw; 7462306a36Sopenharmony_ci}; 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci/* LLI == Linked List Item */ 7762306a36Sopenharmony_cistruct __packed axi_dma_lli { 7862306a36Sopenharmony_ci __le64 sar; 7962306a36Sopenharmony_ci __le64 dar; 8062306a36Sopenharmony_ci __le32 block_ts_lo; 8162306a36Sopenharmony_ci __le32 block_ts_hi; 8262306a36Sopenharmony_ci __le64 llp; 8362306a36Sopenharmony_ci __le32 ctl_lo; 8462306a36Sopenharmony_ci __le32 ctl_hi; 8562306a36Sopenharmony_ci __le32 sstat; 8662306a36Sopenharmony_ci __le32 dstat; 8762306a36Sopenharmony_ci __le32 status_lo; 8862306a36Sopenharmony_ci __le32 status_hi; 8962306a36Sopenharmony_ci __le32 reserved_lo; 9062306a36Sopenharmony_ci __le32 reserved_hi; 9162306a36Sopenharmony_ci}; 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_cistruct axi_dma_hw_desc { 9462306a36Sopenharmony_ci struct axi_dma_lli *lli; 9562306a36Sopenharmony_ci dma_addr_t llp; 9662306a36Sopenharmony_ci u32 len; 9762306a36Sopenharmony_ci}; 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_cistruct axi_dma_desc { 10062306a36Sopenharmony_ci struct axi_dma_hw_desc *hw_desc; 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci struct virt_dma_desc vd; 10362306a36Sopenharmony_ci struct axi_dma_chan *chan; 10462306a36Sopenharmony_ci u32 completed_blocks; 10562306a36Sopenharmony_ci u32 length; 10662306a36Sopenharmony_ci u32 period_len; 10762306a36Sopenharmony_ci}; 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_cistruct axi_dma_chan_config { 11062306a36Sopenharmony_ci u8 dst_multblk_type; 11162306a36Sopenharmony_ci u8 src_multblk_type; 11262306a36Sopenharmony_ci u8 dst_per; 11362306a36Sopenharmony_ci u8 src_per; 11462306a36Sopenharmony_ci u8 tt_fc; 11562306a36Sopenharmony_ci u8 prior; 11662306a36Sopenharmony_ci u8 hs_sel_dst; 11762306a36Sopenharmony_ci u8 hs_sel_src; 11862306a36Sopenharmony_ci}; 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_cistatic inline struct device *dchan2dev(struct dma_chan *dchan) 12162306a36Sopenharmony_ci{ 12262306a36Sopenharmony_ci return &dchan->dev->device; 12362306a36Sopenharmony_ci} 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_cistatic inline struct device *chan2dev(struct axi_dma_chan *chan) 12662306a36Sopenharmony_ci{ 12762306a36Sopenharmony_ci return &chan->vc.chan.dev->device; 12862306a36Sopenharmony_ci} 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_cistatic inline struct axi_dma_desc *vd_to_axi_desc(struct virt_dma_desc *vd) 13162306a36Sopenharmony_ci{ 13262306a36Sopenharmony_ci return container_of(vd, struct axi_dma_desc, vd); 13362306a36Sopenharmony_ci} 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_cistatic inline struct axi_dma_chan *vc_to_axi_dma_chan(struct virt_dma_chan *vc) 13662306a36Sopenharmony_ci{ 13762306a36Sopenharmony_ci return container_of(vc, struct axi_dma_chan, vc); 13862306a36Sopenharmony_ci} 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_cistatic inline struct axi_dma_chan *dchan_to_axi_dma_chan(struct dma_chan *dchan) 14162306a36Sopenharmony_ci{ 14262306a36Sopenharmony_ci return vc_to_axi_dma_chan(to_virt_chan(dchan)); 14362306a36Sopenharmony_ci} 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci#define COMMON_REG_LEN 0x100 14762306a36Sopenharmony_ci#define CHAN_REG_LEN 0x100 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ci/* Common registers offset */ 15062306a36Sopenharmony_ci#define DMAC_ID 0x000 /* R DMAC ID */ 15162306a36Sopenharmony_ci#define DMAC_COMPVER 0x008 /* R DMAC Component Version */ 15262306a36Sopenharmony_ci#define DMAC_CFG 0x010 /* R/W DMAC Configuration */ 15362306a36Sopenharmony_ci#define DMAC_CHEN 0x018 /* R/W DMAC Channel Enable */ 15462306a36Sopenharmony_ci#define DMAC_CHEN_L 0x018 /* R/W DMAC Channel Enable 00-31 */ 15562306a36Sopenharmony_ci#define DMAC_CHEN_H 0x01C /* R/W DMAC Channel Enable 32-63 */ 15662306a36Sopenharmony_ci#define DMAC_CHSUSPREG 0x020 /* R/W DMAC Channel Suspend */ 15762306a36Sopenharmony_ci#define DMAC_CHABORTREG 0x028 /* R/W DMAC Channel Abort */ 15862306a36Sopenharmony_ci#define DMAC_INTSTATUS 0x030 /* R DMAC Interrupt Status */ 15962306a36Sopenharmony_ci#define DMAC_COMMON_INTCLEAR 0x038 /* W DMAC Interrupt Clear */ 16062306a36Sopenharmony_ci#define DMAC_COMMON_INTSTATUS_ENA 0x040 /* R DMAC Interrupt Status Enable */ 16162306a36Sopenharmony_ci#define DMAC_COMMON_INTSIGNAL_ENA 0x048 /* R/W DMAC Interrupt Signal Enable */ 16262306a36Sopenharmony_ci#define DMAC_COMMON_INTSTATUS 0x050 /* R DMAC Interrupt Status */ 16362306a36Sopenharmony_ci#define DMAC_RESET 0x058 /* R DMAC Reset Register1 */ 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ci/* DMA channel registers offset */ 16662306a36Sopenharmony_ci#define CH_SAR 0x000 /* R/W Chan Source Address */ 16762306a36Sopenharmony_ci#define CH_DAR 0x008 /* R/W Chan Destination Address */ 16862306a36Sopenharmony_ci#define CH_BLOCK_TS 0x010 /* R/W Chan Block Transfer Size */ 16962306a36Sopenharmony_ci#define CH_CTL 0x018 /* R/W Chan Control */ 17062306a36Sopenharmony_ci#define CH_CTL_L 0x018 /* R/W Chan Control 00-31 */ 17162306a36Sopenharmony_ci#define CH_CTL_H 0x01C /* R/W Chan Control 32-63 */ 17262306a36Sopenharmony_ci#define CH_CFG 0x020 /* R/W Chan Configuration */ 17362306a36Sopenharmony_ci#define CH_CFG_L 0x020 /* R/W Chan Configuration 00-31 */ 17462306a36Sopenharmony_ci#define CH_CFG_H 0x024 /* R/W Chan Configuration 32-63 */ 17562306a36Sopenharmony_ci#define CH_LLP 0x028 /* R/W Chan Linked List Pointer */ 17662306a36Sopenharmony_ci#define CH_STATUS 0x030 /* R Chan Status */ 17762306a36Sopenharmony_ci#define CH_SWHSSRC 0x038 /* R/W Chan SW Handshake Source */ 17862306a36Sopenharmony_ci#define CH_SWHSDST 0x040 /* R/W Chan SW Handshake Destination */ 17962306a36Sopenharmony_ci#define CH_BLK_TFR_RESUMEREQ 0x048 /* W Chan Block Transfer Resume Req */ 18062306a36Sopenharmony_ci#define CH_AXI_ID 0x050 /* R/W Chan AXI ID */ 18162306a36Sopenharmony_ci#define CH_AXI_QOS 0x058 /* R/W Chan AXI QOS */ 18262306a36Sopenharmony_ci#define CH_SSTAT 0x060 /* R Chan Source Status */ 18362306a36Sopenharmony_ci#define CH_DSTAT 0x068 /* R Chan Destination Status */ 18462306a36Sopenharmony_ci#define CH_SSTATAR 0x070 /* R/W Chan Source Status Fetch Addr */ 18562306a36Sopenharmony_ci#define CH_DSTATAR 0x078 /* R/W Chan Destination Status Fetch Addr */ 18662306a36Sopenharmony_ci#define CH_INTSTATUS_ENA 0x080 /* R/W Chan Interrupt Status Enable */ 18762306a36Sopenharmony_ci#define CH_INTSTATUS 0x088 /* R/W Chan Interrupt Status */ 18862306a36Sopenharmony_ci#define CH_INTSIGNAL_ENA 0x090 /* R/W Chan Interrupt Signal Enable */ 18962306a36Sopenharmony_ci#define CH_INTCLEAR 0x098 /* W Chan Interrupt Clear */ 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_ci/* These Apb registers are used by Intel KeemBay SoC */ 19262306a36Sopenharmony_ci#define DMAC_APB_CFG 0x000 /* DMAC Apb Configuration Register */ 19362306a36Sopenharmony_ci#define DMAC_APB_STAT 0x004 /* DMAC Apb Status Register */ 19462306a36Sopenharmony_ci#define DMAC_APB_DEBUG_STAT_0 0x008 /* DMAC Apb Debug Status Register 0 */ 19562306a36Sopenharmony_ci#define DMAC_APB_DEBUG_STAT_1 0x00C /* DMAC Apb Debug Status Register 1 */ 19662306a36Sopenharmony_ci#define DMAC_APB_HW_HS_SEL_0 0x010 /* DMAC Apb HW HS register 0 */ 19762306a36Sopenharmony_ci#define DMAC_APB_HW_HS_SEL_1 0x014 /* DMAC Apb HW HS register 1 */ 19862306a36Sopenharmony_ci#define DMAC_APB_LPI 0x018 /* DMAC Apb Low Power Interface Reg */ 19962306a36Sopenharmony_ci#define DMAC_APB_BYTE_WR_CH_EN 0x01C /* DMAC Apb Byte Write Enable */ 20062306a36Sopenharmony_ci#define DMAC_APB_HALFWORD_WR_CH_EN 0x020 /* DMAC Halfword write enables */ 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_ci#define UNUSED_CHANNEL 0x3F /* Set unused DMA channel to 0x3F */ 20362306a36Sopenharmony_ci#define DMA_APB_HS_SEL_BIT_SIZE 0x08 /* HW handshake bits per channel */ 20462306a36Sopenharmony_ci#define DMA_APB_HS_SEL_MASK 0xFF /* HW handshake select masks */ 20562306a36Sopenharmony_ci#define MAX_BLOCK_SIZE 0x1000 /* 1024 blocks * 4 bytes data width */ 20662306a36Sopenharmony_ci#define DMA_REG_MAP_CH_REF 0x08 /* Channel count to choose register map */ 20762306a36Sopenharmony_ci 20862306a36Sopenharmony_ci/* DMAC_CFG */ 20962306a36Sopenharmony_ci#define DMAC_EN_POS 0 21062306a36Sopenharmony_ci#define DMAC_EN_MASK BIT(DMAC_EN_POS) 21162306a36Sopenharmony_ci 21262306a36Sopenharmony_ci#define INT_EN_POS 1 21362306a36Sopenharmony_ci#define INT_EN_MASK BIT(INT_EN_POS) 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_ci/* DMAC_CHEN */ 21662306a36Sopenharmony_ci#define DMAC_CHAN_EN_SHIFT 0 21762306a36Sopenharmony_ci#define DMAC_CHAN_EN_WE_SHIFT 8 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_ci#define DMAC_CHAN_SUSP_SHIFT 16 22062306a36Sopenharmony_ci#define DMAC_CHAN_SUSP_WE_SHIFT 24 22162306a36Sopenharmony_ci 22262306a36Sopenharmony_ci/* DMAC_CHEN2 */ 22362306a36Sopenharmony_ci#define DMAC_CHAN_EN2_WE_SHIFT 16 22462306a36Sopenharmony_ci 22562306a36Sopenharmony_ci/* DMAC_CHSUSP */ 22662306a36Sopenharmony_ci#define DMAC_CHAN_SUSP2_SHIFT 0 22762306a36Sopenharmony_ci#define DMAC_CHAN_SUSP2_WE_SHIFT 16 22862306a36Sopenharmony_ci 22962306a36Sopenharmony_ci/* CH_CTL_H */ 23062306a36Sopenharmony_ci#define CH_CTL_H_ARLEN_EN BIT(6) 23162306a36Sopenharmony_ci#define CH_CTL_H_ARLEN_POS 7 23262306a36Sopenharmony_ci#define CH_CTL_H_AWLEN_EN BIT(15) 23362306a36Sopenharmony_ci#define CH_CTL_H_AWLEN_POS 16 23462306a36Sopenharmony_ci 23562306a36Sopenharmony_cienum { 23662306a36Sopenharmony_ci DWAXIDMAC_ARWLEN_1 = 0, 23762306a36Sopenharmony_ci DWAXIDMAC_ARWLEN_2 = 1, 23862306a36Sopenharmony_ci DWAXIDMAC_ARWLEN_4 = 3, 23962306a36Sopenharmony_ci DWAXIDMAC_ARWLEN_8 = 7, 24062306a36Sopenharmony_ci DWAXIDMAC_ARWLEN_16 = 15, 24162306a36Sopenharmony_ci DWAXIDMAC_ARWLEN_32 = 31, 24262306a36Sopenharmony_ci DWAXIDMAC_ARWLEN_64 = 63, 24362306a36Sopenharmony_ci DWAXIDMAC_ARWLEN_128 = 127, 24462306a36Sopenharmony_ci DWAXIDMAC_ARWLEN_256 = 255, 24562306a36Sopenharmony_ci DWAXIDMAC_ARWLEN_MIN = DWAXIDMAC_ARWLEN_1, 24662306a36Sopenharmony_ci DWAXIDMAC_ARWLEN_MAX = DWAXIDMAC_ARWLEN_256 24762306a36Sopenharmony_ci}; 24862306a36Sopenharmony_ci 24962306a36Sopenharmony_ci#define CH_CTL_H_LLI_LAST BIT(30) 25062306a36Sopenharmony_ci#define CH_CTL_H_LLI_VALID BIT(31) 25162306a36Sopenharmony_ci 25262306a36Sopenharmony_ci/* CH_CTL_L */ 25362306a36Sopenharmony_ci#define CH_CTL_L_LAST_WRITE_EN BIT(30) 25462306a36Sopenharmony_ci 25562306a36Sopenharmony_ci#define CH_CTL_L_DST_MSIZE_POS 18 25662306a36Sopenharmony_ci#define CH_CTL_L_SRC_MSIZE_POS 14 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_cienum { 25962306a36Sopenharmony_ci DWAXIDMAC_BURST_TRANS_LEN_1 = 0, 26062306a36Sopenharmony_ci DWAXIDMAC_BURST_TRANS_LEN_4, 26162306a36Sopenharmony_ci DWAXIDMAC_BURST_TRANS_LEN_8, 26262306a36Sopenharmony_ci DWAXIDMAC_BURST_TRANS_LEN_16, 26362306a36Sopenharmony_ci DWAXIDMAC_BURST_TRANS_LEN_32, 26462306a36Sopenharmony_ci DWAXIDMAC_BURST_TRANS_LEN_64, 26562306a36Sopenharmony_ci DWAXIDMAC_BURST_TRANS_LEN_128, 26662306a36Sopenharmony_ci DWAXIDMAC_BURST_TRANS_LEN_256, 26762306a36Sopenharmony_ci DWAXIDMAC_BURST_TRANS_LEN_512, 26862306a36Sopenharmony_ci DWAXIDMAC_BURST_TRANS_LEN_1024 26962306a36Sopenharmony_ci}; 27062306a36Sopenharmony_ci 27162306a36Sopenharmony_ci#define CH_CTL_L_DST_WIDTH_POS 11 27262306a36Sopenharmony_ci#define CH_CTL_L_SRC_WIDTH_POS 8 27362306a36Sopenharmony_ci 27462306a36Sopenharmony_ci#define CH_CTL_L_DST_INC_POS 6 27562306a36Sopenharmony_ci#define CH_CTL_L_SRC_INC_POS 4 27662306a36Sopenharmony_cienum { 27762306a36Sopenharmony_ci DWAXIDMAC_CH_CTL_L_INC = 0, 27862306a36Sopenharmony_ci DWAXIDMAC_CH_CTL_L_NOINC 27962306a36Sopenharmony_ci}; 28062306a36Sopenharmony_ci 28162306a36Sopenharmony_ci#define CH_CTL_L_DST_MAST BIT(2) 28262306a36Sopenharmony_ci#define CH_CTL_L_SRC_MAST BIT(0) 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ci/* CH_CFG_H */ 28562306a36Sopenharmony_ci#define CH_CFG_H_PRIORITY_POS 17 28662306a36Sopenharmony_ci#define CH_CFG_H_DST_PER_POS 12 28762306a36Sopenharmony_ci#define CH_CFG_H_SRC_PER_POS 7 28862306a36Sopenharmony_ci#define CH_CFG_H_HS_SEL_DST_POS 4 28962306a36Sopenharmony_ci#define CH_CFG_H_HS_SEL_SRC_POS 3 29062306a36Sopenharmony_cienum { 29162306a36Sopenharmony_ci DWAXIDMAC_HS_SEL_HW = 0, 29262306a36Sopenharmony_ci DWAXIDMAC_HS_SEL_SW 29362306a36Sopenharmony_ci}; 29462306a36Sopenharmony_ci 29562306a36Sopenharmony_ci#define CH_CFG_H_TT_FC_POS 0 29662306a36Sopenharmony_cienum { 29762306a36Sopenharmony_ci DWAXIDMAC_TT_FC_MEM_TO_MEM_DMAC = 0, 29862306a36Sopenharmony_ci DWAXIDMAC_TT_FC_MEM_TO_PER_DMAC, 29962306a36Sopenharmony_ci DWAXIDMAC_TT_FC_PER_TO_MEM_DMAC, 30062306a36Sopenharmony_ci DWAXIDMAC_TT_FC_PER_TO_PER_DMAC, 30162306a36Sopenharmony_ci DWAXIDMAC_TT_FC_PER_TO_MEM_SRC, 30262306a36Sopenharmony_ci DWAXIDMAC_TT_FC_PER_TO_PER_SRC, 30362306a36Sopenharmony_ci DWAXIDMAC_TT_FC_MEM_TO_PER_DST, 30462306a36Sopenharmony_ci DWAXIDMAC_TT_FC_PER_TO_PER_DST 30562306a36Sopenharmony_ci}; 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_ci/* CH_CFG_L */ 30862306a36Sopenharmony_ci#define CH_CFG_L_DST_MULTBLK_TYPE_POS 2 30962306a36Sopenharmony_ci#define CH_CFG_L_SRC_MULTBLK_TYPE_POS 0 31062306a36Sopenharmony_cienum { 31162306a36Sopenharmony_ci DWAXIDMAC_MBLK_TYPE_CONTIGUOUS = 0, 31262306a36Sopenharmony_ci DWAXIDMAC_MBLK_TYPE_RELOAD, 31362306a36Sopenharmony_ci DWAXIDMAC_MBLK_TYPE_SHADOW_REG, 31462306a36Sopenharmony_ci DWAXIDMAC_MBLK_TYPE_LL 31562306a36Sopenharmony_ci}; 31662306a36Sopenharmony_ci 31762306a36Sopenharmony_ci/* CH_CFG2 */ 31862306a36Sopenharmony_ci#define CH_CFG2_L_SRC_PER_POS 4 31962306a36Sopenharmony_ci#define CH_CFG2_L_DST_PER_POS 11 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_ci#define CH_CFG2_H_TT_FC_POS 0 32262306a36Sopenharmony_ci#define CH_CFG2_H_HS_SEL_SRC_POS 3 32362306a36Sopenharmony_ci#define CH_CFG2_H_HS_SEL_DST_POS 4 32462306a36Sopenharmony_ci#define CH_CFG2_H_PRIORITY_POS 20 32562306a36Sopenharmony_ci 32662306a36Sopenharmony_ci/** 32762306a36Sopenharmony_ci * DW AXI DMA channel interrupts 32862306a36Sopenharmony_ci * 32962306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_NONE: Bitmask of no one interrupt 33062306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_BLOCK_TRF: Block transfer complete 33162306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_DMA_TRF: Dma transfer complete 33262306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_SRC_TRAN: Source transaction complete 33362306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_DST_TRAN: Destination transaction complete 33462306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_SRC_DEC_ERR: Source decode error 33562306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_DST_DEC_ERR: Destination decode error 33662306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_SRC_SLV_ERR: Source slave error 33762306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_DST_SLV_ERR: Destination slave error 33862306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_LLI_RD_DEC_ERR: LLI read decode error 33962306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_LLI_WR_DEC_ERR: LLI write decode error 34062306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_LLI_RD_SLV_ERR: LLI read slave error 34162306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_LLI_WR_SLV_ERR: LLI write slave error 34262306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_INVALID_ERR: LLI invalid error or Shadow register error 34362306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_MULTIBLKTYPE_ERR: Slave Interface Multiblock type error 34462306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_DEC_ERR: Slave Interface decode error 34562306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_WR2RO_ERR: Slave Interface write to read only error 34662306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_RD2RWO_ERR: Slave Interface read to write only error 34762306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_WRONCHEN_ERR: Slave Interface write to channel error 34862306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_SHADOWREG_ERR: Slave Interface shadow reg error 34962306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_WRONHOLD_ERR: Slave Interface hold error 35062306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_LOCK_CLEARED: Lock Cleared Status 35162306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_SRC_SUSPENDED: Source Suspended Status 35262306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_SUSPENDED: Channel Suspended Status 35362306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_DISABLED: Channel Disabled Status 35462306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_ABORTED: Channel Aborted Status 35562306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_ALL_ERR: Bitmask of all error interrupts 35662306a36Sopenharmony_ci * @DWAXIDMAC_IRQ_ALL: Bitmask of all interrupts 35762306a36Sopenharmony_ci */ 35862306a36Sopenharmony_cienum { 35962306a36Sopenharmony_ci DWAXIDMAC_IRQ_NONE = 0, 36062306a36Sopenharmony_ci DWAXIDMAC_IRQ_BLOCK_TRF = BIT(0), 36162306a36Sopenharmony_ci DWAXIDMAC_IRQ_DMA_TRF = BIT(1), 36262306a36Sopenharmony_ci DWAXIDMAC_IRQ_SRC_TRAN = BIT(3), 36362306a36Sopenharmony_ci DWAXIDMAC_IRQ_DST_TRAN = BIT(4), 36462306a36Sopenharmony_ci DWAXIDMAC_IRQ_SRC_DEC_ERR = BIT(5), 36562306a36Sopenharmony_ci DWAXIDMAC_IRQ_DST_DEC_ERR = BIT(6), 36662306a36Sopenharmony_ci DWAXIDMAC_IRQ_SRC_SLV_ERR = BIT(7), 36762306a36Sopenharmony_ci DWAXIDMAC_IRQ_DST_SLV_ERR = BIT(8), 36862306a36Sopenharmony_ci DWAXIDMAC_IRQ_LLI_RD_DEC_ERR = BIT(9), 36962306a36Sopenharmony_ci DWAXIDMAC_IRQ_LLI_WR_DEC_ERR = BIT(10), 37062306a36Sopenharmony_ci DWAXIDMAC_IRQ_LLI_RD_SLV_ERR = BIT(11), 37162306a36Sopenharmony_ci DWAXIDMAC_IRQ_LLI_WR_SLV_ERR = BIT(12), 37262306a36Sopenharmony_ci DWAXIDMAC_IRQ_INVALID_ERR = BIT(13), 37362306a36Sopenharmony_ci DWAXIDMAC_IRQ_MULTIBLKTYPE_ERR = BIT(14), 37462306a36Sopenharmony_ci DWAXIDMAC_IRQ_DEC_ERR = BIT(16), 37562306a36Sopenharmony_ci DWAXIDMAC_IRQ_WR2RO_ERR = BIT(17), 37662306a36Sopenharmony_ci DWAXIDMAC_IRQ_RD2RWO_ERR = BIT(18), 37762306a36Sopenharmony_ci DWAXIDMAC_IRQ_WRONCHEN_ERR = BIT(19), 37862306a36Sopenharmony_ci DWAXIDMAC_IRQ_SHADOWREG_ERR = BIT(20), 37962306a36Sopenharmony_ci DWAXIDMAC_IRQ_WRONHOLD_ERR = BIT(21), 38062306a36Sopenharmony_ci DWAXIDMAC_IRQ_LOCK_CLEARED = BIT(27), 38162306a36Sopenharmony_ci DWAXIDMAC_IRQ_SRC_SUSPENDED = BIT(28), 38262306a36Sopenharmony_ci DWAXIDMAC_IRQ_SUSPENDED = BIT(29), 38362306a36Sopenharmony_ci DWAXIDMAC_IRQ_DISABLED = BIT(30), 38462306a36Sopenharmony_ci DWAXIDMAC_IRQ_ABORTED = BIT(31), 38562306a36Sopenharmony_ci DWAXIDMAC_IRQ_ALL_ERR = (GENMASK(21, 16) | GENMASK(14, 5)), 38662306a36Sopenharmony_ci DWAXIDMAC_IRQ_ALL = GENMASK(31, 0) 38762306a36Sopenharmony_ci}; 38862306a36Sopenharmony_ci 38962306a36Sopenharmony_cienum { 39062306a36Sopenharmony_ci DWAXIDMAC_TRANS_WIDTH_8 = 0, 39162306a36Sopenharmony_ci DWAXIDMAC_TRANS_WIDTH_16, 39262306a36Sopenharmony_ci DWAXIDMAC_TRANS_WIDTH_32, 39362306a36Sopenharmony_ci DWAXIDMAC_TRANS_WIDTH_64, 39462306a36Sopenharmony_ci DWAXIDMAC_TRANS_WIDTH_128, 39562306a36Sopenharmony_ci DWAXIDMAC_TRANS_WIDTH_256, 39662306a36Sopenharmony_ci DWAXIDMAC_TRANS_WIDTH_512, 39762306a36Sopenharmony_ci DWAXIDMAC_TRANS_WIDTH_MAX = DWAXIDMAC_TRANS_WIDTH_512 39862306a36Sopenharmony_ci}; 39962306a36Sopenharmony_ci 40062306a36Sopenharmony_ci#endif /* _AXI_DMA_PLATFORM_H */ 401