Commit 8d248f0d authored by Maxime Ripard's avatar Maxime Ripard Committed by Nicolas Ferre

ARM: at91: Rework ramc mapping code

Adapt the ramc mapping code to handle multiple ram controllers in the DT.
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
parent 9e8be232
...@@ -63,7 +63,6 @@ RAMC SDRAM/DDR Controller required properties: ...@@ -63,7 +63,6 @@ RAMC SDRAM/DDR Controller required properties:
"atmel,at91sam9g45-ddramc", "atmel,at91sam9g45-ddramc",
"atmel,sama5d3-ddramc", "atmel,sama5d3-ddramc",
- reg: Should contain registers location and length - reg: Should contain registers location and length
For at91sam9263 and at91sam9g45 you must specify 2 entries.
Examples: Examples:
...@@ -72,12 +71,6 @@ Examples: ...@@ -72,12 +71,6 @@ Examples:
reg = <0xffffe800 0x200>; reg = <0xffffe800 0x200>;
}; };
ramc0: ramc@ffffe400 {
compatible = "atmel,at91sam9g45-ddramc";
reg = <0xffffe400 0x200
0xffffe600 0x200>;
};
SHDWC Shutdown Controller SHDWC Shutdown Controller
required properties: required properties:
......
...@@ -395,24 +395,26 @@ static void at91_dt_ramc(void) ...@@ -395,24 +395,26 @@ static void at91_dt_ramc(void)
{ {
struct device_node *np; struct device_node *np;
const struct of_device_id *of_id; const struct of_device_id *of_id;
int idx = 0;
np = of_find_matching_node(NULL, ramc_ids); for_each_matching_node(np, ramc_ids) {
if (!np) at91_ramc_base[idx] = of_iomap(np, 0);
panic(pr_fmt("unable to find compatible ram controller node in dtb\n")); if (!at91_ramc_base[idx])
panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx);
at91_ramc_base[0] = of_iomap(np, 0); idx++;
if (!at91_ramc_base[0]) }
panic(pr_fmt("unable to map ramc[0] cpu registers\n"));
/* the controller may have 2 banks */ if (!idx)
at91_ramc_base[1] = of_iomap(np, 1); panic(pr_fmt("unable to find compatible ram controller node in dtb\n"));
of_id = of_match_node(ramc_ids, np); of_id = of_match_node(ramc_ids, np);
if (!of_id) if (!of_id) {
pr_warn("ramc no standby function available\n"); pr_warn("ramc no standby function available\n");
else return;
at91_pm_set_standby(of_id->data); }
of_node_put(np); at91_pm_set_standby(of_id->data);
} }
static struct of_device_id shdwc_ids[] = { static struct of_device_id shdwc_ids[] = {
......
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