1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

68 Commits

Author SHA1 Message Date
Nikolay Nikolaev
c80c4a35a0 Add support for Spansion S25FL...S chips
Add...
 - S25FL128S
 - S25FL256S uniform version (defunct due to addressing)
 - S25FL512S uniform version (defunct due to addressing)

Merge Intel S33 status register functions with this one's.

Corresponding to flashrom svn r1692.

Signed-off-by: Nikolay Nikolaev <evrinoma@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-06-28 21:29:44 +00:00
Nikolay Nikolaev
d0e3ea1470 Add support for Eon EN25S series
Add...
 - EN25S10
 - EN25S20
 - EN25S40
 - EN25S80
 - EN25S16
 - EN25S32
 - EN25S64

Corresponding to flashrom svn r1687.

Signed-off-by: Nikolay Nikolaev <evrinoma@gmail.com>
Reviewed-by: Steven Zakulec <spzakulec@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-06-28 21:29:08 +00:00
Nikolay Nikolaev
579f1e0b67 Introduce spi_block_erase_db()
Used for page erase on some chips (e.g. Numonyx M45PE and
Sanyo LF25FW series).

Corresponding to flashrom svn r1682.

Signed-off-by: Nikolay Nikolaev <evrinoma@gmail.com>
Reviewed-by: Steven Zakulec <spzakulec@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-06-28 21:28:37 +00:00
Stefan Tauner
278ba6e967 Introduce additional SPI status register helpers
- spi_prettyprint_status_register_default_welwip():
   It just prettyprints the plain hex value and the welwip bits.
 - spi_prettyprint_status_register_default_bp4():
   Prints the hex value, welwip, bp0-5 and srwd bits.
 - spi_disable_blockprotect_bp2_srwd(),
 - spi_disable_blockprotect_bp3_srwd() and
   spi_disable_blockprotect_bp4_srwd():
   Three new common block unprotection functions for the frequent
   cases where there is a status register lock bit at bit #7 and some
   block protection bits at bits #2-#4, #2-#5 and #2-#6 respectively.

Corresponding to flashrom svn r1681.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-06-28 21:28:27 +00:00
Stefan Tauner
cecb2c56d0 Fix unlocking function for most Atmel AT2[56]D* chips
I broke unlocking them correctly in r1635 while refactoring (NB: the
commit log including the overly selfconfident statement about the
"bug in spi_disable_blockprotect_at25df()").

Affected chips have per sector protection bits and the write protection bits
in the status register do indicate if none, some or all sectors are protected.
It is possible to globally (un)lock all sectors at once but in a way that was
not anticipated when refactoring the spi25 unlocking functions into
spi_disable_blockprotect_generic(). To globally unprotect not only the
protection bits (2 and 3) have 0 to be written to them but also bits 4 and 5
which normally would not be touched by spi_disable_blockprotect_generic().
Some of the chips also support a permanent lockdown with fuses which we
do not handle yet.

To fix this without copying the whole method I introduce another mask
parameter to spi_disable_blockprotect_generic() namely unprotect_mask.
See verbose comments inline for details.

Also, prettyprint the status register after trying to disable the block
protection fails.

Corresponding to flashrom svn r1679.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Tested-by: Chi Zhang <zhangchi866@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-06-20 22:55:41 +00:00
Stefan Tauner
730e7e74eb Update spi_get_erasefn_from_opcode()
We forgot to add a few SPI erase functions to the helper function that is
used for SFDP. Also, sort the declarations in the header.

Corresponding to flashrom svn r1672.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-05-01 14:04:19 +00:00
Stefan Tauner
3f5e35db4b Refine PMC Pm25LV series
- Add missing bits and resort chips
 - Refine Pm25LV512(A) and Pm25LV010
   Due to manufacturer ID continuation this one needs a new probing
   function: probe_spi_res3() which should be refactored in the future.
   The datasheet describes a very weird order of ID bytes:
   Vendor byte, model byte, vendor continuation byte. Let's pretend we did
   not read that or the datasheet is bogus (although the datasheet of the
   successor series describes the same but luckily additionally to RDID).
 - Add Pm25LV010A
   This was tested by Chi Zhang:
   http://paste.flashrom.org/view.php?id=1573

