Files
RCM-Emulator/tests/hwtest
Claude 39bfad6a0b Model the SDMMC host registers, eMMC HS200 tuning and HS400
The SDHCI power, clock, reset and HOST_CONTROL2 registers and Tegra's
vendor block all read 0, whatever was written. bdk picks the eMMC bus
mode from them: POWER_CONTROL reading "off" made it fall back to HS52,
so the eMMC ran at 51 MHz while its EXT_CSD claimed HS400.

- Keep a register file per controller for 0x28-0x3F and 0x100-0x1FF,
  with the TRM reset values. INTERNAL_CLK_STABLE follows INT_CLK_EN,
  the SW_RESET bits self-clear (RESET_ALL resets the standard registers,
  RESET_CMD/RESET_DATA clear their line's status), and the pad
  auto-calibration and DLL calibration complete at once.
- Model the tuning circuit (TRM 32.9.2.14). EXECUTE_TUNING starts it,
  each CMD19/CMD21 tries one tap against a fixed data eye, and after
  NUM_TUNING_ITERATIONS commands the final tap is set per MUL_M/DIV_N.
  The tuning block's BUFFER_READ_READY waits for the card clock to be
  re-enabled, which is the order bdk waits in.
- Keep EXT_CSD as one array per power cycle. CMD6 SWITCH updates its
  writable bytes, CMD8 reads them back, and CMD0 resets the card
  fields. BOOT0/BOOT1 and RPMB are 4 MiB, as on a Switch.

hwtest now tunes the eMMC in 128 iterations and reports a 199.68 MHz
HS400 card clock. The hwtest check asserts both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YYewwDPujjo5B2xRyC5Grb
2026-09-25 18:37:38 +00:00
..