ARM: OMAP2+: Enable ti-sysc to use device tree data for smartreflex
authorTony Lindgren <tony@atomide.com>
Thu, 22 Feb 2018 22:05:31 +0000 (14:05 -0800)
committerTony Lindgren <tony@atomide.com>
Thu, 1 Mar 2018 04:03:21 +0000 (20:03 -0800)
Let's enable ti-sysc probing of child devices. So far we have only used
ti-sysc to probe interconnect target modules to idle them for cases where
the SoC does not have any child devices configured for the module, such
as smartreflex on dra7.

As we have smartreflex driver configured in the device tree for some SoCs,
we need to flip things on with a single patch to prevent both omap_device
and ti-sysc to probe smartreflex. So let's stop probing smartreflex with
omap_device and probe it with ti-sysc by enabling passing the auxdata.

Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/omap_device.c
arch/arm/mach-omap2/pdata-quirks.c
arch/arm/mach-omap2/sr_device.c

index f0388058b7da399d28d3819ab268d5d0a2a61073..3b829a50d1dbb6258f7e8a18bc6a042c0c2c6ea3 100644 (file)
@@ -140,6 +140,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
        struct omap_device *od;
        struct omap_hwmod *oh;
        struct device_node *node = pdev->dev.of_node;
+       struct resource res;
        const char *oh_name;
        int oh_cnt, i, ret = 0;
        bool device_active = false;
@@ -150,6 +151,10 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
                return -ENODEV;
        }
 
+       /* Use ti-sysc driver instead of omap_device? */
+       if (!omap_hwmod_parse_module_range(NULL, node, &res))
+               return -ENODEV;
+
        hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt, GFP_KERNEL);
        if (!hwmods) {
                ret = -ENOMEM;
index eea82c31ee7778b8baf885d58a82561b930b894b..67e2fcdfe3f07afee02e5267df703fe30df742f7 100644 (file)
@@ -487,6 +487,7 @@ static struct of_dev_auxdata omap_auxdata_lookup[];
 
 static struct ti_sysc_platform_data ti_sysc_pdata = {
        .auxdata = omap_auxdata_lookup,
+       .init_module = omap_hwmod_init_module,
        .enable_module = ti_sysc_enable_module,
        .idle_module = ti_sysc_idle_module,
        .shutdown_module = ti_sysc_shutdown_module,
index 906b03b29c49b3a1c8e8bd491a5d9cf96ad86b0b..0854ed9ff379804c3c41a7e4e275a9f231930ad1 100644 (file)
@@ -93,16 +93,23 @@ extern struct omap_sr_data omap_sr_pdata[];
 
 static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
 {
-       struct omap_sr_data *sr_data;
-       struct platform_device *pdev;
+       struct omap_sr_data *sr_data = NULL;
        struct omap_volt_data *volt_data;
        struct omap_smartreflex_dev_attr *sr_dev_attr;
-       char *name = "smartreflex";
        static int i;
 
-       sr_data = kzalloc(sizeof(*sr_data), GFP_KERNEL);
-       if (!sr_data)
-               return -ENOMEM;
+       if (!strncmp(oh->name, "smartreflex_mpu_iva", 20) ||
+           !strncmp(oh->name, "smartreflex_mpu", 16))
+               sr_data = &omap_sr_pdata[OMAP_SR_MPU];
+       else if (!strncmp(oh->name, "smartreflex_core", 17))
+               sr_data = &omap_sr_pdata[OMAP_SR_CORE];
+       else if (!strncmp(oh->name, "smartreflex_iva", 16))
+               sr_data = &omap_sr_pdata[OMAP_SR_IVA];
+
+       if (!sr_data) {
+               pr_err("%s: Unknown instance %s\n", __func__, oh->name);
+               return -EINVAL;
+       }
 
        sr_dev_attr = (struct omap_smartreflex_dev_attr *)oh->dev_attr;
        if (!sr_dev_attr || !sr_dev_attr->sensor_voltdm_name) {
@@ -147,13 +154,9 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
 
        sr_data->enable_on_init = sr_enable_on_init;
 
-       pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data));
-       if (IS_ERR(pdev))
-               pr_warn("%s: Could not build omap_device for %s: %s\n",
-                       __func__, name, oh->name);
 exit:
        i++;
-       kfree(sr_data);
+
        return 0;
 }