<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://flashprog.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Adding_and_Reviewing_new_flash_chips</id>
	<title>Adding and Reviewing new flash chips - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://flashprog.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Adding_and_Reviewing_new_flash_chips"/>
	<link rel="alternate" type="text/html" href="https://flashprog.org/wiki/index.php?title=Adding_and_Reviewing_new_flash_chips&amp;action=history"/>
	<updated>2026-05-20T08:02:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>https://flashprog.org/wiki/index.php?title=Adding_and_Reviewing_new_flash_chips&amp;diff=180&amp;oldid=prev</id>
		<title>Icon: &quot;nico.h@gmx.de: Split Adding/reviewing flash chips out of Development Guidelines&quot;</title>
		<link rel="alternate" type="text/html" href="https://flashprog.org/wiki/index.php?title=Adding_and_Reviewing_new_flash_chips&amp;diff=180&amp;oldid=prev"/>
		<updated>2023-12-03T17:46:37Z</updated>

		<summary type="html">&lt;p&gt;&amp;quot;nico.h@gmx.de: Split Adding/reviewing flash chips out of Development Guidelines&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;# Get the datasheet of the exact type of chip.&lt;br /&gt;
# Open &amp;lt;tt&amp;gt;flashchips.c&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;flashchips.h&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# First, find the best* IDs in the datasheet (*FIXME: this needs to be explained together with the probing somewhere else in detail) and check if the ID exists in &amp;lt;tt&amp;gt;flashchips.h&amp;lt;/tt&amp;gt; already&lt;br /&gt;
#* If it does but is named after a different chip,&lt;br /&gt;
#*:then add a comment regarding the twin and continue by comparing the definition in &amp;lt;tt&amp;gt;flashchips.c&amp;lt;/tt&amp;gt; with the datasheet of the twin/new chip as if you would add it but leave out the next step (see below). First you should change the &amp;lt;tt&amp;gt;.name&amp;lt;/tt&amp;gt; to reflect the additional chip model (see other chips of naming examples). If you find significant* differences in the chips behavior you have found a so called evil twin (*judging the significance of a difference is quite hard and requires some understanding of flashprog behavior, examples of significant differences are: different sizes of blocks or different opcodes for operations). In that case copy the entry and continue to change that (don&amp;#039;t forget to undo the previous changes before).&lt;br /&gt;
#* If it does and the name matches too,&lt;br /&gt;
#*:the chip is either already added or only the ID was added and you should use that define.&lt;br /&gt;
#* If it does not,&lt;br /&gt;
#*:then you should add it conforming to the standards/comments in the file.&lt;br /&gt;
#: Usually the chip IDs follow a simple scheme: They are all uppercase; first the manufacturer name (like for the manufacturer IDs on top of each paragraph in flashchips.h) followed by an underscore and then the chipname. The latter should in general equal the &amp;lt;tt&amp;gt;.name&amp;lt;/tt&amp;gt;, with dots (and other disallowed characters) replaced by underscores. Shared chip IDs typically use the macro name that happened to be added first to flashprog (which is also probably the first one manufactured) and which usually matches the other chips of that series in flashchips.h.&lt;br /&gt;
# If possible copy an existing, similar entry in the giant array in &amp;lt;tt&amp;gt;flashchips.c&amp;lt;/tt&amp;gt; or start a new one at the right position (according to the comment on top of the array)&lt;br /&gt;
# Add &amp;lt;tt&amp;gt;.vendor&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;.name&amp;lt;/tt&amp;gt;, IDs selected as explained above and &amp;lt;tt&amp;gt;.total_size&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# &amp;lt;tt&amp;gt;.page_size&amp;lt;/tt&amp;gt; is really hard. Please read this [http://www.flashrom.org/pipermail/flashrom/2013-April/010817.html long explanation], or ignore it for now and set it to &amp;lt;tt&amp;gt;256&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# We encode various features of flash chips in a bitmask named &amp;lt;tt&amp;gt;.feature_bits&amp;lt;/tt&amp;gt;. The various possibilities can be found in &amp;lt;tt&amp;gt;flash.h&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# &amp;lt;tt&amp;gt;.tested&amp;lt;/tt&amp;gt; is used to indicate if the code was tested to work with real hardware, its possible values are defined in &amp;lt;tt&amp;gt;flash.h&amp;lt;/tt&amp;gt;. Without any tests it should be set to &amp;lt;tt&amp;gt;TEST_UNTESTED&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# &amp;lt;tt&amp;gt;.probe&amp;lt;/tt&amp;gt; indicates which function is called to fetch IDs from the chip and to compare them with the ones in &amp;lt;tt&amp;gt;.manufacture_id&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;.model_id&amp;lt;/tt&amp;gt;. This requires some knowledge or source reading. For most SPI flash chips &amp;lt;tt&amp;gt;probe_spi_rdid&amp;lt;/tt&amp;gt; is the right one if the datasheets mentions &amp;lt;tt&amp;gt;0x9f&amp;lt;/tt&amp;gt; as an identification/probing opcode.&lt;br /&gt;
# &amp;lt;tt&amp;gt;.probe_timing&amp;lt;/tt&amp;gt; is only used for non-SPI chips. It indicates the delay after &amp;quot;enter/exit ID mode&amp;quot; commands in microseconds (see &amp;lt;tt&amp;gt;flash.h&amp;lt;/tt&amp;gt; for special values).&lt;br /&gt;
# &amp;lt;tt&amp;gt;.block_erasers&amp;lt;/tt&amp;gt; stores an array of pairs of erase functions (&amp;lt;tt&amp;gt;.block_erase&amp;lt;/tt&amp;gt;) with their respective layout (&amp;lt;tt&amp;gt;.eraseblocks&amp;lt;/tt&amp;gt;).&lt;br /&gt;
## &amp;lt;tt&amp;gt;.block_erase&amp;lt;/tt&amp;gt; is similar to the probing function. You should at least check that the opcode named in the function name is matching the respective opcode in the datasheet.&lt;br /&gt;
## Two forms of &amp;lt;tt&amp;gt;.eraseblocks&amp;lt;/tt&amp;gt; can be distinguished: symmetric and asymmetric layouts. Symmetric means that all blocks that can be erased by an opcode are sized equal. In that case a single range can define the whole layout (e.g. &amp;lt;tt&amp;gt;{4 * 1024, 256}&amp;lt;/tt&amp;gt; means 256 blocks of 4 kB each). Asymmetric layouts on the other hand contain differently sized blocks, ordered by their base addresses (e.g. &amp;lt;tt&amp;gt;{{8 * 1024, 1}, {4 * 1024, 2}, {16 * 1024, 7}}&amp;lt;/tt&amp;gt; describes a layout that starts with a single 8 kB block, followed by two 4 kB blocks and 7 16 kB blocks at the end).&lt;br /&gt;
# &amp;lt;tt&amp;gt;.printlock&amp;lt;/tt&amp;gt; is a [http://www.flashrom.org/pipermail/flashrom/2011-May/006495.html misnomer to some extent]. It is misused not only to print (write) protected address ranges of the chip, but also to pretty print the values of the status register(s) - especially true for SPI chips. There are a lot of existing functions for that already and you should reuse one if possible. Comparing the description of the status register in the datasheet of an already supported chip with that of your chip can help to determine if you can reuse a printlock function.&lt;br /&gt;
# &amp;lt;tt&amp;gt;.unlock&amp;lt;/tt&amp;gt; is called before flashprog wants to modify the chip&amp;#039;s contents to disable possible write protections. It is tightly related to the &amp;lt;tt&amp;gt;.printlock&amp;lt;/tt&amp;gt; function as it tries to change some of the bits displayed by &amp;lt;tt&amp;gt;.printlock&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# &amp;lt;tt&amp;gt;.write&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;.read&amp;lt;/tt&amp;gt; are function pointers with the obvious meaning. Currently flashprog does only support a single function each. The one that is best supported by existing programmers should be used for now, but others should be noted in a comment if available.&lt;br /&gt;
# &amp;lt;tt&amp;gt;.voltage&amp;lt;/tt&amp;gt; defines the upper and lower bounds of the supply voltage of the chip. If there are multiple chip models with different allowed voltage ranges, the [http://en.wikipedia.org/wiki/Intersection_(set_theory) intersection] should be used and an appropriate comment added.&lt;br /&gt;
# The write [http://www.flashrom.org/pipermail/flashrom/2013-April/010817.html granularity] can be expressed by the &amp;lt;tt&amp;gt;.gran&amp;lt;/tt&amp;gt; field. If you think you need something else than the default (&amp;lt;tt&amp;gt;write_gran_256bytes&amp;lt;/tt&amp;gt;) then you should definitely ask one of the regular flashprog hackers first. Possible values can be found in &amp;lt;tt&amp;gt;flash.h&amp;lt;/tt&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Icon</name></author>
	</entry>
</feed>