Rock64 eMMC not working

From: John-Mark Gurney <jmg_at_funkthat.com>
Date: Thu, 07 Apr 2022 04:08:10 UTC
Hello,

I am trying to get the latest FreeBSD -current snapshot to boot/run off
a Pine64 eMMC module on the Rock64, but I'm seeing an issue w/ mounting
root:

FreeBSD 14.0-CURRENT #0 main-n254105-d53927b0bae: Thu Mar 31 09:26:31 UTC 2022
[...]
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
mmcsd0: Error indicated: 4 Failed

I got similar messages when 13.1-RC1:

mmcsd0: 16GB <MMCHC M8B16G 2.8 SN D808D122 MFG 07/2018 by 136 0x0003> at mmc0 150.0MHz/8bit/1016-block
mmcsd0boot0: 4MB partition 1 at mmcsd0
mmcsd0boot1: 4MB partition 2 at mmcsd0
mmcsd0rpmb: 4MB partition 3 at mmcsd0
[...]
GEOM: mmcsd0: the secondary GPT header is not in the last LBA.
mmcsd0: Error indicated: 4 Failed
rockchip_dwmmc1: Failed to update clk


Are there any known issues w/ this?  A different image to try?

Also, in trying to debug this issue, I tried to boot from a microSD
card with the eMMC module installed by shorting the jumper, but when I did,
I got:
mmcsd0: 32GB <SDHC GB1QT 3.0 SN xxx MFG 03/2020 by 27 SM> at mmc0 50.0MHz/4bit/1016-block
mmcsd1: Error reading EXT_CSD Failed
device_attach: mmcsd1 attach returned 6
Kernel page fault with the following non-sleepable locks held:
exclusive sleep mutex rockchip_dwmmc1 (dwmmc) r = 0 (0xffffa000008d2128) locked @ /usr/src/sys/dev/mmc/host/dwmmc.c:386
stack backtrace:
#0 0xffff0000004e5390 at witness_debugger+0x5c
#1 0xffff0000004e6564 at witness_warn+0x3e8
#2 0xffff00000078962c at data_abort+0xa0
#3 0xffff000000767810 at handle_el1h_sync+0x10
  x0:             8088
  x1: ffff00008e18b000 (ucom_cons_softc + 8ce4ca40)
  x2:               40
  x3:              182
  x4:                0
  x5: ffff00008e1767a0 (ucom_cons_softc + 8ce381e0)
  x6:                0
  x7:                0
  x8:                4
  x9: ffff000000b55910 (memmap_bus + 0)
 x10:                3
 x11:            10000
 x12:                1
 x13:             2af8
 x14:               88
 x15:             2af8
 x16:               88
 x17:                0
 x18: ffff00008e176850 (ucom_cons_softc + 8ce38290)
 x19: ffffa000008d2140
 x20: ffffa000008d2000
 x21:             8088
 x22:                0
 x23:         80000003
 x24: ffffa000008c9580
 x25: ffffa00000bb9100
 x26: ffff000000b9ea98 (Giant + 18)
 x27: ffff0000008df336 (digits + ea96)
 x28: ffffa00000bb9110
 x29: ffff00008e176850 (ucom_cons_softc + 8ce38290)
  sp: ffff00008e176850
  lr: ffff0000007b0298 (dwmmc_intr + 50)
 elr: ffff0000007b02c4 (dwmmc_intr + 7c)
spsr:               45
 far:               20
 esr:         96000044
panic: data abort in critical section or under mutex
cpuid = 0
time = 1
KDB: stack backtrace:
db_trace_self() at db_trace_self
db_trace_self_wrapper() at db_trace_self_wrapper+0x30
vpanic() at vpanic+0x174
panic() at panic+0x44
data_abort() at data_abort+0x2dc
handle_el1h_sync() at handle_el1h_sync+0x10
--- exception, esr 0x96000044
dwmmc_intr() at dwmmc_intr+0x7c
ithread_loop() at ithread_loop+0x2a0
fork_exit() at fork_exit+0x74
fork_trampoline() at fork_trampoline+0x14
KDB: enter: panic


