David Hendricks has uploaded this change for review.
WIP: dediprog: implement updated command spec
This is a work-in-progress to update the command spec for Dediprog
SF100/SF600 programmers. For now the new bulk read and write command
packet format is hacked in and will be cleaned up once things are
working and I get clarification about which firmware versions implement
them.
Change-Id: I1a53c143948ec40d40433621891a2871d8815f2f
Signed-off-by: David Hendricks <dhendricks@fb.com>
---
M dediprog.c
1 file changed, 14 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/36/23836/1
diff --git a/dediprog.c b/dediprog.c
index 2f5b441..fce067a 100644
--- a/dediprog.c
+++ b/dediprog.c
@@ -387,7 +387,7 @@
return 0;
}
-static void fill_rw_cmd_payload(uint8_t *data_packet, unsigned int count, uint8_t dedi_spi_cmd, unsigned int *value, unsigned int *idx, unsigned int start) {
+static void fill_rw_cmd_payload(uint8_t *data_packet, unsigned int count, uint8_t dedi_spi_cmd, unsigned int *value, unsigned int *idx, unsigned int start, int is_read) {
/* First 5 bytes are common in both generations. */
data_packet[0] = count & 0xff;
data_packet[1] = (count >> 8) & 0xff;
@@ -402,6 +402,15 @@
data_packet[7] = (start >> 8) & 0xff;
data_packet[8] = (start >> 16) & 0xff;
data_packet[9] = (start >> 24) & 0xff;
+ if (is_read) {
+ data_packet[10] = 0x00;
+ data_packet[11] = 0x00;
+ } else {
+ data_packet[10] = 0x00;
+ data_packet[11] = 0x00;
+ data_packet[12] = 0x01;
+ data_packet[13] = 0x00;
+ }
} else {
*value = start % 0x10000;
*idx = start / 0x10000;
@@ -435,9 +444,9 @@
return 0;
/* Command packet size of protocols: new 10 B, old 5 B. */
- uint8_t data_packet[is_new_prot() ? 10 : 5];
+ uint8_t data_packet[is_new_prot() ? 12 : 5];
unsigned int value, idx;
- fill_rw_cmd_payload(data_packet, count, READ_MODE_STD, &value, &idx, start);
+ fill_rw_cmd_payload(data_packet, count, READ_MODE_STD, &value, &idx, start, 1);
int ret = dediprog_write(CMD_READ, value, idx, data_packet, sizeof(data_packet));
if (ret != sizeof(data_packet)) {
@@ -577,9 +586,9 @@
return 0;
/* Command packet size of protocols: new 10 B, old 5 B. */
- uint8_t data_packet[is_new_prot() ? 10 : 5];
+ uint8_t data_packet[is_new_prot() ? 14 : 5];
unsigned int value, idx;
- fill_rw_cmd_payload(data_packet, count, dedi_spi_cmd, &value, &idx, start);
+ fill_rw_cmd_payload(data_packet, count, dedi_spi_cmd, &value, &idx, start, 0);
int ret = dediprog_write(CMD_WRITE, value, idx, data_packet, sizeof(data_packet));
if (ret != sizeof(data_packet)) {
msg_perr("Command Write SPI Bulk failed, %s!\n", libusb_error_name(ret));
To view, visit change 23836. To unsubscribe, or for help writing mail filters, visit settings.