@@ -56,8 +56,6 @@ struct at91_reset {
56
56
struct notifier_block nb ;
57
57
};
58
58
59
- static struct at91_reset * reset ;
60
-
61
59
/*
62
60
* unless the SDRAM is cleanly shutdown before we hit the
63
61
* reset register it can be left driving the data bus and
@@ -66,6 +64,8 @@ static struct at91_reset *reset;
66
64
static int at91sam9260_restart (struct notifier_block * this , unsigned long mode ,
67
65
void * cmd )
68
66
{
67
+ struct at91_reset * reset = container_of (this , struct at91_reset , nb );
68
+
69
69
asm volatile (
70
70
/* Align to cache lines */
71
71
".balign 32\n\t"
@@ -93,6 +93,8 @@ static int at91sam9260_restart(struct notifier_block *this, unsigned long mode,
93
93
static int at91sam9g45_restart (struct notifier_block * this , unsigned long mode ,
94
94
void * cmd )
95
95
{
96
+ struct at91_reset * reset = container_of (this , struct at91_reset , nb );
97
+
96
98
asm volatile (
97
99
/*
98
100
* Test wether we have a second RAM controller to care
@@ -137,6 +139,8 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
137
139
static int sama5d3_restart (struct notifier_block * this , unsigned long mode ,
138
140
void * cmd )
139
141
{
142
+ struct at91_reset * reset = container_of (this , struct at91_reset , nb );
143
+
140
144
writel (cpu_to_le32 (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST ),
141
145
reset -> rstc_base );
142
146
@@ -146,6 +150,8 @@ static int sama5d3_restart(struct notifier_block *this, unsigned long mode,
146
150
static int samx7_restart (struct notifier_block * this , unsigned long mode ,
147
151
void * cmd )
148
152
{
153
+ struct at91_reset * reset = container_of (this , struct at91_reset , nb );
154
+
149
155
writel (cpu_to_le32 (AT91_RSTC_KEY | AT91_RSTC_PROCRST ),
150
156
reset -> rstc_base );
151
157
@@ -210,6 +216,7 @@ MODULE_DEVICE_TABLE(of, at91_reset_of_match);
210
216
static int __init at91_reset_probe (struct platform_device * pdev )
211
217
{
212
218
const struct of_device_id * match ;
219
+ struct at91_reset * reset ;
213
220
struct device_node * np ;
214
221
int ret , idx = 0 ;
215
222
@@ -250,6 +257,8 @@ static int __init at91_reset_probe(struct platform_device *pdev)
250
257
return ret ;
251
258
}
252
259
260
+ platform_set_drvdata (pdev , reset );
261
+
253
262
ret = register_restart_handler (& reset -> nb );
254
263
if (ret ) {
255
264
clk_disable_unprepare (reset -> sclk );
@@ -263,6 +272,8 @@ static int __init at91_reset_probe(struct platform_device *pdev)
263
272
264
273
static int __exit at91_reset_remove (struct platform_device * pdev )
265
274
{
275
+ struct at91_reset * reset = platform_get_drvdata (pdev );
276
+
266
277
unregister_restart_handler (& reset -> nb );
267
278
clk_disable_unprepare (reset -> sclk );
268
279
0 commit comments