Skip to content

Commit

Permalink
ARM: at91: fix ramc standby function registration
Browse files Browse the repository at this point in the history
After the for_each_matching_node loop, we end up with a null value for np. Then,
of_match_node() is not matching anything and we can't register the standby
function and "ramc no standby function available" is printed.

Fix that by selecting the first available standby function. For now,
at91_pm_set_standby doesn't support multiple different standby functions and no
existing SoCs have different RAM controllers.

Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Nicolas Ferre <[email protected]>
  • Loading branch information
alexandrebelloni authored and Nicolas Ferre committed Sep 1, 2014
1 parent f55df0d commit c8260db
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions arch/arm/mach-at91/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,25 +343,28 @@ static void at91_dt_ramc(void)
struct device_node *np;
const struct of_device_id *of_id;
int idx = 0;
const void *standby = NULL;

for_each_matching_node(np, ramc_ids) {
for_each_matching_node_and_match(np, ramc_ids, &of_id) {
at91_ramc_base[idx] = of_iomap(np, 0);
if (!at91_ramc_base[idx])
panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx);

if (!standby)
standby = of_id->data;

idx++;
}

if (!idx)
panic(pr_fmt("unable to find compatible ram controller node in dtb\n"));

of_id = of_match_node(ramc_ids, np);
if (!of_id) {
if (!standby) {
pr_warn("ramc no standby function available\n");
return;
}

at91_pm_set_standby(of_id->data);
at91_pm_set_standby(standby);
}

void __init at91rm9200_dt_initialize(void)
Expand Down

0 comments on commit c8260db

Please sign in to comment.