2019-05-28 19:57:21 +03:00
/* SPDX-License-Identifier: GPL-2.0-only */
2010-03-30 17:33:42 +04:00
# ifndef STE_DMA40_H
# define STE_DMA40_H
2010-12-20 20:31:38 +03:00
/*
* Maxium size for a single dma descriptor
* Size is limited to 16 bits .
* Size is in the units of addr - widths ( 1 , 2 , 4 , 8 bytes )
* Larger transfers will be split up to multiple linked desc
*/
# define STEDMA40_MAX_SEG_SIZE 0xFFFF
2010-03-30 17:33:42 +04:00
/* dev types for memcpy */
# define STEDMA40_DEV_DST_MEMORY (-1)
# define STEDMA40_DEV_SRC_MEMORY (-1)
2010-10-12 17:00:51 +04:00
enum stedma40_mode {
STEDMA40_MODE_LOGICAL = 0 ,
STEDMA40_MODE_PHYSICAL ,
STEDMA40_MODE_OPERATION ,
} ;
2010-03-30 17:33:42 +04:00
2010-10-12 17:00:52 +04:00
enum stedma40_mode_opt {
STEDMA40_PCHAN_BASIC_MODE = 0 ,
STEDMA40_LCHAN_SRC_LOG_DST_LOG = 0 ,
STEDMA40_PCHAN_MODULO_MODE ,
STEDMA40_PCHAN_DOUBLE_DST_MODE ,
STEDMA40_LCHAN_SRC_PHY_DST_LOG ,
STEDMA40_LCHAN_SRC_LOG_DST_PHY ,
} ;
2010-03-30 17:33:42 +04:00
# define STEDMA40_ESIZE_8_BIT 0x0
# define STEDMA40_ESIZE_16_BIT 0x1
# define STEDMA40_ESIZE_32_BIT 0x2
# define STEDMA40_ESIZE_64_BIT 0x3
/* The value 4 indicates that PEN-reg shall be set to 0 */
# define STEDMA40_PSIZE_PHY_1 0x4
# define STEDMA40_PSIZE_PHY_2 0x0
# define STEDMA40_PSIZE_PHY_4 0x1
# define STEDMA40_PSIZE_PHY_8 0x2
# define STEDMA40_PSIZE_PHY_16 0x3
/*
* The number of elements differ in logical and
* physical mode
*/
# define STEDMA40_PSIZE_LOG_1 STEDMA40_PSIZE_PHY_2
# define STEDMA40_PSIZE_LOG_4 STEDMA40_PSIZE_PHY_4
# define STEDMA40_PSIZE_LOG_8 STEDMA40_PSIZE_PHY_8
# define STEDMA40_PSIZE_LOG_16 STEDMA40_PSIZE_PHY_16
2010-08-09 16:08:34 +04:00
/* Maximum number of possible physical channels */
# define STEDMA40_MAX_PHYS 32
2010-03-30 17:33:42 +04:00
enum stedma40_flow_ctrl {
STEDMA40_NO_FLOW_CTRL ,
STEDMA40_FLOW_CTRL ,
} ;
2010-08-09 16:09:21 +04:00
/**
2013-05-15 13:51:33 +04:00
* struct stedma40_half_channel_info - dst / src channel configuration
2010-08-09 16:09:21 +04:00
*
2010-10-12 17:00:54 +04:00
* @ big_endian : true if the src / dst should be read as big endian
2010-08-09 16:09:21 +04:00
* @ data_width : Data width of the src / dst hardware
* @ p_size : Burst size
* @ flow_ctrl : Flow control on / off .
*/
struct stedma40_half_channel_info {
2010-10-12 17:00:54 +04:00
bool big_endian ;
2013-05-15 13:51:57 +04:00
enum dma_slave_buswidth data_width ;
2010-08-09 16:09:21 +04:00
int psize ;
enum stedma40_flow_ctrl flow_ctrl ;
} ;
2010-03-30 17:33:42 +04:00
/**
* struct stedma40_chan_cfg - Structure to be filled by client drivers .
*
* @ dir : MEM 2 MEM , PERIPH 2 MEM , MEM 2 PERIPH , PERIPH 2 PERIPH
2010-10-12 17:00:50 +04:00
* @ high_priority : true if high - priority
2011-01-25 13:18:11 +03:00
* @ realtime : true if realtime mode is to be enabled . Only available on DMA40
* version 3 + , i . e DB8500v2 +
2010-10-12 17:00:51 +04:00
* @ mode : channel mode : physical , logical , or operation
2010-10-12 17:00:52 +04:00
* @ mode_opt : options for the chosen channel mode
2013-05-03 18:31:56 +04:00
* @ dev_type : src / dst device type ( driver uses dir to figure out which )
2010-03-30 17:33:42 +04:00
* @ src_info : Parameters for dst half channel
* @ dst_info : Parameters for dst half channel
2011-11-30 17:50:42 +04:00
* @ use_fixed_channel : if true , use physical channel specified by phy_channel
* @ phy_channel : physical channel to use , only if use_fixed_channel is true
2010-03-30 17:33:42 +04:00
*
* This structure has to be filled by the client drivers .
* It is recommended to do all dma configurations for clients in the machine .
*
*/
struct stedma40_chan_cfg {
2013-05-15 13:51:55 +04:00
enum dma_transfer_direction dir ;
2010-10-12 17:00:50 +04:00
bool high_priority ;
2011-01-25 13:18:11 +03:00
bool realtime ;
2010-10-12 17:00:51 +04:00
enum stedma40_mode mode ;
2010-10-12 17:00:52 +04:00
enum stedma40_mode_opt mode_opt ;
2013-05-03 18:31:56 +04:00
int dev_type ;
2010-03-30 17:33:42 +04:00
struct stedma40_half_channel_info src_info ;
struct stedma40_half_channel_info dst_info ;
2011-11-30 17:50:42 +04:00
bool use_fixed_channel ;
int phy_channel ;
2010-03-30 17:33:42 +04:00
} ;
2023-05-16 15:55:34 +03:00
# endif /* STE_DMA40_H */