Stefan Reinauer has uploaded this change for review. ( 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 --- M em100.c M em100.h M firmware.c 3 files changed, 20 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/44/37344/1
diff --git a/em100.c b/em100.c index 492af4b..578707d 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 == 0xff ? "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 == 0xff ? "DP" : "EM", em100.serialno); em100_detach(&em100); count++; @@ -924,7 +927,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 == 0xff ? "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 3d9cdc8..d48e52b 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");