Stefan Reinauer has submitted this change. ( https://review.coreboot.org/c/em100/+/37344 )
Change subject: Add support for older EM100Pro ......................................................................
Add support for older EM100Pro
These have hardware version 0xff but are otherwise version 4. Their serial numbers start with DP instead of EM.
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Change-Id: I18f19d83b515c4e740f1efec07d49c1ceb2373ec Reviewed-on: https://review.coreboot.org/c/em100/+/37344 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: David Hendricks david.hendricks@gmail.com --- M em100.c M em100.h M firmware.c 3 files changed, 21 insertions(+), 7 deletions(-)
Approvals: build bot (Jenkins): Verified David Hendricks: Looks good to me, approved
diff --git a/em100.c b/em100.c index 682f3a5..6d7fce6 100644 --- a/em100.c +++ b/em100.c @@ -256,7 +256,9 @@ /* Re-read serial number */ get_device_info(em100); if (em100->serialno != 0xffffffff) - printf("New serial number: EM%06d\n", em100->serialno); + printf("New serial number: %s%06d\n", + em100->hwversion == HWVERSION_EM100PRO_EARLY ? "DP" : "EM", + em100->serialno); else printf("New serial number: N.A.\n");
@@ -494,9 +496,10 @@ libusb_get_device_address(dev)); continue; } - printf(" Bus %03d Device %03d: EM100pro EM%06d\n", + printf(" Bus %03d Device %03d: EM100pro %s%06d\n", libusb_get_bus_number(dev), libusb_get_device_address(dev), + em100.hwversion == HWVERSION_EM100PRO_EARLY ? "DP" : "EM", em100.serialno); em100_detach(&em100); count++; @@ -889,7 +892,7 @@ return 1;
- if (em100.hwversion == HWVERSION_EM100PRO) { + if (em100.hwversion == HWVERSION_EM100PRO || em100.hwversion == HWVERSION_EM100PRO_EARLY) { printf("MCU version: %d.%02d\n", em100.mcu >> 8, em100.mcu & 0xff); /* While the Dediprog software for Windows will refuse to work * with 1.8V chips on older FPGA versions, it does not @@ -914,7 +917,8 @@ printf("Hardware version: %u\n", em100.hwversion);
if (em100.serialno != 0xffffffff) - printf("Serial number: EM%06d\n", em100.serialno); + printf("Serial number: %s%06d\n", + em100.hwversion == HWVERSION_EM100PRO_EARLY ? "DP" : "EM", em100.serialno); else printf("Serial number: N.A.\n"); printf("SPI flash database: %s\n", database_version); diff --git a/em100.h b/em100.h index cd0fc91..8870330 100644 --- a/em100.h +++ b/em100.h @@ -39,8 +39,9 @@ } chipdesc;
/* Hardware versions */ -#define HWVERSION_EM100PRO 4 -#define HWVERSION_EM100PRO_G2 6 +#define HWVERSION_EM100PRO_EARLY 0xff +#define HWVERSION_EM100PRO 0x04 +#define HWVERSION_EM100PRO_G2 0x06
#define BULK_SEND_TIMEOUT 5000 /* sentinel value */
diff --git a/firmware.c b/firmware.c index 96e2565..384e3f3 100644 --- a/firmware.c +++ b/firmware.c @@ -37,7 +37,7 @@ * 0x0100100: mcu firmware * 0x01f0000: 4 bytes secret key, 00 padded * 0x01fff00: ff xx yy yy yy yy ff ff - * xx: HW version + * xx: HW version (0xff, 0x04, 0x06) * yy: 4 bytes serial number * * Notes @@ -133,6 +133,7 @@ unsigned char header[0x100];
switch (em100->hwversion) { + case HWVERSION_EM100PRO_EARLY: case HWVERSION_EM100PRO: hdrversion=1; break; @@ -220,6 +221,7 @@ mcu_version[MAX_VERSION_LENGTH + 1];
switch (em100->hwversion) { + case HWVERSION_EM100PRO_EARLY: case HWVERSION_EM100PRO: printf("Detected EM100Pro (original).\n"); break; @@ -263,6 +265,13 @@ } fclose(f);
+ if (em100->hwversion == HWVERSION_EM100PRO_EARLY && (memcmp(fw, "em100pro", 8) != 0 || + memcmp(fw + 0x28, "WFPD", 4) != 0)) { + printf("ERROR: Not an EM100Pro (original) firmware file.\n"); + free(fw); + return 0; + } + if (em100->hwversion == HWVERSION_EM100PRO && (memcmp(fw, "em100pro", 8) != 0 || memcmp(fw + 0x28, "WFPD", 4) != 0)) { printf("ERROR: Not an EM100Pro (original) firmware file.\n");