firmware/main: Use defines for misc CSR

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2023-11-09 22:06:18 +01:00
parent aa3768a257
commit 7e50002216
1 changed files with 5 additions and 2 deletions

View File

@ -13,14 +13,17 @@
struct wb_misc {
uint32_t warmboot;
uint32_t csr;
} __attribute__((packed,aligned(4)));
#define MISC_CSR_WARMBOOT_NOW (1 << 2)
#define MISC_CSR_WARMBOOT_SEL(x) (x)
static volatile struct wb_misc * const misc_regs = (void*)(MISC_BASE);
void
reboot(int fw)
{
misc_regs->warmboot = (1 << 2) | (fw << 0);
misc_regs->csr = MISC_CSR_WARMBOOT_NOW | MISC_CSR_WARMBOOT_SEL(fw);
}