1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

686 Commits

Author SHA1 Message Date
Nikolai Artemiev
a850fd0aa8 flashchips.c: add writeprotect support for more chips
Chips I had available for testing were tested with all writeprotect
commands and an FT232H adapter. Chips I wasn't able to test were just
checked against the datasheets.

Chips used for testing (including chips added in previous patches) are
listed in the table below:

Flashrom Chip name               | Chip(s) tested
---------------------------------+----------------------------
AT25SL128A                       |
EN25QH128                        |
GD25LQ128C/GD25LQ128D/GD25LQ128E | GD25LQ128DSIG
GD25LQ64(B)                      | GD25LQ64CWIG
GD25Q127C/GD25Q128C              | GD25Q127CSIG, GD25Q128ESIG
GD25Q256D                        | GD25Q256DYIG
GD25Q64(B)                       | GD25Q64CSIG
W25Q128.JW.DTR                   |
W25Q128.V..M                     |
W25Q128.W                        |
W25Q256JV_M                      |
W25Q256.V                        |
W25Q64.W                         |
XM25QH128C                       |
XM25QH256C                       |

BUG=b:182223106
BRANCH=none
TEST=flashrom --wp-{enable,disable,range,list,status}

Change-Id: I7f3d4c4148056098a845b5c64308b0333ebda395
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/62214
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2022-04-05 22:47:09 +00:00
Nikolai Artemiev
9fc100f549 flashchips,writeprotect_ranges: add range decoding function
Allow chips to specify functions that map status register bits to
protection ranges. These are used to enumerate available ranges and
determine the protection state of chips. The patch also adds a range
decoding function for the example chips. Many other chips can also be
handled by it, though some will require different functions (e.g.
MX25L6406 and related chips).

Another approach that has been tried in cros flashrom is maintaining
tables of range data, but it quickly becomes error prone and hard to
validate.

Using a function to interpret the ranges allows compact encoding with
most chips and is flexible enough to allow chips with less predictable
ranges to be handled as well.

BUG=b:195381327,b:153800563
BRANCH=none
TEST=dumped range tables, checked against datasheets

Change-Id: Id163ed80938a946a502ed116e48e8236e36eb203
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/58480
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
2022-03-01 04:12:19 +00:00
Nikolai Artemiev
e007908657 flash.h,flashchips.c: add writeprotect bit layout map to chips
This patch adds a register bit map `struct reg_bit_info`, with fields
for storing the register, bit index, and writability of each bit that
affects the chip's write protection. This allows writeprotect code to be
independent of the register layout of any specific chip. The new fields
have been filled out for example chips.

The representation is centered around describing how bits can be
accessed and modified, rather than the layout of registers. This is
generally easier to work with in code that needs to access specific bits
and typically requires specifying the locations of fewer bits overall.

BUG=b:195381327,b:153800563
BRANCH=none
TEST=flashrom --wp-{enable,disable,range,list,status} at end of patch series

Change-Id: Id08d77e6d4ca5109c0d698271146d026dbc21284
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/58477
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
2022-03-01 03:56:22 +00:00
Nikolai Artemiev
b7ea3a9a5d spi25_statusreg,flashchips: add SR2 read/write support
This patch adds support for reading and writing the second status
register and enables it on a limited set of flash chips.

Chip support for RDSR2/WRSR2/extended WRSR is represented using feature
flags to be consistent with how other SPI capabilities are represented.

BUG=b:195381327,b:153800563
BRANCH=none
TEST=flashrom -{r,w,E}
TEST=flashrom --wp-{enable,disable,range,list,status} at end of patch series
TEST=logged SR2 read/write values during wp commands

Change-Id: I34a503b0958e8f2f22a2a993a6ea529eb46b41db
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/58570
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2022-02-28 07:58:43 +00:00
Simon Buhrow
ea0ae153dd flashchips: Add W25Q64JV
I have successfully tested it with FT2232H-programmer.

Change-Id: Ia9a32146b225eca66e9a6bfef45be5f2b24aef46
Signed-off-by: Simon Buhrow <simon.buhrow@posteo.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/58971
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-12-09 19:14:09 +00:00
Simon Buhrow
51a9c38fcc flashchips.c: mark EN25F10 as TEST_OK_PREW
As reported by Wolf Dieter Brandt in his e-mail from 09.Aug.2021.

