Re: [flashrom] [PATCH 1/5] dediprog: Invert the LED polarity in the code.
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;
-- Kind regards/Mit freundlichen Grüßen, Stefan Tauner
Dear Stefan, I understand you are very busy. The flashrom software is wonderful for helping people like me to try to flash a bios chip or efi chip. In the last few days I was trying to read a chip Macronix MX25L6473E. I managed getting the v0.9.8 working in a linux machine, but somehow the buspirate or the flashrom said "No eeprom found", I have tried a lots of ways, not successful. However if I use my windows computer which has flashrom v0.9.6.1, the flashrom said "found Generic chip (unknown SPI chip)." So I assume the wiring of the chip to the buspirate is ok. I suppose that I will need the v0.9.8 for windows version to read this chip. however the link Snapshots on http://ra.openbios.org/~idwer/flashrom/mingw does not work anymore. Can you please email me a windows version snapshot for the v0.9.8? Or is there any link I can get a windows version v0.9.8? Any help will be much appreciated. Thank you very much Kind Regards David from Sydney Stefan Tauner wrote:
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_endpo #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;
participants (2)
-
David G ZHAO -
Stefan Tauner