Commit fbfa463b authored by Tony Lindgren's avatar Tony Lindgren

ARM: OMAP2+: Fix smartreflex init regression after dropping legacy data

When I dropped legacy data for omap4 and dra7 smartreflex in favor of
device tree based data, it seems I only testd for the "SmartReflex Class3
initialized" line in dmesg. I missed the fact that there is also
omap_devinit_smartreflex() that happens later, and now it produces an
error on boot for "No Voltage table for the corresponding vdd. Cannot
create debugfs entries for n-values".

This happens as we no longer have the smartreflex instance legacy data,
and have not yet moved completely to device tree based booting for the
driver. Let's fix the issue by changing the smartreflex init to use names.
This should all eventually go away in favor of doing the init in the
driver based on devicetree compatible value.

Note that dra7xx_init_early() is not calling any voltage domain init like
omap54xx_voltagedomains_init(), or a dra7 specific voltagedomains init.
This means that on dra7 smartreflex is still not fully initialized, and
also seems to be missing the related devicetree nodes.

Fixes: a6b1e717 ("ARM: OMAP2+: Drop legacy platform data for omap4 smartreflex")
Fixes: e54740b4 ("ARM: OMAP2+: Drop legacy platform data for dra7 smartreflex")
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent a249ca66
...@@ -88,34 +88,26 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data, ...@@ -88,34 +88,26 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
extern struct omap_sr_data omap_sr_pdata[]; extern struct omap_sr_data omap_sr_pdata[];
static int __init sr_dev_init(struct omap_hwmod *oh, void *user) static int __init sr_init_by_name(const char *name, const char *voltdm)
{ {
struct omap_sr_data *sr_data = NULL; struct omap_sr_data *sr_data = NULL;
struct omap_volt_data *volt_data; struct omap_volt_data *volt_data;
struct omap_smartreflex_dev_attr *sr_dev_attr;
static int i; static int i;
if (!strncmp(oh->name, "smartreflex_mpu_iva", 20) || if (!strncmp(name, "smartreflex_mpu_iva", 20) ||
!strncmp(oh->name, "smartreflex_mpu", 16)) !strncmp(name, "smartreflex_mpu", 16))
sr_data = &omap_sr_pdata[OMAP_SR_MPU]; sr_data = &omap_sr_pdata[OMAP_SR_MPU];
else if (!strncmp(oh->name, "smartreflex_core", 17)) else if (!strncmp(name, "smartreflex_core", 17))
sr_data = &omap_sr_pdata[OMAP_SR_CORE]; sr_data = &omap_sr_pdata[OMAP_SR_CORE];
else if (!strncmp(oh->name, "smartreflex_iva", 16)) else if (!strncmp(name, "smartreflex_iva", 16))
sr_data = &omap_sr_pdata[OMAP_SR_IVA]; sr_data = &omap_sr_pdata[OMAP_SR_IVA];
if (!sr_data) { if (!sr_data) {
pr_err("%s: Unknown instance %s\n", __func__, oh->name); pr_err("%s: Unknown instance %s\n", __func__, name);
return -EINVAL; return -EINVAL;
} }
sr_dev_attr = (struct omap_smartreflex_dev_attr *)oh->dev_attr; sr_data->name = name;
if (!sr_dev_attr || !sr_dev_attr->sensor_voltdm_name) {
pr_err("%s: No voltage domain specified for %s. Cannot initialize\n",
__func__, oh->name);
goto exit;
}
sr_data->name = oh->name;
if (cpu_is_omap343x()) if (cpu_is_omap343x())
sr_data->ip_type = 1; sr_data->ip_type = 1;
else else
...@@ -136,10 +128,10 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user) ...@@ -136,10 +128,10 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
} }
} }
sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name); sr_data->voltdm = voltdm_lookup(voltdm);
if (!sr_data->voltdm) { if (!sr_data->voltdm) {
pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", pr_err("%s: Unable to get voltage domain pointer for VDD %s\n",
__func__, sr_dev_attr->sensor_voltdm_name); __func__, voltdm);
goto exit; goto exit;
} }
...@@ -160,6 +152,20 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user) ...@@ -160,6 +152,20 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
return 0; return 0;
} }
static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
{
struct omap_smartreflex_dev_attr *sr_dev_attr;
sr_dev_attr = (struct omap_smartreflex_dev_attr *)oh->dev_attr;
if (!sr_dev_attr || !sr_dev_attr->sensor_voltdm_name) {
pr_err("%s: No voltage domain specified for %s. Cannot initialize\n",
__func__, oh->name);
return 0;
}
return sr_init_by_name(oh->name, sr_dev_attr->sensor_voltdm_name);
}
/* /*
* API to be called from board files to enable smartreflex * API to be called from board files to enable smartreflex
* autocompensation at init. * autocompensation at init.
...@@ -169,7 +175,42 @@ void __init omap_enable_smartreflex_on_init(void) ...@@ -169,7 +175,42 @@ void __init omap_enable_smartreflex_on_init(void)
sr_enable_on_init = true; sr_enable_on_init = true;
} }
static const char * const omap4_sr_instances[] = {
"mpu",
"iva",
"core",
};
static const char * const dra7_sr_instances[] = {
"mpu",
"core",
};
int __init omap_devinit_smartreflex(void) int __init omap_devinit_smartreflex(void)
{ {
const char * const *sr_inst;
int i, nr_sr = 0;
if (soc_is_omap44xx()) {
sr_inst = omap4_sr_instances;
nr_sr = ARRAY_SIZE(omap4_sr_instances);
} else if (soc_is_dra7xx()) {
sr_inst = dra7_sr_instances;
nr_sr = ARRAY_SIZE(dra7_sr_instances);
}
if (nr_sr) {
const char *name, *voltdm;
for (i = 0; i < nr_sr; i++) {
name = kasprintf(GFP_KERNEL, "smartreflex_%s", sr_inst[i]);
voltdm = sr_inst[i];
sr_init_by_name(name, voltdm);
}
return 0;
}
return omap_hwmod_for_each_by_class("smartreflex", sr_dev_init, NULL); return omap_hwmod_for_each_by_class("smartreflex", sr_dev_init, NULL);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment