5a1578d92f04ebc04e973802b611f3f6acf28eb1
[openwrt/staging/wigyori.git] /
1 From 01f43125781d5558b82f87fbb2f9a6745e3942a6 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 661/773] 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 }