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
@@ -535,6 +535,8 @@ needed. The 64 KB TX log trim happens in-place during the write hook.
|
||||
start at the TRM reset values (bank U at a real console's reading), so at
|
||||
RCM entry the display is unclocked and `display_init()` does not begin
|
||||
with a panel teardown.
|
||||
- **USB PLL.** `UTMIPLL_HW_PWRDN_CFG0.LOCK` is set unless software holds
|
||||
the PLL in IDDQ (the reset state), for bdk's `clock_enable_utmipll()`.
|
||||
- **PINMUX (`APB_MISC` pad config) and PWM controller (`0x7000A000`).**
|
||||
No active behaviour, but reads return whatever the payload last wrote
|
||||
via the global `mmio_regs` cache. Hwtest's "Display backlight & PWM"
|
||||
@@ -547,7 +549,9 @@ needed. The 64 KB TX log trim happens in-place during the write hook.
|
||||
payload programs them (PLLM up but unlocked on Erista, the rest down),
|
||||
then read back what was written, dividers included, with LOCK set
|
||||
whenever ENABLE is. That includes PLLMB, which Minerva moves the EMC onto
|
||||
for a frequency change.
|
||||
for a frequency change, and PLLC4, which clocks the eMMC at HS200/HS400
|
||||
(not while its IDDQ bit is set); PLLC2, PLLC3, PLLDP and PLLA1 lock the
|
||||
same way.
|
||||
- **KFUSE.** `STATE` returns `DONE | CRCPASS` immediately so the BDK function
|
||||
`kfuse_wait_ready` doesn't hang.
|
||||
- **TSEC.** `DMATRFCMD_IDLE` is reported set, and the keygen status word is
|
||||
@@ -714,6 +718,11 @@ don't repeat the diagnosis:
|
||||
|
||||
- **Minerva DRAM training** hangs in a `PLL_BASE.LOCK` poll. Fix: report
|
||||
LOCK once the PLL is enabled.
|
||||
- **TegraExplorer hung on the eMMC.** Switching SDMMC4 to HS200 enables
|
||||
PLLC4, and TegraExplorer's bdk waits for `PLLC4_BASE.LOCK` with no
|
||||
timeout; the CAR model had no PLLC4, so Erista hung at the key dump and
|
||||
both SoCs at "Browse EMMC". (hekate's newer bdk times the wait out, which
|
||||
hid it.) Fix: PLLC4 locks once enabled, out of IDDQ.
|
||||
- **Every payload began with a display teardown.** `CLK_OUT_ENB_L` read a
|
||||
real console's value taken after a payload had brought the display up, so
|
||||
`display_init()` found DISP1 already clocked at RCM entry. Fix: the bank
|
||||
|
||||
+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