On Sat, 27 Jun 2015 17:24:55 -0700 David Hendricks david.hendricks@gmail.com wrote:
Acked-by: David Hendricks dhendrix@chromium.org
Thanks David. I have committed a slightly revised version in r1894 after realising that there are two mistakes in the proposed change.
dediprog_firmwareversion was defined already, it was simply initialized in the hunk below to some (in)sane default. However, this should not happen at all in this patch but a later one.
@@ -45,6 +45,17 @@ static int dediprog_endpoint; #define DEDI_SPI_CMD_PAGEWRITE 0x1 #define DEDI_SPI_CMD_AAIWRITE 0x4
+enum dediprog_leds {
LED_INVALID = -1,
LED_NONE = 0,
LED_PASS = 1 << 0,
LED_BUSY = 1 << 1,
LED_ERROR = 1 << 2,
LED_ALL = 7,
+};
+static int dediprog_firmwareversion = FIRMWARE_VERSION(0, 0, 0);
#if 0 /* Might be useful for other pieces of code as well. */ static void print_hex(void *buf, size_t len)
The else path below was simply wrong.
@@ -406,10 +399,10 @@ static int dediprog_spi_write(struct flashctx *flash, const uint8_t *buf, /* Round down. */ bulklen = (len - residue) / chunksize * chunksize; ret = dediprog_spi_bulk_write(flash, buf + residue, chunksize, start + residue, bulklen, dedi_spi_cmd);
if (ret) {
dediprog_set_leds(PASS_OFF|BUSY_OFF|ERROR_ON);
return ret;
}
if (ret)
dediprog_set_leds(LED_ERROR);
else
dediprog_set_leds(LED_PASS); len -= residue + bulklen; if (len) {
This ensures the firmware version is reset at shutdown, but this has nothing to do with the LEDs handling...
@@ -781,6 +774,8 @@ static int dediprog_shutdown(void *data) return 1; #endif
dediprog_firmwareversion = FIRMWARE_VERSION(0, 0, 0);
/* URB 28. Command Set SPI Voltage to 0. */ if (dediprog_set_spi_voltage(0x0)) return 1;