diff --git a/Documentation/MX25L3206E.md b/Documentation/MX25L3206E.md new file mode 100644 index 000000000..53c7e5107 --- /dev/null +++ b/Documentation/MX25L3206E.md @@ -0,0 +1,265 @@ +# Flashrom WP test report + +## Intro + +* Chip name as read from the hardware chip itself: `MX25L3206E` +* Chip name as detected in flashrom: `"MX25L3206E/MX25L3208E"` +* [RTE](https://docs.dasharo.com/transparent-validation/rte/introduction/) was + used as an external programmer and to control the WP pin state via software + - any other programmer could be used there instead +* [flash.sh](flash.sh) script was used as a wrapper for flashrom commands - + please refer there if you need to take a look at the full flashrom commands + +![MX25L3206E.png](MX25L3206E.png) + +## Flashrom version + +```shell +root@rte:~# flashrom --version +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +``` + +## Chip detection + +```shell +root@rte:~# ./flash.sh probe +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Probing ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L3206E/MX25L3208E" (4096 kB, SPI) on linux_spi. +No operations were specified. +SPI Vcc OFF +SPI lines OFF +``` + +## WP status + +```shell +root@rte:~# ./flash.sh wp-status +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP status ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L3206E/MX25L3208E" (4096 kB, SPI) on linux_spi. +Protection range: start=0x00000000 length=0x00000000 (none) +Protection mode: disabled +SPI Vcc OFF +SPI lines OFF +``` + +## WP list + +```shell +root@rte:~# ./flash.sh wp-list +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP list ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L3206E/MX25L3208E" (4096 kB, SPI) on linux_spi. +Available protection ranges: + start=0x00000000 length=0x00000000 (none) + start=0x003f0000 length=0x00010000 (upper 1/64) + start=0x003e0000 length=0x00020000 (upper 1/32) + start=0x003c0000 length=0x00040000 (upper 1/16) + start=0x00380000 length=0x00080000 (upper 1/8) + start=0x00300000 length=0x00100000 (upper 1/4) + start=0x00000000 length=0x00200000 (lower 1/2) + start=0x00200000 length=0x00200000 (upper 1/2) + start=0x00000000 length=0x00300000 (lower 3/4) + start=0x00000000 length=0x00380000 (lower 7/8) + start=0x00000000 length=0x003c0000 (lower 15/16) + start=0x00000000 length=0x003e0000 (lower 31/32) + start=0x00000000 length=0x003f0000 (lower 63/64) + start=0x00000000 length=0x00400000 (all) +SPI Vcc OFF +SPI lines OFF +``` + +## WP enable + +* Set region `0,0x00400000` (whole chip) and enable protection: + +```shell +root@rte:~# ./flash.sh wp-enable +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Setting WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L3206E/MX25L3208E" (4096 kB, SPI) on linux_spi. +Activated protection range: start=0x00000000 length=0x00400000 (all) +Enabling WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L3206E/MX25L3208E" (4096 kB, SPI) on linux_spi. +Enabled hardware protection +SPI Vcc OFF +SPI lines OFF +``` + +* Check the status after locking: + +```shell +root@rte:~# ./flash.sh wp-status +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP status ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L3206E/MX25L3208E" (4096 kB, SPI) on linux_spi. +Protection range: start=0x00000000 length=0x00400000 (all) +Protection mode: hardware +SPI Vcc OFF +SPI lines OFF +``` + +* We can see that the `protection range` was set as desired + +* We can see that the `protection mode` was changed to `hardware` + +## Test WP protection + +* Drive the WP pin LOW: + +```shell +root@rte:~# ./flash.sh wp-low +Setting WP pin LOW ... +``` + +* Try erasing: + +```shell +root@rte:~# ./flash.sh erase +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Erasing chip ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L3206E/MX25L3208E" (4096 kB, SPI) on linux_spi. +Unsetting lock bit(s) failed. + +WARNING!: Updating only part of the image might render your device unusable if old and + new parts are not compatible! + + If you think you know what you're doing, pass --skip-wp-area to exclude + protected part of the flash from the operation. +Your flash chip is in an unknown state. +Please report this to the mailing list at flashrom@flashrom.org or +on IRC (see https://www.flashrom.org/Contact for details), thanks! +SPI Vcc OFF +SPI lines OFF +``` + +## Disable WP protection + +* Set region `0,0` and disable protection (with WP pin still being LOW): + +```shell +root@rte:~# ./flash.sh wp-disable +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Disabling WP protection ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L3206E/MX25L3208E" (4096 kB, SPI) on linux_spi. +Failed to apply new WP settings: unexpected WP configuration read back from chip +Note: hardware status register protection is enabled. The chip's WP# pin must be set to an inactive voltage level to be able to change the WP settings. +Clearing WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +W +Found Macronix flash chip "MX25L3206E/MX25L3208E" (4096 kB, SPI) on linux_spi. +Failed to apply new WP settings: unexpected WP configuration read back from chip +Note: hardware status register protection is enabled. The chip's WP# pin must be set to an inactive voltage level to be able to change the WP settings. +SPI Vcc OFF +SPI lines OFF +``` + +* The protection cannot be disabled by software as long as the WP pin is LOW + +* Drive the WP pin HIGH: + +```shell +root@rte:~# ./flash.sh wp-high +Setting WP pin HIGH ... +``` + +* Set region `0,0` and disable protection (with WP pin HIGH already): + +```shell +root@rte:~# ./flash.sh wp-disable +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Disabling WP protection ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L3206E/MX25L3208E" (4096 kB, SPI) on linux_spi. +Disabled hardware protection +Clearing WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L3206E/MX25L3208E" (4096 kB, SPI) on linux_spi. +Activated protection range: start=0x00000000 length=0x00000000 (none) +SPI Vcc OFF +SPI lines OFF +``` + +* Check the `wp-status` again: + +```shell +root@rte:~# ./flash.sh wp-status +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP status ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L3206E/MX25L3208E" (4096 kB, SPI) on linux_spi. +Protection range: start=0x00000000 length=0x00000000 (none) +Protection mode: disabled +SPI Vcc OFF +SPI lines OFF +``` + +* We can see that the `protection range` was set as desired + +* We can see that the `protection mode` was changed to `disabled` diff --git a/Documentation/MX25L3206E.png b/Documentation/MX25L3206E.png new file mode 100644 index 000000000..6a0e2dbff Binary files /dev/null and b/Documentation/MX25L3206E.png differ diff --git a/Documentation/MX25L6406E.md b/Documentation/MX25L6406E.md new file mode 100644 index 000000000..ca10416e1 --- /dev/null +++ b/Documentation/MX25L6406E.md @@ -0,0 +1,263 @@ +# Flashrom WP test report + +## Intro + +* Chip name as read from the hardware chip itself: `MX25L6406E` +* Chip name as detected in flashrom: `"MX25L6406E/MX25L6408E"` +* [RTE](https://docs.dasharo.com/transparent-validation/rte/introduction/) was + used as an external programmer and to control the WP pin state via software + - any other programmer could be used there instead +* [flash.sh](flash.sh) script was used as a wrapper for flashrom commands - + please refer there if you need to take a look at the full flashrom commands + +![MX25L3206E.png](MX25L3206E.png) + +## Flashrom version + +```shell +root@rte:~# flashrom --version +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +``` + +## Chip detection + +```shell +root@rte:~# ./flash.sh probe +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Probing ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on linux_spi. +No operations were specified. +SPI Vcc OFF +SPI lines OFF +``` + +## WP status + +```shell +root@rte:~# ./flash.sh wp-status +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP status ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on linux_spi. +Protection range: start=0x00000000 length=0x00000000 (none) +Protection mode: disabled +SPI Vcc OFF +SPI lines OFF +``` + +## WP list + +```shell +root@rte:~# ./flash.sh wp-list +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP list ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on linux_spi. +Available protection ranges: + start=0x00000000 length=0x00000000 (none) + start=0x007e0000 length=0x00020000 (upper 1/64) + start=0x007c0000 length=0x00040000 (upper 1/32) + start=0x00780000 length=0x00080000 (upper 1/16) + start=0x00700000 length=0x00100000 (upper 1/8) + start=0x00600000 length=0x00200000 (upper 1/4) + start=0x00000000 length=0x00400000 (lower 1/2) + start=0x00400000 length=0x00400000 (upper 1/2) + start=0x00000000 length=0x00600000 (lower 3/4) + start=0x00000000 length=0x00700000 (lower 7/8) + start=0x00000000 length=0x00780000 (lower 15/16) + start=0x00000000 length=0x007c0000 (lower 31/32) + start=0x00000000 length=0x007e0000 (lower 63/64) + start=0x00000000 length=0x00800000 (all) +SPI Vcc OFF +SPI lines OFF +``` + +## WP enable + +* Set region `0,0x00800000` (whole chip) and enable protection: + +```shell +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Setting WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on linux_spi. +Activated protection range: start=0x00000000 length=0x00800000 (all) +Enabling WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on linux_spi. +Enabled hardware protection +SPI Vcc OFF +SPI lines OFF +``` + +* Check the status after locking: + +```shell +root@rte:~# ./flash.sh wp-status +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP status ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on linux_spi. +Protection range: start=0x00000000 length=0x00800000 (all) +Protection mode: hardware +SPI Vcc OFF +SPI lines OFF +``` + +* We can see that the `protection range` was set as desired + +* We can see that the `protection mode` was changed to `hardware` + +## Test WP protection + +* Drive the WP pin LOW: + +```shell +root@rte:~# ./flash.sh wp-low +Setting WP pin LOW ... +``` + +* Try erasing: + +```shell +root@rte:~# ./flash.sh erase +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Erasing chip ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on linux_spi. +Unsetting lock bit(s) failed. + +WARNING!: Updating only part of the image might render your device unusable if old and + new parts are not compatible! + + If you think you know what you're doing, pass --skip-wp-area to exclude + protected part of the flash from the operation. +Your flash chip is in an unknown state. +Please report this to the mailing list at flashrom@flashrom.org or +on IRC (see https://www.flashrom.org/Contact for details), thanks! +SPI Vcc OFF +SPI lines OFF +``` + +## Disable WP protection + +* Set region `0,0` and disable protection (with WP pin still being LOW): + +```shell +root@rte:~# ./flash.sh wp-disable +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Disabling WP protection ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on linux_spi. +Failed to apply new WP settings: unexpected WP configuration read back from chip +Note: hardware status register protection is enabled. The chip's WP# pin must be set to an inactive voltage level to be able to change the WP settings. +Clearing WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on linux_spi. +Failed to apply new WP settings: unexpected WP configuration read back from chip +Note: hardware status register protection is enabled. The chip's WP# pin must be set to an inactive voltage level to be able to change the WP settings. +SPI Vcc OFF +SPI lines OFF +``` + +* The protection cannot be disabled by software as long as the WP pin is LOW + +* Drive the WP pin HIGH: + +```shell +root@rte:~# ./flash.sh wp-high +Setting WP pin HIGH ... +``` + +* Set region `0,0` and disable protection (with WP pin HIGH already): + +```shell +root@rte:~# ./flash.sh wp-disable +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Disabling WP protection ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on linux_spi. +Disabled hardware protection +Clearing WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on linux_spi. +Activated protection range: start=0x00000000 length=0x00000000 (none) +SPI Vcc OFF +SPI lines OFF +``` + +* Check the `wp-status` again: + +```shell +root@rte:~# ./flash.sh wp-status +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP status ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6406E/MX25L6408E" (8192 kB, SPI) on linux_spi. +Protection range: start=0x00000000 length=0x00000000 (none) +Protection mode: disabled +SPI Vcc OFF +SPI lines OFF +``` + +* We can see that the `protection range` was set as desired + +* We can see that the `protection mode` was changed to `disabled` diff --git a/Documentation/MX25L6436E.md b/Documentation/MX25L6436E.md new file mode 100644 index 000000000..dda1dc522 --- /dev/null +++ b/Documentation/MX25L6436E.md @@ -0,0 +1,258 @@ +# Flashrom WP test report + +## Intro + +* Chip name as read from the hardware chip itself: `MX25L6436E` +* Chip name as detected in flashrom: `"MX25L6436E/MX25L6445E/MX25L6465E"` +* [RTE](https://docs.dasharo.com/transparent-validation/rte/introduction/) was + used as an external programmer and to control the WP pin state via software + - any other programmer could be used there instead +* [flash.sh](flash.sh) script was used as a wrapper for flashrom commands - + please refer there if you need to take a look at the full flashrom commands +* Tested with chip located on the + [Protectli FW6 board](https://eu.protectli.com/vault-6-port/) + +## Flashrom version + +```shell +root@rte:~# flashrom --version +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +``` + +## Chip detection + +```shell +root@rte:~# ./flash.sh probe +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Probing ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6436E/MX25L6445E/MX25L6465E" (8192 kB, SPI) on linux_spi. +No operations were specified. +SPI Vcc OFF +SPI lines OFF +``` + +## WP status + +```shell +root@rte:~# ./flash.sh wp-status +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP status ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6436E/MX25L6445E/MX25L6465E" (8192 kB, SPI) on linux_spi. +Protection range: start=0x00000000 length=0x00000000 (none) +Protection mode: disabled +SPI Vcc OFF +SPI lines OFF +``` + +## WP list + +```shell +root@rte:~# ./flash.sh wp-list +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP list ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6436E/MX25L6445E/MX25L6465E" (8192 kB, SPI) on linux_spi. +Available protection ranges: + start=0x00000000 length=0x00000000 (none) + start=0x007e0000 length=0x00020000 (upper 1/64) + start=0x007c0000 length=0x00040000 (upper 1/32) + start=0x00780000 length=0x00080000 (upper 1/16) + start=0x00700000 length=0x00100000 (upper 1/8) + start=0x00600000 length=0x00200000 (upper 1/4) + start=0x00400000 length=0x00400000 (upper 1/2) + start=0x00000000 length=0x00800000 (all) +SPI Vcc OFF +SPI lines OFF +``` + +## WP enable + +* Set region `0,0x00800000` (whole chip) and enable protection: + +```shell +root@rte:~# ./flash.sh wp-enable +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Setting WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6436E/MX25L6445E/MX25L6465E" (8192 kB, SPI) on linux_spi. +Activated protection range: start=0x00000000 length=0x00800000 (all) +Enabling WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6436E/MX25L6445E/MX25L6465E" (8192 kB, SPI) on linux_spi. +Enabled hardware protection +SPI Vcc OFF +SPI lines OFF +``` + +* Check the status after locking: + +```shell +root@rte:~# ./flash.sh wp-status +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP status ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6436E/MX25L6445E/MX25L6465E" (8192 kB, SPI) on linux_spi. +Protection range: start=0x00000000 length=0x00800000 (all) +Protection mode: hardware +SPI Vcc OFF +SPI lines OFF +``` + +* We can see that the `protection range` was set as desired + +* We can see that the `protection mode` was changed to `hardware` + +## Test WP protection + +* Drive the WP pin LOW: + +```shell +root@rte:~# ./flash.sh wp-low +Setting WP pin LOW ... +``` + +* Try erasing: + +```shell +root@rte:~# ./flash.sh erase +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Erasing chip ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6436E/MX25L6445E/MX25L6465E" (8192 kB, SPI) on linux_spi. +Unsetting lock bit(s) failed. + +WARNING!: Updating only part of the image might render your device unusable if old and + new parts are not compatible! + + If you think you know what you're doing, pass --skip-wp-area to exclude + protected part of the flash from the operation. +Your flash chip is in an unknown state. +Please report this to the mailing list at flashrom@flashrom.org or +on IRC (see https://www.flashrom.org/Contact for details), thanks! +SPI Vcc OFF +SPI lines OFF +``` + +## Disable WP protection + +* Set region `0,0` and disable protection (with WP pin still being LOW): + +```shell +root@rte:~# ./flash.sh wp-disable +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Disabling WP protection ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6436E/MX25L6445E/MX25L6465E" (8192 kB, SPI) on linux_spi. +Failed to apply new WP settings: unexpected WP configuration read back from chip +Note: hardware status register protection is enabled. The chip's WP# pin must be set to an inactive voltage level to be able to change the WP settings. +Clearing WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6436E/MX25L6445E/MX25L6465E" (8192 kB, SPI) on linux_spi. +Failed to apply new WP settings: unexpected WP configuration read back from chip +Note: hardware status register protection is enabled. The chip's WP# pin must be set to an inactive voltage level to be able to change the WP settings. +SPI Vcc OFF +SPI lines OFF +``` + +* The protection cannot be disabled by software as long as the WP pin is LOW + +* Drive the WP pin HIGH: + +```shell +root@rte:~# ./flash.sh wp-high +Setting WP pin HIGH ... +``` + +* Set region `0,0` and disable protection (with WP pin HIGH already): + +```shell +root@rte:~# ./flash.sh wp-disable +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Disabling WP protection ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6436E/MX25L6445E/MX25L6465E" (8192 kB, SPI) on linux_spi. +Disabled hardware protection +Clearing WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6436E/MX25L6445E/MX25L6465E" (8192 kB, SPI) on linux_spi. +Activated protection range: start=0x00000000 length=0x00000000 (none) +SPI Vcc OFF +SPI lines OFF +``` + +* Check the `wp-status` again: + +```shell +root@rte:~# ./flash.sh wp-status +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP status ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Macronix flash chip "MX25L6436E/MX25L6445E/MX25L6465E" (8192 kB, SPI) on linux_spi. +Protection range: start=0x00000000 length=0x00000000 (none) +Protection mode: disabled +SPI Vcc OFF +SPI lines OFF +``` + +* We can see that the `protection range` was set as desired + +* We can see that the `protection mode` was changed to `disabled` diff --git a/Documentation/W25Q64.W.md b/Documentation/W25Q64.W.md new file mode 100644 index 000000000..45992d7e9 --- /dev/null +++ b/Documentation/W25Q64.W.md @@ -0,0 +1,293 @@ +# Flashrom WP test report + +## Intro + +* Chip name as detected in flashrom: `"W25Q64.W"` +* [RTE](https://docs.dasharo.com/transparent-validation/rte/introduction/) was + used as an external programmer and to control the WP pin state via software + - any other programmer could be used there instead +* [flash.sh](flash.sh) script was used as a wrapper for flashrom commands - + please refer there if you need to take a look at the full flashrom commands +* Tested with chip located on the + [Protectli FW4B board](https://protectli.com/vault-4-port/) + +## Flashrom version + +```shell +root@rte:/data# flashrom --version +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +``` + +## Chip detection + +```shell +root@rte:~# ./flash.sh probe +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Probing ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Winbond flash chip "W25Q64.W" (8192 kB, SPI) on linux_spi. +No operations were specified. +SPI Vcc OFF +SPI lines OFF +``` + +## WP status + +```shell +root@rte:~# ./flash.sh wp-status +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP status ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Winbond flash chip "W25Q64.W" (8192 kB, SPI) on linux_spi. +Protection range: start=0x00000000 length=0x00000000 (none) +Protection mode: disabled +SPI Vcc OFF +SPI lines OFF +``` + +## WP list + +```shell +root@rte:~# ./flash.sh wp-list +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP list ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Winbond flash chip "W25Q64.W" (8192 kB, SPI) on linux_spi. +Available protection ranges: + start=0x00000000 length=0x00000000 (none) + start=0x00000000 length=0x00001000 (lower 1/2048) + start=0x007ff000 length=0x00001000 (upper 1/2048) + start=0x00000000 length=0x00002000 (lower 1/1024) + start=0x007fe000 length=0x00002000 (upper 1/1024) + start=0x00000000 length=0x00004000 (lower 1/512) + start=0x007fc000 length=0x00004000 (upper 1/512) + start=0x00000000 length=0x00008000 (lower 1/256) + start=0x007f8000 length=0x00008000 (upper 1/256) + start=0x00000000 length=0x00020000 (lower 1/64) + start=0x007e0000 length=0x00020000 (upper 1/64) + start=0x00000000 length=0x00040000 (lower 1/32) + start=0x007c0000 length=0x00040000 (upper 1/32) + start=0x00000000 length=0x00080000 (lower 1/16) + start=0x00780000 length=0x00080000 (upper 1/16) + start=0x00000000 length=0x00100000 (lower 1/8) + start=0x00700000 length=0x00100000 (upper 1/8) + start=0x00000000 length=0x00200000 (lower 1/4) + start=0x00600000 length=0x00200000 (upper 1/4) + start=0x00000000 length=0x00400000 (lower 1/2) + start=0x00400000 length=0x00400000 (upper 1/2) + start=0x00000000 length=0x00600000 (lower 3/4) + start=0x00200000 length=0x00600000 (upper 3/4) + start=0x00000000 length=0x00700000 (lower 7/8) + start=0x00100000 length=0x00700000 (upper 7/8) + start=0x00000000 length=0x00780000 (lower 15/16) + start=0x00080000 length=0x00780000 (upper 15/16) + start=0x00000000 length=0x007c0000 (lower 31/32) + start=0x00040000 length=0x007c0000 (upper 31/32) + start=0x00000000 length=0x007e0000 (lower 63/64) + start=0x00020000 length=0x007e0000 (upper 63/64) + start=0x00000000 length=0x007f8000 (lower 255/256) + start=0x00008000 length=0x007f8000 (upper 255/256) + start=0x00000000 length=0x007fc000 (lower 511/512) + start=0x00004000 length=0x007fc000 (upper 511/512) + start=0x00000000 length=0x007fe000 (lower 1023/1024) + start=0x00002000 length=0x007fe000 (upper 1023/1024) + start=0x00000000 length=0x007ff000 (lower 2047/2048) + start=0x00001000 length=0x007ff000 (upper 2047/2048) + start=0x00000000 length=0x00800000 (all) +SPI Vcc OFF +SPI lines OFF +``` + +## WP enable + +* Set region `0,0x00800000` (whole chip) and enable protection: + +```shell +root@rte:~# ./flash.sh wp-enable +set SPI Vcc to 3.3V +SPI Vcc ON +SPI lines ON +Setting WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Winbond flash chip "W25Q64.W" (8192 kB, SPI) on linux_spi. +Activated protection range: start=0x00000000 length=0x00800000 (all) + +Enabling WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Winbond flash chip "W25Q64.W" (8192 kB, SPI) on linux_spi. +Enabled hardware protection +Turn SPI off +``` + +* Check the status after locking: + +```shell +root@rte:~# ./flash.sh wp-status +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP status ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Winbond flash chip "W25Q64.W" (8192 kB, SPI) on linux_spi. +Protection range: start=0x00000000 length=0x00800000 (all) +Protection mode: hardware +SPI Vcc OFF +SPI lines OFF +``` + +* We can see that the `protection range` was set as desired + +* We can see that the `protection mode` was changed to `hardware` + +## Test WP protection + +* Drive the WP pin LOW: + +```shell +root@rte:~# ./flash.sh wp-low +Setting WP pin LOW ... +``` + +* Try erasing: + +```shell +root@rte:~# ./flash.sh erase +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Erasing chip ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Winbond flash chip "W25Q64.W" (8192 kB, SPI) on linux_spi. +Block protection could not be disabled! + +WARNING!: Updating only part of the image might render your device unusable if old and + new parts are not compatible! + + If you think you know what you're doing, pass --skip-wp-area to exclude + protected part of the flash from the operation. +Your flash chip is in an unknown state. +Please report this to the mailing list at flashrom@flashrom.org or +on IRC (see https://www.flashrom.org/Contact for details), thanks! +SPI Vcc OFF +SPI lines OFF +``` + +## Disable WP protection + +* Set region `0,0` and disable protection (with WP pin still being LOW): + +```shell +root@rte:~# ./flash.sh wp-disable +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Disabling WP protection ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Winbond flash chip "W25Q64.W" (8192 kB, SPI) on linux_spi. +Failed to apply new WP settings: unexpected WP configuration read back from chip +Note: hardware status register protection is enabled. The chip's WP# pin must be set to an inactive voltage level to be able to change the WP settings. +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Clearing WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Winbond flash chip "W25Q64.W" (8192 kB, SPI) on linux_spi. +Failed to apply new WP settings: unexpected WP configuration read back from chip +Note: hardware status register protection is enabled. The chip's WP# pin must be set to an inactive voltage level to be able to change the WP settings. +SPI Vcc OFF +SPI lines OFF +``` + +* The protection cannot be disabled by software as long as the WP pin is LOW + +* Drive the WP pin HIGH: + +```shell +root@rte:~# ./flash.sh wp-high +Setting WP pin HIGH ... +``` + +* Set region `0,0` and disable protection (with WP pin HIGH already): + +```shell +root@rte:~# ./flash.sh wp-disable +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Disabling WP protection ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Winbond flash chip "W25Q64.W" (8192 kB, SPI) on linux_spi. +Disabled hardware protection +Clearing WP region ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Winbond flash chip "W25Q64.W" (8192 kB, SPI) on linux_spi. +Activated protection range: start=0x00000000 length=0x00000000 (none) +SPI Vcc OFF +SPI lines OFF +``` + +* Check the `wp-status` again: + +```shell +root@rte:~# ./flash.sh wp-status +set SPI Vcc to 3.3V +SPI lines ON +SPI Vcc ON +Checking WP status ... +flashrom v1.2-880-gd047111 on Linux 5.4.69 (armv7l) +flashrom is free software, get the source code at https://flashrom.org + +Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). +Found Winbond flash chip "W25Q64.W" (8192 kB, SPI) on linux_spi. +Protection range: start=0x00000000 length=0x00000000 (none) +Protection mode: disabled +SPI Vcc OFF +SPI lines OFF +``` + +* We can see that the `protection range` was set as desired + +* We can see that the `protection mode` was changed to `disabled` diff --git a/Documentation/chips.md b/Documentation/chips.md index 326792a78..ae7a98418 100644 --- a/Documentation/chips.md +++ b/Documentation/chips.md @@ -1,53 +1,57 @@ List of chips for extending WP support in flashrom as of 26 July 2022. -| Manufacturer | Model(s) | Upstream | [flashrom#185] | Notes -| ----------------- | ---------------- | -------- | -------------- | ----- -| Atmel | `AT25SL128A` | + | | -| Eon | `EN25QH128` | + | | -| ^ | `EN25QH32` | | + | -| ^ | `EN25QH64` | | + | -| GigaDevice | `GD25LQ64` | + | | -| ^ | `GD25LQ64B` | + | | -| ^ | `GD25LQ128C` | + | | -| ^ | `GD25LQ128D` | + | | -| ^ | `GD25LQ128E` | + | | -| ^ | `GD25Q32` | + | | -| ^ | `GD25Q32B` | + | | -| ^ | `GD25Q64` | + | | -| ^ | `GD25Q64B` | + | | -| ^ | `GD25Q127C` | + | | -| ^ | `GD25Q128C` | + | | -| ^ | `GD25Q256D` | + | | -| Winbond | `W25Q32.V` | | + | -| ^ | `W25Q32.W` | | + | -| ^ | `W25Q64BV` | + | + | -| ^ | `W25Q64CV` | + | + | -| ^ | `W25Q64FV` | + | + | in KGPE-D16 -| ^ | `W25Q64JV-.Q` | + | + | -| ^ | `W25Q64.W` | + | + | in Protectli FW4C -| ^ | `W25Q128.V` | + | | in KGPE-D16 -| ^ | `W25Q128.V..M` | + | | -| ^ | `W25Q128.W` | + | | -| ^ | `W25Q128.JW.DTR` | + | | -| ^ | `W25Q256.V` | + | | -| ^ | `W25Q256JV_M` | + | | -| Macronix | `MX25L3206E` | | + | in Dell OptiPlex -| ^ | `MX25L3208E` | | + | same flash description as MX25L3206E -| ^ | `MX25L6405` | | + | -| ^ | `MX25L6405D` | | + | -| ^ | `MX25L6406E` | | + | in Dell OptiPlex -| ^ | `MX25L6408E` | | + | same flash description as MX25L6406E -| ^ | `MX25L6436E` | | + | -| ^ | `MX25L6445E` | | + | -| ^ | `MX25L6465E` | | + | -| ^ | `MX25L6473E` | | + | -| ^ | `MX25L6473F` | | + | -| ^ | `MX25L6495F` | | + | **no datasheet!** -| Micron/Numonyx/ST | `N25Q032..1E` | | + | -| ^ | `N25Q032..3E` | | + | -| ^ | `N25Q064..1E` | | + | -| ^ | `N25Q064..3E` | | + | -| ^ | `MT25QL512ABB8ESF-0SIT` | | | in Talos II -| XTX | `XT25F16` | | optional | +| Manufacturer | Model(s) | Upstream | [flashrom#185] | test results |Notes +| ----------------- | ---------------- | -------- | -------------- |---------------|----- +| Atmel | `AT25SL128A` | + | | | +| Eon | `EN25QH128` | + | | | +| ^ | `EN25QH32` | | + | | +| ^ | `EN25QH64` | | + | | +| GigaDevice | `GD25LQ64` | + | | | +| ^ | `GD25LQ64B` | + | | | +| ^ | `GD25LQ128C` | + | | | +| ^ | `GD25LQ128D` | + | | | +| ^ | `GD25LQ128E` | + | | | +| ^ | `GD25Q32` | + | | | +| ^ | `GD25Q32B` | + | | | +| ^ | `GD25Q64` | + | | | +| ^ | `GD25Q64B` | + | | | +| ^ | `GD25Q127C` | + | | | +| ^ | `GD25Q128C` | + | | | +| ^ | `GD25Q256D` | + | | | +| Winbond | `W25Q32.V` | | + | | +| ^ | `W25Q32.W` | | + | | +| ^ | `W25Q64BV` | + | + | | +| ^ | `W25Q64CV` | + | + | | +| ^ | `W25Q64FV` | + | + | |in KGPE-D16 +| ^ | `W25Q64JV-.Q` | + | + | | +| ^ | `W25Q64.W` | + | + | [W25Q64.W] |in Protectli FW4C +| ^ | `W25Q128.V` | + | | |in KGPE-D16 +| ^ | `W25Q128.V..M` | + | | | +| ^ | `W25Q128.W` | + | | | +| ^ | `W25Q128.JW.DTR` | + | | | +| ^ | `W25Q256.V` | + | | | +| ^ | `W25Q256JV_M` | + | | | +| Macronix | `MX25L3206E` | | + | [MX25L3206E] |in Dell OptiPlex +| ^ | `MX25L3208E` | | + | [MX25L3206E] |same flash description as MX25L3206E +| ^ | `MX25L6405` | | + | | +| ^ | `MX25L6405D` | | + | | +| ^ | `MX25L6406E` | | + | [MX25L6406E] |in Dell OptiPlex +| ^ | `MX25L6408E` | | + | [MX25L6406E] |same flash description as MX25L6406E +| ^ | `MX25L6436E` | | + | [MX25L6436E] | +| ^ | `MX25L6445E` | | + | [MX25L6436E] | +| ^ | `MX25L6465E` | | + | [MX25L6436E] | +| ^ | `MX25L6473E` | | + | | +| ^ | `MX25L6473F` | | + | | +| ^ | `MX25L6495F` | | + | |**no datasheet!** +| Micron/Numonyx/ST | `N25Q032..1E` | | + | | +| ^ | `N25Q032..3E` | | + | | +| ^ | `N25Q064..1E` | | + | | +| ^ | `N25Q064..3E` | | + | | +| ^ | `MT25QL512ABB8ESF-0SIT` | | | |in Talos II +| XTX | `XT25F16` | | optional |optional | [flashrom#185]: https://github.com/flashrom/flashrom/issues/185 +[MX25L3206E]: MX25L3206E.md +[MX25L6406E]: MX25L6406E.md +[MX25L6436E]: MX25L6436E.md +[W25Q64.W]: W25Q64.W.md diff --git a/Documentation/flash.sh b/Documentation/flash.sh new file mode 100755 index 000000000..89e2ecc92 --- /dev/null +++ b/Documentation/flash.sh @@ -0,0 +1,145 @@ +#!/bin/sh + +# Set these according to the chip you want to use +CHIP_THINKPAD_SPI1="MX25L6406E/MX25L6408E" +CHIP_THINKPAD_SPI2="MX25L3206E/MX25L3208E" +FLASHROM_CHIP="-c $CHIP_THINKPAD_SPI2" +WP_RANGE="0,0x00400000" + +errorExit() { + errorMessage="$1" + echo "$errorMessage" + exit 1 +} + +errorCheck() { + errorCode=$? + errorMessage="$1" + [ "$errorCode" -ne 0 ] && errorExit "$errorMessage : ($errorCode)" +} + +usage() { + echo "${0} command [FILE]" + echo "Available commands:" + echo " - probe - probe flash" + echo " - read FILE - read flash to FILE" + echo " - write FILE - flash to FILE" + echo "For example:" + echo "${0} probe" + echo "${0} read flash.rom" + echo "${0} write flash.rom" + exit 0 +} + +SPI_DEV="/dev/spidev1.0" +SPI_SPEED="16000" +FLASHROM_PROGRAMMER="linux_spi:dev=$SPI_DEV,spispeed=$SPI_SPEED" + +[ $# -eq 0 ] && usage + +spiON() { + echo "set SPI Vcc to 3.3V" + # 0 - 1.8V , 1 - 3.3V + echo 1 > /sys/class/gpio/gpio405/value + sleep 1 + echo "SPI lines ON" + echo 1 > /sys/class/gpio/gpio404/value + sleep 1 + echo "SPI Vcc ON" + echo 1 > /sys/class/gpio/gpio406/value + sleep 2 +} + +spiOFF() { + echo "SPI Vcc OFF" + echo 0 > /sys/class/gpio/gpio406/value + echo "SPI lines OFF" + echo 0 > /sys/class/gpio/gpio404/value + echo 0 > /sys/class/gpio/gpio405/value +} + +CMD="$1" +FILE="$2" + +case "$CMD" in + "probe") + spiON + echo "Probing ..." + flashrom -p "$FLASHROM_PROGRAMMER" $FLASHROM_CHIP + sleep 1 + spiOFF + ;; + "read") + [ -z "$FILE" ] && errorExit "FILE not given" + spiON + echo "Reading ..." + flashrom -p "$FLASHROM_PROGRAMMER" -r "$FILE" $FLASHROM_CHIP + sleep 1 + spiOFF + ;; + "write") + [ -z "$FILE" ] && errorExit "FILE not given" + spiON + echo "Writing ..." + flashrom -p "$FLASHROM_PROGRAMMER" -w "$FILE" "$FLASHROM_CHIP" + sleep 1 + spiOFF + ;; + "wp-list") + spiON + echo "Checking WP list ..." + flashrom -p "$FLASHROM_PROGRAMMER" --wp-list $FLASHROM_CHIP + sleep 1 + spiOFF + ;; + "wp-status") + spiON + echo "Checking WP status ..." + flashrom -p "$FLASHROM_PROGRAMMER" --wp-status $FLASHROM_CHIP + sleep 1 + spiOFF + ;; + "wp-enable") + spiON + echo "Setting WP region ..." + flashrom -p "$FLASHROM_PROGRAMMER" --wp-range="$WP_RANGE" $FLASHROM_CHIP + sleep 1 + echo "Enabling WP region ..." + flashrom -p "$FLASHROM_PROGRAMMER" --wp-enable $FLASHROM_CHIP + sleep 1 + spiOFF + ;; + "wp-disable") + spiON + echo "Disabling WP protection ..." + flashrom -p "$FLASHROM_PROGRAMMER" --wp-disable $FLASHROM_CHIP + sleep 1 + echo "Clearing WP region ..." + flashrom -p "$FLASHROM_PROGRAMMER" --wp-range=0,0 $FLASHROM_CHIP + sleep 1 + spiOFF + ;; + "erase") + spiON + echo "Erasing chip ..." + flashrom -p "$FLASHROM_PROGRAMMER" -E $FLASHROM_CHIP + sleep 1 + spiOFF + ;; + "wp-high") + echo "Setting WP pin HIGH ..." + echo "out" > /sys/class/gpio/gpio402/direction + # deassert WP pin to disable hardware protection of status registers + echo "1" > /sys/class/gpio/gpio402/value + ;; + "wp-low") + echo "Setting WP pin LOW ..." + echo "out" > /sys/class/gpio/gpio402/direction + # assert WP pin to enable hardware protection of status registers + echo "0" > /sys/class/gpio/gpio402/value + ;; + *) + echo "Command \"$CMD\" is not supported" + usage + ;; +esac