Skip to content

Commit b2a1661

Browse files
claudiubezneasre
authored andcommitted
power: reset: at91-reset: introduce struct at91_reset
Introduce struct at91_reset intended to keep all the at91 reset controller data. Signed-off-by: Claudiu Beznea <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 9c80662 commit b2a1661

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

drivers/power/reset/at91-reset.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ enum reset_type {
4949
RESET_TYPE_ULP2 = 8,
5050
};
5151

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];
5359
static struct clk *sclk;
5460

5561
/*
@@ -76,7 +82,7 @@ static int at91sam9260_restart(struct notifier_block *this, unsigned long mode,
7682
"b .\n\t"
7783
:
7884
: "r" (at91_ramc_base[0]),
79-
"r" (at91_rstc_base),
85+
"r" (reset.rstc_base),
8086
"r" (1),
8187
"r" cpu_to_le32(AT91_SDRAMC_LPCB_POWER_DOWN),
8288
"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,
119125
:
120126
: "r" (at91_ramc_base[0]),
121127
"r" (at91_ramc_base[1]),
122-
"r" (at91_rstc_base),
128+
"r" (reset.rstc_base),
123129
"r" (1),
124130
"r" cpu_to_le32(AT91_DDRSDRC_LPCB_POWER_DOWN),
125131
"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,
131137
static int sama5d3_restart(struct notifier_block *this, unsigned long mode,
132138
void *cmd)
133139
{
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);
136142

137143
return NOTIFY_DONE;
138144
}
139145

140146
static int samx7_restart(struct notifier_block *this, unsigned long mode,
141147
void *cmd)
142148
{
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+
144152
return NOTIFY_DONE;
145153
}
146154

147155
static void __init at91_reset_status(struct platform_device *pdev)
148156
{
149157
const char *reason;
150-
u32 reg = readl(at91_rstc_base + AT91_RSTC_SR);
158+
u32 reg = readl(reset.rstc_base + AT91_RSTC_SR);
151159

152160
switch ((reg & AT91_RSTC_RSTTYP) >> 8) {
153161
case RESET_TYPE_GENERAL:
@@ -208,8 +216,8 @@ static int __init at91_reset_probe(struct platform_device *pdev)
208216
struct device_node *np;
209217
int ret, idx = 0;
210218

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) {
213221
dev_err(&pdev->dev, "Could not map reset controller address\n");
214222
return -ENODEV;
215223
}

0 commit comments

Comments
 (0)