Feel free to cut-n-paste from mails and IRC into this page. Grammar and spelling are not so important.
What numbers do FWH/LPC chips tend to start with?
39/49/50 with 49 being the most common. I've seen 39/49 chips which are parallel but that's ususual. 50 is not very common as model number.
Dirty little secrets why chips are not found although the chipset and the chip are supported
14:10 < carldani> there's a dirty little secret for EEPROMs
14:10 < carldani> actually, two secrets
14:11 < carldani> 1. old parallel flash chips often need a special board enable or the flash chip will ignore any commands (get ID, erase, write)
14:11 < carldani> (that's the case with most boards of PIIX4 or older era, flash chip model names are usually *29*)
14:12 < carldani> 2. modern chipsets usually have more than one flash bus, and some boards even have additional bus translation chips
14:13 < carldani> so for modern boards you have to check the LPC/FWH bus of the chipset, then you check the SPI bus of the chipset (if supported by the chipset and supported by flashrom), then you check the SPI bus of any LPC-to-SPI bus translation chip
14:13 < carldani> on the M2N68, we only probe for LPC chips, but the chip on the board is SPI
14:14 < carldani> that means the SPI chip is either attached to the SPI bus of the chipset (and we don't have a driver for that due to lack of docs)
14:14 < carldani> or it is behind some LPC/SPI translation chip (some of which we support)
14:14 < carldani> the translation test is performed with -p it87spi
14:15 < carldani> as you can see, it's complicated
14:15 < carldani> worst of all, autodetection is basically impossible
The following guidelines are for coreboot, but most of them apply to flashrom as well: http://www.coreboot.org/Development_Guidelines The really important part is about the Signed-off-by procedure.
We try to reuse as much code as possible and create new files only if absolutely needed, so if you find a function somewhere in the tree which already does what you want (even if it is for a totally different chip), please use it. Most chips work fine with probe_jedec even if the command sequence seems to differ at first glance. See also Command set secrets below.
The patch reviews may sound harsh, but please don't get discouraged. We try to merge simple patches after one or two iterations and complicated ones after a maximum of three iterations.
If you introduce new features (not flash chips, but stuff like partial programming, support for new external programmers, voltage handling, etc) please discuss your plans on the list first. That way, we can avoid duplicated work and know about how flashrom internals need to be adjusted and you avoid frustration if there is some disagreement about the design.
Command set secrets
This is only mentioned in very few datasheets, but it applies to most parallel (and some LPC) chips I saw: Upper address bits of commands are ignored if they are not mentioned explicitly. If a datasheet specifies the following sequence:
chip_writeb(0xAA, bios + 0x555); chip_writeb(0x55, bios + 0x2AA); chip_writeb(0x90, bios + 0x555);
then it is quite likely the following sequence will work as well
chip_writeb(0xAA, bios + 0x5555); chip_writeb(0x55, bios + 0x2AAA); chip_writeb(0x90, bios + 0x5555);
However, if the chip datasheet specifies addresses like 0x5555, you can't shorten them to 0x555.
To summarize, replacing short addresses with long addresses usually works, but the other way round usually fails.
Writing or reusing a probe function
If you have a chip with id1 0xc2, id2 0x18, first run
to get an overview of the probe results for the existing probe functions. There's a good chance you'll find a probe function (or even many of them) that works for you. To automate this, run
flashrom -V|grep "0xc2.*0x18"|sed "s/.*probe/probe/"|sort|uniq
and you get a neat list of probe function names and their results, looking roughly like this:
probe_29f002: id1 0xc2, id2 0x18 probe_29f040b: id1 0xc2, id2 0x18 probe_jedec: id1 0xc2, id2 0x18 probe_stm50flw0x0x: id1 0xc2, id2 0x18 probe_w39v040c: id1 0xc2, id2 0x18 probe_winbond_fwhub: id1 0xc2, id2 0x18
As you can see, there are quite a lot of probe functions which seem to work fine (and that's mostly because of the ignored address bits). probe_jedec is the most-used function in our tree, so if the sequence looks ok, please use that one.