From patchwork Wed Mar 19 11:10:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Micron N25Q512, or at least its lower quarter Date: Wed, 19 Mar 2014 11:10:10 -0000 From: David Madl X-Patchwork-Id: 4124 Message-Id: <53297B12.60200@abanbytes.eu> To: Stefan Tauner Cc: flashrom@flashrom.org Here's a patch on top of flashrom v0.9.7, SVN r1767. On 19.03.2014 01:50, Stefan Tauner wrote: > On Wed, 19 Mar 2014 01:00:41 +0100 > David Madl wrote: > >> Hi, >> >> I have a new prototype development board here, with an 512 MBit Flash >> chip, Micron N25Q512 (precise type is N25Q512A11G40). I managed to >> create a config [1] that reads fine, but fails to write [2]. >> >> I understand that flashrom cannot access chips larger than 16 MBytes, >> but the chip should still be able to work in 3-byte addressing mode for >> the lower 16 MBytes. This is what I have created in flashchips.c (copy & >> pasted, then adapted from the part N25Q128, assuming with a bit of good >> faith and some datasheet comparison that they should behave alike). >> >> Has anyone ever successfully written to a small part of a 4-byte flash chip? >> […] >> Erasing and writing flash chip... Trying erase function 0... >> 0x000000-0x000fff:W, 0x001000-0x001fff:E >> FAILED at 0x00001000! Expected=0xff, Found=0x00, failed byte count from >> 0x00001000-0x00001fff: 0x1000 >> ERASE FAILED! >> Reading current flash chip contents... >> done. Looking for another erase function. >> Trying erase function 1... 0x000000-0x00ffff:E >> FAILED at 0x00000000! Expected=0xff, Found=0x00, failed byte count from >> 0x00000000-0x0000ffff: 0x10000 >> ERASE FAILED! >> Reading current flash chip contents... >> done. Looking for another erase function. >> Trying erase function 2... 0x000000-0xffffff:E >> FAILED at 0x00000000! Expected=0xff, Found=0x00, failed byte count from >> 0x00000000-0x00ffffff: 0x1000000 >> ERASE FAILED! >> Looking for another erase function. >> No usable erase functions left. >> FAILED! >> Uh oh. Erase/write failed. Checking if anything changed. >> Your flash chip is in an unknown state. >> Please report this on IRC at chat.freenode.net (channel #flashrom) or >> mail flashrom@flashrom.org, thanks! > Hi David, > > it is almost 2am here, so I wont write a long reply. > The log looks to me as if you were not connecting the write protection > pin correctly. Maybe that's all what's wrong :) > > PS: It would probably be worthwhile for you to look at how patch files > work and how you can create them. That eases the communication of > changes dramatically. > Index: flashchips.c =================================================================== --- flashchips.c (revision 1767) +++ flashchips.c (working copy) @@ -7606,6 +7606,43 @@ }, { + .vendor = "Micron/Numonyx/ST", + .name = "N25Q512..3E", /* ..3E = 3V, uniform 64KB/4KB blocks/sectors */ + .bustype = BUS_SPI, + .manufacture_id = ST_ID, + .model_id = ST_N25Q512__3E, +/* .total_size = 65536,*/ + .total_size = 16384, + .page_size = 256, + /* supports SFDP */ + /* OTP: 64B total; read 0x4B, write 0x42 */ + .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP, + .tested = TEST_OK_PREW, + .probe = probe_spi_rdid, + .probe_timing = TIMING_ZERO, + .block_erasers = { + { + /*.eraseblocks = { {4 * 1024, 16384 } },*/ + .eraseblocks = { {4 * 1024, 4096 } }, + .block_erase = spi_block_erase_20, + }, { + /*.eraseblocks = { {64 * 1024, 1024} },*/ + .eraseblocks = { {64 * 1024, 256} }, + .block_erase = spi_block_erase_d8, + }, { + /*.eraseblocks = { {65536 * 1024, 1} },*/ + .eraseblocks = { {16384 * 1024, 1} }, + .block_erase = spi_block_erase_c7, + } + }, + .printlock = spi_prettyprint_status_register_n25q, /* TODO: config, lock, flag regs */ + .unlock = spi_disable_blockprotect_n25q, /* TODO: per 64kB sector lock registers */ + .write = spi_chip_write_256, /* Multi I/O supported */ + .read = spi_chip_read, /* Fast read (0x0B) and multi I/O supported */ + .voltage = {2700, 3600}, + }, + + { .vendor = "MoselVitelic", .name = "V29C51000B", .bustype = BUS_PARALLEL,