ReviewOS

home-lang/home-os

SDHCI driver for the BCM2712 SD slot: real MMIO init, CMD/DATA state machine, DMA (ADMA2) reads/writes, block device → ext2/homefs root from SD

#66
Open chris opened this 8 days ago ·
8 days ago

Epic: #113 · Milestone: MC3 — Pi 5 platform drivers

Why

Boot media and the media library both start on the SD card. drivers/bcm_emmc.home (635) has a correct SDHCI register map but Pi 4 base addresses and barrier-free MMIO; sdmmc*.home (2,280 lines total) contain no MMIO at all — pure state machines over nothing. The x86 storage stack (ATA PIO → block layer → ext2 with write/remount/read-back) is real and CI-proven, so only the host controller is missing.

Tasks

  • platform/bcm2712/sdhci.home: base + clock + IRQ from DTB (brcm,bcm2712-sdhci / sdhci-brcmstb); reset, clock divider (400 kHz init → 50 MHz HS → SDR104 later), power, CMD0/8/55/ACMD41/2/3/7/16, CSD/CID parse, PIO first, then ADMA2 descriptors with proper barriers and cache maintenance (dc civac) for DMA buffers.
  • Plug into the existing block layer used by drivers/ata.home; storage-roundtrip gate logic reused on ARM (sd shell command: read/write/remount/verify).
  • Partition table (MBR + GPT) parser → /boot (FAT32, read-only for config) and / (ext2 now, homefs when S4 lands).
  • FAT32 read support for the boot partition (needed for OTA to swap images in #109).
  • Throughput measurement (dd-like shell command) — target ≥ 40 MB/s sequential read with ADMA2.

Acceptance

storage-roundtrip-pi5: on hardware, create a file on partition 2, remount, read back, checksum matches; boot milestones show [SDHCI] card <GB> SDR50 and [Filesystem] Root mounted (sd).

Size: L · Depends on: #60, #59, #61 · Blocks: #102, #108

Sign in to comment on this issue.