@@ -49,7 +49,13 @@ enum reset_type {
49
49
RESET_TYPE_ULP2 = 8 ,
50
50
};
51
51
52
- static void __iomem * at91_ramc_base [2 ], * at91_rstc_base ;
52
+ struct at91_reset {
53
+ void __iomem * rstc_base ;
54
+ };
55
+
56
+ static struct at91_reset reset ;
57
+
58
+ static void __iomem * at91_ramc_base [2 ];
53
59
static struct clk * sclk ;
54
60
55
61
/*
@@ -76,7 +82,7 @@ static int at91sam9260_restart(struct notifier_block *this, unsigned long mode,
76
82
"b .\n\t"
77
83
:
78
84
: "r" (at91_ramc_base [0 ]),
79
- "r" (at91_rstc_base ),
85
+ "r" (reset . rstc_base ),
80
86
"r" (1 ),
81
87
"r" cpu_to_le32 (AT91_SDRAMC_LPCB_POWER_DOWN ),
82
88
"r" cpu_to_le32 (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST ));
@@ -119,7 +125,7 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
119
125
:
120
126
: "r" (at91_ramc_base [0 ]),
121
127
"r" (at91_ramc_base [1 ]),
122
- "r" (at91_rstc_base ),
128
+ "r" (reset . rstc_base ),
123
129
"r" (1 ),
124
130
"r" cpu_to_le32 (AT91_DDRSDRC_LPCB_POWER_DOWN ),
125
131
"r" cpu_to_le32 (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST )
@@ -131,23 +137,25 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
131
137
static int sama5d3_restart (struct notifier_block * this , unsigned long mode ,
132
138
void * cmd )
133
139
{
134
- writel (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST ,
135
- at91_rstc_base );
140
+ writel (cpu_to_le32 ( AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST ) ,
141
+ reset . rstc_base );
136
142
137
143
return NOTIFY_DONE ;
138
144
}
139
145
140
146
static int samx7_restart (struct notifier_block * this , unsigned long mode ,
141
147
void * cmd )
142
148
{
143
- writel (AT91_RSTC_KEY | AT91_RSTC_PROCRST , at91_rstc_base );
149
+ writel (cpu_to_le32 (AT91_RSTC_KEY | AT91_RSTC_PROCRST ),
150
+ reset .rstc_base );
151
+
144
152
return NOTIFY_DONE ;
145
153
}
146
154
147
155
static void __init at91_reset_status (struct platform_device * pdev )
148
156
{
149
157
const char * reason ;
150
- u32 reg = readl (at91_rstc_base + AT91_RSTC_SR );
158
+ u32 reg = readl (reset . rstc_base + AT91_RSTC_SR );
151
159
152
160
switch ((reg & AT91_RSTC_RSTTYP ) >> 8 ) {
153
161
case RESET_TYPE_GENERAL :
@@ -208,8 +216,8 @@ static int __init at91_reset_probe(struct platform_device *pdev)
208
216
struct device_node * np ;
209
217
int ret , idx = 0 ;
210
218
211
- at91_rstc_base = of_iomap (pdev -> dev .of_node , 0 );
212
- if (!at91_rstc_base ) {
219
+ reset . rstc_base = of_iomap (pdev -> dev .of_node , 0 );
220
+ if (!reset . rstc_base ) {
213
221
dev_err (& pdev -> dev , "Could not map reset controller address\n" );
214
222
return - ENODEV ;
215
223
}
0 commit comments