Line 38:
Line 38:
int read_otp_internal(int index, void* out_buf, u32 size)
int read_otp_internal(int index, void* out_buf, u32 size)
{
{
−
generate_control_bits();
+
int i_res = disable_interrupts();
if (size != 0)
if (size != 0)
Line 53:
Line 53:
word_addr = word_addr | word_offset;
word_addr = word_addr | word_offset;
−
*(u32*)0x0D8001EC = word_addr; // LT_OTPCMD
+
*(u32*)0x0D8001EC = word_addr; // Write to LT_OTPCMD
−
+
u32 temp = *(u32*)0x0D8001EC; // Read from LT_OTPCMD (sync?)
−
// Keep checking the read flag.
−
if (((*(u32*)0x0D8001EC) & 0x80000000) != 0x80000000)
−
break;
−
*(u32*)(out_buf + step) = *(u32*)0x0D8001F0; // LT_OTPDATA
+
*(u32*)(out_buf + step) = *(u32*)0x0D8001F0; // Copy from LT_OTPDATA
step += 4;
step += 4;
Line 65:
Line 62:
}
}
−
generate_control_bits();
+
enable_interrupts(i_res);
return 0;
return 0;
}
}