Corresponding to flashrom svn r1670.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2013-04-19 01:58:33 +00:00
Stefan Tauner
57794ac158 Add support for Atmel's AT25F series of SPI flash chips
This adds support for the following chips:
 - AT25F512, AT25F512A, AT25F512B
 - AT25F1024, AT25F1024A
 - AT25F2048
 - AT25F4096

Besides the definitions of the the chips in flashchips.c this includes
- a dedicated probing method (probe_spi_at25f)
- pretty printing methods (spi_prettyprint_status_register_at25f*), and
- unlocking methods (spi_disable_blockprotect_at25f*)

Corresponding to flashrom svn r1637.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-12-29 15:04:20 +00:00
Stefan Tauner
54aaa4ae2b Add support for Intel S33 series flash chips
This includes:
Bottom boot block:
* 16Mb/2MB:
  QB25F160S33B8, QB25F016S33B8, QH25F160S33B8, QH25F016S33B8
* 32Mb/4MB:
  QB25F320S33B8, QH25F320S33B8
* 64Mb/8MB:
  QB25F640S33B8, QH25F640S33B8

Top boot block:
* 16Mb/2MB:
  QB25F160S33T8, QB25F016S33T8, QH25F160S33T8, QH25F016S33T8
* 32Mb/4MB:
  QB25F320S33T8, QH25F320S33T8
* 64Mb/8MB:
  QB25F640S33T8, QH25F640S33T8

At least some seem to be marketed by other vendors (too?) but also with
Intel's vendor ID.

Besides a 0xC7 chip erase and a 0xD8 uniform 64kB block erase they
support also erasing the top/bottom 8 8kB blocks with opcode 0x40.
But since this command fails for all addresses outside those ranges,
it is not easily implemented with flashrom's current code base and
hence left out.

Corresponding to flashrom svn r1636.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-12-29 15:04:12 +00:00
Stefan Tauner
6ee37e2836 Improve SPI status register pretty printing
- Move all functions related to SPI status registers to a new file
   spi25_statusreg.c. This includes the generic as well as the
   SST-specific functions from spi25.c and the chip-specific functions
   from a25.c and at25.c.
 - introduce helper functions
    * spi_prettyprint_status_register_hex()
    * spi_prettyprint_status_register_bpl()
    * spi_prettyprint_status_register_plain()
   Use the latter on every compatible flash chip that has no better printlock
   function set and get rid of the implicit pretty printing in the SPI probing
   functions.
 - remove
    * spi_prettyprint_status_register_common()
    * spi_prettyprint_status_register_amic_a25lq032() because it can be fully
      substituted with spi_prettyprint_status_register_amic_a25l032().
    * spi_prettyprint_status_register() (old switch, no longer needed)
 - promote and export
    * spi_prettyprint_status_register_amic_a25l05p() as spi_prettyprint_status_register_default_bp1().
    * spi_prettyprint_status_register_amic_a25l40p() as spi_prettyprint_status_register_default_bp2().
    * spi_prettyprint_status_register_st_m25p() as spi_prettyprint_status_register_default_bp3().
 - add #define TEST_BAD_REW and use it for a number of Atmel chips which
   had only TEST_BAD_READ set even though they dont have erasers or a write
   function set.

Corresponding to flashrom svn r1634.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-12-29 15:03:51 +00:00
Kyösti Mälkki
c31243e173 Add support for Winbond W39F010/W39L010/W39L020
W39F010 is a 128kB parallel 5V flash chip, 16k bootblocks.
W39L010 is a 128kB parallel 3.3V flash chip, 8k bootblocks.
W39L020 is a 256kB parallel 3.3V flash chip, 64k/16k bootblocks.

