summaryrefslogtreecommitdiffstats
path: root/spi.h
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2017-10-14 16:50:43 +0200
committerNico Huber <nico.h@gmx.de>2017-12-28 10:42:49 +0000
commit0ecbacbfca7f919f1780f5062c775d94c7869d81 (patch)
tree2f84f6406d00bc89dd13dfeff3e69f77671a8f9e /spi.h
parenta3140d0b18058610a2694fc3592031a849b0c92a (diff)
downloadflashrom-0ecbacbfca7f919f1780f5062c775d94c7869d81.tar.gz
flashrom-0ecbacbfca7f919f1780f5062c775d94c7869d81.tar.bz2
flashrom-0ecbacbfca7f919f1780f5062c775d94c7869d81.zip
spi25: Use common code for nbyte read/write and block erase
Introduce spi_prepare_address() and spi_write_cmd() and use them in nbyte_program, nbyte_read and block-erase procedures. The former abstracts over the address part of a SPI command to make it exten- sible for 4-byte adressing. spi_write_cmd() implements a WREN + write operation with address and optionally up to 256 bytes of data. It provides a common path to reduce overall redundancy. Also, reduce the polling delay in spi_block_erase_c4() from 500s to 500ms as the comment suggests. Change-Id: Ibc1ae48acbfbd427a30bcd64bdc080dc3dc20503 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/22383 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Diffstat (limited to 'spi.h')
-rw-r--r--spi.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/spi.h b/spi.h
index de5b3be2e..41b02456e 100644
--- a/spi.h
+++ b/spi.h
@@ -24,6 +24,8 @@
* Contains the generic SPI headers
*/
+#define JEDEC_MAX_ADDR_LEN 0x04
+
/* Read Electronic ID */
#define JEDEC_RDID 0x9f
#define JEDEC_RDID_OUTSIZE 0x01