diff options
author | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2014-08-27 12:06:51 -0400 |
---|---|---|
committer | Nicolas Ferre <nicolas.ferre@atmel.com> | 2014-09-01 12:37:51 -0400 |
commit | c8260db557389c1fb46eeafb54414b03d9f19e49 (patch) | |
tree | 7fa322efeb42840e096350b8aafc233109ff8de2 /arch/arm/mach-at91/setup.c | |
parent | f55df0d654e10ad49e0e7edaeef02fa00e084d94 (diff) |
ARM: at91: fix ramc standby function registration
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 <alexandre.belloni@free-electrons.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'arch/arm/mach-at91/setup.c')
-rw-r--r-- | arch/arm/mach-at91/setup.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index 28ae63b8eb16..d2cade21ebd7 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c | |||
@@ -343,25 +343,28 @@ static void at91_dt_ramc(void) | |||
343 | struct device_node *np; | 343 | struct device_node *np; |
344 | const struct of_device_id *of_id; | 344 | const struct of_device_id *of_id; |
345 | int idx = 0; | 345 | int idx = 0; |
346 | const void *standby = NULL; | ||
346 | 347 | ||
347 | for_each_matching_node(np, ramc_ids) { | 348 | for_each_matching_node_and_match(np, ramc_ids, &of_id) { |
348 | at91_ramc_base[idx] = of_iomap(np, 0); | 349 | at91_ramc_base[idx] = of_iomap(np, 0); |
349 | if (!at91_ramc_base[idx]) | 350 | if (!at91_ramc_base[idx]) |
350 | panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx); | 351 | panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx); |
351 | 352 | ||
353 | if (!standby) | ||
354 | standby = of_id->data; | ||
355 | |||
352 | idx++; | 356 | idx++; |
353 | } | 357 | } |
354 | 358 | ||
355 | if (!idx) | 359 | if (!idx) |
356 | panic(pr_fmt("unable to find compatible ram controller node in dtb\n")); | 360 | panic(pr_fmt("unable to find compatible ram controller node in dtb\n")); |
357 | 361 | ||
358 | of_id = of_match_node(ramc_ids, np); | 362 | if (!standby) { |
359 | if (!of_id) { | ||
360 | pr_warn("ramc no standby function available\n"); | 363 | pr_warn("ramc no standby function available\n"); |
361 | return; | 364 | return; |
362 | } | 365 | } |
363 | 366 | ||
364 | at91_pm_set_standby(of_id->data); | 367 | at91_pm_set_standby(standby); |
365 | } | 368 | } |
366 | 369 | ||
367 | void __init at91rm9200_dt_initialize(void) | 370 | void __init at91rm9200_dt_initialize(void) |