Skip to content

Commit 0894aa2

Browse files
radheyxilinxvinodkoul
authored andcommitted
dmaengine: xilinx_dma: Enable VDMA S2MM vertical flip support
Vertical flip state is exported in xilinx_vdma_config and depending on IP configuration(c_enable_vert_flip) vertical flip state is programmed in hardware. Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Kedareswara rao Appana <appanad@xilinx.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 714b839 commit 0894aa2

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

‎drivers/dma/xilinx/xilinx_dma.c‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@
115115
#define XILINX_VDMA_REG_START_ADDRESS(n) (0x000c + 4 * (n))
116116
#define XILINX_VDMA_REG_START_ADDRESS_64(n) (0x000c + 8 * (n))
117117

118+
#define XILINX_VDMA_REG_ENABLE_VERTICAL_FLIP 0x00ec
119+
#define XILINX_VDMA_ENABLE_VERTICAL_FLIP BIT(0)
120+
118121
/* HW specific definitions */
119122
#define XILINX_DMA_MAX_CHANS_PER_DEVICE 0x20
120123

@@ -340,6 +343,7 @@ struct xilinx_dma_tx_descriptor {
340343
* @start_transfer: Differentiate b/w DMA IP's transfer
341344
* @stop_transfer: Differentiate b/w DMA IP's quiesce
342345
* @tdest: TDEST value for mcdma
346+
* @has_vflip: S2MM vertical flip
343347
*/
344348
struct xilinx_dma_chan {
345349
struct xilinx_dma_device *xdev;
@@ -376,6 +380,7 @@ struct xilinx_dma_chan {
376380
void (*start_transfer)(struct xilinx_dma_chan *chan);
377381
int (*stop_transfer)(struct xilinx_dma_chan *chan);
378382
u16 tdest;
383+
bool has_vflip;
379384
};
380385

381386
/**
@@ -1092,6 +1097,14 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan)
10921097
desc->async_tx.phys);
10931098

10941099
/* Configure the hardware using info in the config structure */
1100+
if (chan->has_vflip) {
1101+
reg = dma_read(chan, XILINX_VDMA_REG_ENABLE_VERTICAL_FLIP);
1102+
reg &= ~XILINX_VDMA_ENABLE_VERTICAL_FLIP;
1103+
reg |= config->vflip_en;
1104+
dma_write(chan, XILINX_VDMA_REG_ENABLE_VERTICAL_FLIP,
1105+
reg);
1106+
}
1107+
10951108
reg = dma_ctrl_read(chan, XILINX_DMA_REG_DMACR);
10961109

10971110
if (config->frm_cnt_en)
@@ -2105,6 +2118,8 @@ int xilinx_vdma_channel_set_config(struct dma_chan *dchan,
21052118
}
21062119

21072120
chan->config.frm_cnt_en = cfg->frm_cnt_en;
2121+
chan->config.vflip_en = cfg->vflip_en;
2122+
21082123
if (cfg->park)
21092124
chan->config.park_frm = cfg->park_frm;
21102125
else
@@ -2428,6 +2443,13 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
24282443
chan->direction = DMA_DEV_TO_MEM;
24292444
chan->id = chan_id;
24302445
chan->tdest = chan_id - xdev->nr_channels;
2446+
chan->has_vflip = of_property_read_bool(node,
2447+
"xlnx,enable-vert-flip");
2448+
if (chan->has_vflip) {
2449+
chan->config.vflip_en = dma_read(chan,
2450+
XILINX_VDMA_REG_ENABLE_VERTICAL_FLIP) &
2451+
XILINX_VDMA_ENABLE_VERTICAL_FLIP;
2452+
}
24312453

24322454
chan->ctrl_offset = XILINX_DMA_S2MM_CTRL_OFFSET;
24332455
if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) {

‎include/linux/dma/xilinx_dma.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* @delay: Delay counter
2828
* @reset: Reset Channel
2929
* @ext_fsync: External Frame Sync source
30+
* @vflip_en: Vertical Flip enable
3031
*/
3132
struct xilinx_vdma_config {
3233
int frm_dly;
@@ -39,6 +40,7 @@ struct xilinx_vdma_config {
3940
int delay;
4041
int reset;
4142
int ext_fsync;
43+
bool vflip_en;
4244
};
4345

4446
int xilinx_vdma_channel_set_config(struct dma_chan *dchan,

0 commit comments

Comments
 (0)