diff options
-rw-r--r-- | drivers/dma/xilinx/xilinx_dma.c | 22 | ||||
-rw-r--r-- | include/linux/dma/xilinx_dma.h | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 27b523530c4a..c12442312595 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c | |||
@@ -115,6 +115,9 @@ | |||
115 | #define XILINX_VDMA_REG_START_ADDRESS(n) (0x000c + 4 * (n)) | 115 | #define XILINX_VDMA_REG_START_ADDRESS(n) (0x000c + 4 * (n)) |
116 | #define XILINX_VDMA_REG_START_ADDRESS_64(n) (0x000c + 8 * (n)) | 116 | #define XILINX_VDMA_REG_START_ADDRESS_64(n) (0x000c + 8 * (n)) |
117 | 117 | ||
118 | #define XILINX_VDMA_REG_ENABLE_VERTICAL_FLIP 0x00ec | ||
119 | #define XILINX_VDMA_ENABLE_VERTICAL_FLIP BIT(0) | ||
120 | |||
118 | /* HW specific definitions */ | 121 | /* HW specific definitions */ |
119 | #define XILINX_DMA_MAX_CHANS_PER_DEVICE 0x20 | 122 | #define XILINX_DMA_MAX_CHANS_PER_DEVICE 0x20 |
120 | 123 | ||
@@ -340,6 +343,7 @@ struct xilinx_dma_tx_descriptor { | |||
340 | * @start_transfer: Differentiate b/w DMA IP's transfer | 343 | * @start_transfer: Differentiate b/w DMA IP's transfer |
341 | * @stop_transfer: Differentiate b/w DMA IP's quiesce | 344 | * @stop_transfer: Differentiate b/w DMA IP's quiesce |
342 | * @tdest: TDEST value for mcdma | 345 | * @tdest: TDEST value for mcdma |
346 | * @has_vflip: S2MM vertical flip | ||
343 | */ | 347 | */ |
344 | struct xilinx_dma_chan { | 348 | struct xilinx_dma_chan { |
345 | struct xilinx_dma_device *xdev; | 349 | struct xilinx_dma_device *xdev; |
@@ -376,6 +380,7 @@ struct xilinx_dma_chan { | |||
376 | void (*start_transfer)(struct xilinx_dma_chan *chan); | 380 | void (*start_transfer)(struct xilinx_dma_chan *chan); |
377 | int (*stop_transfer)(struct xilinx_dma_chan *chan); | 381 | int (*stop_transfer)(struct xilinx_dma_chan *chan); |
378 | u16 tdest; | 382 | u16 tdest; |
383 | bool has_vflip; | ||
379 | }; | 384 | }; |
380 | 385 | ||
381 | /** | 386 | /** |
@@ -1092,6 +1097,14 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan) | |||
1092 | desc->async_tx.phys); | 1097 | desc->async_tx.phys); |
1093 | 1098 | ||
1094 | /* Configure the hardware using info in the config structure */ | 1099 | /* 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 | |||
1095 | reg = dma_ctrl_read(chan, XILINX_DMA_REG_DMACR); | 1108 | reg = dma_ctrl_read(chan, XILINX_DMA_REG_DMACR); |
1096 | 1109 | ||
1097 | if (config->frm_cnt_en) | 1110 | if (config->frm_cnt_en) |
@@ -2105,6 +2118,8 @@ int xilinx_vdma_channel_set_config(struct dma_chan *dchan, | |||
2105 | } | 2118 | } |
2106 | 2119 | ||
2107 | chan->config.frm_cnt_en = cfg->frm_cnt_en; | 2120 | chan->config.frm_cnt_en = cfg->frm_cnt_en; |
2121 | chan->config.vflip_en = cfg->vflip_en; | ||
2122 | |||
2108 | if (cfg->park) | 2123 | if (cfg->park) |
2109 | chan->config.park_frm = cfg->park_frm; | 2124 | chan->config.park_frm = cfg->park_frm; |
2110 | else | 2125 | else |
@@ -2428,6 +2443,13 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev, | |||
2428 | chan->direction = DMA_DEV_TO_MEM; | 2443 | chan->direction = DMA_DEV_TO_MEM; |
2429 | chan->id = chan_id; | 2444 | chan->id = chan_id; |
2430 | chan->tdest = chan_id - xdev->nr_channels; | 2445 | 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 | } | ||
2431 | 2453 | ||
2432 | chan->ctrl_offset = XILINX_DMA_S2MM_CTRL_OFFSET; | 2454 | chan->ctrl_offset = XILINX_DMA_S2MM_CTRL_OFFSET; |
2433 | if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { | 2455 | if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { |
diff --git a/include/linux/dma/xilinx_dma.h b/include/linux/dma/xilinx_dma.h index 34b98f276ed0..5b6e61e4b3aa 100644 --- a/include/linux/dma/xilinx_dma.h +++ b/include/linux/dma/xilinx_dma.h | |||
@@ -27,6 +27,7 @@ | |||
27 | * @delay: Delay counter | 27 | * @delay: Delay counter |
28 | * @reset: Reset Channel | 28 | * @reset: Reset Channel |
29 | * @ext_fsync: External Frame Sync source | 29 | * @ext_fsync: External Frame Sync source |
30 | * @vflip_en: Vertical Flip enable | ||
30 | */ | 31 | */ |
31 | struct xilinx_vdma_config { | 32 | struct xilinx_vdma_config { |
32 | int frm_dly; | 33 | int frm_dly; |
@@ -39,6 +40,7 @@ struct xilinx_vdma_config { | |||
39 | int delay; | 40 | int delay; |
40 | int reset; | 41 | int reset; |
41 | int ext_fsync; | 42 | int ext_fsync; |
43 | bool vflip_en; | ||
42 | }; | 44 | }; |
43 | 45 | ||
44 | int xilinx_vdma_channel_set_config(struct dma_chan *dchan, | 46 | int xilinx_vdma_channel_set_config(struct dma_chan *dchan, |