mirror of
https://github.com/Creased/RCM-Emulator.git
synced 2026-12-06 02:48:11 +01:00
Lock PLLC4 and the other PLLs bdk waits on, and the USB PLL
TegraExplorer hung for good the first time it touched the eMMC. Moving SDMMC4 to HS200 enables PLLC4, and TegraExplorer's bdk waits for PLLC4_BASE.LOCK with no timeout; the CAR model had no PLLC4, so the bit never came. On Erista that stopped it at startup, before its key dump; on both SoCs "Browse EMMC" hung. hekate's newer bdk times the wait out, which is why nothing else showed it. - PLLC4 locks once enabled and out of IDDQ (bit 18), setting LOCK and FREQLOCK (27, 28); LOCK_OVERRIDE (24) forces them. - PLLC2, PLLC3, PLLDP and PLLA1 lock on ENABLE like PLLC/A/X/D2 (bit 27; PLLA1 also 26, PLLDP also 28). The read-only lock bits are no longer stored from a payload's read-modify-write. - UTMIPLL_HW_PWRDN_CFG0.LOCK is set unless software holds the USB PLL in IDDQ, its reset state, so clock_enable_utmipll() sees the lock instead of timing out. TegraExplorer now reaches its main menu on both SoCs and lists the eMMC's partitions under "Browse EMMC". With no BOOT0 image it cannot read package1, so the Erista key dump falls back to prod.keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YYewwDPujjo5B2xRyC5Grb
This commit is contained in:
2 files changed
+41
-9
No files matched your search
+31
-8
@@ -3329,10 +3329,11 @@ uint32_t clk_rst_read(EmuState *state, uint64_t addr) {
|
||||
}
|
||||
// PLL_BASE registers (per Hekate bdk/soc/clock.h): each PLL has an _BASE
|
||||
// register where bit 30 = ENABLE and bit 27 = LOCK. After enabling a PLL
|
||||
// the boot code polls bit 27 until set. Real silicon locks within ~1ms; we
|
||||
// simulate "always locked + always enabled" so the polls return immediately.
|
||||
// the boot code polls bit 27 until set. Real silicon locks within ~1ms;
|
||||
// here a PLL is locked as soon as it is enabled.
|
||||
// Offsets: PLLC=0x80, PLLM=0x90, PLLP=0xA0, PLLA=0xB0, PLLU=0xC0, PLLD=0xD0,
|
||||
// PLLX=0xE0, PLLE=0xE8, PLLD2=0x4B8, PLLREFE=0x4C4.
|
||||
// PLLX=0xE0, PLLE=0xE8, PLLD2=0x4B8, PLLREFE=0x4C4, PLLC2=0x4E8,
|
||||
// PLLC3=0x4FC, PLLDP=0x590, PLLC4=0x5A4, PLLMB=0x5E8, PLLA1=0x6A4.
|
||||
bool mariko = state && state->pmic_otp.load() == 0x53;
|
||||
|
||||
// On a real console in RCM most PLLs are DOWN - measured on a Mariko, only
|
||||
@@ -3360,11 +3361,25 @@ uint32_t clk_rst_read(EmuState *state, uint64_t addr) {
|
||||
if (offset == 0xE8 || offset == 0x4C4)
|
||||
return mmio_regs.get(addr);
|
||||
switch (offset) {
|
||||
case 0x80: case 0xB0: case 0xE0: case 0x4B8: {
|
||||
uint32_t w = mmio_regs.get(addr);
|
||||
if (w & (1u << 30))
|
||||
return w | (1u << 27); // payload brought it up -> locked
|
||||
return w; // measured: down on both
|
||||
case 0x80: case 0xB0: case 0xE0: case 0x4B8: case 0x4E8: case 0x4FC:
|
||||
case 0x590: case 0x5A4: case 0x6A4: {
|
||||
// PLLC, PLLA, PLLX, PLLD2 (measured down on both), PLLC2, PLLC3,
|
||||
// PLLDP, PLLC4 and PLLA1: locked once the payload enables them (bit
|
||||
// 30). Bit 27 is LOCK or FREQ_LOCK on all of them; PLLA1 also has LOCK
|
||||
// in 26, and PLLDP and PLLC4 FREQLOCK in 28 and a LOCK_OVERRIDE in 24
|
||||
// (TRM 5.2). PLLC4 does not run in IDDQ (bit 18): bdk clears that,
|
||||
// enables it for the eMMC's HS200/HS400 clock and waits for the lock
|
||||
// with no timeout.
|
||||
uint32_t lock = 1u << 27;
|
||||
if (offset == 0x6A4)
|
||||
lock |= 1u << 26;
|
||||
if (offset == 0x590 || offset == 0x5A4)
|
||||
lock |= 1u << 28;
|
||||
uint32_t w = mmio_regs.get(addr) & ~lock;
|
||||
bool on = (w & (1u << 30)) && !(offset == 0x5A4 && (w & (1u << 18)));
|
||||
if ((offset == 0x590 || offset == 0x5A4) && (w & (1u << 24)))
|
||||
on = true;
|
||||
return on ? w | lock : w;
|
||||
}
|
||||
case 0x90: { // PLLM
|
||||
// Until the payload programs it: Erista leaves PLLM enabled but
|
||||
@@ -3396,6 +3411,14 @@ uint32_t clk_rst_read(EmuState *state, uint64_t addr) {
|
||||
w |= 3u << 26;
|
||||
return w;
|
||||
}
|
||||
case 0x52C: { // UTMIPLL_HW_PWRDN_CFG0 (TRM 5.2.202), reset 0x0000000F
|
||||
// UTMIPLL_LOCK (bit 31) and SEQ_STATE (27:26) are read-only. The USB
|
||||
// PLL locks unless software holds it in IDDQ (IDDQ_SWCTL with
|
||||
// IDDQ_OVERRIDE_VALUE, the reset state); bdk's usb code clears the
|
||||
// override, then clock_enable_utmipll() waits for the lock.
|
||||
uint32_t w = mmio_regs.get(addr, 0x0000000F) & ~(1u << 31 | 3u << 26);
|
||||
return (w & 3) == 3 ? w : w | (1u << 31);
|
||||
}
|
||||
case 0x5EC: // PLLMB_MISC1, reset 0x00010000 (EN_LCKDET)
|
||||
return mmio_regs.get(addr, 0x00010000);
|
||||
case 0x19C: // CLK_SOURCE_EMC, reset 0x60180000 (TRM 5.2.73)
|
||||
|
||||
Reference in new issue
Block a user