31e050aa55e25f7f05dc370de35df504112e38bb
[oweals/openwrt.git] /
1 From f03f60a51efdf7fbc1f7d2c5b120a7de93ea6d9e Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Tue, 29 Jan 2019 16:13:25 +0000
4 Subject: [PATCH] staging: vchiq_arm: Set up dma ranges on child
5  devices
6
7 The VCHIQ driver now loads the audio, camera, codec, and vc-sm
8 drivers as platform drivers. However they were not being given
9 the correct DMA configuration.
10
11 Call of_dma_configure with the parent (VCHIQ) parameters to be
12 inherited by the child.
13
14 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
15 ---
16  .../vc04_services/interface/vchiq_arm/vchiq_arm.c   | 13 ++++++++++++-
17  1 file changed, 12 insertions(+), 1 deletion(-)
18
19 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
20 +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
21 @@ -3585,6 +3585,7 @@ static struct platform_device *
22  vchiq_register_child(struct platform_device *pdev, const char *name)
23  {
24         struct platform_device_info pdevinfo;
25 +       struct platform_device *new_dev;
26  
27         memset(&pdevinfo, 0, sizeof(pdevinfo));
28  
29 @@ -3593,7 +3594,17 @@ vchiq_register_child(struct platform_dev
30         pdevinfo.id = PLATFORM_DEVID_NONE;
31         pdevinfo.dma_mask = DMA_BIT_MASK(32);
32  
33 -       return platform_device_register_full(&pdevinfo);
34 +       new_dev = platform_device_register_full(&pdevinfo);
35 +       if (!new_dev)
36 +               return NULL;
37 +
38 +       /*
39 +        * We want the dma-ranges etc to be copied from the parent VCHIQ device
40 +        * to be passed on to the children too.
41 +        */
42 +       of_dma_configure(&new_dev->dev, pdev->dev.of_node, true);
43 +
44 +       return new_dev;
45  }
46  
47  static int vchiq_probe(struct platform_device *pdev)