fuse: Add NX hw type getter

This commit is contained in:
CTCaer 2020-06-26 18:45:21 +03:00
parent 795ed8aadc
commit 293c47774d
2 changed files with 27 additions and 2 deletions

View file

@ -20,6 +20,7 @@
#include <string.h> #include <string.h>
#include <soc/fuse.h> #include <soc/fuse.h>
#include <soc/hw_init.h>
#include <soc/t210.h> #include <soc/t210.h>
#include <utils/types.h> #include <utils/types.h>
@ -67,6 +68,22 @@ u32 fuse_read_odm_keygen_rev()
return 0; return 0;
} }
u32 fuse_read_hw_type()
{
if (hw_get_chip_id() == GP_HIDREV_MAJOR_T210B01)
{
switch ((fuse_read_odm(4) & 0xF0000) >> 16)
{
case 1:
return FUSE_NX_HW_TYPE_IOWA;
case 2:
return FUSE_NX_HW_TYPE_HOAG;
}
}
return FUSE_NX_HW_TYPE_ICOSA;
}
u8 fuse_count_burnt(u32 val) u8 fuse_count_burnt(u32 val)
{ {
u8 burnt_fuses = 0; u8 burnt_fuses = 0;
@ -339,8 +356,8 @@ int fuse_read_evp_thunk(u32 *iram_evp_thunks, u32 *iram_evp_thunks_len)
bool fuse_check_patched_rcm() bool fuse_check_patched_rcm()
{ {
// Check if XUSB in use. // Check if XUSB in use or Tegra X1+.
if (FUSE(FUSE_RESERVED_SW) & (1<<7)) if (FUSE(FUSE_RESERVED_SW) & (1<<7) || hw_get_chip_id() == GP_HIDREV_MAJOR_T210B01)
return true; return true;
// Check if RCM is ipatched. // Check if RCM is ipatched.

View file

@ -75,9 +75,17 @@
/*! Fuse cache registers. */ /*! Fuse cache registers. */
#define FUSE_RESERVED_ODMX(x) (0x1C8 + 4 * (x)) #define FUSE_RESERVED_ODMX(x) (0x1C8 + 4 * (x))
enum
{
FUSE_NX_HW_TYPE_ICOSA,
FUSE_NX_HW_TYPE_IOWA,
FUSE_NX_HW_TYPE_HOAG
};
void fuse_disable_program(); void fuse_disable_program();
u32 fuse_read_odm(u32 idx); u32 fuse_read_odm(u32 idx);
u32 fuse_read_odm_keygen_rev(); u32 fuse_read_odm_keygen_rev();
u32 fuse_read_hw_type();
u8 fuse_count_burnt(u32 val); u8 fuse_count_burnt(u32 val);
void fuse_wait_idle(); void fuse_wait_idle();
int fuse_read_ipatch(void (*ipatch)(u32 offset, u32 value)); int fuse_read_ipatch(void (*ipatch)(u32 offset, u32 value));