forked from Mirrors/opensbi
		
	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:
		@@ -20,10 +20,6 @@ struct platform_override {
 | 
			
		||||
	int (*final_init)(bool cold_boot, const struct fdt_match *match);
 | 
			
		||||
	void (*early_exit)(const struct fdt_match *match);
 | 
			
		||||
	void (*final_exit)(const struct fdt_match *match);
 | 
			
		||||
	int (*system_reset_check)(u32 reset_type, u32 reset_reason,
 | 
			
		||||
				  const struct fdt_match *match);
 | 
			
		||||
	void (*system_reset)(u32 reset_type, u32 reset_reason,
 | 
			
		||||
			     const struct fdt_match *match);
 | 
			
		||||
	int (*fdt_fixup)(void *fdt, const struct fdt_match *match);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -184,26 +184,6 @@ static u64 generic_tlbr_flush_limit(void)
 | 
			
		||||
	return SBI_PLATFORM_TLB_RANGE_FLUSH_LIMIT_DEFAULT;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int generic_system_reset_check(u32 reset_type, u32 reset_reason)
 | 
			
		||||
{
 | 
			
		||||
	if (generic_plat && generic_plat->system_reset_check)
 | 
			
		||||
		return generic_plat->system_reset_check(reset_type,
 | 
			
		||||
							reset_reason,
 | 
			
		||||
							generic_plat_match);
 | 
			
		||||
	return fdt_system_reset_check(reset_type, reset_reason);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void generic_system_reset(u32 reset_type, u32 reset_reason)
 | 
			
		||||
{
 | 
			
		||||
	if (generic_plat && generic_plat->system_reset) {
 | 
			
		||||
		generic_plat->system_reset(reset_type, reset_reason,
 | 
			
		||||
					   generic_plat_match);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fdt_system_reset(reset_type, reset_reason);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const struct sbi_platform_operations platform_ops = {
 | 
			
		||||
	.early_init		= generic_early_init,
 | 
			
		||||
	.final_init		= generic_final_init,
 | 
			
		||||
@@ -218,8 +198,6 @@ const struct sbi_platform_operations platform_ops = {
 | 
			
		||||
	.get_tlbr_flush_limit	= generic_tlbr_flush_limit,
 | 
			
		||||
	.timer_init		= fdt_timer_init,
 | 
			
		||||
	.timer_exit		= fdt_timer_exit,
 | 
			
		||||
	.system_reset_check	= generic_system_reset_check,
 | 
			
		||||
	.system_reset		= generic_system_reset,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct sbi_platform platform = {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user