bdk: fuse: add sense function

This commit is contained in:
CTCaer
2025-11-11 13:28:44 +02:00
parent 602945d918
commit 260e28e628
2 changed files with 22 additions and 0 deletions

View File

@@ -22,6 +22,7 @@
#include <mem/heap.h>
#include <sec/se.h>
#include <sec/se_t210.h>
#include <soc/clock.h>
#include <soc/fuse.h>
#include <soc/hw_init.h>
#include <soc/pmc.h>
@@ -173,6 +174,25 @@ void fuse_wait_idle()
;
}
void fuse_sense()
{
clock_enable_fuse(false);
FUSE(FUSE_CTRL) = (FUSE(FUSE_CTRL) & (~FUSE_CMD_MASK)) | FUSE_SENSE;
usleep(1);
fuse_wait_idle();
FUSE(FUSE_PRIV2INTFC) = FUSE_PRIV2INTFC_SKIP_RECORDS | FUSE_PRIV2INTFC_START_DATA;
usleep(1);
while (!(FUSE(FUSE_CTRL) & BIT(30)) || ((FUSE(FUSE_CTRL) >> 16) & 0x1F) != FUSE_STATUS_IDLE)
;
clock_enable_fuse(true);
}
u32 fuse_read(u32 addr)
{
FUSE(FUSE_ADDR) = addr;

View File

@@ -316,6 +316,8 @@ u32 fuse_read_hw_state();
u32 fuse_read_hw_type();
int fuse_set_sbk();
void fuse_wait_idle();
void fuse_sense();
u32 fuse_read(u32 addr);
int fuse_read_ipatch(void (*ipatch)(u32 offset, u32 value));
int fuse_read_evp_thunk(u32 *iram_evp_thunks, u32 *iram_evp_thunks_len);
void fuse_read_array(u32 *words);