Change-Id: I0c19f84780e7fa3699fd706f8e105fc5937ba8bf
Signed-off-by: Simon Buhrow <simon.buhrow@posteo.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/58031
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-10-01 11:36:21 +00:00
Tao Xia
cf6668b86b flashchips: Add MX25L12833F
Just add the name to the existing entry, as usual it is supposed to be
compatible.

Signed-off-by: Tao Xia <xiatao5@huaqin.corp-partner.google.com>
Change-Id: I14ab7e04f5209d2bcf34b0d2de9da2c01bf32d00
Reviewed-on: https://review.coreboot.org/c/flashrom/+/56546
Reviewed-by: Weimin Wu <wuweimin@huaqin.corp-partner.google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-08-24 10:28:08 +00:00
Edward O'Callaghan
8ddb8ed568 flashchips.c: Add 'GD25LQ128E' to match C and D variants
As defined by gigadevice. C, D and E are all meant to
be the same.

BUG=b:185957191
BRANCH=none
TEST=builds

Change-Id: I3bef9386a185a0e8c54c125af5509b63540995aa
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/55742
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-08-24 00:37:46 +00:00
Nico Huber
16661d82e3 flashchips: Add MX25L12873F
Just add the name to the existing entry, as usual it is supposed to be
compatible.

Change-Id: I59c8067f15b5ceac5a2e2f8fe93431a465f17e23
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/56054
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-07-14 10:37:04 +00:00
Patrick Rudolph
bc31bd027d flashchips: Add support for Macronix MX66L1G45G
Tested on Dediprog SF600: Reading and writing works.

Change-Id: I554e828c97d9ec77b08489573a34e176599d2518
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/55353
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2021-06-20 09:55:25 +00:00
Simon Buhrow
a6e4df6624 flashchips.c: Mark MT25QL256 as tested
As mentioned in mail from Bernd.Stoeferle@elbitsystems-de.com on 22.12.2020.

Change-Id: Ie49332333f49a40f7bd8f3b5e42a8e2ad6995618
Signed-off-by: Simon Buhrow <simon.buhrow@posteo.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/50720
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-06-10 13:25:35 +00:00
Nikolai Artemiev
085db626fb flashchips: change chip name from 'W25Q64JW' to 'W25Q64JW...M'
According to the W25Q64JW datasheet rev. E, only devices ending with the
letter 'M' have a device ID of 8017h. There are other variants with
different device IDs. This patch makes the 'W25Q64JW...M' definition
consistent with the 'W25Q32JW...M' definition.

The device ID macro defined in flashchips.h has also been renamed from
WINBOND_NEX_W25Q64JW to WINBOND_NEX_W25Q64JW_M.

BUG=b:166294558
BRANCH=none
TEST=builds

Change-Id: Ib0dc914da286a191d22e666332b1063b88db4251
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/54291
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2021-06-10 10:37:04 +00:00
Nikolai Artemiev
91254c5bca flashchips.c: add support for W25Q32JW...M
The chip was added to cros flashrom in
`commit 1fc77dd1ee27a5d6e58a82c6ed6ed390a15372d7`.
Quoting from the commit message:

> We have varied the correct chip name is reported as well as
> write and read 16MBytes of random data and verified the checksum's match.
> Further, --wp-list appears to report the correct ranges.
>
> BUG=b:130199963
> BRANCH=none
> TEST=Ran flashrom with a Dediprog SF100, RW random data and checksum matched.

Change-Id: I7425e12658dd69c4ec8d3309dd591d09a935bb4d
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/53946
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
2021-06-10 10:36:22 +00:00
Nico Huber
b3b860154d flashchips: Fix 4BA advertisement for dummy chip
The dummyflasher only supports the native 4BA read and write
commands, so only advertise these.

Change-Id: Ia7340835ce1680d197f250bdb5990ab2ffe3671f
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/54068
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2021-05-12 23:03:02 +00:00
Nico Huber
d6c7f21a38 flashchips: Add MX25L3233F
Only mattering difference to the MX25L3273E seems to be the voltage
range (starting at 2.65V instead of 2.7V). I don't think that would
justify yet another entry.

Change-Id: I73402dddedf360ab84caed4c019efe27b477d4c2
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52570
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-04-25 13:39:11 +00:00
Nico Huber
d409139554 flashchips: Correct OTP comment for MX25L3273E
The datasheet says 4K bits, maybe just a copy-paste error.

