Skip to content

Commit 51aa7d4

Browse files
claudiubezneasre
authored andcommitted
power: reset: at91-reset: keep only one reset function
Keep only one reset function. With this, notifier_call member of struct at91_reset_data could be removed. Signed-off-by: Claudiu Beznea <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent fcd0532 commit 51aa7d4

File tree

1 file changed

+3
-49
lines changed

1 file changed

+3
-49
lines changed

drivers/power/reset/at91-reset.c

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ enum reset_type {
5050
};
5151

5252
struct at91_reset_data {
53-
int (*notifier_call)(struct notifier_block *this, unsigned long mode,
54-
void *cmd);
5553
u32 args;
5654
};
5755

@@ -69,38 +67,8 @@ struct at91_reset {
6967
* reset register it can be left driving the data bus and
7068
* killing the chance of a subsequent boot from NAND
7169
*/
72-
static int at91sam9260_restart(struct notifier_block *this, unsigned long mode,
73-
void *cmd)
74-
{
75-
struct at91_reset *reset = container_of(this, struct at91_reset, nb);
76-
77-
asm volatile(
78-
/* Align to cache lines */
79-
".balign 32\n\t"
80-
81-
/* Disable SDRAM accesses */
82-
"str %2, [%0, #" __stringify(AT91_SDRAMC_TR) "]\n\t"
83-
84-
/* Power down SDRAM */
85-
"str %3, [%0, %5]\n\t"
86-
87-
/* Reset CPU */
88-
"str %4, [%1, #" __stringify(AT91_RSTC_CR) "]\n\t"
89-
90-
"b .\n\t"
91-
:
92-
: "r" (reset->ramc_base[0]),
93-
"r" (reset->rstc_base),
94-
"r" (1),
95-
"r" cpu_to_le32(AT91_SDRAMC_LPCB_POWER_DOWN),
96-
"r" (reset->args),
97-
"r" (reset->ramc_lpr));
98-
99-
return NOTIFY_DONE;
100-
}
101-
102-
static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
103-
void *cmd)
70+
static int at91_reset(struct notifier_block *this, unsigned long mode,
71+
void *cmd)
10472
{
10573
struct at91_reset *reset = container_of(this, struct at91_reset, nb);
10674

@@ -137,16 +105,6 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
137105
return NOTIFY_DONE;
138106
}
139107

140-
static int sama5d3_restart(struct notifier_block *this, unsigned long mode,
141-
void *cmd)
142-
{
143-
struct at91_reset *reset = container_of(this, struct at91_reset, nb);
144-
145-
writel(reset->args, reset->rstc_base);
146-
147-
return NOTIFY_DONE;
148-
}
149-
150108
static void __init at91_reset_status(struct platform_device *pdev,
151109
void __iomem *base)
152110
{
@@ -199,22 +157,18 @@ static const struct of_device_id at91_ramc_of_match[] = {
199157
};
200158

201159
static const struct at91_reset_data at91sam9260_reset_data = {
202-
.notifier_call = at91sam9260_restart,
203160
.args = AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST,
204161
};
205162

206163
static const struct at91_reset_data at91sam9g45_reset_data = {
207-
.notifier_call = at91sam9g45_restart,
208164
.args = AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST,
209165
};
210166

211167
static const struct at91_reset_data sama5d3_reset_data = {
212-
.notifier_call = sama5d3_restart,
213168
.args = AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST,
214169
};
215170

216171
static const struct at91_reset_data samx7_reset_data = {
217-
.notifier_call = sama5d3_restart,
218172
.args = AT91_RSTC_KEY | AT91_RSTC_PROCRST,
219173
};
220174

@@ -277,7 +231,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
277231

278232
match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
279233
reset_data = match->data;
280-
reset->nb.notifier_call = reset_data->notifier_call;
234+
reset->nb.notifier_call = at91_reset;
281235
reset->nb.priority = 192;
282236
reset->args = reset_data->args;
283237

0 commit comments

Comments
 (0)