Skip to content

Commit c102510

Browse files
feat(espefuse): Adds 3-bit field for wafer major version in ESP32-P4
1 parent 90e3770 commit c102510

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

espefuse/efuse/esp32p4/fields.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,22 @@ def convert(parent, efuse):
291291
"keypurpose": EfuseKeyPurposeField,
292292
"t_sensor": EfuseTempSensor,
293293
"adc_tp": EfuseAdcPointCalibration,
294+
"wafer": EfuseWafer,
294295
}.get(efuse.class_type, EfuseField)(parent, efuse)
295296

296297

298+
class EfuseWafer(EfuseField):
299+
def get(self, from_read=True):
300+
hi_bits = self.parent["WAFER_VERSION_MAJOR_HI"].get(from_read)
301+
assert self.parent["WAFER_VERSION_MAJOR_HI"].bit_len == 1
302+
lo_bits = self.parent["WAFER_VERSION_MAJOR_LO"].get(from_read)
303+
assert self.parent["WAFER_VERSION_MAJOR_LO"].bit_len == 2
304+
return (hi_bits << 2) + lo_bits
305+
306+
def save(self, new_value):
307+
raise esptool.FatalError(f"Burning {self.name} is not supported")
308+
309+
297310
class EfuseTempSensor(EfuseField):
298311
def get(self, from_read=True):
299312
value = self.get_bitstring(from_read)

espefuse/efuse/esp32p4/mem_definition.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
EfuseBlocksBase,
1313
EfuseFieldsBase,
1414
EfuseRegistersBase,
15+
Field,
1516
)
1617

1718

@@ -147,6 +148,16 @@ def __init__(self, extend_efuse_table) -> None:
147148
self.BLOCK2_CALIBRATION_EFUSES.append(efuse)
148149
self.ALL_EFUSES[i] = None
149150

151+
f = Field()
152+
f.name = "WAFER_VERSION_MAJOR"
153+
f.block = 0
154+
f.bit_len = 3
155+
f.type = f"uint:{f.bit_len}"
156+
f.category = "identity"
157+
f.class_type = "wafer"
158+
f.description = "calc WAFER VERSION MAJOR from (WAFER_VERSION_MAJOR_HI << 2) + WAFER_VERSION_MAJOR_LO (read only)"
159+
self.CALC.append(f)
160+
150161
for efuse in self.ALL_EFUSES:
151162
if efuse is not None:
152163
self.EFUSES.append(efuse)

