@@ -52,13 +52,15 @@ enum reset_type {
52
52
struct at91_reset_data {
53
53
int (* notifier_call )(struct notifier_block * this , unsigned long mode ,
54
54
void * cmd );
55
+ u32 args ;
55
56
};
56
57
57
58
struct at91_reset {
58
59
void __iomem * rstc_base ;
59
60
void __iomem * ramc_base [2 ];
60
61
struct clk * sclk ;
61
62
struct notifier_block nb ;
63
+ u32 args ;
62
64
};
63
65
64
66
/*
@@ -90,7 +92,7 @@ static int at91sam9260_restart(struct notifier_block *this, unsigned long mode,
90
92
"r" (reset -> rstc_base ),
91
93
"r" (1 ),
92
94
"r" cpu_to_le32 (AT91_SDRAMC_LPCB_POWER_DOWN ),
93
- "r" cpu_to_le32 ( AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST ));
95
+ "r" ( reset -> args ));
94
96
95
97
return NOTIFY_DONE ;
96
98
}
@@ -135,7 +137,7 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
135
137
"r" (reset -> rstc_base ),
136
138
"r" (1 ),
137
139
"r" cpu_to_le32 (AT91_DDRSDRC_LPCB_POWER_DOWN ),
138
- "r" cpu_to_le32 ( AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST )
140
+ "r" ( reset -> args )
139
141
: "r0" );
140
142
141
143
return NOTIFY_DONE ;
@@ -146,19 +148,7 @@ static int sama5d3_restart(struct notifier_block *this, unsigned long mode,
146
148
{
147
149
struct at91_reset * reset = container_of (this , struct at91_reset , nb );
148
150
149
- writel (cpu_to_le32 (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST ),
150
- reset -> rstc_base );
151
-
152
- return NOTIFY_DONE ;
153
- }
154
-
155
- static int samx7_restart (struct notifier_block * this , unsigned long mode ,
156
- void * cmd )
157
- {
158
- struct at91_reset * reset = container_of (this , struct at91_reset , nb );
159
-
160
- writel (cpu_to_le32 (AT91_RSTC_KEY | AT91_RSTC_PROCRST ),
161
- reset -> rstc_base );
151
+ writel (reset -> args , reset -> rstc_base );
162
152
163
153
return NOTIFY_DONE ;
164
154
}
@@ -210,18 +200,22 @@ static const struct of_device_id at91_ramc_of_match[] = {
210
200
211
201
static const struct at91_reset_data at91sam9260_reset_data = {
212
202
.notifier_call = at91sam9260_restart ,
203
+ .args = AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST ,
213
204
};
214
205
215
206
static const struct at91_reset_data at91sam9g45_reset_data = {
216
207
.notifier_call = at91sam9g45_restart ,
208
+ .args = AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST ,
217
209
};
218
210
219
211
static const struct at91_reset_data sama5d3_reset_data = {
220
212
.notifier_call = sama5d3_restart ,
213
+ .args = AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST ,
221
214
};
222
215
223
216
static const struct at91_reset_data samx7_reset_data = {
224
- .notifier_call = samx7_restart ,
217
+ .notifier_call = sama5d3_restart ,
218
+ .args = AT91_RSTC_KEY | AT91_RSTC_PROCRST ,
225
219
};
226
220
227
221
static const struct of_device_id at91_reset_of_match [] = {
@@ -284,6 +278,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
284
278
reset_data = match -> data ;
285
279
reset -> nb .notifier_call = reset_data -> notifier_call ;
286
280
reset -> nb .priority = 192 ;
281
+ reset -> args = reset_data -> args ;
287
282
288
283
reset -> sclk = devm_clk_get (& pdev -> dev , NULL );
289
284
if (IS_ERR (reset -> sclk ))
0 commit comments