Commit 11f9323a authored by Linus Walleij's avatar Linus Walleij Committed by Arnd Bergmann

ARM: integrator: fix OF-related regression

Commit 07e461cd
"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 <grant.likely@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent f340a59f
...@@ -480,25 +480,18 @@ static const struct of_device_id ebi_match[] = { ...@@ -480,25 +480,18 @@ static const struct of_device_id ebi_match[] = {
static void __init ap_init_of(void) static void __init ap_init_of(void)
{ {
unsigned long sc_dec; unsigned long sc_dec;
struct device_node *root;
struct device_node *syscon; struct device_node *syscon;
struct device_node *ebi; struct device_node *ebi;
struct device *parent; struct device *parent;
struct soc_device *soc_dev; struct soc_device *soc_dev;
struct soc_device_attribute *soc_dev_attr; struct soc_device_attribute *soc_dev_attr;
u32 ap_sc_id; u32 ap_sc_id;
int err;
int i; int i;
/* Here we create an SoC device for the root node */ syscon = of_find_matching_node(NULL, ap_syscon_match);
root = of_find_node_by_path("/");
if (!root)
return;
syscon = of_find_matching_node(root, ap_syscon_match);
if (!syscon) if (!syscon)
return; return;
ebi = of_find_matching_node(root, ebi_match); ebi = of_find_matching_node(NULL, ebi_match);
if (!ebi) if (!ebi)
return; return;
...@@ -509,19 +502,17 @@ static void __init ap_init_of(void) ...@@ -509,19 +502,17 @@ static void __init ap_init_of(void)
if (!ebi_base) if (!ebi_base)
return; return;
of_platform_populate(NULL, of_default_bus_match_table,
ap_auxdata_lookup, NULL);
ap_sc_id = readl(ap_syscon_base); ap_sc_id = readl(ap_syscon_base);
soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
if (!soc_dev_attr) if (!soc_dev_attr)
return; return;
err = of_property_read_string(root, "compatible", soc_dev_attr->soc_id = "XVC";
&soc_dev_attr->soc_id); soc_dev_attr->machine = "Integrator/AP";
if (err)
return;
err = of_property_read_string(root, "model", &soc_dev_attr->machine);
if (err)
return;
soc_dev_attr->family = "Integrator"; soc_dev_attr->family = "Integrator";
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c", soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c",
'A' + (ap_sc_id & 0x0f)); 'A' + (ap_sc_id & 0x0f));
...@@ -536,9 +527,6 @@ static void __init ap_init_of(void) ...@@ -536,9 +527,6 @@ static void __init ap_init_of(void)
parent = soc_device_to_device(soc_dev); parent = soc_device_to_device(soc_dev);
integrator_init_sysfs(parent, ap_sc_id); integrator_init_sysfs(parent, ap_sc_id);
of_platform_populate(root, of_default_bus_match_table,
ap_auxdata_lookup, parent);
sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET); sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
struct lm_device *lmdev; struct lm_device *lmdev;
......
...@@ -279,20 +279,13 @@ static const struct of_device_id intcp_syscon_match[] = { ...@@ -279,20 +279,13 @@ static const struct of_device_id intcp_syscon_match[] = {
static void __init intcp_init_of(void) static void __init intcp_init_of(void)
{ {
struct device_node *root;
struct device_node *cpcon; struct device_node *cpcon;
struct device *parent; struct device *parent;
struct soc_device *soc_dev; struct soc_device *soc_dev;
struct soc_device_attribute *soc_dev_attr; struct soc_device_attribute *soc_dev_attr;
u32 intcp_sc_id; u32 intcp_sc_id;
int err;
/* Here we create an SoC device for the root node */ cpcon = of_find_matching_node(NULL, intcp_syscon_match);
root = of_find_node_by_path("/");
if (!root)
return;
cpcon = of_find_matching_node(root, intcp_syscon_match);
if (!cpcon) if (!cpcon)
return; return;
...@@ -300,19 +293,17 @@ static void __init intcp_init_of(void) ...@@ -300,19 +293,17 @@ static void __init intcp_init_of(void)
if (!intcp_con_base) if (!intcp_con_base)
return; return;
of_platform_populate(NULL, of_default_bus_match_table,
intcp_auxdata_lookup, NULL);
intcp_sc_id = readl(intcp_con_base); intcp_sc_id = readl(intcp_con_base);
soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
if (!soc_dev_attr) if (!soc_dev_attr)
return; return;
err = of_property_read_string(root, "compatible", soc_dev_attr->soc_id = "XCV";
&soc_dev_attr->soc_id); soc_dev_attr->machine = "Integrator/CP";
if (err)
return;
err = of_property_read_string(root, "model", &soc_dev_attr->machine);
if (err)
return;
soc_dev_attr->family = "Integrator"; soc_dev_attr->family = "Integrator";
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c", soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c",
'A' + (intcp_sc_id & 0x0f)); 'A' + (intcp_sc_id & 0x0f));
...@@ -326,8 +317,6 @@ static void __init intcp_init_of(void) ...@@ -326,8 +317,6 @@ static void __init intcp_init_of(void)
parent = soc_device_to_device(soc_dev); parent = soc_device_to_device(soc_dev);
integrator_init_sysfs(parent, intcp_sc_id); integrator_init_sysfs(parent, intcp_sc_id);
of_platform_populate(root, of_default_bus_match_table,
intcp_auxdata_lookup, parent);
} }
static const char * intcp_dt_board_compat[] = { static const char * intcp_dt_board_compat[] = {
......
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