Created
August 28, 2014 19:29
-
-
Save nl5887/e64d13546963e6039afb to your computer and use it in GitHub Desktop.
Flashrom support for Winbond W25Q256 (0x4019)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: flashchips.c | |
=================================================================== | |
--- flashchips.c (revision 1846) | |
+++ flashchips.c (working copy) | |
@@ -13137,7 +13137,40 @@ | |
.read = spi_chip_read, | |
.voltage = {2700, 3600}, | |
}, | |
+ { | |
+ .vendor = "Winbond", | |
+ .name = "W25Q256.V", | |
+ .bustype = BUS_SPI, | |
+ .manufacture_id = WINBOND_NEX_ID, | |
+ .model_id = WINBOND_NEX_W25Q256_V, | |
+ .total_size = 32678, | |
+ .page_size = 256, | |
+ /* supports SFDP */ | |
+ /* OTP: 1024B total, 256B reserved; read 0x48; write 0x42, erase 0x44, read ID 0x4B */ | |
+ .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP, | |
+ .tested = TEST_OK_PREW, | |
+ .probe = probe_spi_rdid, | |
+ .probe_timing = TIMING_ZERO, | |
+ .block_erasers = | |
+ { | |
+ { | |
+ .eraseblocks = { {64 * 1024 - 180, 512} }, | |
+ .block_erase = spi_block_erase_52, | |
+ }, { | |
+ .eraseblocks = { {32 * 1024 * 1024 - 92160, 1} }, | |
+ .block_erase = spi_block_erase_60, | |
+ }, { | |
+ .eraseblocks = { {32 * 1024 * 1024 - 92160, 1} }, | |
+ .block_erase = spi_block_erase_c7, | |
+ } | |
+ }, | |
+ .printlock = spi_prettyprint_status_register_plain, /* TODO: improve */ | |
+ .unlock = spi_disable_blockprotect, | |
+ .write = spi_chip_write_256, | |
+ .read = spi_chip_read, | |
+ .voltage = {1700, 1950}, /* Fast read (0x0B) and multi I/O supported */ | |
+ }, | |
{ | |
.vendor = "Winbond", | |
.name = "W25Q20.W", | |
Index: spi.c | |
=================================================================== | |
--- spi.c (revision 1846) | |
+++ spi.c (working copy) | |
@@ -103,18 +103,18 @@ | |
int spi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start, | |
unsigned int len) | |
{ | |
- unsigned int addrbase = 0; | |
+ unsigned long long addrbase = 0; | |
/* Check if the chip fits between lowest valid and highest possible | |
* address. Highest possible address with the current SPI implementation | |
- * means 0xffffff, the highest unsigned 24bit number. | |
+ * means 0xffffffff, the highest unsigned 24bit number. | |
*/ | |
addrbase = spi_get_valid_read_addr(flash); | |
- if (addrbase + flash->chip->total_size * 1024 > (1 << 24)) { | |
+ if (addrbase + flash->chip->total_size * 1024 > (1ULL << 32)) { | |
msg_perr("Flash chip size exceeds the allowed access window. "); | |
msg_perr("Read will probably fail.\n"); | |
/* Try to get the best alignment subject to constraints. */ | |
- addrbase = (1 << 24) - flash->chip->total_size * 1024; | |
+ addrbase = (1ULL << 32) - flash->chip->total_size * 1024; | |
} | |
/* Check if alignment is native (at least the largest power of two which | |
* is a factor of the mapped size of the chip). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
spi.c fix is courtesy of https://gist.github.com/devicenull/8735650