firmware/ice40-riscv: Create a reboot() function

instead of direct access to registers.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Iaee092c5ef651f0350b3f46386ed79fdbe06afcb
This commit is contained in:
Sylvain Munaut 2020-10-29 13:19:05 +01:00
parent 4ea7d27764
commit 46d6b412f5
6 changed files with 19 additions and 4 deletions

View File

@ -55,8 +55,7 @@ boot_dfu(void)
usb_disconnect();
/* Boot firmware */
volatile uint32_t *boot = (void*)MISC_BASE;
*boot = (1 << 2) | (1 << 0);
reboot(1);
}
void

View File

@ -35,3 +35,10 @@ e1_tick_read(uint16_t *ticks)
ticks[0] = (v ) & 0xffff;
ticks[1] = (v >> 16) & 0xffff;
}
void
reboot(int fw)
{
misc_regs->warmboot = (1 << 2) | (fw << 0);
}

View File

@ -13,3 +13,5 @@
void vio_set(unsigned value);
void e1_tick_read(uint16_t *ticks);
void reboot(int fw);

View File

@ -53,8 +53,7 @@ boot_dfu(void)
usb_disconnect();
/* Boot firmware */
volatile uint32_t *boot = (void*)(MISC_BASE);
*boot = (1 << 2) | (1 << 0);
reboot(1);
}
void

View File

@ -56,3 +56,9 @@ e1_tick_read(void)
{
return misc_regs->e1_tick[0].tx;
}
void
reboot(int fw)
{
misc_regs->warmboot = (1 << 2) | (fw << 0);
}

View File

@ -28,3 +28,5 @@ void pdm_set(int chan, bool enable, unsigned value, bool normalize);
void e1_led_set(bool enable, uint8_t cfg);
uint16_t e1_tick_read(void);
void reboot(int fw);