icE1usb fw: Use green per-port LED to indicate alignment status

Whenever Rx is aligned, the green LED is permanently on.
Whenever Rx is not aligned, the green LED is blinking.

What's missing is to check for E1 clock ticks and turn the LED off
completely if there are no clock ticks.

Change-Id: I42d53544858dbbbae5206d9a62b08672966c9ebf
diff --git a/firmware/ice40-riscv/icE1usb/misc.c b/firmware/ice40-riscv/icE1usb/misc.c
index dca126a..3117be9 100644
--- a/firmware/ice40-riscv/icE1usb/misc.c
+++ b/firmware/ice40-riscv/icE1usb/misc.c
@@ -10,6 +10,7 @@
 
 #include "config.h"
 #include "misc.h"
+#include "e1.h"
 
 
 struct misc {
@@ -51,6 +52,24 @@
 	misc_regs->e1_led = (enable ? 0x100 : 0x000) | cfg;
 }
 
+void
+e1_platform_led_set(uint8_t port, enum e1_platform_led led,
+		    enum e1_platform_led_state state)
+{
+	uint32_t tmp;
+	unsigned int shift;
+
+	if (port >= 2)
+		return;
+
+	shift = 4*port + 2*led;
+
+	tmp = misc_regs->e1_led;
+	tmp &= ~(3 << shift);
+	tmp |= 0x100 | ((state & 3) << shift);
+	misc_regs->e1_led = tmp;
+}
+
 uint16_t
 e1_tick_read(void)
 {