lib: sbi: Simplify system reset platform operations

Instead of having system_reset_check() and system_reset() callbacks
in platform operations, it will be much simpler for reset driver to
directly register these operations as a device to the sbi_system
implementation.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
Anup Patel
2021-04-22 11:53:32 +05:30
committed by Anup Patel
parent dc39c7b630
commit 043d088e39
17 changed files with 148 additions and 171 deletions

View File

@@ -7,8 +7,10 @@
#include <sbi/sbi_bitops.h>
#include <sbi/sbi_hart.h>
#include <sbi/sbi_scratch.h>
#include <sbi/sbi_system.h>
#include <sbi_utils/fdt/fdt_helper.h>
#include <sbi_utils/reset/fdt_reset.h>
#include "fdt_reset_thead.h"
struct custom_csr custom_csr[MAX_CUSTOM_CSR];
@@ -37,6 +39,22 @@ static void clone_csrs(int cnt)
}
}
static int thead_system_reset_check(u32 type, u32 reason)
{
return 1;
}
static void thead_system_reset(u32 type, u32 reason)
{
ebreak();
}
static struct sbi_system_reset_device thead_reset = {
.name = "thead_reset",
.system_reset_check = thead_system_reset_check,
.system_reset = thead_system_reset
};
extern void __thead_pre_start_warm(void);
static int thead_reset_init(void *fdt, int nodeoff,
const struct fdt_match *match)
@@ -106,19 +124,11 @@ static int thead_reset_init(void *fdt, int nodeoff,
}
}
sbi_system_reset_set_device(&thead_reset);
return 0;
}
int thead_system_reset_check(u32 type, u32 reason)
{
return 1;
}
void thead_system_reset(u32 type, u32 reason)
{
ebreak();
}
static const struct fdt_match thead_reset_match[] = {
{ .compatible = "thead,reset-sample" },
{ },
@@ -126,7 +136,5 @@ static const struct fdt_match thead_reset_match[] = {
struct fdt_reset fdt_reset_thead = {
.match_table = thead_reset_match,
.init = thead_reset_init,
.system_reset_check = thead_system_reset_check,
.system_reset = thead_system_reset
.init = thead_reset_init
};