Ver Fonte

efuse: Add some fields in efuse_table and update esp_efuse_get_pkg_ver()

Closes: IDF-1077
KonstantinKondrashov há 5 anos atrás
pai
commit
5cfdf1aa70

+ 1 - 0
components/bootloader_support/src/bootloader_efuse_esp32s2.c

@@ -18,6 +18,7 @@
 
 uint8_t bootloader_common_get_chip_revision(void)
 {
+    // should return the same value as esp_efuse_get_chip_ver()
     /* No other revisions for ESP32-S2 */
     return 0;
 }

+ 45 - 9
components/efuse/esp32s2/esp_efuse_table.c

@@ -17,7 +17,7 @@
 #include <assert.h>
 #include "esp_efuse_table.h"
 
-// md5_digest_table 21c19cced6c4c11c1f731e2ece7d74ab
+// md5_digest_table d9cd89987a033ef74503daeb4dd8dd07
 // This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
 // If you want to change some fields, you need to change esp_efuse_table.csv file
 // then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
@@ -219,6 +219,10 @@ static const esp_efuse_desc_t USB_EXT_PHY_ENABLE[] = {
     {EFUSE_BLK0, 57, 1}, 	 // Enable external PHY,
 };
 
+static const esp_efuse_desc_t BLOCK0_VERSION[] = {
+    {EFUSE_BLK0, 59, 2}, 	 // BLOCK0 efuse version,
+};
+
 static const esp_efuse_desc_t VDD_SPI_XPD[] = {
     {EFUSE_BLK0, 68, 1}, 	 // VDD_SPI regulator power up,
 };
@@ -380,16 +384,28 @@ static const esp_efuse_desc_t SPI_PAD_CONFIG_D7[] = {
     {EFUSE_BLK1, 108, 6}, 	 // SPI_PAD_configure D7,
 };
 
