85d1174a60e553bf16ae70be8937df76bf83505f
[openwrt/openwrt.git] /
1 From 3908c56fdb9e7d6716f91edef21a9dfe0f8cd512 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 0191/1085] 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 @@ -1776,6 +1776,7 @@ vchiq_register_child(struct platform_dev
21 {
22 struct platform_device_info pdevinfo;
23 struct platform_device *child;
24 + struct device_node *np;
25
26 memset(&pdevinfo, 0, sizeof(pdevinfo));
27
28 @@ -1791,10 +1792,20 @@ vchiq_register_child(struct platform_dev
29 }
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(&child->dev, np, true);
46 +
47 + if (np != pdev->dev.of_node)
48 + of_node_put(np);
49
50 return child;
51 }