Complete boot message:
======================
U-Boot TPL 2021.07 (Mar 31 2022 - 05:26:18)
LPDDR3, 800MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2021.07 (Mar 31 2022 - 05:26:18 +0000)
Trying to boot from MMC1
Card did not respond to voltage select! : -110
spl: mmc init failed with error: -95
Trying to boot from MMC2
NOTICE:  BL31: v2.5(release):
NOTICE:  BL31: Built : 05:24:37, Mar 31 2022
NOTICE:  BL31:Rockchip release version: v1.2


U-Boot 2021.07 (Mar 31 2022 - 05:28:19 +0000)

Model: Pine64 Rock64
DRAM:  2 GiB
PMIC:  RK8050 (on=0x40, off=0x00)
MMC:   mmc@ff500000: 1, mmc@ff520000: 0
Loading Environment from MMC... Card did not respond to voltage select! : -110
*** Warning - No block device, using default environment

In:    serial@ff130000
Out:   serial@ff130000
Err:   serial@ff130000
Model: Pine64 Rock64
Net:   eth0: ethernet@ff540000
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
50618 bytes read in 7 ms (6.9 MiB/s)
Card did not respond to voltage select! : -110
Scanning disk mmc@ff500000.blk...
Disk mmc@ff500000.blk not ready
Scanning disk mmc@ff520000.blk...
** Unrecognized filesystem type **
** Unrecognized filesystem type **
** Unrecognized filesystem type **
Found 5 disks
** Unable to read file ubootefi.var **
Failed to load EFI variables
BootOrder not defined
EFI boot manager: Cannot load any image
Found EFI removable media binary efi/boot/bootaa64.efi
1263868 bytes read in 33 ms (36.5 MiB/s)
Booting /efi\boot\bootaa64.efi


Consoles: EFI console  
    Reading loader env vars from /efi/freebsd/loader.env
Setting currdev to disk0p1:
FreeBSD/arm64 EFI loader, Revision 1.1
(Thu Mar 31 08:48:02 UTC 2022 root@releng1.nyi.freebsd.org)

   Command line arguments: loader.efi
   Image base: 0x7cdde000
   EFI version: 2.80
   EFI Firmware: Das U-Boot (rev 8225.1792)
   Console: efi (0x1000)
   Load Path: /efi\boot\bootaa64.efi
   Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/eMMC(0)/eMMC(1)/HD(1,GPT,64400726-b60c-11ec-a26d-85c343ffa803,0x8000,0x19000)
Trying ESP: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/eMMC(0)/eMMC(1)/HD(1,GPT,64400726-b60c-11ec-a26d-85c343ffa803,0x8000,0x19000)
Setting currdev to disk0p1:
Trying: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/eMMC(0)/eMMC(1)/HD(2,GPT,64400726-b60c-11ec-a26d-85c343ffa803,0x21000,0x1cc6fd8)
Setting currdev to disk0p2:
/


Loading /boot/defaults/loader.conf
Loading /boot/defaults/loader.conf
Loading /boot/device.hints
Loading /boot/loader.conf
Loading /boot/loader.conf.local
/

Loading kernel...
/boot/kernel/kernel text=0x2a8 text=0x84f4a0 text=0x249adc data=0x1b9aa8 data=0x0+0x40d000 0x8+0x133de8+0x8+0x15b370\
Loading configured modules...
/boot/entropy size=0x1000
/boot/kernel/umodem.ko text=0x2100 text=0x13a0 data=0x6d8+0x10 0x8+0xf18+0x8+0xb5c
loading required module 'ucom'
/boot/kernel/ucom.ko text=0x2590 text=0x2f00 data=0x8e0+0x858 0x8+0x1290+0x8+0xbd5
/etc/hostid size=0x25

Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/kernel/kernel]...               
Using DTB provided by EFI at 0x80f0000.
EFI framebuffer information:
addr, size     0x0, 0x0
dimensions     0 x 0
stride         0
masks          0x00000000, 0x00000000, 0x00000000, 0x00000000
---<<BOOT>>---
GDB: debug ports: uart
GDB: current port: uart
KDB: debugger backends: ddb gdb
KDB: current backend: ddb
Copyright (c) 1992-2022 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 14.0-CURRENT #0 main-n254105-d53927b0bae: Thu Mar 31 09:26:31 UTC 2022
    root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC arm64
