|
11 | 11 | #define __CAVS_LIB_DW_DMA_H__ |
12 | 12 |
|
13 | 13 | #include <sof/bit.h> |
| 14 | +#include <sof/lib/dma.h> |
| 15 | +#include <sof/lib/shim.h> |
14 | 16 | #include <config.h> |
| 17 | +#include <stdint.h> |
15 | 18 |
|
16 | 19 | /* number of supported DW-DMACs */ |
17 | 20 | #if CONFIG_SUECREEK |
|
51 | 54 | #define DW_CFG_LOW_DEF 0x3 |
52 | 55 | #define DW_CFG_HIGH_DEF 0x0 |
53 | 56 |
|
| 57 | +/* LLPC address */ |
| 58 | +#define DW_CHLLPC(dma, chan) \ |
| 59 | + SHIM_GPDMA_CHLLPC((dma)->plat_data.id, (chan)->index) |
| 60 | + |
54 | 61 | #define platform_dw_dma_set_class(chan, lli, class) \ |
55 | 62 | (lli->ctrl_hi |= DW_CTLH_CLASS(class)) |
56 | 63 |
|
57 | 64 | #define platform_dw_dma_set_transfer_size(chan, lli, size) \ |
58 | 65 | (lli->ctrl_hi |= (size & DW_CTLH_BLOCK_TS_MASK)) |
59 | 66 |
|
| 67 | +static inline void platform_dw_dma_llp_config(struct dma *dma, |
| 68 | + struct dma_chan_data *chan, |
| 69 | + uint32_t config) |
| 70 | +{ |
| 71 | + shim_write(DW_CHLLPC(dma, chan), SHIM_GPDMA_CHLLPC_DHRS(config)); |
| 72 | +} |
| 73 | + |
| 74 | +static inline void platform_dw_dma_llp_enable(struct dma *dma, |
| 75 | + struct dma_chan_data *chan) |
| 76 | +{ |
| 77 | + shim_write(DW_CHLLPC(dma, chan), |
| 78 | + shim_read(DW_CHLLPC(dma, chan)) | SHIM_GPDMA_CHLLPC_EN); |
| 79 | +} |
| 80 | + |
| 81 | +static inline void platform_dw_dma_llp_disable(struct dma *dma, |
| 82 | + struct dma_chan_data *chan) |
| 83 | +{ |
| 84 | + shim_write(DW_CHLLPC(dma, chan), |
| 85 | + shim_read(DW_CHLLPC(dma, chan)) & ~SHIM_GPDMA_CHLLPC_EN); |
| 86 | +} |
| 87 | + |
60 | 88 | #endif /* __CAVS_LIB_DW_DMA_H__ */ |
61 | 89 |
|
62 | 90 | #else |
|
0 commit comments