summaryrefslogtreecommitdiff
path: root/it87spi.c
diff options
context:
space:
mode:
authorhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2010-10-27 22:07:11 +0000
committerhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2010-10-27 22:07:11 +0000
commit13db454e0514b749ec93c6a66cff91f3e3a0c909 (patch)
tree5b8d6ec01a60208129a46e24a33ab0c18f9012c9 /it87spi.c
parentf37c81a74401feed6ab21763af647248abded21e (diff)
downloadflashrom-13db454e0514b749ec93c6a66cff91f3e3a0c909.tar.gz
Fix internal offset calculations for SPI BYTE PROGRAM and SPI AAI PROGRAM.
The bug was invisible so far because we always started at offset 0. The pending partial write patch uses nonzero start offsets and trips over this bug. Clarify a few comments in IT87 SPI. Thanks to Idwer Vollering for reporting write breakage with my latest partial write patch. This should fix the underlying problem. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Idwer Vollering <vidwer@gmail.com> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@1217 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'it87spi.c')
-rw-r--r--it87spi.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/it87spi.c b/it87spi.c
index f06efba..fb1448a 100644
--- a/it87spi.c
+++ b/it87spi.c
@@ -339,7 +339,10 @@ int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, int start,
{
/*
* IT8716F only allows maximum of 512 kb SPI chip size for memory
- * mapped access. It also can't write more than 1+3+256 bytes at once.
+ * mapped access. It also can't write more than 1+3+256 bytes at once,
+ * so page_size > 256 bytes needs a fallback.
+ * FIXME: Split too big page writes into chunks IT87* can handle instead
+ * of degrading to single-byte program.
*/
if ((programmer == PROGRAMMER_IT87SPI) ||
(flash->total_size * 1024 > 512 * 1024) ||
@@ -349,9 +352,8 @@ int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, int start,
int lenhere;
if (start % flash->page_size) {
- /* start to the end of the page or start + len,
- * whichever is smaller. Page length is hardcoded to
- * 256 bytes (IT87 SPI hardware limitation).
+ /* start to the end of the page or to start + len,
+ * whichever is smaller.
*/
lenhere = min(len, flash->page_size - start % flash->page_size);
spi_chip_write_1(flash, buf, start, lenhere);
@@ -360,7 +362,6 @@ int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, int start,
buf += lenhere;
}
- /* FIXME: Handle chips which have max writechunk size >1 and <256. */
while (len >= flash->page_size) {
it8716f_spi_page_program(flash, buf, start);
start += flash->page_size;