Skip to content

Commit fbfa463

Browse files
committed
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: a6b1e71 ("ARM: OMAP2+: Drop legacy platform data for omap4 smartreflex") Fixes: e54740b ("ARM: OMAP2+: Drop legacy platform data for dra7 smartreflex") Signed-off-by: Tony Lindgren <[email protected]>
1 parent a249ca6 commit fbfa463

File tree

1 file changed

+58
-17
lines changed

1 file changed

+58
-17
lines changed

arch/arm/mach-omap2/sr_device.c

Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,34 +88,26 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
8888

8989
extern struct omap_sr_data omap_sr_pdata[];
9090

91-
static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
91+
static int __init sr_init_by_name(const char *name, const char *voltdm)
9292
{
9393
struct omap_sr_data *sr_data = NULL;
9494
struct omap_volt_data *volt_data;
95-
struct omap_smartreflex_dev_attr *sr_dev_attr;
9695
static int i;
9796

98-
if (!strncmp(oh->name, "smartreflex_mpu_iva", 20) ||
99-
!strncmp(oh->name, "smartreflex_mpu", 16))
97+
if (!strncmp(name, "smartreflex_mpu_iva", 20) ||
98+
!strncmp(name, "smartreflex_mpu", 16))
10099
sr_data = &omap_sr_pdata[OMAP_SR_MPU];
101-
else if (!strncmp(oh->name, "smartreflex_core", 17))
100+
else if (!strncmp(name, "smartreflex_core", 17))
102101
sr_data = &omap_sr_pdata[OMAP_SR_CORE];
103-
else if (!strncmp(oh->name, "smartreflex_iva", 16))
102+
else if (!strncmp(name, "smartreflex_iva", 16))
104103
sr_data = &omap_sr_pdata[OMAP_SR_IVA];
105104

106105
if (!sr_data) {
107-
pr_err("%s: Unknown instance %s\n", __func__, oh->name);
106+
pr_err("%s: Unknown instance %s\n", __func__, name);
108107
return -EINVAL;
109108
}
110109

111-
sr_dev_attr = (struct omap_smartreflex_dev_attr *)oh->dev_attr;
112-
if (!sr_dev_attr || !sr_dev_attr->sensor_voltdm_name) {
113-
pr_err("%s: No voltage domain specified for %s. Cannot initialize\n",
114-
__func__, oh->name);
115-
goto exit;
116-
}
117-
118-
sr_data->name = oh->name;
110+
sr_data->name = name;
119111
if (cpu_is_omap343x())
120112
sr_data->ip_type = 1;
121113
else
@@ -136,10 +128,10 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
136128
}
137129
}
138130

139-
sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name);
131+
sr_data->voltdm = voltdm_lookup(voltdm);
140132
if (!sr_data->voltdm) {
141133
pr_err("%s: Unable to get voltage domain pointer for VDD %s\n",
142-
__func__, sr_dev_attr->sensor_voltdm_name);
134+
__func__, voltdm);
143135
goto exit;
144136
}
145137

@@ -160,6 +152,20 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
160152
return 0;
161153
}
162154

155+
static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
156+
{
157+
struct omap_smartreflex_dev_attr *sr_dev_attr;
158+
159+
sr_dev_attr = (struct omap_smartreflex_dev_attr *)oh->dev_attr;
160+
if (!sr_dev_attr || !sr_dev_attr->sensor_voltdm_name) {
161+
pr_err("%s: No voltage domain specified for %s. Cannot initialize\n",
162+
__func__, oh->name);
163+
return 0;
164+
}
165+
166+
return sr_init_by_name(oh->name, sr_dev_attr->sensor_voltdm_name);
167+
}
168+
163169
/*
164170
* API to be called from board files to enable smartreflex
165171
* autocompensation at init.
@@ -169,7 +175,42 @@ void __init omap_enable_smartreflex_on_init(void)
169175
sr_enable_on_init = true;
170176
}
171177

178+
static const char * const omap4_sr_instances[] = {
179+
"mpu",
180+
"iva",
181+
"core",
182+
};
183+
184+
static const char * const dra7_sr_instances[] = {
185+
"mpu",
186+
"core",
187+
};
188+
172189
int __init omap_devinit_smartreflex(void)
173190
{
191+
const char * const *sr_inst;
192+
int i, nr_sr = 0;
193+
194+
if (soc_is_omap44xx()) {
195+
sr_inst = omap4_sr_instances;
196+
nr_sr = ARRAY_SIZE(omap4_sr_instances);
197+
198+
} else if (soc_is_dra7xx()) {
199+
sr_inst = dra7_sr_instances;
200+
nr_sr = ARRAY_SIZE(dra7_sr_instances);
201+
}
202+
203+
if (nr_sr) {
204+
const char *name, *voltdm;
205+
206+
for (i = 0; i < nr_sr; i++) {
207+
name = kasprintf(GFP_KERNEL, "smartreflex_%s", sr_inst[i]);
208+
voltdm = sr_inst[i];
209+
sr_init_by_name(name, voltdm);
210+
}
211+
212+
return 0;
213+
}
214+
174215
return omap_hwmod_for_each_by_class("smartreflex", sr_dev_init, NULL);
175216
}

0 commit comments

Comments
 (0)