bus: ti-sysc: Check for old incomplete dtb
authorTony Lindgren <tony@atomide.com>
Mon, 8 Mar 2021 09:35:09 +0000 (11:35 +0200)
committerTony Lindgren <tony@atomide.com>
Wed, 10 Mar 2021 11:59:17 +0000 (13:59 +0200)
Let's be nice and show an error on the SoCs about old imcomplete devicetree
if the dtb is still using "simple-bus" instead of "simple-pm-bus" for the
root OCP node.

Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/bus/ti-sysc.c

index b715e59013734e6476e5b049a4494bfa3bef717f..65943d1a25577c2ddaddafac4e5605379f6e4dd1 100644 (file)
@@ -2858,6 +2858,7 @@ static int sysc_init_soc(struct sysc *ddata)
        const struct soc_device_attribute *match;
        struct ti_sysc_platform_data *pdata;
        unsigned long features = 0;
+       struct device_node *np;
 
        if (sysc_soc)
                return 0;
@@ -2878,6 +2879,21 @@ static int sysc_init_soc(struct sysc *ddata)
        if (match && match->data)
                sysc_soc->soc = (int)match->data;
 
+       /*
+        * Check and warn about possible old incomplete dtb. We now want to see
+        * simple-pm-bus instead of simple-bus in the dtb for genpd using SoCs.
+        */
+       switch (sysc_soc->soc) {
+       case SOC_AM3:
+       case SOC_AM4:
+               np = of_find_node_by_path("/ocp");
+               WARN_ONCE(np && of_device_is_compatible(np, "simple-bus"),
+                         "ti-sysc: Incomplete old dtb, please update\n");
+               break;
+       default:
+               break;
+       }
+
        /* Ignore devices that are not available on HS and EMU SoCs */
        if (!sysc_soc->general_purpose) {
                switch (sysc_soc->soc) {