The W39F010 code was tested with a satasii programmer. The first write
attempt after an erase returned with verify failure, but the second
write attempt was succesful:
http://paste.flashrom.org/view.php?id=1418

Corresponding to flashrom svn r1620.

Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-10-28 01:50:08 +00:00
Stefan Tauner
94b39b47e4 Add support for Atmel AT26DF041
Wicked chip: No WRSR, no write enable command (but swallows our
default one without a problem), supports an auto-erasing page write
(but even without that page writes are recommended to write the
whole page i.e. operate on a completely erased page), mad
requirements on block refreshments if only partly written.

Found on my Intel D946GZIS and tested with my serprog in situ.
Using the page write by setting JEDEC_BYTE_PROGRAM to 0x11 and using
the spi_chip_write_256 command greatly improves performance and works
flawlessly.

Corresponding to flashrom svn r1616.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-10-27 00:06:02 +00:00
Stefan Tauner
5609f9d408 Generify a25.c's SRWD printing function and move it to spi25.c
Corresponding to flashrom svn r1602.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-09-22 01:38:06 +00:00
Stefan Tauner
eb58257b96 Add a bunch of new/tested stuff and various small changes 14
Tested Mainboards:
OK:
 - ASUS M3A78-EH
   http://www.flashrom.org/pipermail/flashrom/2010-October/005297.html
 - ASUS P2B-LS
   http://www.flashrom.org/pipermail/flashrom/2010-November/005506.html
 - Biostar TA790GX A3+
   http://paste.flashrom.org/view.php?id=1350
 - ECS 848P-A7
   http://www.flashrom.org/pipermail/flashrom/2011-January/005781.html
 - GIGABYTE GA-G41MT-S2PT
   Reported on IRC
 - GIGABYTE GA-H77-D3H
   Reported and tested by Alexander Gordeev on IRC.
 - Gigabyte GA-X79-UD5
   http://www.flashrom.org/pipermail/flashrom/2012-August/009811.html
 - Shuttle FN78S
   http://www.flashrom.org/pipermail/flashrom/2012-August/009714.html
 - VIA EITX-3000
   Reported on IRC by Tuju

NOT OK:
 - Dell PowerEdge C6220 (0HYFFG)
   http://www.flashrom.org/pipermail/flashrom/2012-September/009900.html
 - Foxconn Q45M
   http://www.flashrom.org/pipermail/flashrom/2012-September/009923.html
 - MSI MS-7309 (K9N6SGM-V)
   http://www.flashrom.org/pipermail/flashrom/2012-August/009712.html
 - Supermicro X9QRi-F+
   http://www.flashrom.org/pipermail/flashrom/2012-September/009887.html
 - ZOTAC H61-ITX WiFi (H61ITX-A-E)
   http://www.flashrom.org/pipermail/flashrom/2012-August/009649.html

ASUS CUSL2-C has been tested to be working with the board enable once
implemented for the TUSL2-C board. They seem to have the same PCI IDs
as shown in the links below. Since only the CUSL2-C board enable has been
tested yet, we distinguish the two by DMI strings.
http://paste.flashrom.org/view.php?id=1393
http://www.flashrom.org/pipermail/flashrom/attachments/20091206/ddca2c6c/attachment-0002.eml

Tested flash chips:
 - Set EMST F25L008A to PREW (+PREW)
   http://www.flashrom.org/pipermail/flashrom/2012-August/009714.html
 - Set GigaDevice GD25Q64 to PREW (+PREW)
   http://git.chromium.org/gitweb/?p=chromiumos/third_party/flashrom.git;a=commit;h=9e8ef49b1f626c2197e131fba6c5b65c8af4eeea
 - Set Macronix MX25L12805 to P (+P)
   http://www.flashrom.org/pipermail/flashrom/2012-September/009887.html
 - Set SST SST49LF003A/B to PREW (+EW)
   http://paste.flashrom.org/view.php?id=467
 - Set Winbond W49V002FA to PREW (+EW)
   http://www.flashrom.org/pipermail/flashrom/2011-January/005781.html