Change-Id: I42b10aa09c969e5c5e7102b1e8ab496f52bd27bb
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52569
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-04-25 13:37:44 +00:00
Christian Kudera
47aff8c2f1 flashchips: Add support for Boya/BoHong Microelectronics B_25D16A
Read tested on CH341A

Change-Id: I25b776204affda94cc7e753e7671ef9d3d9508f1
Signed-off-by: Christian Kudera <coreboot@kudera.at>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52555
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-04-24 11:30:48 +00:00
Angel Pons
844d7716e4 flashchips: Adapt IDs for Boya Microelectronics
Looks like BoHong Microelectronics has the same vendor ID and makes very
similar chips. For instance, Boya BY25Q128AS and BoHong BH25Q128AS have
the same specifications and their datasheets are mostly identical.

Change-Id: I8d6951797daeeecca6af200c995297c0394adefd
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52550
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-04-24 11:30:19 +00:00
Nikolai Artemiev
6d79a6ab80 flashchips.c: mark MX25U25635F as TESTED_OK_PREW
The chip was marked as TESTED_OK_PREW in the cros tree by
`commit 419e32ae457cc36b03757b89471a7ce3770e9611`.

Quoting from the original commit message:
> TEST=Tested writes using Servo

Change-Id: Id7f44a41d6b2c397f1ce2e345f8ab44e95e4cfa2
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/51736
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-03-24 03:12:37 +00:00
Nikolai Artemiev
1fb4050faf flashchips.c: mark GD25Q256D as TESTED_OK_PREW
Tested read/write/erase/verify with FT232H programmer.

Change-Id: Ia7d52b69eb571113fe3c60ec9a139ee67180509b
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/51735
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-03-24 03:12:12 +00:00
Nikolai Artemiev
64eb987690 flashchips.c: mark EN25S64 as TESTED_OK_PREW
The chip was marked as TESTED_OK_PREW in the cros tree by
`commit b2f900273aac329b82089e4dbc5a8ba3d032fff0`.

Quoting from the original commit message:
> TEST=read and write BIOS on glimmer with Eon device.

Change-Id: I13dc3e6bde9e4581fdd5856a412918784b913fbc
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/51734
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-03-24 03:11:16 +00:00
Tim Chen
c60eceff19 CHROMIUM: flashrom: update .tested field for EN25QH128
update .tested field from TEST_UNTESTED to TEST_OK_PREW

BUG=b:159768722
BRANCH=none
TEST=Flash Duffy bios
     pass on running `flashrom_tester /usr/sbin/flashrom host`

Original-Change-Id: I9467588988c2cab0987737c53ace0832144ef169
Original-Signed-off-by: Tim Chen <tim-chen@quanta.corp-partner.google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/flashrom/+/2281508
Original-Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Original-Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
(cherry picked from commit 045e05eb92e3dd826e8ce61973c0d1004195a3ff)

Change-Id: Ic111f1a9cc5c7b5b5100ddda362c11c91e8a4165
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/48104
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2021-03-11 00:31:38 +00:00
Edward O'Callaghan
f3359e50de Add support for Adesto AT25SF128A
The following adds support for the Adesto AT25SF128A-SHB-T part.
We have varied the correct chip name is reported as well as write
and read 16MBytes of random data and verified the checksum's match.
Further, --wp-list appears to report the correct ranges.

BUG=None
BRANCH=none
TEST=Ran flashrom with a Dediprog SF100, RW random data and checksum
matched.

Original-Change-Id: Ic22ca588f33753fdf492e8445324bcc0a809d3e2
Original-Signed-off-by: Edward O'Callaghan <quasisec@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/1593201
Original-Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Original-Tested-by: Martin Roth <martinroth@chromium.org>
Original-Reviewed-by: Martin Roth <martinroth@chromium.org>
(cherry picked from commit 1fa87e058b72a2de1e9127a45e9978361de48479)

Note: this does not include the changes made to writeprotect.c in the
original patch, as they depend on a large amount of additional
writeprotect code that is currently only present in the cros tree, and
the intention here is just to reduce the diff in flashchips.c.
The `.wp` field has also been removed.

Change-Id: I1ce2a6699a1f0116306f668123673a1ba9c932d2
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/51097
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2021-02-28 02:01:04 +00:00
Angel Pons
4e31838eb1 flashchips: Mark Macronix MX25L1635D as tested
Tested probe, read, erase and write with a FTDI FT2232H successfully.

