2c9449df0fe73ca951e951db09dfbf275c05d842
[openwrt/staging/robimarko.git] /
1 From 13c11f40ded81f258178936e9fa22788e59b82cf Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 19 May 2020 14:54:28 +0100
4 Subject: [PATCH] drm/vc4: Adopt the dma configuration from the HVS or
5 V3D component
6
7 vc4_drv isn't necessarily under the /soc node in DT as it is a
8 virtual device, but it is the one that does the allocations.
9 The DMA addresses are consumed by primarily the HVS or V3D, and
10 those require VideoCore cache alias address mapping, and so will be
11 under /soc.
12
13 During probe find the a suitable device node for HVS or V3D,
14 and adopt the DMA configuration of that node.
15
16 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
17 ---
18 drivers/gpu/drm/vc4/vc4_drv.c | 18 ++++++++++++++++++
19 1 file changed, 18 insertions(+)
20
21 --- a/drivers/gpu/drm/vc4/vc4_drv.c
22 +++ b/drivers/gpu/drm/vc4/vc4_drv.c
23 @@ -249,6 +249,14 @@ static void vc4_match_add_drivers(struct
24 }
25 }
26
27 +const struct of_device_id vc4_dma_range_matches[] = {
28 + { .compatible = "brcm,bcm2835-hvs" },
29 + { .compatible = "brcm,bcm2835-v3d" },
30 + { .compatible = "brcm,cygnus-v3d" },
31 + { .compatible = "brcm,vc4-v3d" },
32 + {}
33 +};
34 +
35 static int vc4_drm_bind(struct device *dev)
36 {
37 struct platform_device *pdev = to_platform_device(dev);
38 @@ -269,6 +277,16 @@ static int vc4_drm_bind(struct device *d
39 vc4_drm_driver.driver_features &= ~DRIVER_RENDER;
40 of_node_put(node);
41
42 + node = of_find_matching_node_and_match(NULL, vc4_dma_range_matches,
43 + NULL);
44 + if (node) {
45 + ret = of_dma_configure(dev, node, true);
46 + of_node_put(node);
47 +
48 + if (ret)
49 + return ret;
50 + }
51 +
52 drm = drm_dev_alloc(&vc4_drm_driver, dev);
53 if (IS_ERR(drm))
54 return PTR_ERR(drm);