Tested chipsets:
 - Intel X79 (0x1d41)
   http://www.flashrom.org/pipermail/flashrom/2012-August/009811.html

Board enables:
 - add ASUS P4P800-X
   Created by Idwer Vollering and tested by Mingsen Bao:
   http://paste.flashrom.org/view.php?id=467
 - add DMI string to P4P800-VM

Miscellaneous:
 - Add remaining Intel 7 series chipset (LPC) PCI IDs
 - Add generic SPI detection for chips from Winbond
 - Minor manpage changes
 - Minor other cleanups
 - Escape full stops after abbreviations in the manpage.
 - Add ICH9 and successors to spi_get_valid_read_addr

Corresponding to flashrom svn r1601.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-09-21 12:52:50 +00:00
Stefan Tauner
3c0fcd0f30 Add spi_block_erase_62
This is used by the AT25F series (only?), but is generic enough to
reside in spi25.c. The only currently supported chip is the AT25F512B.
Other members of that series need some additional infrastructure code,
hence this patch adds the erase function to the AT25F512B only.

Corresponding to flashrom svn r1600.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-09-21 12:46:56 +00:00
Stefan Tauner
7bf4ed9277 Rename AT25F512B-specific code
The AT25F512B is quite different from the other (older and yet
unsupported) chips in the AT25F* familiy, hence rename 512B-specific
stuff to make room for the generic AT25F* code.

Corresponding to flashrom svn r1583.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-08-26 21:04:27 +00:00
Stefan Tauner
1ba08f6d41 Clean up a25.c, at25.c, spi25.c
- introduce spi_prettyprint_status_register_atmel_at25_wpen()
- use spi_prettyprint_status_register_bit() where possible
- generify spi_prettyprint_status_register_bp3210 and use it in at25.c too

Corresponding to flashrom svn r1560.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2012-08-02 23:51:28 +00:00
David Borg
f5a30f65ad Add support for for the Atmel AT49F040 chip
Chip features an optional permanent boot block write protection.

Corresponding to flashrom svn r1522.

Signed-off-by: David Borg <borg.db@gmail.com>
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2012-04-15 13:16:32 +00:00
Rudolf Marek
47eff6b5b4 Add support for the Eon EN29LV640B chip
This chip needs special command sequences in 8 bit mode. Also, 8 bit
programming needs actually 16bit double byte program.

The chip is found on the Bifferos Bifferboard, for example.

Corresponding to flashrom svn r1521.

Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2012-04-14 22:51:40 +00:00
Stefan Tauner
ac1b4c8bd7 Add support for SFDP (JESD216)
Similar to modules using the opaque programmer framework (e.g. ICH Hardware
Sequencing) this uses a template struct flashchip element in flashchips.c with
a special probe function that fills the obtained values into that struct.

This allows yet unknown SPI chips to be supported (read, erase, write) almost
as if it was already added to flashchips.c.

Documentation used:
http://www.jedec.org/standards-documents/docs/jesd216 (2011-04)
W25Q32BV data sheet Revision F (2011-04-01)
EN25QH16 data sheet Revision F (2011-06-01)
MX25L6436E data sheet Revision 1.8 (2011-12-26)

Tested-by: David Hendricks <dhendrix@google.com>
on W25Q64CV + dediprog
Tested-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
on a 2010 MX25L6436E with preliminary (i.e. incorrect) SFDP implementation + serprog

Thanks also to Michael Karcher for his comments and preliminary review!

Corresponding to flashrom svn r1500.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2012-02-17 14:51:04 +00:00
Carl-Daniel Hailfinger
8a3c60cdd0 Add struct flashctx * parameter to all functions accessing flash chips
All programmer access function prototypes except init have been made
static and moved to the respective file.

A few internal functions in flash chip drivers had chipaddr parameters
which are no longer needed.