Change-Id: I7421b7e36e687ea2ffff494c00157976db73ac43
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/49489
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-02-07 23:39:19 +00:00
Alan Green
4f112f6994 flashchips.c: Mark GD25LQ128C/D as TEST_OK_PREW
I have successfully probed/read/erased/written a GD25LQ128D, so marking
this entry as tested.

Signed-off-by: Alan Green <avg@google.com>
Change-Id: Ic5329ebe81b6c1eabfb594f7f7affb3fd460db6b
Reviewed-on: https://review.coreboot.org/c/flashrom/+/49229
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-01-15 01:22:43 +00:00
luke he
32f4cb4ffa flashchips.c: Add support for XMC new SPI flash types
Adds initial support for the follow SPI flash chips:

 XM25QU64C
 XM25QU128C
 XM25QU256C
 XM25QH64C
 XM25QH128C
 XM25QH256C

BUG=none
TEST=builds

Signed-off-by: Luke He <sixuerain@qq.com>
Change-Id: I15c51b0f1ed789bcb2cabe33bc830f8d5d916969
Reviewed-on: https://review.coreboot.org/c/flashrom/+/48949
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-01-02 00:07:23 +00:00
Zoltan HERPAI
f634a0dcc6 flashchips: Mark Intel 25F640S33B8 as TESTED_PREW
Tested with ch341a_spi from an Atheros AP81 reference board.

Change-Id: I67b5962a1ae26fd1bc7e3889f1616def28b599ef
Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/44342
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-12-11 09:16:05 +00:00
Nikolai Artemiev
8fa792fb1f flashchips.c: add Spansion chips
Adds support for the following chips:
- S25FL128S
- S25FL129P
- S25FL256S
- S25FS128S
- {F,S,V}29C51001B

Chips imported from cros flashrom at
`9c4c9a56b6a0370b383df9c75d71b3bd469e672d`.

BUG=b:153800073
TEST=builds

Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Change-Id: If6b23ad2e65258143e0045133828d9db119fb665
Reviewed-on: https://review.coreboot.org/c/flashrom/+/46064
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-12-03 12:32:05 +00:00
Jack Olsen
3b6bff6b4c flashchips: Add support for Boya Microelectronics BY25Q128AS
Tested on Buspirate.

Signed-off-by: Jack Olsen <omegasec@tutanota.com>
Change-Id: I881ba86cfaa82e43c73360135d47c74d896cc191
Reviewed-on: https://review.coreboot.org/c/flashrom/+/44308
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-11-20 17:06:38 +00:00
Jakob Petersson
ea9106a91c flashchips: Add support for Fudan SPI flash chips
Signed-off-by: Jakob Petersson <github@jakobpetersson.se>
Change-Id: I8045ecb8778fd6111fcccc075e69928f131a926a
Reviewed-on: https://review.coreboot.org/c/flashrom/+/46513
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-10-23 06:27:12 +00:00
Namyoon Woo
79da18f869 support 4-byte address format for VARIABLE_SIZE dummy flash device
This patch adds a support of 4-byte address format for VARIABLE_SIZE
dummy flash device, so that it can emulate an flash size larger than
16 MBytes.
- assigned a feature bits FEATURE_4BA to VARIABLE_SIZE flash config.
- added codes handling two commands, JEDEC_READ_4BA and
JEDEC_BYTE_PROGRAM_4BA.
- changed blockeraser to use Chip-Erase command so that it can be
free from flash address byte format.

TEST=ran the command line below:
$ flashrom -p dummy:image=${TMP_FILE},size=33554432, \
emulate=VARIABLE_SIZE -w ${IMG_32MB} -V -f

$ flashrom -p dummy:image=${TMP_FILE},size=16777216, \
emulate=VARIABLE_SIZE -w ${IMG_16MB} -V -f

$ flashrom -p dummy:image=${TMP_FILE},size=8388608, \
emulate=VARIABLE_SIZE -w ${IMG_8MB} -V -f

Signed-off-by: Namyoon Woo <namyoon@google.com>
Change-Id: Ia59eecfcbe798d50f8dacea98c3c508edf8ec77e
Reviewed-on: https://review.coreboot.org/c/flashrom/+/44881
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-09-07 00:54:16 +00:00
Namyoon Woo
3149822cd4 support variable-size SPI chip for dummy programmer
This is designed for firmware updater to pack firmware image
preserving some specific partitions in any size.

