@@ -61,6 +61,7 @@ struct at91_reset {
61
61
struct clk * sclk ;
62
62
struct notifier_block nb ;
63
63
u32 args ;
64
+ u32 ramc_lpr ;
64
65
};
65
66
66
67
/*
@@ -81,7 +82,7 @@ static int at91sam9260_restart(struct notifier_block *this, unsigned long mode,
81
82
"str %2, [%0, #" __stringify (AT91_SDRAMC_TR ) "]\n\t"
82
83
83
84
/* Power down SDRAM */
84
- "str %3, [%0, #" __stringify ( AT91_SDRAMC_LPR ) " ]\n\t"
85
+ "str %3, [%0, %5 ]\n\t"
85
86
86
87
/* Reset CPU */
87
88
"str %4, [%1, #" __stringify (AT91_RSTC_CR ) "]\n\t"
@@ -92,7 +93,8 @@ static int at91sam9260_restart(struct notifier_block *this, unsigned long mode,
92
93
"r" (reset -> rstc_base ),
93
94
"r" (1 ),
94
95
"r" cpu_to_le32 (AT91_SDRAMC_LPCB_POWER_DOWN ),
95
- "r" (reset -> args ));
96
+ "r" (reset -> args ),
97
+ "r" (reset -> ramc_lpr ));
96
98
97
99
return NOTIFY_DONE ;
98
100
}
@@ -122,11 +124,11 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
122
124
/* Disable SDRAM0 accesses */
123
125
"1: str %3, [%0, #" __stringify (AT91_DDRSDRC_RTR ) "]\n\t"
124
126
/* Power down SDRAM0 */
125
- " str %4, [%0, #" __stringify ( AT91_DDRSDRC_LPR ) " ]\n\t"
127
+ " str %4, [%0, %6 ]\n\t"
126
128
/* Disable SDRAM1 accesses */
127
129
" strne %3, [%1, #" __stringify (AT91_DDRSDRC_RTR ) "]\n\t"
128
130
/* Power down SDRAM1 */
129
- " strne %4, [%1, #" __stringify ( AT91_DDRSDRC_LPR ) " ]\n\t"
131
+ " strne %4, [%1, %6 ]\n\t"
130
132
/* Reset CPU */
131
133
" str %5, [%2, #" __stringify (AT91_RSTC_CR ) "]\n\t"
132
134
@@ -137,7 +139,8 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
137
139
"r" (reset -> rstc_base ),
138
140
"r" (1 ),
139
141
"r" cpu_to_le32 (AT91_DDRSDRC_LPCB_POWER_DOWN ),
140
- "r" (reset -> args )
142
+ "r" (reset -> args ),
143
+ "r" (reset -> ramc_lpr )
141
144
: "r4" );
142
145
143
146
return NOTIFY_DONE ;
@@ -193,8 +196,14 @@ static void __init at91_reset_status(struct platform_device *pdev,
193
196
}
194
197
195
198
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
+ },
198
207
{ /* sentinel */ }
199
208
};
200
209
@@ -263,7 +272,8 @@ static int __init at91_reset_probe(struct platform_device *pdev)
263
272
264
273
if (!of_device_is_compatible (pdev -> dev .of_node , "atmel,sama5d3-rstc" )) {
265
274
/* 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 ;
267
277
reset -> ramc_base [idx ] = of_iomap (np , 0 );
268
278
if (!reset -> ramc_base [idx ]) {
269
279
dev_err (& pdev -> dev , "Could not map ram controller address\n" );
0 commit comments