The lines touched by flashctx changes have been adjusted to 80 columns
except in header files.

Corresponding to flashrom svn r1474.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2011-12-18 15:01:24 +00:00
Carl-Daniel Hailfinger
63fd9026f1 Use struct flashctx instead of struct flashchip for flash chip access
Struct flashchip is used only for the flashchips array and for
operations which do not access hardware, e.g. printing a list of
supported flash chips.

struct flashctx (flash context) contains all data available in
struct flashchip, but it also contains runtime information like
mapping addresses. struct flashctx is expected to grow additional
members over time, a prime candidate being programmer info.
struct flashctx contains all of struct flashchip with identical
member layout, but struct flashctx has additional members at the end.

The separation between struct flashchip/flashctx shrinks the memory
requirement of the big flashchips array and allows future extension
of flashctx without having to worry about bloat.

Corresponding to flashrom svn r1473.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2011-12-14 22:25:15 +00:00
Stefan Tauner
c69c9c84e0 Unsignify lengths and addresses in chip functions and structs
Push those changes forward where needed to prevent new sign
conversion warnings where possible.

Corresponding to flashrom svn r1470.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-11-23 09:13:48 +00:00
Carl-Daniel Hailfinger
532c717bcc Add opaque programmer registration infrastructure
An opaque programmer does not allow direct flash access and only offers
abstract probe/read/erase/write methods.
Due to that, opaque programmers need their own infrastructure and
registration framework.

Corresponding to flashrom svn r1459.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2011-11-04 21:35:26 +00:00
Stefan Tauner
8c35745fcf Revert "Unsignify lengths and addresses in chip functions and structs"
- probe_timing was changed to unsigned although we use negative values
  for special cases
- some code was not changed along hence did no longer compile:
  * dediprog's read and write functions
  * linux_spi's read and write functions
