[PATCH RFC 100/111] staging: etnaviv: use more natural devicetree abstraction
Lucas Stach
l.stach at pengutronix.de
Thu Apr 2 08:30:42 PDT 2015
The GPU cores are possibly scattered in the SoC address space, so the
current abstraction of having a parent node for the master device and
the cores as child nodes doesn't fit too well.
Instead take the same approach as with imx-drm to have a logical master
node that refers to the other components by a phandle, so those can be
placed under their real parent buses in the DT.
Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
---
drivers/staging/etnaviv/etnaviv_drv.c | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/etnaviv/etnaviv_drv.c b/drivers/staging/etnaviv/etnaviv_drv.c
index 25c64319ab34..eade6010ce42 100644
--- a/drivers/staging/etnaviv/etnaviv_drv.c
+++ b/drivers/staging/etnaviv/etnaviv_drv.c
@@ -563,14 +563,6 @@ static struct drm_driver etnaviv_drm_driver = {
/*
* Platform driver:
*/
-
-static int etnaviv_compare(struct device *dev, void *data)
-{
- struct device_node *np = data;
-
- return dev->of_node == np;
-}
-
static int etnaviv_bind(struct device *dev)
{
return drm_platform_init(&etnaviv_drm_driver, to_platform_device(dev));
@@ -586,6 +578,13 @@ static const struct component_master_ops etnaviv_master_ops = {
.unbind = etnaviv_unbind,
};
+static int compare_of(struct device *dev, void *data)
+{
+ struct device_node *np = data;
+
+ return dev->of_node == np;
+}
+
static int compare_str(struct device *dev, void *data)
{
return !strcmp(dev_name(dev), data);
@@ -600,15 +599,17 @@ static int etnaviv_pdev_probe(struct platform_device *pdev)
dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
if (node) {
- struct device_node *child_np;
-
- of_platform_populate(node, NULL, NULL, dev);
+ struct device_node *core_node;
+ int i;
- for_each_available_child_of_node(node, child_np) {
- DRM_INFO("add child %s\n", child_np->name);
+ for (i = 0; ; i++) {
+ core_node = of_parse_phandle(node, "cores", i);
+ if (!core_node)
+ break;
- component_match_add(dev, &match, etnaviv_compare,
- child_np);
+ component_match_add(&pdev->dev, &match, compare_of,
+ core_node);
+ of_node_put(core_node);
}
} else if (dev->platform_data) {
char **names = dev->platform_data;
@@ -629,7 +630,7 @@ static int etnaviv_pdev_remove(struct platform_device *pdev)
}
static const struct of_device_id dt_match[] = {
- { .compatible = "vivante,gccore" },
+ { .compatible = "fsl,imx-gpu-subsystem" },
{}
};
MODULE_DEVICE_TABLE(of, dt_match);
--
2.1.4
More information about the dri-devel
mailing list