@@ -49,6 +49,11 @@ enum reset_type {
49
49
RESET_TYPE_ULP2 = 8 ,
50
50
};
51
51
52
+ struct at91_reset_data {
53
+ int (* notifier_call )(struct notifier_block * this , unsigned long mode ,
54
+ void * cmd );
55
+ };
56
+
52
57
struct at91_reset {
53
58
void __iomem * rstc_base ;
54
59
void __iomem * ramc_base [2 ];
@@ -203,18 +208,50 @@ static const struct of_device_id at91_ramc_of_match[] = {
203
208
{ /* sentinel */ }
204
209
};
205
210
211
+ static const struct at91_reset_data at91sam9260_reset_data = {
212
+ .notifier_call = at91sam9260_restart ,
213
+ };
214
+
215
+ static const struct at91_reset_data at91sam9g45_reset_data = {
216
+ .notifier_call = at91sam9g45_restart ,
217
+ };
218
+
219
+ static const struct at91_reset_data sama5d3_reset_data = {
220
+ .notifier_call = sama5d3_restart ,
221
+ };
222
+
223
+ static const struct at91_reset_data samx7_reset_data = {
224
+ .notifier_call = samx7_restart ,
225
+ };
226
+
206
227
static const struct of_device_id at91_reset_of_match [] = {
207
- { .compatible = "atmel,at91sam9260-rstc" , .data = at91sam9260_restart },
208
- { .compatible = "atmel,at91sam9g45-rstc" , .data = at91sam9g45_restart },
209
- { .compatible = "atmel,sama5d3-rstc" , .data = sama5d3_restart },
210
- { .compatible = "atmel,samx7-rstc" , .data = samx7_restart },
211
- { .compatible = "microchip,sam9x60-rstc" , .data = samx7_restart },
228
+ {
229
+ .compatible = "atmel,at91sam9260-rstc" ,
230
+ .data = & at91sam9260_reset_data
231
+ },
232
+ {
233
+ .compatible = "atmel,at91sam9g45-rstc" ,
234
+ .data = & at91sam9g45_reset_data
235
+ },
236
+ {
237
+ .compatible = "atmel,sama5d3-rstc" ,
238
+ .data = & sama5d3_reset_data
239
+ },
240
+ {
241
+ .compatible = "atmel,samx7-rstc" ,
242
+ .data = & samx7_reset_data
243
+ },
244
+ {
245
+ .compatible = "microchip,sam9x60-rstc" ,
246
+ .data = & samx7_reset_data
247
+ },
212
248
{ /* sentinel */ }
213
249
};
214
250
MODULE_DEVICE_TABLE (of , at91_reset_of_match );
215
251
216
252
static int __init at91_reset_probe (struct platform_device * pdev )
217
253
{
254
+ const struct at91_reset_data * reset_data ;
218
255
const struct of_device_id * match ;
219
256
struct at91_reset * reset ;
220
257
struct device_node * np ;
@@ -244,7 +281,8 @@ static int __init at91_reset_probe(struct platform_device *pdev)
244
281
}
245
282
246
283
match = of_match_node (at91_reset_of_match , pdev -> dev .of_node );
247
- reset -> nb .notifier_call = match -> data ;
284
+ reset_data = match -> data ;
285
+ reset -> nb .notifier_call = reset_data -> notifier_call ;
248
286
reset -> nb .priority = 192 ;
249
287
250
288
reset -> sclk = devm_clk_get (& pdev -> dev , NULL );
0 commit comments