- it introduced a number of new sign conversion warnings
  (http://paste.flashrom.org/view.php?id=832)

To be safe this patch reverts all changes made in r1448, a corrected
patch will follow later.

Thanks to idwer for pointing out the problem first!

Corresponding to flashrom svn r1450.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2011-09-18 22:42:18 +00:00
Stefan Tauner
d196e7c138 Unsignify lengths and addresses in chip functions and structs
Corresponding to flashrom svn r1448.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-09-18 00:41:33 +00:00
Mattias Mattsson
fca3b012da Add support for the Sharp LH28F008BJT-BTLZ1 chip
Tested by Mattias Mattsson <vitplister@gmail.com> on a PowerPC box.

Corresponding to flashrom svn r1420.

Signed-off-by: Mattias Mattsson <vitplister@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2011-08-25 22:44:11 +00:00
Stefan Tauner
a63c7c4496 Remove unneeded inclusions of chipdrivers.h
This is related to the spi split patch as discussed in:
http://www.flashrom.org/pipermail/flashrom/2010-February/thread.html#2364
the old commit (r914) log notes:
"Some of the spi programmer drivers required chipdrivers.h, needs fixing later: it87spi.c
  ichspi.c   sb600spi.c   wbsio_spi.c   buspirate_spi.c   ft2232spi.c   bitbang_spi.c   dediprog.c"

there still remain a few cases where chipdrivers.h is needed:
dediprog.c (spi_read_chunked and spi_write_chunked)
it87spi.c (due to spi_write_enable and spi_read_status_register)
wbsio_spi.c (spi_programmer registration only)

besides that, there are also non-spi files that do not need it.
also, add flash.h to chipdrivers.h because it uses some types of it
and remove flashchips.h from print.c

Corresponding to flashrom svn r1414.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2011-08-16 12:08:22 +00:00
Carl-Daniel Hailfinger
7a3bd8f28f Refine status register and lock printing of Atmel and AMIC SPI chips
Add lock printing for AMIC A25L05PT, A25L05PU, A25L10PT, A25L10PU,
A25L20PT, A25L20PU, A25L40PT, A25L40PU, A25L80P, A25L16PT, A25L16PU,
A25L512, A25L010, A25L020, A25L040, A25L080, A25L016, A25L032, A25LQ032
to a25.c.

Add lock printing for Atmel AT26DF081A, AT26DF161, AT26DF161A,
AT26DF321.

Move Atmel AT25*/AT26* lock related functions originally added in r1115
from spi25.c to at25.c.

For SPI chips the lock printing was handled by one common function, but
sharing a common function which only is a big switch() statement doesn't
make sense, especially if we can define lock printing functions per
flash chip anyway.

The printlock function pointer in struct flashchip is used to print
status register and locking information, and serves as replacement for
implicit status register and lock printing during probe. That code will
later be changed to store locking info in a machine- accessible data
structure so flashrom can handle locked regions correctly.

Corresponding to flashrom svn r1316.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
2011-05-19 00:06:06 +00:00
Michael Karcher
4b17736985 Remove erase_chip_stm50flw0x0x
As the comment indicates, that function is not a chip erase function
at all, but a function calling a block eraser in a loop. So it adds
no extra value to what we already have in the block_eraser
infrastructure.

Furthermore, that function assumes a uniform sector size layout, but
is referenced from flash chip with non-uniform sector size layout, which
is just wrong.

Corresponding to flashrom svn r1287.

Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-04-14 23:43:19 +00:00
Michael Karcher
19e0aacd63 Add W39L040
Corresponding to flashrom svn r1268.

Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2011-03-06 17:58:05 +00:00
Idwer Vollering
ecc67072b6 Enable unlocking (erasing/writing) W39V040FB chips
Add code for the unlocking (erasing/writing) of Winbond W39V040FB
chips, enabling erasing/writing this type of chip.

Corresponding to flashrom svn r1248.

Signed-off-by: Idwer Vollering <vidwer@gmail.com>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-12-26 23:55:12 +00:00
Carl-Daniel Hailfinger
9188240a14 Add support for Winbond W39V040FB and W39V040FC
Print lock status for all supported Winbond W39* chips:
W39V040A, W39V040B, W39V040C, W39V040FA, W39V040FB, W39V040FC,
W39V080A, W39V080FA, W39V080FA (dual mode).

Fill in correct probe timing for Winbond W39V040C and W39V080FA.

Please note that the W39V040B/W39V040FB pair has identical IDs,
identical read/write/erase, but locking differs. Same applies to
W39V040C/W39V040FC. This causes double detection on chipsets which
support LPC and FWH, making flashing more difficult because the user
has to select the correct chip. This is called the evil twin problem.
A better evil twin handling (patch available) will resolve that problem.

Corresponding to flashrom svn r1245.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-12-05 16:33:59 +00:00
Carl-Daniel Hailfinger
75a58f94cc Switch all flash chips to partial write
The inner write functions which handle partial write are renamed to the
original name of their wrappers. The write wrappers are removed.

Corresponding to flashrom svn r1211.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Tested-by: Maciej Pijanka <maciej.pijanka@gmail.com>
Tested-by: Andrew Morgan <ziltro@ziltro.com>
Tested-by: Idwer Vollering <vidwer@gmail.com>
Acked-by: Idwer Vollering <vidwer@gmail.com>
Tested-by: Sean Nelson <audiohacked@gmail.com> 
Acked-by: Sean Nelson <audiohacked@gmail.com>
2010-10-13 22:26:56 +00:00
Carl-Daniel Hailfinger
79e6757d26 Refactor remaining write wrappers
Kill duplicated code.

Annotate write functions with their chunk size.

Mark Fujitsu MBM29F400BC and ST M29F400BB as untested because their
write code no longer uses a broken layout.

Corresponding to flashrom svn r1210.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
Tested-by: Maciej Pijanka <maciej.pijanka@gmail.com>
Tested-by: Idwer Vollering <vidwer@gmail.com>
Acked-by: Idwer Vollering <vidwer@gmail.com>
Tested-by: Sean Nelson <audiohacked@gmail.com> 
Acked-by: Sean Nelson <audiohacked@gmail.com>
2010-10-13 21:49:30 +00:00
Carl-Daniel Hailfinger
b30a5ed4af Unify chip write functions
The currently used write functions (wrappers) all use helpers which
perform the actual write (inner functions).

The signature of the write wrappers is: int write_chip(struct flashchip
*flash, uint8_t * buf);

The signature of the inner write functions varied a lot. This patch
changes them to: int write_part(struct flashchip *flash, uint8_t *src,
int start, int len);

Did you know that flashrom has only 8 inner write functions for all
flash chips? write_page_write_jedec_common write_sector_jedec_common
write_sector_28sf040 spi_chip_write_256_new spi_chip_write_1_new
spi_aai_write_new write_page_82802ab write_page_m29f400bt

Export all inner write functions.

Change the function signature of wait_82802ab to eliminate single-use
variables.

Remove an error message in write_page_m29f400bt which was printed for
every byte written regardless of success.

Add sharplhf00l04.c to the list of flash chip drivers in the Makefile.
While the functions in there are unused, I suspect we will need them
later, and by hooking the file up we ensure that compilation won't
break.

Corresponding to flashrom svn r1208.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2010-10-10 14:02:27 +00:00
Carl-Daniel Hailfinger
f52f784bb3 Move implicit erase out of chip drivers
Flashrom had an implicit erase-on-write for most flash chip and
programmer drivers, but it was not entirely consistent.

Some drivers had their own hand-rolled partial update functionality
which made handling partial updates from generic code impossible.

Move implicit erase out of chip drivers, and kill some dead erase
functions at the same time. A full chip erase is now performed in the
generic code for all flash chips on write, and after that the whole chip
is written.

Corresponding to flashrom svn r1206.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2010-10-08 18:52:29 +00:00
Helge Wagner
1db7a448b3 Massive speedups for SST25VF032B and SST25VF064C
Use AAI write for SST SST25VF032B.
Speedup from 228 to 113 seconds.

Use page (256 byte) write for SST SST25VF064C.
Speedup from 3091 to 123 seconds.

Corresponding to flashrom svn r1194.

Signed-off-by: Helge Wagner <helge.wagner@ge.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-10-05 22:29:08 +00:00
Carl-Daniel Hailfinger
fd7075ae75 Add detailed status register printing and unlocking for all ATMEL AT25* chips
Add support for Atmel AT25DF081A and AT25DQ161.

Some chips require EWSR before WRSR, others require WREN before WRSR,
and some support both variants. Add feature_bits to select the correct
SPI command, and default to EWSR.

Corresponding to flashrom svn r1115.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Tested-by: Steven Rosario
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
2010-07-29 13:09:18 +00:00
Carl-Daniel Hailfinger
420cf6f633 Mark Fujitsu MBM29F400BC write as broken (implicit eraseblock layout in write)
Use full-chip write function on Fujitsu MBM29F400TC and ST M29F400BT.
Add support for ST M29F400BB.

Corresponding to flashrom svn r1083.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-07-16 22:07:20 +00:00
Carl-Daniel Hailfinger
29a1c66a23 Use generic unlocking infrastructure for SPI chips
Actually check if the unlock worked instead of just assuming it worked.

Corresponding to flashrom svn r1082.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-07-14 20:21:22 +00:00
Carl-Daniel Hailfinger
9a795d83fb Convert SPI chips to partial write
However, wrap the write functions in a compat layer to allow converting
the rest of flashrom later. Tested on Intel NM10 by David Hendricks.

Corresponding to flashrom svn r1080.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
2010-07-14 16:19:05 +00:00
Carl-Daniel Hailfinger
3a25fea9e7 The SPI opcode 0xd8 is not a chip erase opcode on any chip out there
Besides that, the function as implemented just walks the chip and
ignores sector sizes.
Sector erase with SPI opcode 0xd8 is of course still supported.
Kill a declaration for a nonexisting function while we're at it.

Corresponding to flashrom svn r1054.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
2010-06-20 11:02:33 +00:00
Carl-Daniel Hailfinger
dc1cda15d4 Add support for two-byte RES probes
Some chips implement the RES (0xab) opcode, but they use a non-standard
two byte response instead of the usual one byte response. A two-byte
response has the accuracy of REMS and RDID, so don't check for REMS/RDID
availability before running a two-byte RES.

Corresponding to flashrom svn r1017.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
2010-05-28 17:07:57 +00:00
Carl-Daniel Hailfinger
5824fbff01 Introduce a generic SPI read function: spi_write_chunked()
Every SPI programmer driver had its own completely different chip write
implementation, and all of them were insufficiently commented. Create
spi_write_chunked as a copy of spi_read_chunked and convert all SPI
programmers to use it. No functional changes except: - Bus Pirate uses
12 Byte writes instead of 8 Byte writes - SB600 uses 5 Byte writes
instead of 1 Byte writes

Corresponding to flashrom svn r1005.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Acked-by: David Hendricks <dhendrix@google.com>
2010-05-21 23:09:42 +00:00
Sean Nelson
69e5811e79 Sst49lfxxxc chips are functionally the same as 82802ab chips
Sst49lfxxxc software status register is functionally the same as the 
82802ab status register, "Block Protect Status"(49lfxxxc) can be treated 
the same as "Device Protect Status"(82802ab).
Erase_block_49lfxxxc is the same command sequence as erase_block_82802ab.
Add unlock_49lfxxxc to chips definitions.
Write_sector_49lfxxxc is the same as write_page_82802ab.

Corresponding to flashrom svn r972.

Signed-off-by: Sean Nelson <audiohacked@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-03-23 17:10:28 +00:00
Sean Nelson
8864710cd5 Fix a few typos from the last commit
Corresponding to flashrom svn r966.

Signed-off-by: Sean Nelson <audiohacked@gmail.com>
Acked-by: Sean Nelson <audiohacked@gmail.com>
2010-03-22 06:57:02 +00:00
Sean Nelson
28accc2700 Various JEDEC refactorings touching 82802ab.c, sharplhf00l04.c and stm50flw0x0x.c
Rename print_82802ab_status to print_status_82802ab add unlock_82802ab strip unlock code from erase_block_82802ab rename erase_82802ab_block  to erase_block_80280ab delete sharplhf00l04.o from Makefile delete *_lhf00l04* from chipdrivers.h.

add unlock_stm50flw0x0x
delete wait_stm50flw0x0x
delete write_page_stm50flw0x0x
convert erase_stm50flw0x0x to erase_chip_stm50flw0x0x
delete write_stm50flw0x0x
add unlock_82802ab to two Intel chips with TEST_BAD_WRITE
change the status of 82802AB, 82802AC, M50FW040, M50FW080 to TEST_OK_PR

Corresponding to flashrom svn r948.

Signed-off-by: Sean Nelson <audiohacked@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-03-19 18:47:06 +00:00
Sean Nelson
ccf7a2a231 Further cleanup after JEDEC refactorings
Convert _sst_fwhub functions to jedec.

Corresponding to flashrom svn r943.

kill unused sst_fwhub.c functions
make unlock_* check if unlock was successful and only return 0 when fully successful
Signed-off-by: Sean Nelson <audiohacked@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-03-16 03:09:10 +00:00
Sean Nelson
b3289c904c Clean up sst28sf040.c after JEDEC refactorings
Remove function probe_28sf040.

Corresponding to flashrom svn r942.

delete references to dead sharplhf00l04.c and sst29sf040.c functions from chipdrivers.h
Signed-off-by: Sean Nelson <audiohacked@gmail.com>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
2010-03-16 01:00:50 +00:00