Skip to contentSkip to conversation

drivers: bus: simple-pm-bus: Fix compability with simple-bus for auxdata

PATCH Superseded Tony Lindgren 2 participants 3 messages Jan 15, 2021 – Jan 18, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

PATCH 1/1 drivers: bus: simple-pm-bus: Fix compability with simple-bus for auxdata

After converting am335x to probe devices with simple-pm-bus I noticed that we are not passing auxdata for of_platform_populate() like we do with simple-bus.

While device tree using SoCs should no longer need platform data, there are still quite a few drivers that still need it.

Let's fix the issue by passing auxdata as platform data to simple-pm-bus. That way the SoCs needing this can pass the auxdata with OF_DEV_AUXDATA. And let's pass the auxdata for omaps to fix the issue for am335x.

Later on we may want to consider handling simple-pm-bus directly in drivers/of/platform.c as then we no longer need the platform data for simple-pm-bus.

Fixes 5a230524f879 ("ARM: dts: Use simple-pm-bus for genpd for am3 l4_wkup")
---
 arch/arm/mach-omap2/pdata-quirks.c | 1 +
 drivers/bus/simple-pm-bus.c        | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-omap2/pdata-quirks.c +1 -0
@@ -532,6 +532,7 @@ static struct of_dev_auxdata omap_auxdata_lookup[] = {
 		       &dra7_ipu1_dsp_iommu_pdata),
 #endif
 	/* Common auxdata */
+	OF_DEV_AUXDATA("simple-pm-bus", 0, NULL, omap_auxdata_lookup),
 	OF_DEV_AUXDATA("ti,sysc", 0, NULL, &ti_sysc_pdata),
 	OF_DEV_AUXDATA("pinctrl-single", 0, NULL, &pcs_pdata),
 	OF_DEV_AUXDATA("ti,omap-prm-inst", 0, NULL, &ti_prm_pdata),
drivers/bus/simple-pm-bus.c +2 -1
@@ -16,6 +16,7 @@
 
 static int simple_pm_bus_probe(struct platform_device *pdev)
 {
+	const struct of_dev_auxdata *lookup = dev_get_platdata(&pdev->dev);
 	struct device_node *np = pdev->dev.of_node;
 
 	dev_dbg(&pdev->dev, "%s\n", __func__);
@@ -23,7 +24,7 @@ static int simple_pm_bus_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);
 
 	if (np)
-		of_platform_populate(np, NULL, NULL, &pdev->dev);
+		of_platform_populate(np, NULL, lookup, &pdev->dev);
 
 	return 0;
 }
Signature · 1 line
2.30.0
#1 lore raw

CC DT

Quoted 54 lines · Tony Lindgren

After converting am335x to probe devices with simple-pm-bus I noticed that we are not passing auxdata for of_platform_populate() like we do with simple-bus.

While device tree using SoCs should no longer need platform data, there are still quite a few drivers that still need it.

Let's fix the issue by passing auxdata as platform data to simple-pm-bus. That way the SoCs needing this can pass the auxdata with OF_DEV_AUXDATA. And let's pass the auxdata for omaps to fix the issue for am335x.

Later on we may want to consider handling simple-pm-bus directly in drivers/of/platform.c as then we no longer need the platform data for simple-pm-bus.

Fixes 5a230524f879 ("ARM: dts: Use simple-pm-bus for genpd for am3 l4_wkup")
---
 arch/arm/mach-omap2/pdata-quirks.c | 1 +
 drivers/bus/simple-pm-bus.c        | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-omap2/pdata-quirks.c +1 -0
@@ -532,6 +532,7 @@ static struct of_dev_auxdata omap_auxdata_lookup[] = {
                       &dra7_ipu1_dsp_iommu_pdata),
 #endif
        /* Common auxdata */
+       OF_DEV_AUXDATA("simple-pm-bus", 0, NULL, omap_auxdata_lookup),
        OF_DEV_AUXDATA("ti,sysc", 0, NULL, &ti_sysc_pdata),
        OF_DEV_AUXDATA("pinctrl-single", 0, NULL, &pcs_pdata),
        OF_DEV_AUXDATA("ti,omap-prm-inst", 0, NULL, &ti_prm_pdata),
drivers/bus/simple-pm-bus.c +2 -2
@@ -16,6 +16,7 @@
 
 static int simple_pm_bus_probe(struct platform_device *pdev)
 {
+       const struct of_dev_auxdata *lookup = dev_get_platdata(&pdev->dev);
        struct device_node *np = pdev->dev.of_node;
 
        dev_dbg(&pdev->dev, "%s\n", __func__);
@@ -23,7 +24,7 @@ static int simple_pm_bus_probe(struct platform_device *pdev)
        pm_runtime_enable(&pdev->dev);
 
        if (np)
-               of_platform_populate(np, NULL, NULL, &pdev->dev);
+               of_platform_populate(np, NULL, lookup, &pdev->dev);
 
        return 0;
 }
--
Quoted 1 line

2.30.0

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author maintainer
#2 lore raw
Quoted 6 lines · Geert Uytterhoeven

CC DT

Quoted 3 lines · Tony Lindgren

Later on we may want to consider handling simple-pm-bus directly in drivers/of/platform.c as then we no longer need the platform data for simple-pm-bus.

As we still need a device driver for simple-pm-bus this is not a good option. I sent out v2 with updated description.

Regards,

Tony