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");
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/em100/+/37344 )
Change subject: Add support for older EM100Pro ......................................................................
Patch Set 1:
(4 comments)
https://review.coreboot.org/c/em100/+/37344/1/em100.c File em100.c:
https://review.coreboot.org/c/em100/+/37344/1/em100.c@260 PS1, Line 260: 0xff Why this magic number? Isn't it `HWVERSION_EM100PRO_EARLY`?
https://review.coreboot.org/c/em100/+/37344/1/em100.c@502 PS1, Line 502: 0xff Same
https://review.coreboot.org/c/em100/+/37344/1/em100.c@930 PS1, Line 930: Trailing space
https://review.coreboot.org/c/em100/+/37344/1/em100.c@931 PS1, Line 931: 0xff Another
Hello Angel Pons, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/em100/+/37344
to look at the new patch set (#2).
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, 21 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/44/37344/2
Stefan Reinauer has posted comments on this change. ( https://review.coreboot.org/c/em100/+/37344 )
Change subject: Add support for older EM100Pro ......................................................................
Patch Set 2:
(4 comments)
https://review.coreboot.org/c/em100/+/37344/1/em100.c File em100.c:
https://review.coreboot.org/c/em100/+/37344/1/em100.c@260 PS1, Line 260: 0xff
Why this magic number? Isn't it `HWVERSION_EM100PRO_EARLY`?
Done
https://review.coreboot.org/c/em100/+/37344/1/em100.c@502 PS1, Line 502: 0xff
Same
Done
https://review.coreboot.org/c/em100/+/37344/1/em100.c@930 PS1, Line 930:
Trailing space
Done
https://review.coreboot.org/c/em100/+/37344/1/em100.c@931 PS1, Line 931: 0xff
Another
Done
David Hendricks has posted comments on this change. ( https://review.coreboot.org/c/em100/+/37344 )
Change subject: Add support for older EM100Pro ......................................................................
Patch Set 2: Code-Review+2
(1 comment)
https://review.coreboot.org/c/em100/+/37344/2/em100.c File em100.c:
https://review.coreboot.org/c/em100/+/37344/2/em100.c@921 PS2, Line 921: em100.hwversion == HWVERSION_EM100PRO_EARLY ? "DP" : "EM", Nit: Create a macro for this since the same logic is used in a couple other places in this file? Then again it might be overkill for now... Up to you.
Stefan Reinauer has posted comments on this change. ( https://review.coreboot.org/c/em100/+/37344 )
Change subject: Add support for older EM100Pro ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/em100/+/37344/2/em100.c File em100.c:
https://review.coreboot.org/c/em100/+/37344/2/em100.c@921 PS2, Line 921: em100.hwversion == HWVERSION_EM100PRO_EARLY ? "DP" : "EM",
Nit: Create a macro for this since the same logic is used in a couple other places in this file? The […]
Hm. Let me do a follow-up
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");
Stefan Reinauer has posted comments on this change. ( https://review.coreboot.org/c/em100/+/37344 )
Change subject: Add support for older EM100Pro ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/em100/+/37344/2/em100.c File em100.c:
https://review.coreboot.org/c/em100/+/37344/2/em100.c@921 PS2, Line 921: em100.hwversion == HWVERSION_EM100PRO_EARLY ? "DP" : "EM",
Hm. […]
Actually not worth it, because the occurrence split between em100. and em100->
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/em100/+/37344 )
Change subject: Add support for older EM100Pro ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/em100/+/37344/2/em100.c File em100.c:
https://review.coreboot.org/c/em100/+/37344/2/em100.c@921 PS2, Line 921: em100.hwversion == HWVERSION_EM100PRO_EARLY ? "DP" : "EM",
Actually not worth it, because the occurrence split between em100. […]
maaaybe:
char *version_prefix(uint8_t hwversion) { return hwversion == HWVERSION_EM100PRO_EARLY ? "DP" : "EM"; }