Skip to content

Commit d099224

Browse files
author
Konstantin Kondrashov
committed
Merge branch 'feature/p4_add_3bit_for_wafer_major' into 'master'
feat(efuse): Adds 3-bit field for wafer major version in ESP32-P4 See merge request espressif/esp-idf!39562
2 parents d38621e + 3b0f4e4 commit d099224

File tree

6 files changed

+60
-38
lines changed

6 files changed

+60
-38
lines changed

components/efuse/esp32p4/esp_efuse_table.c

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -9,7 +9,7 @@
99
#include <assert.h>
1010
#include "esp_efuse_table.h"
1111

12-
// md5_digest_table c56ed98dde7a08c8f70d57a01faba96a
12+
// md5_digest_table 665d4d3a1354653f8e46869d49df1a2f
1313
// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
1414
// If you want to change some fields, you need to change esp_efuse_table.csv file
1515
// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
@@ -247,8 +247,8 @@ static const esp_efuse_desc_t WR_DIS_WAFER_VERSION_MINOR[] = {
247247
{EFUSE_BLK0, 20, 1}, // [] wr_dis of WAFER_VERSION_MINOR,
248248
};
249249

250-
static const esp_efuse_desc_t WR_DIS_WAFER_VERSION_MAJOR[] = {
251-
{EFUSE_BLK0, 20, 1}, // [] wr_dis of WAFER_VERSION_MAJOR,
250+
static const esp_efuse_desc_t WR_DIS_WAFER_VERSION_MAJOR_LO[] = {
251+
{EFUSE_BLK0, 20, 1}, // [] wr_dis of WAFER_VERSION_MAJOR_LO,
252252
};
253253

254254
static const esp_efuse_desc_t WR_DIS_DISABLE_WAFER_VERSION_MAJOR[] = {
@@ -287,6 +287,10 @@ static const esp_efuse_desc_t WR_DIS_SYS_DATA_PART1[] = {
287287
{EFUSE_BLK0, 21, 1}, // [] wr_dis of BLOCK2,
288288
};
289289

290+
static const esp_efuse_desc_t WR_DIS_WAFER_VERSION_MAJOR_HI[] = {
291+
{EFUSE_BLK0, 20, 1}, // [] wr_dis of WAFER_VERSION_MAJOR_HI,
292+
};
293+
290294
static const esp_efuse_desc_t WR_DIS_LDO_VO1_DREF[] = {
291295
{EFUSE_BLK0, 20, 1}, // [] wr_dis of LDO_VO1_DREF,
292296
};
@@ -892,8 +896,8 @@ static const esp_efuse_desc_t WAFER_VERSION_MINOR[] = {
892896
{EFUSE_BLK1, 64, 4}, // [] Minor chip version,
893897
};
894898

895-
static const esp_efuse_desc_t WAFER_VERSION_MAJOR[] = {
896-
{EFUSE_BLK1, 68, 2}, // [] Major chip version,
899+
static const esp_efuse_desc_t WAFER_VERSION_MAJOR_LO[] = {
900+
{EFUSE_BLK1, 68, 2}, // [] Major chip version (lower 2 bits),
897901
};
898902

899903
static const esp_efuse_desc_t DISABLE_WAFER_VERSION_MAJOR[] = {
@@ -928,6 +932,10 @@ static const esp_efuse_desc_t PKG_VERSION[] = {
928932
{EFUSE_BLK1, 84, 3}, // [] Package version,
929933
};
930934

935+
static const esp_efuse_desc_t WAFER_VERSION_MAJOR_HI[] = {
936+
{EFUSE_BLK1, 87, 1}, // [] Major chip version (MSB),
937+
};
938+
931939
static const esp_efuse_desc_t LDO_VO1_DREF[] = {
932940
{EFUSE_BLK1, 88, 4}, // [] Output VO1 parameter,
933941
};
@@ -1446,8 +1454,8 @@ const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_WAFER_VERSION_MINOR[] = {
14461454
NULL
14471455
};
14481456

1449-
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_WAFER_VERSION_MAJOR[] = {
1450-
&WR_DIS_WAFER_VERSION_MAJOR[0], // [] wr_dis of WAFER_VERSION_MAJOR
1457+
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_WAFER_VERSION_MAJOR_LO[] = {
1458+
&WR_DIS_WAFER_VERSION_MAJOR_LO[0], // [] wr_dis of WAFER_VERSION_MAJOR_LO
14511459
NULL
14521460
};
14531461

@@ -1496,6 +1504,11 @@ const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SYS_DATA_PART1[] = {
14961504
NULL
14971505
};
14981506

1507+
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_WAFER_VERSION_MAJOR_HI[] = {
1508+
&WR_DIS_WAFER_VERSION_MAJOR_HI[0], // [] wr_dis of WAFER_VERSION_MAJOR_HI
1509+
NULL
1510+
};
1511+
14991512
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_LDO_VO1_DREF[] = {
15001513
&WR_DIS_LDO_VO1_DREF[0], // [] wr_dis of LDO_VO1_DREF
15011514
NULL
@@ -2251,8 +2264,8 @@ const esp_efuse_desc_t* ESP_EFUSE_WAFER_VERSION_MINOR[] = {
22512264
NULL
22522265
};
22532266

2254-
const esp_efuse_desc_t* ESP_EFUSE_WAFER_VERSION_MAJOR[] = {
2255-
&WAFER_VERSION_MAJOR[0], // [] Major chip version
2267+
const esp_efuse_desc_t* ESP_EFUSE_WAFER_VERSION_MAJOR_LO[] = {
2268+
&WAFER_VERSION_MAJOR_LO[0], // [] Major chip version (lower 2 bits)
22562269
NULL
22572270
};
22582271

@@ -2296,6 +2309,11 @@ const esp_efuse_desc_t* ESP_EFUSE_PKG_VERSION[] = {
22962309
NULL
22972310
};
22982311

2312+
const esp_efuse_desc_t* ESP_EFUSE_WAFER_VERSION_MAJOR_HI[] = {
2313+
&WAFER_VERSION_MAJOR_HI[0], // [] Major chip version (MSB)
2314+
NULL
2315+
};
2316+
22992317
const esp_efuse_desc_t* ESP_EFUSE_LDO_VO1_DREF[] = {
23002318
&LDO_VO1_DREF[0], // [] Output VO1 parameter
23012319
NULL

components/efuse/esp32p4/esp_efuse_table.csv

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# this will generate new source files, next rebuild all the sources.
1010
# !!!!!!!!!!! #
1111

12-
# This file was generated by regtools.py based on the efuses.yaml file with the version: 73787d3f5ae45b80abca925a7562120b
12+
# This file was generated by regtools.py based on the efuses.yaml file with the version: f7765f0ac3faf4b54f8c1f064307522c
1313

1414
WR_DIS, EFUSE_BLK0, 0, 32, [] Disable programming of individual eFuses
1515
WR_DIS.RD_DIS, EFUSE_BLK0, 0, 1, [] wr_dis of RD_DIS
@@ -69,7 +69,7 @@ WR_DIS.KM_HUK_GEN_STATE, EFUSE_BLK0, 19, 1, [] wr_dis
6969
WR_DIS.BLK1, EFUSE_BLK0, 20, 1, [] wr_dis of BLOCK1
7070
WR_DIS.MAC, EFUSE_BLK0, 20, 1, [WR_DIS.MAC_FACTORY] wr_dis of MAC
7171
WR_DIS.WAFER_VERSION_MINOR, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MINOR
72-
WR_DIS.WAFER_VERSION_MAJOR, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MAJOR
72+
WR_DIS.WAFER_VERSION_MAJOR_LO, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MAJOR_LO
7373
WR_DIS.DISABLE_WAFER_VERSION_MAJOR, EFUSE_BLK0, 20, 1, [] wr_dis of DISABLE_WAFER_VERSION_MAJOR
7474
WR_DIS.DISABLE_BLK_VERSION_MAJOR, EFUSE_BLK0, 20, 1, [] wr_dis of DISABLE_BLK_VERSION_MAJOR
7575
WR_DIS.BLK_VERSION_MINOR, EFUSE_BLK0, 20, 1, [] wr_dis of BLK_VERSION_MINOR
@@ -79,6 +79,7 @@ WR_DIS.TEMP, EFUSE_BLK0, 20, 1, [] wr_dis
7979
WR_DIS.PSRAM_VENDOR, EFUSE_BLK0, 20, 1, [] wr_dis of PSRAM_VENDOR
8080
WR_DIS.PKG_VERSION, EFUSE_BLK0, 20, 1, [] wr_dis of PKG_VERSION
8181
WR_DIS.SYS_DATA_PART1, EFUSE_BLK0, 21, 1, [] wr_dis of BLOCK2
82+
WR_DIS.WAFER_VERSION_MAJOR_HI, EFUSE_BLK0, 20, 1, [] wr_dis of WAFER_VERSION_MAJOR_HI
8283
WR_DIS.LDO_VO1_DREF, EFUSE_BLK0, 20, 1, [] wr_dis of LDO_VO1_DREF
8384
WR_DIS.LDO_VO2_DREF, EFUSE_BLK0, 20, 1, [] wr_dis of LDO_VO2_DREF
8485
WR_DIS.LDO_VO1_MUL, EFUSE_BLK0, 20, 1, [] wr_dis of LDO_VO1_MUL
@@ -234,7 +235,7 @@ MAC, EFUSE_BLK1, 40, 8, [MAC_FACT
234235
, EFUSE_BLK1, 8, 8, [MAC_FACTORY] MAC address
235236
, EFUSE_BLK1, 0, 8, [MAC_FACTORY] MAC address
236237
WAFER_VERSION_MINOR, EFUSE_BLK1, 64, 4, [] Minor chip version
237-
WAFER_VERSION_MAJOR, EFUSE_BLK1, 68, 2, [] Major chip version
238+
WAFER_VERSION_MAJOR_LO, EFUSE_BLK1, 68, 2, [] Major chip version (lower 2 bits)
238239
DISABLE_WAFER_VERSION_MAJOR, EFUSE_BLK1, 70, 1, [] Disables check of wafer version major
239240
DISABLE_BLK_VERSION_MAJOR, EFUSE_BLK1, 71, 1, [] Disables check of blk version major
240241
BLK_VERSION_MINOR, EFUSE_BLK1, 72, 3, [] BLK_VERSION_MINOR of BLOCK2
@@ -243,6 +244,7 @@ PSRAM_CAP, EFUSE_BLK1, 77, 3, [] PSRAM
243244
TEMP, EFUSE_BLK1, 80, 2, [] Operating temperature of the ESP chip
244245
PSRAM_VENDOR, EFUSE_BLK1, 82, 2, [] PSRAM vendor
245246
PKG_VERSION, EFUSE_BLK1, 84, 3, [] Package version
247+
WAFER_VERSION_MAJOR_HI, EFUSE_BLK1, 87, 1, [] Major chip version (MSB)
246248
LDO_VO1_DREF, EFUSE_BLK1, 88, 4, [] Output VO1 parameter
247249
LDO_VO2_DREF, EFUSE_BLK1, 92, 4, [] Output VO2 parameter
248250
LDO_VO1_MUL, EFUSE_BLK1, 96, 3, [] Output VO1 parameter

components/efuse/esp32p4/include/esp_efuse_table.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -10,7 +10,7 @@ extern "C" {
1010

1111
#include "esp_efuse.h"
1212

13-
// md5_digest_table c56ed98dde7a08c8f70d57a01faba96a
13+
// md5_digest_table 665d4d3a1354653f8e46869d49df1a2f
1414
// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
1515
// If you want to change some fields, you need to change esp_efuse_table.csv file
1616
// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
@@ -82,7 +82,7 @@ extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_BLK1[];
8282
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_MAC[];
8383
#define ESP_EFUSE_WR_DIS_MAC_FACTORY ESP_EFUSE_WR_DIS_MAC
8484
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_WAFER_VERSION_MINOR[];
85-
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_WAFER_VERSION_MAJOR[];
85+
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_WAFER_VERSION_MAJOR_LO[];
8686
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_DISABLE_WAFER_VERSION_MAJOR[];
8787
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_DISABLE_BLK_VERSION_MAJOR[];
8888
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_BLK_VERSION_MINOR[];
@@ -92,6 +92,7 @@ extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_TEMP[];
9292
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_PSRAM_VENDOR[];
9393
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_PKG_VERSION[];
9494
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SYS_DATA_PART1[];
95+
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_WAFER_VERSION_MAJOR_HI[];
9596
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_LDO_VO1_DREF[];
9697
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_LDO_VO2_DREF[];
9798
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_LDO_VO1_MUL[];
@@ -266,7 +267,7 @@ extern const esp_efuse_desc_t* ESP_EFUSE_DIS_SWD[];
266267
extern const esp_efuse_desc_t* ESP_EFUSE_MAC[];
267268
#define ESP_EFUSE_MAC_FACTORY ESP_EFUSE_MAC
268269
extern const esp_efuse_desc_t* ESP_EFUSE_WAFER_VERSION_MINOR[];
269-
extern const esp_efuse_desc_t* ESP_EFUSE_WAFER_VERSION_MAJOR[];
270+
extern const esp_efuse_desc_t* ESP_EFUSE_WAFER_VERSION_MAJOR_LO[];
270271
extern const esp_efuse_desc_t* ESP_EFUSE_DISABLE_WAFER_VERSION_MAJOR[];
271272
extern const esp_efuse_desc_t* ESP_EFUSE_DISABLE_BLK_VERSION_MAJOR[];
272273
extern const esp_efuse_desc_t* ESP_EFUSE_BLK_VERSION_MINOR[];
@@ -275,6 +276,7 @@ extern const esp_efuse_desc_t* ESP_EFUSE_PSRAM_CAP[];
275276
extern const esp_efuse_desc_t* ESP_EFUSE_TEMP[];
276277
extern const esp_efuse_desc_t* ESP_EFUSE_PSRAM_VENDOR[];
277278
extern const esp_efuse_desc_t* ESP_EFUSE_PKG_VERSION[];
279+
extern const esp_efuse_desc_t* ESP_EFUSE_WAFER_VERSION_MAJOR_HI[];
278280
extern const esp_efuse_desc_t* ESP_EFUSE_LDO_VO1_DREF[];
279281
extern const esp_efuse_desc_t* ESP_EFUSE_LDO_VO2_DREF[];
280282
extern const esp_efuse_desc_t* ESP_EFUSE_LDO_VO1_MUL[];

components/hal/esp32p4/include/hal/efuse_ll.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ __attribute__((always_inline)) static inline bool efuse_ll_get_secure_boot_v2_en
5858
// use efuse_hal_get_major_chip_version() to get major chip version
5959
__attribute__((always_inline)) static inline uint32_t efuse_ll_get_chip_wafer_version_major(void)
6060
{
61-
return EFUSE.rd_mac_sys_2.wafer_version_major;
61+
return (EFUSE.rd_mac_sys_2.wafer_version_major_hi << 2) | EFUSE.rd_mac_sys_2.wafer_version_major_lo;
6262
}
6363

6464
// use efuse_hal_get_minor_chip_version() to get minor chip version

components/soc/esp32p4/register/soc/efuse_reg.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -754,13 +754,13 @@ extern "C" {
754754
#define EFUSE_WAFER_VERSION_MINOR_M (EFUSE_WAFER_VERSION_MINOR_V << EFUSE_WAFER_VERSION_MINOR_S)
755755
#define EFUSE_WAFER_VERSION_MINOR_V 0x0000000FU
756756
#define EFUSE_WAFER_VERSION_MINOR_S 0
757-
/** EFUSE_WAFER_VERSION_MAJOR : R; bitpos: [5:4]; default: 0;
758-
* Major chip version
757+
/** EFUSE_WAFER_VERSION_MAJOR_LO : R; bitpos: [5:4]; default: 0;
758+
* Major chip version (lower 2 bits)
759759
*/
760-
#define EFUSE_WAFER_VERSION_MAJOR 0x00000003U
761-
#define EFUSE_WAFER_VERSION_MAJOR_M (EFUSE_WAFER_VERSION_MAJOR_V << EFUSE_WAFER_VERSION_MAJOR_S)
762-
#define EFUSE_WAFER_VERSION_MAJOR_V 0x00000003U
763-
#define EFUSE_WAFER_VERSION_MAJOR_S 4
760+
#define EFUSE_WAFER_VERSION_MAJOR_LO 0x00000003U
761+
#define EFUSE_WAFER_VERSION_MAJOR_LO_M (EFUSE_WAFER_VERSION_MAJOR_LO_V << EFUSE_WAFER_VERSION_MAJOR_LO_S)
762+
#define EFUSE_WAFER_VERSION_MAJOR_LO_V 0x00000003U
763+
#define EFUSE_WAFER_VERSION_MAJOR_LO_S 4
764764
/** EFUSE_DISABLE_WAFER_VERSION_MAJOR : R; bitpos: [6]; default: 0;
765765
* Disables check of wafer version major
766766
*/
@@ -817,13 +817,13 @@ extern "C" {
817817
#define EFUSE_PKG_VERSION_M (EFUSE_PKG_VERSION_V << EFUSE_PKG_VERSION_S)
818818
#define EFUSE_PKG_VERSION_V 0x00000007U
819819
#define EFUSE_PKG_VERSION_S 20
820-
/** EFUSE_RESERVED_1_87 : R; bitpos: [23]; default: 0;
821-
* reserved
820+
/** EFUSE_WAFER_VERSION_MAJOR_HI : R; bitpos: [23]; default: 0;
821+
* Major chip version (MSB)
822822
*/
823-
#define EFUSE_RESERVED_1_87 (BIT(23))
824-
#define EFUSE_RESERVED_1_87_M (EFUSE_RESERVED_1_87_V << EFUSE_RESERVED_1_87_S)
825-
#define EFUSE_RESERVED_1_87_V 0x00000001U
826-
#define EFUSE_RESERVED_1_87_S 23
823+
#define EFUSE_WAFER_VERSION_MAJOR_HI (BIT(23))
824+
#define EFUSE_WAFER_VERSION_MAJOR_HI_M (EFUSE_WAFER_VERSION_MAJOR_HI_V << EFUSE_WAFER_VERSION_MAJOR_HI_S)
825+
#define EFUSE_WAFER_VERSION_MAJOR_HI_V 0x00000001U
826+
#define EFUSE_WAFER_VERSION_MAJOR_HI_S 23
827827
/** EFUSE_LDO_VO1_DREF : R; bitpos: [27:24]; default: 0;
828828
* Output VO1 parameter
829829
*/

components/soc/esp32p4/register/soc/efuse_struct.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -571,10 +571,10 @@ typedef union {
571571
* Minor chip version
572572
*/
573573
uint32_t wafer_version_minor:4;
574-
/** wafer_version_major : R; bitpos: [5:4]; default: 0;
575-
* Major chip version
574+
/** wafer_version_major_lo : R; bitpos: [5:4]; default: 0;
575+
* Major chip version (lower 2 bits)
576576
*/
577-
uint32_t wafer_version_major:2;
577+
uint32_t wafer_version_major_lo:2;
578578
/** disable_wafer_version_major : R; bitpos: [6]; default: 0;
579579
* Disables check of wafer version major
580580
*/
@@ -607,10 +607,10 @@ typedef union {
607607
* Package version
608608
*/
609609
uint32_t pkg_version:3;
610-
/** reserved_1_87 : R; bitpos: [23]; default: 0;
611-
* reserved
610+
/** wafer_version_major_hi : R; bitpos: [23]; default: 0;
611+
* Major chip version (MSB)
612612
*/
613-
uint32_t reserved_1_87:1;
613+
uint32_t wafer_version_major_hi:1;
614614
/** ldo_vo1_dref : R; bitpos: [27:24]; default: 0;
615615
* Output VO1 parameter
616616
*/

0 commit comments

Comments
 (0)