From 0429ee9f8fd75dd99b4085c4dde802de166bbe93 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 6 Aug 2018 12:23:50 +0200 Subject: [PATCH] soc/software/bios: add reboot command --- litex/soc/software/bios/main.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/litex/soc/software/bios/main.c b/litex/soc/software/bios/main.c index 4d06d1310..73613a0e4 100644 --- a/litex/soc/software/bios/main.c +++ b/litex/soc/software/bios/main.c @@ -313,6 +313,9 @@ static void help(void) puts("rcsr - read processor CSR"); puts("wcsr - write processor CSR"); #endif +#ifdef CSR_CTRL_BASE + puts("reboot - reset processor"); +#endif #ifdef CSR_ETHMAC_BASE puts("netboot - boot via TFTP"); #endif @@ -344,6 +347,13 @@ static char *get_token(char **str) return d; } +#ifdef CSR_CTRL_BASE +static void reboot(void) +{ + ctrl_reset_write(1); +} +#endif + static void do_command(char *c) { char *token; @@ -359,7 +369,9 @@ static void do_command(char *c) #ifdef L2_SIZE else if(strcmp(token, "flushl2") == 0) flush_l2_cache(); #endif - +#ifdef CSR_CTRL_BASE + else if(strcmp(token, "reboot") == 0) reboot(); +#endif #ifdef FLASH_BOOT_ADDRESS else if(strcmp(token, "flashboot") == 0) flashboot(); #endif