BUG=none
TEST=ran the command line below:
$ flashrom -p dummy:image=${TMP_FILE},size=16777216, \
emulate=VARIABLE_SIZE -w ${IMG} -V -f

$ flashrom -p dummy:image=${TMP_FILE},size=auto, \
emulate=VARIABLE_SIZE -w ${IMG} -V -f

Signed-off-by: Namyoon Woo <namyoon@google.com>
Change-Id: Iff266e151459561b126ecfd1c47420b385be1db2
Reviewed-on: https://review.coreboot.org/c/flashrom/+/44879
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2020-09-07 00:52:34 +00:00
David Hendricks
22cd31674d flashchips: Add W25Q256JW_DTR
W25Q256JW currently has two variants, the W25Q256JW with device
ID 0x6019 added in commit be4682d and the W25Q256JW_DTR (aka
W25Q256JW-IM) with device ID 0x8019 added by this patch.

Winbond W25Q256-series chips have a few device IDs:
0x4019: W25Q256FV
0x6019: W25Q256JW
0x7019: W25Q256JV
0x8019: W25Q256JW_DTR

Hence we need to be more specific with naming than usual to avoid a
false positive with wildcards.

Change-Id: I50a6de2c915f9201c458378fcc49130ead73d8c4
Signed-off-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/42386
Reviewed-by: Simon Buhrow
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-08-19 05:12:38 +00:00
Steve Markgraf
f82dd300e3 flashchips: Add support for Macronix MX25L5121E
Tested with ch341a_spi.

Change-Id: I881e2cda938083ba271b2ee0c457d2bbd8e1a766
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43416
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-08-04 22:26:08 +00:00
Jacob Appelbaum
f4eeefd8ab Add support for Winbond W25X05CL
This commit adds support for the Winbond W25X05CL SPI flash chip.  The
Winbond W25X05CL is a 512Kib (64 KiB) SPI flash chip with 4KiB sectors.
I have tested this patch with a Bus Pirate (v3b) and an in-circuit W25X05CL
flash chip using a test clip. Reading, erasing, and writing all function
as expected.

Change-Id: I19c33c7da374f0263f30577a10a0f0f1afa4febc
Signed-off-by: Jacob Appelbaum <jacob@appelbaum.net>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/43573
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-07-26 09:16:20 +00:00
el-coderon
be4682dc44 flashchips: Add W25Q256.W
Nicklas Lennert wrote me via the flashrom mailing list that
he successfully ran read, write and verify cmd.

Signed-off-by: Simon Buhrow <simon.buhrow@posteo.de>
Change-Id: I3608945a38b5ed42b8b2b9b2b388cdea97141d7b
Reviewed-on: https://review.coreboot.org/c/flashrom/+/40855
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
2020-06-16 17:05:47 +00:00
Nico Huber
9dc3d8d35b Revert "flashchips: port S25FS(128S) chip from chromiumos"
This reverts commit a3519561bd0fb44153bb376322b799000657576f.

Breaks support for most SPI flash chips. It's too big and too
invasive to be reviewed as a single commit.

The changes to `spi_poll_wip():spi25.c` were not noticed in the
original review that were from the similarly named function and
file `s25f_poll_status():s25f.c` in the downstream Chromium fork.

V.2: Rebase and rephrase commit msg to reflect how the issue
     slipped in.

Change-Id: Id2a4593bdb654f8a26957d69d52189ce61621d93
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/40626
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Shiyu Sun <sshiyu@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-05-01 14:06:48 +00:00
sibradzic
a3519561bd flashchips: port S25FS(128S) chip from chromiumos
This may seem too big just to support yet another flash chip, but in
reality it brings support for whole new family of S25FS
Spansion/Cypress flash chips. These chips require handling of some
special status registers for erasing or writing, with very specific
timing checks in place.

