Skip to content

Commit 68a84a3

Browse files
claudiubezneasre
authored andcommitted
power: reset: at91-reset: introduce ramc_lpr to struct at91_reset
Introduce ramc_lpr to struct at91_reset. This will lead to the unification of at91sam9260_restart() and at91sam9g45_restart(). Signed-off-by: Claudiu Beznea <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 7cb290d commit 68a84a3

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

drivers/power/reset/at91-reset.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct at91_reset {
6161
struct clk *sclk;
6262
struct notifier_block nb;
6363
u32 args;
64+
u32 ramc_lpr;
6465
};
6566

6667
/*
@@ -81,7 +82,7 @@ static int at91sam9260_restart(struct notifier_block *this, unsigned long mode,
8182
"str %2, [%0, #" __stringify(AT91_SDRAMC_TR) "]\n\t"
8283

8384
/* Power down SDRAM */
84-
"str %3, [%0, #" __stringify(AT91_SDRAMC_LPR) "]\n\t"
85+
"str %3, [%0, %5]\n\t"
8586

8687
/* Reset CPU */
8788
"str %4, [%1, #" __stringify(AT91_RSTC_CR) "]\n\t"
@@ -92,7 +93,8 @@ static int at91sam9260_restart(struct notifier_block *this, unsigned long mode,
9293
"r" (reset->rstc_base),
9394
"r" (1),
9495
"r" cpu_to_le32(AT91_SDRAMC_LPCB_POWER_DOWN),
95-
"r" (reset->args));
96+
"r" (reset->args),
97+
"r" (reset->ramc_lpr));
9698

9799
return NOTIFY_DONE;
98100
}
@@ -122,11 +124,11 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
122124
/* Disable SDRAM0 accesses */
123125
"1: str %3, [%0, #" __stringify(AT91_DDRSDRC_RTR) "]\n\t"
124126
/* Power down SDRAM0 */
125-
" str %4, [%0, #" __stringify(AT91_DDRSDRC_LPR) "]\n\t"
127+
" str %4, [%0, %6]\n\t"
126128
/* Disable SDRAM1 accesses */
127129
" strne %3, [%1, #" __stringify(AT91_DDRSDRC_RTR) "]\n\t"
128130
/* Power down SDRAM1 */
129-
" strne %4, [%1, #" __stringify(AT91_DDRSDRC_LPR) "]\n\t"
131+
" strne %4, [%1, %6]\n\t"
130132
/* Reset CPU */
131133
" str %5, [%2, #" __stringify(AT91_RSTC_CR) "]\n\t"
132134

@@ -137,7 +139,8 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
137139
"r" (reset->rstc_base),
138140
"r" (1),
139141
"r" cpu_to_le32(AT91_DDRSDRC_LPCB_POWER_DOWN),
140-
"r" (reset->args)
142+
"r" (reset->args),
143+
"r" (reset->ramc_lpr)
141144
: "r4");
142145

143146
return NOTIFY_DONE;
@@ -193,8 +196,14 @@ static void __init at91_reset_status(struct platform_device *pdev,
193196
}
194197

195198
static const struct of_device_id at91_ramc_of_match[] = {
196-
{ .compatible = "atmel,at91sam9260-sdramc", },
197-
{ .compatible = "atmel,at91sam9g45-ddramc", },
199+
{
200+
.compatible = "atmel,at91sam9260-sdramc",
201+
.data = (void *)AT91_SDRAMC_LPR,
202+
},
203+
{
204+
.compatible = "atmel,at91sam9g45-ddramc",
205+
.data = (void *)AT91_DDRSDRC_LPR,
206+
},
198207
{ /* sentinel */ }
199208
};
200209

@@ -263,7 +272,8 @@ static int __init at91_reset_probe(struct platform_device *pdev)
263272

264273
if (!of_device_is_compatible(pdev->dev.of_node, "atmel,sama5d3-rstc")) {
265274
/* we need to shutdown the ddr controller, so get ramc base */
266-
for_each_matching_node(np, at91_ramc_of_match) {
275+
for_each_matching_node_and_match(np, at91_ramc_of_match, &match) {
276+
reset->ramc_lpr = (u32)match->data;
267277
reset->ramc_base[idx] = of_iomap(np, 0);
268278
if (!reset->ramc_base[idx]) {
269279
dev_err(&pdev->dev, "Could not map ram controller address\n");

0 commit comments

Comments
 (0)