espefuse/efuse_defs/esp32p4.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VER_NO: 73787d3f5ae45b80abca925a7562120b
1+
VER_NO: f7765f0ac3faf4b54f8c1f064307522c
22
EFUSES:
33
WR_DIS : {show: y, blk : 0, word: 0, pos : 0, len : 32, start : 0, type : 'uint:32', wr_dis: null, rd_dis: null, alt : '', dict : '', desc: Disable programming of individual eFuses, rloc: EFUSE_RD_WR_DIS_REG, bloc: 'B0,B1,B2,B3'}
44
RD_DIS : {show: y, blk : 0, word: 1, pos : 0, len : 7, start : 32, type : 'uint:7', wr_dis : 0, rd_dis: null, alt : '', dict : '', desc: Disable reading from BlOCK4-10, rloc: 'EFUSE_RD_REPEAT_DATA0_REG[6:0]', bloc: 'B4[6:0]'}
@@ -74,7 +74,7 @@ EFUSES:
7474
MAC : {show: y, blk : 1, word: 0, pos : 0, len : 48, start : 0, type : 'bytes:6', wr_dis : 20, rd_dis: null, alt : MAC_FACTORY, dict : '', desc: MAC address, rloc: EFUSE_RD_MAC_SYS_0_REG, bloc: 'B0,B1,B2,B3,B4,B5'}
7575
RESERVED_1_16 : {show: n, blk : 1, word: 1, pos: 16, len : 16, start : 48, type : 'uint:16', wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: Stores the extended bits of MAC address, rloc: 'EFUSE_RD_MAC_SYS_1_REG[31:16]', bloc: 'B6,B7'}
7676
WAFER_VERSION_MINOR : {show: y, blk : 1, word: 2, pos : 0, len : 4, start : 64, type : 'uint:4', wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: Minor chip version, rloc: 'EFUSE_RD_MAC_SYS_2_REG[3:0]', bloc: 'B8[3:0]'}
77-
WAFER_VERSION_MAJOR : {show: y, blk : 1, word: 2, pos : 4, len : 2, start : 68, type : 'uint:2', wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: Major chip version, rloc: 'EFUSE_RD_MAC_SYS_2_REG[5:4]', bloc: 'B8[5:4]'}
77+
WAFER_VERSION_MAJOR_LO : {show: y, blk : 1, word: 2, pos : 4, len : 2, start : 68, type : 'uint:2', wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: Major chip version (lower 2 bits), rloc: 'EFUSE_RD_MAC_SYS_2_REG[5:4]', bloc: 'B8[5:4]'}
7878
DISABLE_WAFER_VERSION_MAJOR : {show: y, blk : 1, word: 2, pos : 6, len : 1, start : 70, type : bool, wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: Disables check of wafer version major, rloc: 'EFUSE_RD_MAC_SYS_2_REG[6]', bloc: 'B8[6]'}
7979
DISABLE_BLK_VERSION_MAJOR : {show: y, blk : 1, word: 2, pos : 7, len : 1, start : 71, type : bool, wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: Disables check of blk version major, rloc: 'EFUSE_RD_MAC_SYS_2_REG[7]', bloc: 'B8[7]'}
8080
BLK_VERSION_MINOR : {show: y, blk : 1, word: 2, pos : 8, len : 3, start : 72, type : 'uint:3', wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: BLK_VERSION_MINOR of BLOCK2, rloc: 'EFUSE_RD_MAC_SYS_2_REG[10:8]', bloc: 'B9[2:0]'}
@@ -83,7 +83,7 @@ EFUSES:
8383
TEMP : {show: y, blk : 1, word: 2, pos: 16, len : 2, start : 80, type : 'uint:2', wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: Operating temperature of the ESP chip, rloc: 'EFUSE_RD_MAC_SYS_2_REG[17:16]', bloc: 'B10[1:0]'}
8484
PSRAM_VENDOR : {show: y, blk : 1, word: 2, pos: 18, len : 2, start : 82, type : 'uint:2', wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: PSRAM vendor, rloc: 'EFUSE_RD_MAC_SYS_2_REG[19:18]', bloc: 'B10[3:2]'}
8585
PKG_VERSION : {show: y, blk : 1, word: 2, pos: 20, len : 3, start : 84, type : 'uint:3', wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: Package version, rloc: 'EFUSE_RD_MAC_SYS_2_REG[22:20]', bloc: 'B10[6:4]'}
86-
RESERVED_1_87 : {show: n, blk : 1, word: 2, pos: 23, len : 1, start : 87, type : bool, wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: reserved, rloc: 'EFUSE_RD_MAC_SYS_2_REG[23]', bloc: 'B10[7]'}
86+
WAFER_VERSION_MAJOR_HI : {show: y, blk : 1, word: 2, pos: 23, len : 1, start : 87, type : bool, wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: Major chip version (MSB), rloc: 'EFUSE_RD_MAC_SYS_2_REG[23]', bloc: 'B10[7]'}
8787
LDO_VO1_DREF : {show: y, blk : 1, word: 2, pos: 24, len : 4, start : 88, type : 'uint:4', wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: Output VO1 parameter, rloc: 'EFUSE_RD_MAC_SYS_2_REG[27:24]', bloc: 'B11[3:0]'}
8888
LDO_VO2_DREF : {show: y, blk : 1, word: 2, pos: 28, len : 4, start : 92, type : 'uint:4', wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: Output VO2 parameter, rloc: 'EFUSE_RD_MAC_SYS_2_REG[31:28]', bloc: 'B11[7:4]'}
8989
LDO_VO1_MUL : {show: y, blk : 1, word: 3, pos : 0, len : 3, start : 96, type : 'uint:3', wr_dis : 20, rd_dis: null, alt : '', dict : '', desc: Output VO1 parameter, rloc: 'EFUSE_RD_MAC_SYS_3_REG[2:0]', bloc: 'B12[2:0]'}

esptool/targets/esp32p4.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ def get_minor_chip_version(self):
137137

138138
def get_major_chip_version(self):
139139
num_word = 2
140-
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 4) & 0x03
140+
word = self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word))
141+
return (((word >> 23) & 1) << 2) | ((word >> 4) & 0x03)
141142

142143
def get_chip_description(self):
143144
chip_name = {

0 commit comments

Comments
 (0)