Commit 51aa7d45 authored by Claudiu.Beznea@microchip.com's avatar Claudiu.Beznea@microchip.com Committed by Sebastian Reichel

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: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent fcd0532f
......@@ -50,8 +50,6 @@ enum reset_type {
};
struct at91_reset_data {
int (*notifier_call)(struct notifier_block *this, unsigned long mode,
void *cmd);
u32 args;
};
......@@ -69,38 +67,8 @@ struct at91_reset {
* reset register it can be left driving the data bus and
* killing the chance of a subsequent boot from NAND
*/
static int at91sam9260_restart(struct notifier_block *this, unsigned long mode,
void *cmd)
{
struct at91_reset *reset = container_of(this, struct at91_reset, nb);
asm volatile(
/* Align to cache lines */
".balign 32\n\t"
/* Disable SDRAM accesses */
"str %2, [%0, #" __stringify(AT91_SDRAMC_TR) "]\n\t"
/* Power down SDRAM */
"str %3, [%0, %5]\n\t"
/* Reset CPU */
"str %4, [%1, #" __stringify(AT91_RSTC_CR) "]\n\t"
"b .\n\t"
:
: "r" (reset->ramc_base[0]),
"r" (reset->rstc_base),
"r" (1),
"r" cpu_to_le32(AT91_SDRAMC_LPCB_POWER_DOWN),
"r" (reset->args),
"r" (reset->ramc_lpr));
return NOTIFY_DONE;
}
static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
void *cmd)
static int at91_reset(struct notifier_block *this, unsigned long mode,
void *cmd)
{
struct at91_reset *reset = container_of(this, struct at91_reset, nb);
......@@ -137,16 +105,6 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
return NOTIFY_DONE;
}
static int sama5d3_restart(struct notifier_block *this, unsigned long mode,
void *cmd)
{
struct at91_reset *reset = container_of(this, struct at91_reset, nb);
writel(reset->args, reset->rstc_base);
return NOTIFY_DONE;
}
static void __init at91_reset_status(struct platform_device *pdev,
void __iomem *base)
{
......@@ -199,22 +157,18 @@ static const struct of_device_id at91_ramc_of_match[] = {
};
static const struct at91_reset_data at91sam9260_reset_data = {
.notifier_call = at91sam9260_restart,
.args = AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST,
};
static const struct at91_reset_data at91sam9g45_reset_data = {
.notifier_call = at91sam9g45_restart,
.args = AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST,
};
static const struct at91_reset_data sama5d3_reset_data = {
.notifier_call = sama5d3_restart,
.args = AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST,
};
static const struct at91_reset_data samx7_reset_data = {
.notifier_call = sama5d3_restart,
.args = AT91_RSTC_KEY | AT91_RSTC_PROCRST,
};
......@@ -277,7 +231,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
reset_data = match->data;
reset->nb.notifier_call = reset_data->notifier_call;
reset->nb.notifier_call = at91_reset;
reset->nb.priority = 192;
reset->args = reset_data->args;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment