flashrom: backport support for new flashchips

Backport upstreamed support for AT25EU0041A, AT25EU0161A,
AT25FF041A, PUYA-PY25Q16HB and PUYA-P25Q40HB.

Adapt and backport cherry-picked commits from
raspberry/flashrom/1.4.x-rpi
AT25FF161A: https://github.com/flashrom/flashrom/commit/86ea3102aa021083e223d89b806cb7dad9fea41d

Signed-off-by: Joshua Covington <joshuacov@gmail.com>
This commit is contained in:
Joshua Covington authored and Hannu Nyman committed 2026-10-24 10:33:19 +03:00
1 parent 3d2fc358cd
commit 88a56a3981
6 files changed
+467

No files matched your search

@@ -0,0 +1,83 @@
From 5b80ae94824f720b8377d99d654016b52d5c5a27 Mon Sep 17 00:00:00 2001
From: Mathew Blowers <mathew.blowers@raspberrypi.com>
Date: Tue, 11 Aug 2026 15:56:23 +0100
Subject: [PATCH] flashchips: Add AT25EU0041A
Datasheet: https://www.renesas.com/en/document/dst/at25eu0041a-datasheet
Tested: probe, read, write and erase
Tested-with: Raspberry Pi 4
https://paste.flashrom.org/view.php?id=3886
Change-Id: If52e2935cc3bb3d8c62d558ce1898c594b6501c9
Signed-off-by: Mathew Blowers <mathew.blowers@raspberrypi.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/94904
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Abdelkader Boudih <coreboot@seuros.com>
---
flashchips/atmel.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
include/flashchips.h | 1 +
2 files changed, 45 insertions(+)
--- a/flashchips/atmel.c
+++ b/flashchips/atmel.c
@@ -514,6 +514,50 @@
{
.vendor = "Atmel",
+ .name = "AT25EU0041A",
+ .bustype = BUS_SPI,
+ .manufacture_id = ATMEL_ID,
+ .model_id = ATMEL_AT25EU0041A,
+ .total_size = 512,
+ .page_size = 256,
+ .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP,
+ .tested = TEST_OK_PREW,
+ .probe = PROBE_SPI_RDID,
+ .probe_timing = TIMING_ZERO,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {256, 2048} },
+ .block_erase = SPI_BLOCK_ERASE_81,
+ }, {
+ .eraseblocks = { {256, 2048} },
+ .block_erase = SPI_BLOCK_ERASE_DB,
+ }, {
+ .eraseblocks = { {4 * 1024, 128} },
+ .block_erase = SPI_BLOCK_ERASE_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 16} },
+ .block_erase = SPI_BLOCK_ERASE_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 8} },
+ .block_erase = SPI_BLOCK_ERASE_D8,
+ }, {
+ .eraseblocks = { {512 * 1024, 1} },
+ .block_erase = SPI_BLOCK_ERASE_60,
+ }, {
+ .eraseblocks = { {512 * 1024, 1} },
+ .block_erase = SPI_BLOCK_ERASE_C7,
+ }
+ },
+ .printlock = SPI_PRETTYPRINT_STATUS_REGISTER_BP4_SRWD,
+ .unlock = SPI_DISABLE_BLOCKPROTECT_BP4_SRWD,
+ .write = SPI_CHIP_WRITE256,
+ .read = SPI_CHIP_READ,
+ .voltage = {1650, 3600},
+ },
+
+ {
+ .vendor = "Atmel",
/* The A suffix indicates 33MHz instead of 20MHz clock rate.
* All other properties seem to be the same.*/
.name = "AT25F1024(A)",
--- a/include/flashchips.h
+++ b/include/flashchips.h
@@ -131,6 +131,7 @@
#define ATMEL_AT25DL161 0x4603 /* EDI 0x0100 */
#define ATMEL_AT25DQ161 0x8600 /* EDI 0x0100 */
#define ATMEL_AT25DQ321 0x8700 /* EDI 0x0100 */
+#define ATMEL_AT25EU0041A 0x1401
#define ATMEL_AT25F512 0x60 /* Needs AT25F_RDID. ID from PCN and actual HW. Seems to be a relabeled AT25F1024. */
#define ATMEL_AT25F512A 0x65 /* Needs AT25F_RDID */
#define ATMEL_AT25F512B 0x6500
@@ -0,0 +1,83 @@
From cfa5ed4234c8476cf00c5545bb91c48a10518c39 Mon Sep 17 00:00:00 2001
From: Mathew Blowers <mathew.blowers@raspberrypi.com>
Date: Tue, 11 Aug 2026 16:16:19 +0100
Subject: [PATCH] flashchips: Add AT25EU0161A
Datasheet: https://www.renesas.com/en/document/dst/at25eu0161a-datasheet
Tested: probe, read, write and erase
Tested-with: Raspberry Pi 5
https://paste.flashrom.org/view.php?id=3887
Change-Id: Ie9122a26e94a309e1879763ac3bd414622f8ec52
Signed-off-by: Mathew Blowers <mathew.blowers@raspberrypi.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/94906
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Abdelkader Boudih <coreboot@seuros.com>
---
flashchips/atmel.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
include/flashchips.h | 1 +
2 files changed, 45 insertions(+)
--- a/flashchips/atmel.c
+++ b/flashchips/atmel.c
@@ -514,6 +514,50 @@
{
.vendor = "Atmel",
+ .name = "AT25EU0161A",
+ .bustype = BUS_SPI,
+ .manufacture_id = ATMEL_ID,
+ .model_id = ATMEL_AT25EU0161A,
+ .total_size = 2048,
+ .page_size = 256,
+ .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP,
+ .tested = TEST_OK_PREW,
+ .probe = PROBE_SPI_RDID,
+ .probe_timing = TIMING_ZERO,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {256, 8192} },
+ .block_erase = SPI_BLOCK_ERASE_81,
+ }, {
+ .eraseblocks = { {256, 8192} },
+ .block_erase = SPI_BLOCK_ERASE_DB,
+ }, {
+ .eraseblocks = { {4 * 1024, 512} },
+ .block_erase = SPI_BLOCK_ERASE_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 64} },
+ .block_erase = SPI_BLOCK_ERASE_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 32} },
+ .block_erase = SPI_BLOCK_ERASE_D8,
+ }, {
+ .eraseblocks = { {2048 * 1024, 1} },
+ .block_erase = SPI_BLOCK_ERASE_60,
+ }, {
+ .eraseblocks = { {2048 * 1024, 1} },
+ .block_erase = SPI_BLOCK_ERASE_C7,
+ }
+ },
+ .printlock = SPI_PRETTYPRINT_STATUS_REGISTER_BP4_SRWD,
+ .unlock = SPI_DISABLE_BLOCKPROTECT_BP4_SRWD,
+ .write = SPI_CHIP_WRITE256,
+ .read = SPI_CHIP_READ,
+ .voltage = {1650, 3600},
+ },
+
+ {
+ .vendor = "Atmel",
.name = "AT25EU0041A",
.bustype = BUS_SPI,
.manufacture_id = ATMEL_ID,
--- a/include/flashchips.h
+++ b/include/flashchips.h
@@ -132,6 +132,7 @@
#define ATMEL_AT25DQ161 0x8600 /* EDI 0x0100 */
#define ATMEL_AT25DQ321 0x8700 /* EDI 0x0100 */
#define ATMEL_AT25EU0041A 0x1401
+#define ATMEL_AT25EU0161A 0x1601
#define ATMEL_AT25F512 0x60 /* Needs AT25F_RDID. ID from PCN and actual HW. Seems to be a relabeled AT25F1024. */
#define ATMEL_AT25F512A 0x65 /* Needs AT25F_RDID */
#define ATMEL_AT25F512B 0x6500
@@ -0,0 +1,77 @@
From f9ee9196463dc0b08c6b96910405dc8eed9becb1 Mon Sep 17 00:00:00 2001
From: Mathew Blowers <mathew.blowers@raspberrypi.com>
Date: Tue, 11 Aug 2026 16:45:29 +0100
Subject: [PATCH] flashchips: Add AT25FF041A
Datasheet: https://www.renesas.com/en/document/dst/at25ff041a-datasheet
Tested: probe, read, write and erase
Tested-with: Raspberry Pi 4
https://paste.flashrom.org/view.php?id=3888
Change-Id: I96f762aa209dd413d1caff11dd4cfa07d91de2eb
Signed-off-by: Mathew Blowers <mathew.blowers@raspberrypi.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/94907
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
flashchips/atmel.c | 38 ++++++++++++++++++++++++++++++++++++++
include/flashchips.h | 1 +
2 files changed, 39 insertions(+)
--- a/flashchips/atmel.c
+++ b/flashchips/atmel.c
@@ -793,6 +793,44 @@
{
.vendor = "Atmel",
+ .name = "AT25FF041A",
+ .bustype = BUS_SPI,
+ .manufacture_id = ATMEL_ID,
+ .model_id = ATMEL_AT25FF041A,
+ .total_size = 512,
+ .page_size = 256,
+ .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP,
+ .tested = TEST_OK_PREW,
+ .probe = PROBE_SPI_RDID,
+ .probe_timing = TIMING_ZERO,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 128} },
+ .block_erase = SPI_BLOCK_ERASE_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 16} },
+ .block_erase = SPI_BLOCK_ERASE_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 8} },
+ .block_erase = SPI_BLOCK_ERASE_D8,
+ }, {
+ .eraseblocks = { {512 * 1024, 1} },
+ .block_erase = SPI_BLOCK_ERASE_60,
+ }, {
+ .eraseblocks = { {512 * 1024, 1} },
+ .block_erase = SPI_BLOCK_ERASE_C7,
+ }
+ },
+ .printlock = SPI_PRETTYPRINT_STATUS_REGISTER_SRWD_SEC_TB_BP2_WELWIP,
+ .unlock = SPI_DISABLE_BLOCKPROTECT_BP2_SRWD,
+ .write = SPI_CHIP_WRITE256,
+ .read = SPI_CHIP_READ,
+ .voltage = {1650, 3600},
+ },
+
+ {
+ .vendor = "Atmel",
.name = "AT25FS010",
.bustype = BUS_SPI,
.manufacture_id = ATMEL_ID,
--- a/include/flashchips.h
+++ b/include/flashchips.h
@@ -139,6 +139,7 @@
#define ATMEL_AT25F1024 0x60 /* Needs AT25F_RDID */
#define ATMEL_AT25F2048 0x63 /* Needs AT25F_RDID */
#define ATMEL_AT25F4096 0x64 /* Needs AT25F_RDID */
+#define ATMEL_AT25FF041A 0x4408
#define ATMEL_AT25FS010 0x6601
#define ATMEL_AT25FS040 0x6604
#define ATMEL_AT25SF041 0x8401
@@ -0,0 +1,70 @@
From 86ea3102aa021083e223d89b806cb7dad9fea41d Mon Sep 17 00:00:00 2001
From: Mathew Blowers <mathew.blowers@raspberrypi.com>
Date: Tue, 26 May 2026 16:29:36 +0100
Subject: [PATCH] Add AT25FF161A
Signed-off-by: Mathew Blowers <mathew.blowers@raspberrypi.com>
[joshuacov: adapted from 86ea3102, use BP2 printlock to match unlock]
Signed-off-by: Joshua Covington <joshuacov@gmail.com>
---
flashchips/atmel.c | 38 ++++++++++++++++++++++++++++++++++++++
include/flashchips.h | 1 +
2 files changed, 39 insertions(+)
--- a/flashchips/atmel.c
+++ b/flashchips/atmel.c
@@ -831,6 +831,44 @@
{
.vendor = "Atmel",
+ .name = "AT25FF161A",
+ .bustype = BUS_SPI,
+ .manufacture_id = ATMEL_ID,
+ .model_id = ATMEL_AT25FF161A,
+ .total_size = 2048,
+ .page_size = 256,
+ .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP | FEATURE_WRSR2,
+ .tested = TEST_OK_PREW,
+ .probe = PROBE_SPI_RDID,
+ .probe_timing = TIMING_ZERO,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 512} },
+ .block_erase = SPI_BLOCK_ERASE_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 64} },
+ .block_erase = SPI_BLOCK_ERASE_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 32} },
+ .block_erase = SPI_BLOCK_ERASE_D8,
+ }, {
+ .eraseblocks = { {2048 * 1024, 1} },
+ .block_erase = SPI_BLOCK_ERASE_60,
+ }, {
+ .eraseblocks = { {2048 * 1024, 1} },
+ .block_erase = SPI_BLOCK_ERASE_C7,
+ }
+ },
+ .printlock = SPI_PRETTYPRINT_STATUS_REGISTER_BP2_SRWD,
+ .unlock = SPI_DISABLE_BLOCKPROTECT_BP2_SRWD,
+ .write = SPI_CHIP_WRITE256,
+ .read = SPI_CHIP_READ,
+ .voltage = {1650, 3600},
+ },
+
+ {
+ .vendor = "Atmel",
.name = "AT25FS010",
.bustype = BUS_SPI,
.manufacture_id = ATMEL_ID,
--- a/include/flashchips.h
+++ b/include/flashchips.h
@@ -140,6 +140,7 @@
#define ATMEL_AT25F2048 0x63 /* Needs AT25F_RDID */
#define ATMEL_AT25F4096 0x64 /* Needs AT25F_RDID */
#define ATMEL_AT25FF041A 0x4408
+#define ATMEL_AT25FF161A 0x4608
#define ATMEL_AT25FS010 0x6601
#define ATMEL_AT25FS040 0x6604
#define ATMEL_AT25SF041 0x8401
@@ -0,0 +1,77 @@
From da5d731d8c91f157167513cc7abfbde4b90451eb Mon Sep 17 00:00:00 2001
From: Mathew Blowers <mathew.blowers@raspberrypi.com>
Date: Thu, 6 Aug 2026 15:47:59 +0100
Subject: [PATCH] flashchips: Add PUYA PY25Q16HB
Datasheet: https://datasheet4u.com/pdf/1603106/PY25Q16HB.pdf
Tested: probe, read, write and erase
Tested-with: Raspberry Pi 5
http://paste.flashrom.org/view.php?id=3884
Change-Id: Ice337ab2b52a54b316567684f6b59d68fd2effcc
Signed-off-by: Mathew Blowers <mathew.blowers@raspberrypi.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/94756
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
flashchips/puya.c | 38 ++++++++++++++++++++++++++++++++++++++
include/flashchips.h | 1 +
2 files changed, 39 insertions(+)
--- a/flashchips/puya.c
+++ b/flashchips/puya.c
@@ -12,6 +12,44 @@
{
.vendor = "PUYA",
+ .name = "P25Q16HB",
+ .bustype = BUS_SPI,
+ .manufacture_id = PUYA_ID,
+ .model_id = PUYA_P25Q16HB,
+ .total_size = 2048,
+ .page_size = 256,
+ .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP,
+ .tested = TEST_OK_PREW,
+ .probe = PROBE_SPI_RDID,
+ .probe_timing = TIMING_ZERO,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 512} },
+ .block_erase = SPI_BLOCK_ERASE_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 64} },
+ .block_erase = SPI_BLOCK_ERASE_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 32} },
+ .block_erase = SPI_BLOCK_ERASE_D8,
+ }, {
+ .eraseblocks = { {2 * 1024 * 1024, 1} },
+ .block_erase = SPI_BLOCK_ERASE_60,
+ }, {
+ .eraseblocks = { {2 * 1024 * 1024, 1} },
+ .block_erase = SPI_BLOCK_ERASE_C7,
+ }
+ },
+ .printlock = SPI_PRETTYPRINT_STATUS_REGISTER_BP4_SRWD,
+ .unlock = SPI_DISABLE_BLOCKPROTECT_BP4_SRWD,
+ .write = SPI_CHIP_WRITE256,
+ .read = SPI_CHIP_READ,
+ .voltage = {2300, 3600},
+ },
+
+ {
+ .vendor = "PUYA",
.name = "P25Q06H",
.bustype = BUS_SPI,
.manufacture_id = PUYA_ID,
--- a/include/flashchips.h
+++ b/include/flashchips.h
@@ -669,6 +669,7 @@
#define PMC_PM49FL004 0x6E
#define PUYA_ID 0x85
+#define PUYA_P25Q16HB 0x2015
#define PUYA_P25Q06H 0x4010
#define PUYA_P25Q11H 0x4011
#define PUYA_P25Q21H 0x4012
@@ -0,0 +1,77 @@
From 9282e2f4ce89cc3d19a5d1cb32c321dfe1808fc3 Mon Sep 17 00:00:00 2001
From: Mathew Blowers <mathew.blowers@raspberrypi.com>
Date: Tue, 11 Aug 2026 13:56:21 +0100
Subject: [PATCH] flashchips: Add PUYA P25Q40HB
Datasheet: https://datasheet4u.com/pdf/1603105/PY25Q40HB.pdf
Tested: probe, read, write and erase
Tested-with: Raspberry Pi 4
https://paste.flashrom.org/view.php?id=3885
Change-Id: I1bf8ccced1d1d63dfb7ec56eac6c95cbe14ec742
Signed-off-by: Mathew Blowers <mathew.blowers@raspberrypi.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/94903
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Abdelkader Boudih <coreboot@seuros.com>
---
flashchips/puya.c | 38 ++++++++++++++++++++++++++++++++++++++
include/flashchips.h | 1 +
2 files changed, 39 insertions(+)
--- a/flashchips/puya.c
+++ b/flashchips/puya.c
@@ -12,6 +12,44 @@
{
.vendor = "PUYA",
+ .name = "P25Q40HB",
+ .bustype = BUS_SPI,
+ .manufacture_id = PUYA_ID,
+ .model_id = PUYA_P25Q40HB,
+ .total_size = 512,
+ .page_size = 256,
+ .feature_bits = FEATURE_WRSR_WREN | FEATURE_OTP,
+ .tested = TEST_OK_PREW,
+ .probe = PROBE_SPI_RDID,
+ .probe_timing = TIMING_ZERO,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {4 * 1024, 128} },
+ .block_erase = SPI_BLOCK_ERASE_20,
+ }, {
+ .eraseblocks = { {32 * 1024, 16} },
+ .block_erase = SPI_BLOCK_ERASE_52,
+ }, {
+ .eraseblocks = { {64 * 1024, 8} },
+ .block_erase = SPI_BLOCK_ERASE_D8,
+ }, {
+ .eraseblocks = { {512 * 1024, 1} },
+ .block_erase = SPI_BLOCK_ERASE_60,
+ }, {
+ .eraseblocks = { {512 * 1024, 1} },
+ .block_erase = SPI_BLOCK_ERASE_C7,
+ }
+ },
+ .printlock = SPI_PRETTYPRINT_STATUS_REGISTER_BP4_SRWD,
+ .unlock = SPI_DISABLE_BLOCKPROTECT_BP4_SRWD,
+ .write = SPI_CHIP_WRITE256,
+ .read = SPI_CHIP_READ,
+ .voltage = {2300, 3600},
+ },
+
+ {
+ .vendor = "PUYA",
.name = "P25Q16HB",
.bustype = BUS_SPI,
.manufacture_id = PUYA_ID,
--- a/include/flashchips.h
+++ b/include/flashchips.h
@@ -669,6 +669,7 @@
#define PMC_PM49FL004 0x6E
#define PUYA_ID 0x85
+#define PUYA_P25Q40HB 0x2013
#define PUYA_P25Q16HB 0x2015
#define PUYA_P25Q06H 0x4010
#define PUYA_P25Q11H 0x4011