Skip to content

Commit 11f9323

Browse files
linuswarndb
authored andcommitted
ARM: integrator: fix OF-related regression
Commit 07e461c "of: Ensure unique names without sacrificing determinism" caused a boot failure regression on the Integrator machines. The problem is probably caused by fiddling too much with the device tree population in the OF init function, such as passing the SoC bus device as parent when populating the device tree. This patch fixes the problem by: - Avoiding to explicitly look up the tree root - Look up devices needed before device population from the match only, passing NULL as root - Passing NULL as root and parent when calling of_platform_populate() After this the Integrators boot again. Tested on Integrator/AP and Integrator/CP. Cc: Grant Likely <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent f340a59 commit 11f9323

File tree

2 files changed

+13
-36
lines changed

2 files changed

+13
-36
lines changed

arch/arm/mach-integrator/integrator_ap.c

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -480,25 +480,18 @@ static const struct of_device_id ebi_match[] = {
480480
static void __init ap_init_of(void)
481481
{
482482
unsigned long sc_dec;
483-
struct device_node *root;
484483
struct device_node *syscon;
485484
struct device_node *ebi;
486485
struct device *parent;
487486
struct soc_device *soc_dev;
488487
struct soc_device_attribute *soc_dev_attr;
489488
u32 ap_sc_id;
490-
int err;
491489
int i;
492490

493-
/* Here we create an SoC device for the root node */
494-
root = of_find_node_by_path("/");
495-
if (!root)
496-
return;
497-
498-
syscon = of_find_matching_node(root, ap_syscon_match);
491+
syscon = of_find_matching_node(NULL, ap_syscon_match);
499492
if (!syscon)
500493
return;
501-
ebi = of_find_matching_node(root, ebi_match);
494+
ebi = of_find_matching_node(NULL, ebi_match);
502495
if (!ebi)
503496
return;
504497

@@ -509,19 +502,17 @@ static void __init ap_init_of(void)
509502
if (!ebi_base)
510503
return;
511504

505+
of_platform_populate(NULL, of_default_bus_match_table,
506+
ap_auxdata_lookup, NULL);
507+
512508
ap_sc_id = readl(ap_syscon_base);
513509

514510
soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
515511
if (!soc_dev_attr)
516512
return;
517513

518-
err = of_property_read_string(root, "compatible",
519-
&soc_dev_attr->soc_id);
520-
if (err)
521-
return;
522-
err = of_property_read_string(root, "model", &soc_dev_attr->machine);
523-
if (err)
524-
return;
514+
soc_dev_attr->soc_id = "XVC";
515+
soc_dev_attr->machine = "Integrator/AP";
525516
soc_dev_attr->family = "Integrator";
526517
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c",
527518
'A' + (ap_sc_id & 0x0f));
@@ -536,9 +527,6 @@ static void __init ap_init_of(void)
536527
parent = soc_device_to_device(soc_dev);
537528
integrator_init_sysfs(parent, ap_sc_id);
538529

539-
of_platform_populate(root, of_default_bus_match_table,
540-
ap_auxdata_lookup, parent);
541-
542530
sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
543531
for (i = 0; i < 4; i++) {
544532
struct lm_device *lmdev;

arch/arm/mach-integrator/integrator_cp.c

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -279,40 +279,31 @@ static const struct of_device_id intcp_syscon_match[] = {
279279

280280
static void __init intcp_init_of(void)
281281
{
282-
struct device_node *root;
283282
struct device_node *cpcon;
284283
struct device *parent;
285284
struct soc_device *soc_dev;
286285
struct soc_device_attribute *soc_dev_attr;
287286
u32 intcp_sc_id;
288-
int err;
289287

290-
/* Here we create an SoC device for the root node */
291-
root = of_find_node_by_path("/");
292-
if (!root)
293-
return;
294-
295-
cpcon = of_find_matching_node(root, intcp_syscon_match);
288+
cpcon = of_find_matching_node(NULL, intcp_syscon_match);
296289
if (!cpcon)
297290
return;
298291

299292
intcp_con_base = of_iomap(cpcon, 0);
300293
if (!intcp_con_base)
301294
return;
302295

296+
of_platform_populate(NULL, of_default_bus_match_table,
297+
intcp_auxdata_lookup, NULL);
298+
303299
intcp_sc_id = readl(intcp_con_base);
304300

305301
soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
306302
if (!soc_dev_attr)
307303
return;
308304

309-
err = of_property_read_string(root, "compatible",
310-
&soc_dev_attr->soc_id);
311-
if (err)
312-
return;
313-
err = of_property_read_string(root, "model", &soc_dev_attr->machine);
314-
if (err)
315-
return;
305+
soc_dev_attr->soc_id = "XCV";
306+
soc_dev_attr->machine = "Integrator/CP";
316307
soc_dev_attr->family = "Integrator";
317308
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c",
318309
'A' + (intcp_sc_id & 0x0f));
@@ -326,8 +317,6 @@ static void __init intcp_init_of(void)
326317

327318
parent = soc_device_to_device(soc_dev);
328319
integrator_init_sysfs(parent, intcp_sc_id);
329-
of_platform_populate(root, of_default_bus_match_table,
330-
intcp_auxdata_lookup, parent);
331320
}
332321

333322
static const char * intcp_dt_board_compat[] = {

0 commit comments

Comments
 (0)