icE1usb fw: Add function to enable/disable E1 led runner

Also don't force enable the runner in the e1_platform_led_set
callback.

Due to GPIO shortage, the E1 leds control are multiplexed with
SPI so this adds a method to temporarely stop the runner so SPI
can be used.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ie671daab5ee5e0b5f58de9d4fef1f0ca7d6d02b6
diff --git a/firmware/ice40-riscv/icE1usb/misc.c b/firmware/ice40-riscv/icE1usb/misc.c
index 4b32fcd..bd9198a 100644
--- a/firmware/ice40-riscv/icE1usb/misc.c
+++ b/firmware/ice40-riscv/icE1usb/misc.c
@@ -47,6 +47,18 @@
 
 
 void
+e1_led_run(void)
+{
+	misc_regs->e1_led |= 0x100;
+}
+
+void
+e1_led_pause(void)
+{
+	misc_regs->e1_led &= 0xff;
+}
+
+void
 e1_led_set(bool enable, uint8_t cfg)
 {
 	misc_regs->e1_led = (enable ? 0x100 : 0x000) | cfg;
@@ -66,10 +78,11 @@
 
 	tmp = misc_regs->e1_led;
 	tmp &= ~(3 << shift);
-	tmp |= 0x100 | ((state & 3) << shift);
+	tmp |= ((state & 3) << shift);
 	misc_regs->e1_led = tmp;
 }
 
+
 uint16_t
 e1_tick_read(int port)
 {
diff --git a/firmware/ice40-riscv/icE1usb/misc.h b/firmware/ice40-riscv/icE1usb/misc.h
index dac5730..b4baef1 100644
--- a/firmware/ice40-riscv/icE1usb/misc.h
+++ b/firmware/ice40-riscv/icE1usb/misc.h
@@ -26,7 +26,10 @@
 
 void pdm_set(int chan, bool enable, unsigned value, bool normalize);
 
+void e1_led_run(void);
+void e1_led_pause(void);
 void e1_led_set(bool enable, uint8_t cfg);
+
 uint16_t e1_tick_read(int port);
 
 void reboot(int fw);