For example, WIP status bit will remain being set to 1 if erase or
programming errors occur, and in that case chip 'software reset' has
to be performed otherwise the chip will remain unresponsive to all
further commands. Also, special CR3NV register (Configuration Register
3 Nonvolatile) status bits needs to be read and set by using RDAR
(ReaD Any Register) and WRAR (WRite Any Register) OP commands, and
these states are needed to determine which type of reset feature is
enabled at the time (legacy or S25FS type) in the first place,
determine whether Uniform or Hybrid sector architecture is used
at the time, or set programming buffer address wrap point (256 or 512
bytes). Furthermore, S25FS chip status register has to be restored to
its original state (hence that ugly CHIP_RESTORE_CALLBACK) following
erasing or writing, failing to do so may result in host being unable
to access data on the chip at all.

Finally, although this brings support for the whole family of chips,
I only have one such chip to do the actual testing, S25FS128S (Small
Sectors), which I had fully tested on ch341a and FT4232H programmers,
with confirmed working probe, read, erase and write.

Full summary of changes are here:

flashchips:
  add new flashchip sctructure property:
    .reset
  add chip definitions:
    S25FS128S Large Sectors
    S25FS128S Small Sectors

flash:
  add macro (chip_restore_func_data call-back):
    CHIP_RESTORE_CALLBACK

flashrom:
  add struct:
    chip_restore_func_data
  add call-back function:
    register_chip_restore

spi:
  add OP codes:
    CMD_RDAR, CMD_WRAR, CMD_WRAR_LEN, CMD_RSTEN, CMD_RST
  add register bit function definitions:
    CR3NV_ADDR, CR3NV_20H_NV
  add timers:
    T_W, T_RPH, T_SE

spi25:
  refactor (based on chromiumos implementation) function:
    spi_poll_wip
  port these functions from chromiumos:
    probe_spi_big_spansion
    s25fs_software_reset
    s25f_legacy_software_reset
    s25fs_block_erase_d8

spi25_statusreg:
  port these functions from chromiumos:
    spi_restore_status
    s25fs_read_cr
    s25fs_write_cr
    s25fs_restore_cr3nv

Most of the ported functions are originally from s25f.c found at
https://chromium.googlesource.com/chromiumos/third_party/flashrom
with exception of spi_restore_status which is defined in
spi25_statusreg.c. The rest of macros and OP codes are defined in
same files as in this commit.

Change-Id: If659290874a4b9db6e71256bdef382d31b288e72
Signed-off-by: Samir Ibradzic <sibradzic@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/39822
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2020-04-22 06:06:36 +00:00
Scott Chao
f572b50ec7 flashchips: Add support for Winbond W25Q64JW
BUG=b:153515968
BRANCH=kukui
TEST=flash coreboot on kakadu and get successful result.

Change-Id: I8637129421a3b0f96bd8dffa4f50783ea6931967
Signed-off-by: Scott Chao <scott.chao@bitland.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/40275
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Edward O'Callaghan <quasisec@chromium.org>
2020-04-09 14:58:54 +00:00
Joel Stanley
be451edd25 flashchips: Add W25Q512JV
https://www.winbond.com/resource-files/W25Q512JV%20DTR%20RevB%2006132019%20133.pdf

Tested with dediprog SF100.

Change-Id: I8d16f0918785795cc49500435a03641b87d706e9
Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/34595
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-04-08 21:30:35 +00:00
Dino Li
548c880760 flashchips: add support for GigaDevice GD25WQ80E
Support GD25WQ80E, which is the internal flash of IT81202.

TEST=Building flashrom and flashing FW image into IT81202 successfully.

Change-Id: Ib5feaa6ecc7b11b2218e5f02c087b4331388bef8
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/39820
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2020-03-25 23:23:43 +00:00
sibradzic
425dff07ba flashchips: Add Macronix MX25R3235F
32Mbit (4MiB) [x1/x2/x4] Wide Voltage Range (VCC 1.65V-3.6V). It is
similar to the already-supported MX25R6435F, but the total size is
halved.

Tested on ch341a, FT4232H and FT2232H (PicoTAP) programmers, confirmed
working probe, read, erase and write.

Fixes: https://github.com/flashrom/flashrom/issues/43

Change-Id: I6e79115adba17d13d24bc85d78707d53fd4a0be5
Signed-off-by: Samir Ibradzic <sibradzic@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/39532
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-03-24 14:05:52 +00:00
Bernhard Urban-Forster
05c629be29 flashchips: Add Spansion S25FL512S
As found on the Tesla AP2.5 board.

Based on https://mail.coreboot.org/pipermail/flashrom/2013-June/011066.html

Tested with:
    flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 -r content.bin

