|
18 | 18 | #include <linux/module.h>
|
19 | 19 | #include <linux/of.h>
|
20 | 20 | #include <linux/of_dma.h>
|
| 21 | +#include <linux/of_address.h> |
21 | 22 | #include <linux/platform_device.h>
|
22 | 23 | #include <linux/regmap.h>
|
23 | 24 | #include <linux/slab.h>
|
|
55 | 56 | #define AXI_DMAC_DMA_DST_TYPE_GET(x) FIELD_GET(AXI_DMAC_DMA_DST_TYPE_MSK, x)
|
56 | 57 | #define AXI_DMAC_DMA_DST_WIDTH_MSK GENMASK(3, 0)
|
57 | 58 | #define AXI_DMAC_DMA_DST_WIDTH_GET(x) FIELD_GET(AXI_DMAC_DMA_DST_WIDTH_MSK, x)
|
| 59 | +#define AXI_DMAC_REG_COHERENCY_DESC 0x14 |
| 60 | +#define AXI_DMAC_DST_COHERENT_MSK BIT(0) |
| 61 | +#define AXI_DMAC_DST_COHERENT_GET(x) FIELD_GET(AXI_DMAC_DST_COHERENT_MSK, x) |
58 | 62 |
|
59 | 63 | #define AXI_DMAC_REG_IRQ_MASK 0x80
|
60 | 64 | #define AXI_DMAC_REG_IRQ_PENDING 0x84
|
@@ -979,6 +983,18 @@ static int axi_dmac_probe(struct platform_device *pdev)
|
979 | 983 |
|
980 | 984 | axi_dmac_write(dmac, AXI_DMAC_REG_IRQ_MASK, 0x00);
|
981 | 985 |
|
| 986 | + if (of_dma_is_coherent(pdev->dev.of_node)) { |
| 987 | + ret = axi_dmac_read(dmac, AXI_DMAC_REG_COHERENCY_DESC); |
| 988 | + |
| 989 | + if (version < ADI_AXI_PCORE_VER(4, 4, 'a') || |
| 990 | + !AXI_DMAC_DST_COHERENT_GET(ret)) { |
| 991 | + dev_err(dmac->dma_dev.dev, |
| 992 | + "Coherent DMA not supported in hardware"); |
| 993 | + ret = -EINVAL; |
| 994 | + goto err_clk_disable; |
| 995 | + } |
| 996 | + } |
| 997 | + |
982 | 998 | ret = dma_async_device_register(dma_dev);
|
983 | 999 | if (ret)
|
984 | 1000 | goto err_clk_disable;
|
|
0 commit comments