-static const esp_efuse_desc_t CLK8M_FREQ[] = {
-    {EFUSE_BLK1, 114, 12}, 	 // The frequency of 8M CLK (0.01MHz),
+static const esp_efuse_desc_t WAFER_VERSION[] = {
+    {EFUSE_BLK1, 114, 3}, 	 // WAFER version 0:A,
+};
+
+static const esp_efuse_desc_t PKG_VERSION[] = {
+    {EFUSE_BLK1, 117, 4}, 	 // Package version 0:ESP32-S2 1:ESP32-S2FH16 2:ESP32-S2FH32,
+};
+
+static const esp_efuse_desc_t BLOCK1_VERSION[] = {
+    {EFUSE_BLK1, 121, 3}, 	 // BLOCK1 efuse version 0:No calibration 1:With calibration,
 };
 
 static const esp_efuse_desc_t SYS_DATA_PART0[] = {
     {EFUSE_BLK1, 126, 66}, 	 // System configuration,
 };
 
-static const esp_efuse_desc_t SYS_DATA_PART1[] = {
-    {EFUSE_BLK2, 0, 256}, 	 // System configuration,
+static const esp_efuse_desc_t OPTIONAL_UNIQUE_ID[] = {
+    {EFUSE_BLK2, 0, 128}, 	 // Optional unique 128-bit ID,
+};
+
+static const esp_efuse_desc_t BLOCK2_VERSION[] = {
+    {EFUSE_BLK2, 132, 3}, 	 // Version of BLOCK2,
 };
 
 static const esp_efuse_desc_t USER_DATA[] = {
@@ -673,6 +689,11 @@ const esp_efuse_desc_t* ESP_EFUSE_USB_EXT_PHY_ENABLE[] = {
     NULL
 };
 
+const esp_efuse_desc_t* ESP_EFUSE_BLOCK0_VERSION[] = {
+    &BLOCK0_VERSION[0],    		// BLOCK0 efuse version
+    NULL
+};
+
 const esp_efuse_desc_t* ESP_EFUSE_VDD_SPI_XPD[] = {
     &VDD_SPI_XPD[0],    		// VDD_SPI regulator power up
     NULL
@@ -873,8 +894,18 @@ const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D7[] = {
     NULL
 };
 
-const esp_efuse_desc_t* ESP_EFUSE_CLK8M_FREQ[] = {
-    &CLK8M_FREQ[0],    		// The frequency of 8M CLK (0.01MHz)
+const esp_efuse_desc_t* ESP_EFUSE_WAFER_VERSION[] = {
+    &WAFER_VERSION[0],    		// WAFER version 0:A
+    NULL
+};
+
+const esp_efuse_desc_t* ESP_EFUSE_PKG_VERSION[] = {
+    &PKG_VERSION[0],    		// Package version 0:ESP32-S2 1:ESP32-S2FH16 2:ESP32-S2FH32
+    NULL
+};
+
+const esp_efuse_desc_t* ESP_EFUSE_BLOCK1_VERSION[] = {
+    &BLOCK1_VERSION[0],    		// BLOCK1 efuse version 0:No calibration 1:With calibration
     NULL
 };
 
@@ -883,8 +914,13 @@ const esp_efuse_desc_t* ESP_EFUSE_SYS_DATA_PART0[] = {
     NULL
 };
 
-const esp_efuse_desc_t* ESP_EFUSE_SYS_DATA_PART1[] = {
-    &SYS_DATA_PART1[0],    		// System configuration
+const esp_efuse_desc_t* ESP_EFUSE_OPTIONAL_UNIQUE_ID[] = {
+    &OPTIONAL_UNIQUE_ID[0],    		// Optional unique 128-bit ID
+    NULL
+};
+
+const esp_efuse_desc_t* ESP_EFUSE_BLOCK2_VERSION[] = {
+    &BLOCK2_VERSION[0],    		// Version of BLOCK2
     NULL
 };
 

+ 9 - 2
components/efuse/esp32s2/esp_efuse_table.csv

@@ -66,6 +66,7 @@
         DIS_DOWNLOAD_MANUAL_ENCRYPT,      EFUSE_BLK0,   51,    1,     Disable flash encrypt function, other than SPI/Legacy SPI boot mode
         USB_EXCHG_PINS,                   EFUSE_BLK0,   56,    1,     Exchange D+ D- pins
         USB_EXT_PHY_ENABLE,               EFUSE_BLK0,   57,    1,     Enable external PHY
+        BLOCK0_VERSION,                   EFUSE_BLK0,   59,    2,     BLOCK0 efuse version
 
     # EFUSE_RD_REPEAT_DATA1_REG #
         VDD_SPI_XPD,                      EFUSE_BLK0,   68,    1,     VDD_SPI regulator power up
@@ -122,11 +123,17 @@
     SPI_PAD_CONFIG_D5,                    EFUSE_BLK1,   96,    6,     SPI_PAD_configure D5
     SPI_PAD_CONFIG_D6,                    EFUSE_BLK1,  102,    6,     SPI_PAD_configure D6
     SPI_PAD_CONFIG_D7,                    EFUSE_BLK1,  108,    6,     SPI_PAD_configure D7
-    CLK8M_FREQ,                           EFUSE_BLK1,  114,   12,     The frequency of 8M CLK (0.01MHz)
+    WAFER_VERSION,                        EFUSE_BLK1,  114,    3,     WAFER version 0:A
+    PKG_VERSION,                          EFUSE_BLK1,  117,    4,     Package version 0:ESP32-S2 1:ESP32-S2FH16 2:ESP32-S2FH32
+    BLOCK1_VERSION,                       EFUSE_BLK1,  121,    3,     BLOCK1 efuse version 0:No calibration 1:With calibration
     SYS_DATA_PART0,                       EFUSE_BLK1,  126,   66,     System configuration
 
+# SYS_DATA_PART1 BLOCK# - System configuration
+#######################
+    OPTIONAL_UNIQUE_ID,                   EFUSE_BLK2,    0,  128,     Optional unique 128-bit ID
+    BLOCK2_VERSION,                       EFUSE_BLK2,  132,    3,     Version of BLOCK2
+
 ################
-SYS_DATA_PART1,                           EFUSE_BLK2,    0,  256,     System configuration
 USER_DATA,                                EFUSE_BLK3,    0,  256,     User data
 KEY0,                                     EFUSE_BLK4,    0,  256,     Key0 or user data
 KEY1,                                     EFUSE_BLK5,    0,  256,     Key1 or user data

+ 7 - 3
components/efuse/esp32s2/include/esp_efuse_table.h

@@ -17,7 +17,7 @@ extern "C" {
 #endif
 
 
-// md5_digest_table 21c19cced6c4c11c1f731e2ece7d74ab
+// md5_digest_table d9cd89987a033ef74503daeb4dd8dd07
 // This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
 // If you want to change some fields, you need to change esp_efuse_table.csv file
 // then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
@@ -73,6 +73,7 @@ extern const esp_efuse_desc_t* ESP_EFUSE_HARD_DIS_JTAG[];
 extern const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT[];
 extern const esp_efuse_desc_t* ESP_EFUSE_USB_EXCHG_PINS[];
 extern const esp_efuse_desc_t* ESP_EFUSE_USB_EXT_PHY_ENABLE[];
+extern const esp_efuse_desc_t* ESP_EFUSE_BLOCK0_VERSION[];
 extern const esp_efuse_desc_t* ESP_EFUSE_VDD_SPI_XPD[];
 extern const esp_efuse_desc_t* ESP_EFUSE_VDD_SPI_TIEH[];
 extern const esp_efuse_desc_t* ESP_EFUSE_VDD_SPI_FORCE[];
@@ -112,9 +113,12 @@ extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D4[];
 extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D5[];
 extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D6[];
 extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D7[];
-extern const esp_efuse_desc_t* ESP_EFUSE_CLK8M_FREQ[];
+extern const esp_efuse_desc_t* ESP_EFUSE_WAFER_VERSION[];
+extern const esp_efuse_desc_t* ESP_EFUSE_PKG_VERSION[];
+extern const esp_efuse_desc_t* ESP_EFUSE_BLOCK1_VERSION[];
 extern const esp_efuse_desc_t* ESP_EFUSE_SYS_DATA_PART0[];
-extern const esp_efuse_desc_t* ESP_EFUSE_SYS_DATA_PART1[];
+extern const esp_efuse_desc_t* ESP_EFUSE_OPTIONAL_UNIQUE_ID[];
+extern const esp_efuse_desc_t* ESP_EFUSE_BLOCK2_VERSION[];
 extern const esp_efuse_desc_t* ESP_EFUSE_USER_DATA[];
 extern const esp_efuse_desc_t* ESP_EFUSE_KEY0[];
 extern const esp_efuse_desc_t* ESP_EFUSE_KEY1[];

+ 2 - 1
components/efuse/src/esp32s2/esp_efuse_fields.c

@@ -32,6 +32,7 @@ const static char *TAG = "efuse";
 // Returns chip version from efuse
 uint8_t esp_efuse_get_chip_ver(void)
 {
+    // should return the same value as bootloader_common_get_chip_revision()
     uint32_t chip_ver = 0;
     // TODO: ESP32S2 does not have this field
     return chip_ver;
@@ -41,7 +42,7 @@ uint8_t esp_efuse_get_chip_ver(void)
 uint32_t esp_efuse_get_pkg_ver(void)
 {
     uint32_t pkg_ver = 0;
-    // TODO: ESP32S2 does not have this field
+    esp_efuse_read_field_blob(ESP_EFUSE_PKG_VERSION, &pkg_ver, 4);
     return pkg_ver;
 }