fd9e1f7aa7d2be27cae29e6d2ed5983cbcd31643
[openwrt/staging/ynezz.git] /
1 From de87121af8502dd27082ff963aa2bf9fdfc9c60b Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Tue, 18 Jun 2019 12:15:50 +0100
4 Subject: [PATCH 660/782] staging: vchiq: Use the old dma controller for OF
5 config on platform devices
6
7 vchiq on Pi4 is no longer under the soc node, therefore it
8 doesn't get the dma-ranges for the VPU.
9
10 Switch to using the configuration of the old dma controller as
11 that will set the dma-ranges correctly.
12
13 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
14 ---
15 .../interface/vchiq_arm/vchiq_arm.c | 17 ++++++++++++++---
16 1 file changed, 14 insertions(+), 3 deletions(-)
17
18 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
19 +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
20 @@ -3599,6 +3599,7 @@ vchiq_register_child(struct platform_dev
21 {
22 struct platform_device_info pdevinfo;
23 struct platform_device *new_dev;
24 + struct device_node *np;
25
26 memset(&pdevinfo, 0, sizeof(pdevinfo));
27
28 @@ -3612,10 +3613,20 @@ vchiq_register_child(struct platform_dev
29 return NULL;
30
31 /*
32 - * We want the dma-ranges etc to be copied from the parent VCHIQ device
33 - * to be passed on to the children too.
34 + * We want the dma-ranges etc to be copied from a device with the
35 + * correct dma-ranges for the VPU.
36 + * VCHIQ on Pi4 is now under scb which doesn't get those dma-ranges.
37 + * Take the "dma" node as going to be suitable as it sees the world
38 + * through the same eyes as the VPU.
39 */
40 - of_dma_configure(&new_dev->dev, pdev->dev.of_node, true);
41 + np = of_find_node_by_path("dma");
42 + if (!np)
43 + np = pdev->dev.of_node;
44 +
45 + of_dma_configure(&new_dev->dev, np, true);
46 +
47 + if (np != pdev->dev.of_node)
48 + of_node_put(np);
49
50 return new_dev;
51 }