Signed-off-by: Bernhard Urban-Forster <lewurm@gmail.com>
Change-Id: Ifa9b7615951125b6bbc1f051370ef54896bf506c
Reviewed-on: https://review.coreboot.org/c/flashrom/+/38596
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
2020-02-09 06:21:46 +00:00
darkarnium
4139438943 flashchips: Add AT25SF321
This commit adds support for the Adesto AT25SF321 SPI flash chip. Probe
and read operations have been tested via FT2232H interface, but writes
have not been verified.

Datasheet is available at the following URL:
https://www.adestotech.com/wp-content/uploads/DS-AT25SF321_047.pdf

Change-Id: I7410815e063ffe154a97d7ea5881c8eb82025f56
Signed-off-by: Peter Adkins <pete@kernelpicnic.net>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/36904
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
2019-12-14 15:25:30 +00:00
Peichao Wang
1a119498b4 flashchips: Add W25Q128JW_DTR
Port the code from chromeos flashrom

BUG=b:144297264
TEST=Tested using W25Q128JWDTR in SPI mode

Signed-off-by: Peichao.Wang <peichao.wang@bitland.corp-partner.google.com>
Change-Id: Ifc28878b17dc10da2cfd8f82fffbd57adb22799e
Reviewed-on: https://review.coreboot.org/c/flashrom/+/36717
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2019-11-13 12:32:11 +00:00
Jacob Creedon
80e8dc4df7 flashchips: Add missing N25Q/MT25Q variants
This adds missing voltage and capacity variants for N25Q and MT25Q
series devices. This also fixes a typo in some model numbers where the
last letter should have been a G instead of an E. Added devices include:

N25Q256..1E
N25Q512..1G
N25Q00A..1G
N25Q00A..3G
MT25QU128
MT25QL128
MT25QU256
MT25QU512 tested by Jacob Creedon <jcreedon@google.com>
MT25QL01G tested by Konstantin Grudnev <grudnevkv@gmail.com>
MT25QU01G
MT25QL02G
MT25QU02G

Two have been tested as indicated, all other variants added are marked
untested.

Signed-off-by: Jacob Creedon <jcreedon@google.com>
Change-Id: I85630e4f6c0aa3b261f9871b7d363dad278b997e
Reviewed-on: https://review.coreboot.org/c/flashrom/+/34491
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2019-11-11 02:53:01 +00:00
Nico Huber
5374dc3461 flashchips: Add missing block erasers for GD25Q256D
Change-Id: I7e49e468c7f1eaf0ddd5fc08d6cc6569274faf94
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/35798
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2019-10-05 23:33:22 +00:00
Konstantin Grudnev
3d8868c2b4 Add support for M95M02-A125
Automotive 2 Mbit (256KiB) serial SPI bus EEPROM
PREW tested successfully with use of ch341a programmer
on Linux host 5.2.0-1-MANJARO x86_64

Signed-off-by: Konstantin Grudnev <grudnevkv@gmail.com>
Change-Id: Ic29cd9051c7eac4822d620c299834134f987f01b
Reviewed-on: https://review.coreboot.org/c/flashrom/+/34496
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2019-10-04 17:41:01 +00:00
Alan Green
a1fc01d9e2 flashchips.c: Add W25Q128.V..M printlock attribute
Add a printlock attribute for the Winbond W25Q128.V..M chip. The
printlock attributes matches the ChromiumOS repo's definition of this
chip.

Signed-off-by: Alan Green <avg@google.com>
Change-Id: I775d5d40677593dcb2d05750f8bbc62871b0e551
Reviewed-on: https://review.coreboot.org/c/flashrom/+/35549
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2019-09-24 03:20:55 +00:00
Alan Green
07b8a17db6 flashchips.c: Mark W25Q40EW as TESTED_PREW
Mark Winbond W25Q40EW as TESTED_PREW.

The Winbond W25Q40EW has been marked TESTED_PREW in the ChromiumOS
repository. ChromiumOS has the same defintion for this chip as this
repo, except that ChromiumOS does not have FEATURE_OTP.

Signed-off-by: Alan Green <avg@google.com>
Change-Id: I4be5b2e1069a3f735f0dc6ec92d5f4c8946fbb02
Reviewed-on: https://review.coreboot.org/c/flashrom/+/35535
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
2019-09-24 03:19:00 +00:00