diff options
author | Maxime Ripard <maxime.ripard@free-electrons.com> | 2014-07-03 09:58:49 -0400 |
---|---|---|
committer | Nicolas Ferre <nicolas.ferre@atmel.com> | 2014-08-25 10:02:26 -0400 |
commit | 8d248f0d3a1ddb3c671b4029f8950fbad09be7ae (patch) | |
tree | ac57e82af0222496cf5c6e993b85861a25fdd9e8 /arch/arm/mach-at91/setup.c | |
parent | 9e8be232b934418932e40da276f6871dce83fa7c (diff) |
ARM: at91: Rework ramc mapping code
Adapt the ramc mapping code to handle multiple ram controllers in the DT.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-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 | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index c565572157db..0c8daf7a4a77 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c | |||
@@ -395,24 +395,26 @@ static void at91_dt_ramc(void) | |||
395 | { | 395 | { |
396 | struct device_node *np; | 396 | struct device_node *np; |
397 | const struct of_device_id *of_id; | 397 | const struct of_device_id *of_id; |
398 | int idx = 0; | ||
398 | 399 | ||
399 | np = of_find_matching_node(NULL, ramc_ids); | 400 | for_each_matching_node(np, ramc_ids) { |
400 | if (!np) | 401 | at91_ramc_base[idx] = of_iomap(np, 0); |
401 | panic(pr_fmt("unable to find compatible ram controller node in dtb\n")); | 402 | if (!at91_ramc_base[idx]) |
403 | panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx); | ||
402 | 404 | ||
403 | at91_ramc_base[0] = of_iomap(np, 0); | 405 | idx++; |
404 | if (!at91_ramc_base[0]) | 406 | } |
405 | panic(pr_fmt("unable to map ramc[0] cpu registers\n")); | 407 | |
406 | /* the controller may have 2 banks */ | 408 | if (!idx) |
407 | at91_ramc_base[1] = of_iomap(np, 1); | 409 | panic(pr_fmt("unable to find compatible ram controller node in dtb\n")); |
408 | 410 | ||
409 | of_id = of_match_node(ramc_ids, np); | 411 | of_id = of_match_node(ramc_ids, np); |
410 | if (!of_id) | 412 | if (!of_id) { |
411 | pr_warn("ramc no standby function available\n"); | 413 | pr_warn("ramc no standby function available\n"); |
412 | else | 414 | return; |
413 | at91_pm_set_standby(of_id->data); | 415 | } |
414 | 416 | ||
415 | of_node_put(np); | 417 | at91_pm_set_standby(of_id->data); |
416 | } | 418 | } |
417 | 419 | ||
418 | static struct of_device_id shdwc_ids[] = { | 420 | static struct of_device_id shdwc_ids[] = { |