FreeBSD clang version 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303)
WARNING: WITNESS option enabled, expect reduced performance.
VT: init without driver.
module firmware already present!
real memory  = 2145136640 (2045 MB)
avail memory = 2065342464 (1969 MB)
Starting CPU 1 (1)
Starting CPU 2 (2)
Starting CPU 3 (3)
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
random: unblocking device.
random: entropy device external interface
MAP 7cf1b000 mode 2 pages 1
MAP 7cf1f000 mode 2 pages 3
MAP 7cf23000 mode 2 pages 4
MAP 7ff40000 mode 2 pages 16
kbd0 at kbdmux0
ofwbus0: <Open Firmware Device Tree>
clk_fixed0: <Fixed clock> on ofwbus0
rk_grf0: <RockChip General Register Files> mem 0xff100000-0xff100fff on ofwbus0
rk3328_cru0: <Rockchip RK3328 Clock and Reset Unit> mem 0xff440000-0xff440fff on ofwbus0
clknode_link_recalc: Attempt to use unresolved linked clock: hdmi_phy
Cannot get frequency for clk: hdmi_phy, error: 9
Cannot set frequency for clk: aclk_bus_pre_c, error: 34
rk3328_cru0: Failed to set aclk_bus_pre to a frequency of 15000000
clknode_link_recalc: Attempt to use unresolved linked clock: hdmi_phy
Cannot get frequency for clk: hdmi_phy, error: 9
Cannot set frequency for clk: aclk_peri_pre, error: 34
rk3328_cru0: Failed to set aclk_peri_pre to a frequency of 15000000
clknode_link_recalc: Attempt to use unresolved linked clock: hdmi_phy
Cannot get frequency for clk: hdmi_phy, error: 9
clknode_link_recalc: Attempt to use unresolved linked clock: hdmi_phy
Cannot get frequency for clk: hdmi_phy, error: 9
clknode_link_recalc: Attempt to use unresolved linked clock: hdmi_phy
Cannot get frequency for clk: hdmi_phy, error: 9
clknode_link_recalc: Attempt to use unresolved linked clock: hdmi_phy
Cannot get frequency for clk: hdmi_phy, error: 9
clknode_link_recalc: Attempt to use unresolved linked clock: hdmi_phy
Cannot get frequency for clk: hdmi_phy, error: 9
clknode_link_recalc: Attempt to use unresolved linked clock: hdmi_phy
Cannot get frequency for clk: hdmi_phy, error: 9
clknode_link_recalc: Attempt to use unresolved linked clock: hdmi_phy
Cannot get frequency for clk: hdmi_phy, error: 9
clknode_link_recalc: Attempt to use unresolved linked clock: hdmi_phy
Cannot get frequency for clk: hdmi_phy, error: 9
clknode_link_recalc: Attempt to use unresolved linked clock: hdmi_phy
Cannot get frequency for clk: hdmi_phy, error: 9
clknode_link_recalc: Attempt to use unresolved linked clock: hdmi_phy
Cannot get frequency for clk: hdmi_phy, error: 9
clknode_link_recalc: Attempt to use unresolved linked clock: hdmi_phy
Cannot get frequency for clk: hdmi_phy, error: 9
clknode_link_recalc: Attempt to use unresolved linked clock: hdmi_phy
Cannot get frequency for clk: hdmi_phy, error: 9
clk_fixed1: <Fixed clock> on ofwbus0
regfix0: <Fixed Regulator> on ofwbus0
regfix1: <Fixed Regulator> on ofwbus0
regfix2: <Fixed Regulator> on ofwbus0
regfix3: <Fixed Regulator> on ofwbus0
simple_mfd0: <Simple MFD (Multi-Functions Device)> mem 0xff450000-0xff45ffff on ofwbus0
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
gic0: <ARM Generic Interrupt Controller> mem 0xff811000-0xff811fff,0xff812000-0xff813fff,0xff814000-0xff815fff,0xff816000-0xff817fff irq 52 on ofwbus0
gic0: pn 0x2, arch 0x2, rev 0x1, implementer 0x43b irqs 160
rk_pinctrl0: <RockChip Pinctrl controller> on ofwbus0
gpio0: <RockChip GPIO Bank controller> mem 0xff210000-0xff2100ff irq 53 on rk_pinctrl0
gpiobus0: <OFW GPIO bus> on gpio0
gpio1: <RockChip GPIO Bank controller> mem 0xff220000-0xff2200ff irq 54 on rk_pinctrl0
gpiobus1: <OFW GPIO bus> on gpio1
gpio2: <RockChip GPIO Bank controller> mem 0xff230000-0xff2300ff irq 55 on rk_pinctrl0
gpiobus2: <OFW GPIO bus> on gpio2
gpio3: <RockChip GPIO Bank controller> mem 0xff240000-0xff2400ff irq 56 on rk_pinctrl0
gpiobus3: <OFW GPIO bus> on gpio3
rk_i2c0: <RockChip I2C> mem 0xff160000-0xff160fff irq 16 on ofwbus0
iicbus0: <OFW I2C bus> on rk_i2c0
rk805_pmu0: <RockChip RK805 PMIC> at addr 0x30 irq 57 on iicbus0
generic_timer0: <ARMv8 Generic Timer> irq 4,5,6,7 on ofwbus0
Timecounter "ARM MPCore Timecounter" frequency 24000000 Hz quality 1000
Event timer "ARM MPCore Eventtimer" frequency 24000000 Hz quality 1000
rk_tsadc0: <RockChip temperature sensors> mem 0xff250000-0xff2500ff irq 24 on ofwbus0
cpulist0: <Open Firmware CPU Group> on ofwbus0
cpu0: <Open Firmware CPU> on cpulist0
cpufreq_dt0: <Generic cpufreq driver> on cpu0
cpufreq_dt0: Found cpu-supply
cpu1: <Open Firmware CPU> on cpulist0
cpufreq_dt1: <Generic cpufreq driver> on cpu1
cpufreq_dt1: Found cpu-supply
cpu2: <Open Firmware CPU> on cpulist0
cpufreq_dt2: <Generic cpufreq driver> on cpu2
cpufreq_dt2: Found cpu-supply
cpu3: <Open Firmware CPU> on cpulist0
cpufreq_dt3: <Generic cpufreq driver> on cpu3
cpufreq_dt3: Found cpu-supply
pcm0: <simple-audio-card> on ofwbus0
pmu0: <Performance Monitoring Unit> irq 0,1,2,3 on ofwbus0
pcm1: <simple-audio-card> on ofwbus0
i2s0: <Rockchip I2S> mem 0xff000000-0xff000fff irq 8 on ofwbus0
Cannot set frequency for clk: xin12m, error: 34
Cannot set frequency for clk: xin12m, error: 34
i2s1: <Rockchip I2S> mem 0xff010000-0xff010fff irq 9 on ofwbus0
Cannot set frequency for clk: clkin_i2s1, error: 34
Cannot set frequency for clk: xin12m, error: 34
uart0: <16750 or compatible> mem 0xff130000-0xff1300ff irq 14 on ofwbus0
uart0: console (1500000,n,8,1)
iic0: <I2C generic I/O> on iicbus0
spi0: <Rockchip SPI> mem 0xff190000-0xff190fff irq 19 on ofwbus0
spibus0: <OFW SPI bus> on spi0
spibus0: <unknown card> at cs 0 mode 0
rockchip_dwmmc0: <Synopsys DesignWare Mobile Storage Host Controller (RockChip)> mem 0xff500000-0xff503fff irq 43 on ofwbus0
rockchip_dwmmc0: Hardware version ID is 270a
rockchip_dwmmc1: <Synopsys DesignWare Mobile Storage Host Controller (RockChip)> mem 0xff520000-0xff523fff irq 45 on ofwbus0
rockchip_dwmmc1: Hardware version ID is 270a
mmc0: <MMC/SD bus> on rockchip_dwmmc1
dwc0: <Rockchip Gigabit Ethernet Controller> mem 0xff540000-0xff54ffff irq 46 on ofwbus0
miibus0: <MII bus> on dwc0
rgephy0: <RTL8169S/8110S/8211 1000BASE-T media interface> PHY 0 on miibus0
rgephy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
rgephy1: <RTL8169S/8110S/8211 1000BASE-T media interface> PHY 1 on miibus0
rgephy1:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
dwc0: Ethernet address: xxx
dwcotg0: <DWC OTG 2.0 integrated USB controller> mem 0xff580000-0xff5bffff irq 48 on ofwbus0
usbus1 on dwcotg0
ehci0: <Generic EHCI Controller> mem 0xff5c0000-0xff5cffff irq 49 on ofwbus0
usbus2: EHCI version 1.0
usbus2 on ehci0
ohci0: <Generic OHCI Controller> mem 0xff5d0000-0xff5dffff irq 50 on ofwbus0
usbus3 on ohci0
gpioc0: <GPIO controller> on gpio0
gpioc1: <GPIO controller> on gpio1
gpioc2: <GPIO controller> on gpio2
gpioc3: <GPIO controller> on gpio3
gpioled0: <GPIO LEDs> on ofwbus0
gpioled0: <led-0> failed to map pin
gpioled0: <led-1> failed to map pin
pcm2: <simple-audio-card> on ofwbus0
armv8crypto0: <AES-CBC,AES-XTS,AES-GCM>
Timecounters tick every 1.000 msec
usbus1: 480Mbps High Speed USB v2.0
usbus2: 480Mbps High Speed USB v2.0
usbus3: 12Mbps Full Speed USB v1.0
rk805_pmu0: registered as a time-of-day clock, resolution 1.000000s
pcm0: no driver attached to codec node
pcm1: no driver attached to codec node
ugen2.1: <Generic EHCI root HUB> at usbus2
uhub0 on usbus2
uhub0: <Generic EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus2
ugen1.1: <DWCOTG OTG Root HUB> at usbus1
uhub1 on usbus1
uhub1: <DWCOTG OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
ugen3.1: <Generic OHCI root HUB> at usbus3
uhub2 on usbus3
uhub2: <Generic OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus3
mmcsd0: 16GB <MMCHC M8B16G 2.8 SN xxx MFG 07/2018 by 136 0x0003> at mmc0 150.0MHz/8bit/1016-block
mmcsd0boot0: 4MB partition 1 at mmcsd0
mmcsd0boot1: 4MB partition 2 at mmcsd0
mmcsd0rpmb: 4MB partition 3 at mmcsd0
pcm2: no driver attached to cpu node
CPU  0: ARM Cortex-A53 r0p4 affinity:  0
                   Cache Type = <64 byte D-cacheline,64 byte I-cacheline,VIPT ICache,64 byte ERG,64 byte CWG>
 Instruction Set Attributes 0 = <CRC32,SHA2,SHA1,AES+PMULL>
 Instruction Set Attributes 1 = <>
         Processor Features 0 = <AdvSIMD,FP,EL3 32,EL2 32,EL1 32,EL0 32>
         Processor Features 1 = <>
      Memory Model Features 0 = <TGran4,TGran64,SNSMem,BigEnd,16bit ASID,1TB PA>
      Memory Model Features 1 = <8bit VMID>
      Memory Model Features 2 = <32bit CCIDX,48bit VA>
             Debug Features 0 = <DoubleLock,2 CTX BKPTs,4 Watchpoints,6 Breakpoints,PMUv3,Debugv8>
             Debug Features 1 = <>
         Auxiliary Features 0 = <>
         Auxiliary Features 1 = <>
AArch32 Instruction Set Attributes 5 = <CRC32,SHA2,SHA1,AES+VMULL,SEVL>
AArch32 Media and VFP Features 0 = <FPRound,FPSqrt,FPDivide,DP VFPv3+v4,SP VFPv3+v4,AdvSIMD>
AArch32 Media and VFP Features 1 = <SIMDFMAC,FPHP DP Conv,SIMDHP SP Conv,SIMDSP,SIMDInt,SIMDLS,FPDNaN,FPFtZ>
CPU  1: ARM Cortex-A53 r0p4 affinity:  1
CPU  2: ARM Cortex-A53 r0p4 affinity:  2
CPU  3: ARM Cortex-A53 r0p4 affinity:  3
Release APs...done
WARNING: WITNESS option enabled, expect reduced performance.
Unresolved linked clock found: hdmi_phy
Unresolved linked clock found: usb480m_phy
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
mmcsd0: Error indicated: 4 Failed
uhub2: 1 port with 1 removable, self powered
uhub1: 1 port with 1 removable, self powered
uhub0: 1 port with 1 removable, self powered

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."