Page MenuHomeFreeBSD

Discover cards on boot
AbandonedPublic

Authored by kibab on Jun 21 2018, 6:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 28, 3:55 PM
Unknown Object (File)
Fri, Apr 26, 11:40 PM
Unknown Object (File)
Fri, Apr 26, 10:47 PM
Unknown Object (File)
Fri, Apr 26, 9:21 AM
Unknown Object (File)
Wed, Apr 24, 3:25 PM
Unknown Object (File)
Tue, Apr 23, 6:33 AM
Unknown Object (File)
Fri, Apr 19, 2:54 AM
Unknown Object (File)
Jan 22 2024, 4:36 PM

Details

Reviewers
manu
imp
Group Reviewers
cam
Summary

Card insertion / removal detection is not implemented on AllWinner yet.
So just initiate bus scan unconditionally after succesfully attaching
to the controller.

This makes it possible to use inserted SD/MMC card as root file system.

Also refactor force-rescan code into a function and call it both from AllWinner SDHC controller and all SDHCI-based implementations.

Test Plan

Using this patch, I get after rebooting and without running camcontrol rescan:

On Nanopi M1+ (armv7, AllWinner):

root@nanopi:~ # camcontrol devlist
<SDHC SD16G 3.0 SN 7CA5C349 MFG 03/2016 >  at scbus0 target 0 lun 0 (pass0,sdda0)
<SDIO card>                        at scbus1 target 0 lun 0 (pass1,sdiob0)
<MMCHC 8WPD3R 0.0 SN 53CFF01B MFG 10/200>  at scbus2 target 0 lun 0 (pass2,sdda1)

On Pine64 (arm64, AllWinner):

root@r64:~ # camcontrol devlist
<SDHC SC32G 8.0 SN 1B240699 MFG 05/2018 >  at scbus0 target 0 lun 0 (pass0,sdda0)
<MMCHC M8B16G 2.8 SN 4E176927 MFG 07/200>  at scbus1 target 0 lun 0 (pass1,sdda1)

On Raspberry Pi 3 (arm64. SDHCI + SDHOST controllers):

root@rpi3:~ # camcontrol devlist
<SDHC SL16G 8.0 SN 19853490 MFG 01/2017 >  at scbus0 target 0 lun 0 (pass0,sdda0)
<SDIO card>                        at scbus1 target 0 lun 0 (pass1,sdiob0)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 27833

Event Timeline

Tested on: Lamobo R1 w/ root-on-SD

sys/arm/allwinner/aw_mmc.c
428

I can't see what this protects in this code. Do you need it?

Hmm... any chance we can try to squeeze this in before the freeze?

Quoting myself :

20:51 < manu> I'm not sure this is the right solution
20:52 < manu
> it seems that it's cam only code
20:52 < manu__> so I don't understand why it's not in a generic function

In D15955#357900, @manu wrote:

Quoting myself :

20:51 < manu> I'm not sure this is the right solution
20:52 < manu
> it seems that it's cam only code
20:52 < manu__> so I don't understand why it's not in a generic function

The correct solution is implementing proper card insertion detection. This is, however, out of scope for this change. I'm just replicating the way it's implemented for mmc(4) in this driver, for now.

sys/arm/allwinner/aw_mmc.c
428

Seems indeed this is excessive.

In D15955#357900, @manu wrote:

Quoting myself :

20:51 < manu> I'm not sure this is the right solution
20:52 < manu
> it seems that it's cam only code
20:52 < manu__> so I don't understand why it's not in a generic function

The correct solution is implementing proper card insertion detection. This is, however, out of scope for this change. I'm just replicating the way it's implemented for mmc(4) in this driver, for now.

Yes and that's what I don't like, this is not the correct solution for this problem.

In D15955#420988, @manu wrote:
In D15955#357900, @manu wrote:

Quoting myself :

The correct solution is implementing proper card insertion detection. This is, however, out of scope for this change. I'm just replicating the way it's implemented for mmc(4) in this driver, for now.

Yes and that's what I don't like, this is not the correct solution for this problem.

Ok, stupid me, has two questions:

(a) what would be proper card insertion detection here for this one? (I am battling a similar issue elsewhere currently)

(b) if the API gets changed, so it works without the aw_mmc_softc, the function gets put into a central place outside this driver, and then gets called, is that what you are asking @manu ?

In D15955#421067, @bz wrote:
In D15955#420988, @manu wrote:
In D15955#357900, @manu wrote:

Quoting myself :

The correct solution is implementing proper card insertion detection. This is, however, out of scope for this change. I'm just replicating the way it's implemented for mmc(4) in this driver, for now.

Yes and that's what I don't like, this is not the correct solution for this problem.

Ok, stupid me, has two questions:

(a) what would be proper card insertion detection here for this one? (I am battling a similar issue elsewhere currently)

(b) if the API gets changed, so it works without the aw_mmc_softc, the function gets put into a central place outside this driver, and then gets called, is that what you are asking @manu ?

The correct solution would be to start a separate task that checks the status of "Card present" register and initiates a rescan based on that.

@manu : you are right, I will withdraw this change and try to implement a proper solution.

kibab edited the summary of this revision. (Show Details)
kibab set the repository for this revision to rS FreeBSD src repository - subversion.
This revision is now accepted and ready to land.Nov 26 2019, 9:39 PM

Other than printing a warning here to help debugging should the alloc fail, I think this is good.

sys/cam/mmc/mmc_xpt.c
415

I'd print a warning here... why was no wait used though?

Updated to output an error message if various allocation functions failed. Also, revert to using alloc_ccb() from alloc_ccb_nowait() since it's pretty fine to wait in the contexts where start_discovery() is executed.

This revision now requires review to proceed.Nov 28 2019, 3:45 PM
kibab added inline comments.
sys/cam/mmc/mmc_xpt.c
415

Indeed _nowait() is excessive, it's fine to wait.

sys/cam/mmc/mmc_xpt.c
417

With the waiting version, you don't get null returns. .

(perhaps with some additions/changes) this patch should give us access
to the proprietary brcmfmac- driver for the RPI4,
so that we could boot the root filesystem from SD-card AND get WIFI over SDIO (GENERIC-MMCCAM(actually logically hangs @ mount root)) for that RPI-board.

(perhaps with some additions/changes) this patch should give us access
to the proprietary brcmfmac- driver for the RPI4,

I don't follow this- how are you expecting it to work? What driver specifically are you referring to? I'm not aware of a proprietary brcmfmac driver for FreeBSD.

so that we could boot the root filesystem from SD-card AND get WIFI over SDIO (GENERIC-MMCCAM(actually logically hangs @ mount root)) for that RPI-board.

This is a separate problem, apparently. All RPi use an sdhci driver, and this doesn't need a patch like this as it just works. I'll investigate the hangs, because it wasn't doing that a month ago. I can only use GENERIC-MMCCAM for rpi3/4 because the other stack leaves us at 400Hz and userland is unbearably slow.

I don't follow this- how are you expecting it to work? What driver specifically are you referring to? I'm not aware of a proprietary brcmfmac driver for FreeBSD.

I'm talking about brcmfmac43455-sdio.bin and brcmfmac43455-sdio.txt
Here`s how it worked for me in netbsd via SDIO :
https://mail-index.netbsd.org/port-arm/2019/10/17/msg006228.html
(the original Broadcom didn't `t work but the one from Debian) .
there's already something prepared in src to bind that driver in fbsd :
please take a look @ /usr.bin/sdiotool/sdiotool.c

This is a separate problem, apparently. All RPi use an sdhci driver, and this doesn't need a patch like this as it just works. I'll investigate the hangs, >because it wasn't doing that a month ago. I can only use GENERIC-MMCCAM for rpi3/4 because the other stack leaves us at 400Hz and userland is >unbearably slow.

after compiling GENERIC-MMCCAM on RPI4 (customized GENERIC_MMCCAM (additionally excluding witness)) :

Using DTB provided by EFI at 0x7ef2000.
---<<BOOT>>---
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2020 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 13.0-CURRENT #10 r357173M: Mon Jan 27 17:44:41 UTC 2020
    root@generic:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC-MMCCAM-NODEBUG arm64
FreeBSD clang version 9.0.1 (git@github.com:llvm/llvm-project.git c1a0a213378a4)
VT: init without driver.
module firmware already present!
KLD file umodem.ko is missing dependencies
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 39f53000 mode 2 pages 1
MAP 39f57000 mode 2 pages 1
MAP 3b360000 mode 2 pages 16
MAP fe100000 mode 0 pages 1
WARNING: Device "kbd" is Giant locked and may be deleted before FreeBSD 13.0.
kbd0 at kbdmux0
WARNING: Device "openfirm" is Giant locked and may be deleted before FreeBSD 13.
ofwbus0: <Open Firmware Device Tree>
simplebus0: <Flattened device tree simple bus> on ofwbus0
ofw_clkbus0: <OFW clocks bus> on ofwbus0
clk_fixed0: <Fixed clock> on ofw_clkbus0
clk_fixed1: <Fixed clock> on ofw_clkbus0
simplebus1: <Flattened device tree simple bus> on ofwbus0
simplebus2: <Flattened device tree simple bus> on ofwbus0
regfix0: <Fixed Regulator> on ofwbus0
regfix1: <Fixed Regulator> on ofwbus0
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
gic0: <ARM Generic Interrupt Controller> mem 0x40041000-0x40041fff,0x40042000-00
gic0: pn 0x2, arch 0x2, rev 0x1, implementer 0x43b irqs 256
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
gpio0: <BCM2708/2835 GPIO controller> mem 0x7e200000-0x7e2000b3 irq 22,23 on si0
gpiobus0: <OFW GPIO bus> on gpio0
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
gpioregulator0: <GPIO controlled regulator> on ofwbus0
gpioregulator0: cannot get pin 0
gpioregulator0: cannot parse parameters
device_attach: gpioregulator0 attach returned 6
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
generic_timer0: <ARMv7 Generic Timer> irq 4,5,6,7 on ofwbus0
Timecounter "ARM MPCore Timecounter" frequency 54000000 Hz quality 1000
Event timer "ARM MPCore Eventtimer" frequency 54000000 Hz quality 1000
gpioregulator0: <GPIO controlled regulator> on ofwbus0
gpioregulator0: cannot get pin 0
gpioregulator0: cannot parse parameters
device_attach: gpioregulator0 attach returned 6
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
gpioregulator0: <GPIO controlled regulator> on ofwbus0
gpioregulator0: cannot get pin 0
gpioregulator0: cannot parse parameters
device_attach: gpioregulator0 attach returned 6
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
gpioregulator0: <GPIO controlled regulator> on ofwbus0
gpioregulator0: cannot get pin 0
gpioregulator0: cannot parse parameters
device_attach: gpioregulator0 attach returned 6
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
gpioregulator0: <GPIO controlled regulator> on ofwbus0
gpioregulator0: cannot get pin 0
gpioregulator0: cannot parse parameters
device_attach: gpioregulator0 attach returned 6
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
usb_nop_xceiv0: <USB NOP PHY> on ofwbus0
gpioregulator0: <GPIO controlled regulator> on ofwbus0
gpioregulator0: cannot get pin 0
gpioregulator0: cannot parse parameters
device_attach: gpioregulator0 attach returned 6
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
psci0: PSCI version number mismatched with DT
device_attach: psci0 attach returned 6
bcm_dma0: <BCM2835 DMA Controller> mem 0x7e007000-0x7e007aff irq 9,10,11,12,13,0
bcmwd0: <BCM2708/2835 Watchdog> mem 0x7e100000-0x7e100113,0x7e00a000-0x7e00a0230
mbox0: <BCM2835 VideoCore Mailbox> mem 0x7e00b880-0x7e00b8bf irq 21 on simplebu0
                                                                              g0
uart0: <PrimeCell UART (PL011)> mem 0x7e201000-0x7e2011ff irq 24 on simplebus0
uart0: console (115200,n,8,1)
spi0: <BCM2708/2835 SPI controller> mem 0x7e204000-0x7e2041ff irq 26 on simpleb0
spibus0: <OFW SPI bus> on spi0
spibus0: <unknown card> at cs 0 mode 0
spibus0: <unknown card> at cs 1 mode 0
iichb0: <BCM2708/2835 BSC controller> mem 0x7e804000-0x7e804fff irq 38 on simpl0
sdhci_bcm0: <Broadcom 2708 SDHCI controller> mem 0x7e340000-0x7e3400ff irq 60 o0
mmc_alloc_device()
sdhci_bcm1: <Broadcom 2708 SDHCI controller> mem 0x7e300000-0x7e3000ff irq 61 o0
mmc_alloc_device()
fb0: <BCM2835 VT framebuffer driver> on simplebus0
fb0: changing fb bpp from 0 to 24
mbox0: mbox response error
fb0: bcm2835_mbox_fb_init failed, err=5
device_attach: fb0 attach returned 6
cpulist0: <Open Firmware CPU Group> on ofwbus0
cpu0: <Open Firmware CPU> on cpulist0
cpu1: <Open Firmware CPU> on cpulist0
cpu2: <Open Firmware CPU> on cpulist0
cpu3: <Open Firmware CPU> on cpulist0
gpioled0: <GPIO LEDs> on ofwbus0
gpioled0: <led1> failed to map pin
gpioregulator0: <GPIO controlled regulator> on ofwbus0
gpioregulator0: cannot get pin 0
gpioregulator0: cannot parse parameters
device_attach: gpioregulator0 attach returned 6
cryptosoft0: <software crypto>
Timecounters tick every 1.000 msec
Obsolete code will be removed soon: random(9) is the obsolete Park-Miller LCG f8
mmc_dev_async(async_code=0x20, path_id=0, target_id=0, lun_id=0
Got AC_PATH_REGISTERED -- whatever...
mmc_dev_async(async_code=0x20, path_id=0, target_id=ffffffff, lun_id=ffffffff
mmc_dev_async(async_code=0x20, path_id=1, target_id=0, lun_id=0
Got AC_PATH_REGISTERED -- whatever...
mmc_dev_async(async_code=0x20, path_id=1, target_id=ffffffff, lun_id=ffffffff
iicbus0: <OFW I2C bus> on iichb0
iic0: <I2C generic I/O> on iicbus0
Release APs...(noperiph:sdhci_slot0:0:-1:ffffffff): XPT_SCAN_{BUS,TGT,LUN}
(noperiph:sdhci_slot0:0:0:0): XPT_SCAN_{BUS,TGT,LUN}
(noperiph:sdhci_slot0:0:0:0):  Set up the mmcprobe device...
(mmcprobe0:sdhci_slot0:0:0:0): Periph created
(mmcprobe0:sdhci_slot0:0:0:0): Probe started
(mmcprobe0:sdhci_slot0:0:0:0): Probe PROBE_INVALID to PROBE_RESET
(mmcprobe0:sdhci_slot0:0:0:0): mmcprobe_start
(mmcprobe0:sdhci_slot0:0:0:0): Start with PROBE_RESET
sdhci_bcm0-slot0: Clock => 0
sdhci_bcm0-slot0: VDD => 21
sdhci_bcm0-slot0: CS => 0
sdhci_bcm0-slot0: Bus width => 0
sdhci_bcm0-slot0: Power mode => 1
sdhci_bcm0-slot0: Bus mode => 1
sdhci_bcm0-slot0: sdhci_cam_update_ios: power_mode=1, clk=0, bus_width=0, timin0
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
Root mount waiting for: CAM
sdhci_bcm0-slot0: Clock => 400000
sdhci_bcm0-slot0: Power mode => 2
sdhci_bcm0-slot0: Timing => 0
sdhci_bcm0-slot0: sdhci_cam_update_ios: power_mode=2, clk=400000, bus_width=0, 0
sdhci_bcm0-slot0: CS => 1
sdhci_bcm0-slot0: sdhci_cam_update_ios: power_mode=2, clk=400000, bus_width=0, 0
(mmcprobe0:sdhci_slot0:0:0:0): Send first XPT_MMC_IO
(noperiph:sdhci_slot1:0:-1:ffffffff): XPT_SCAN_{BUS,TGT,LUN}
(noperiph:sdhci_slot1:0:0:0): XPT_SCAN_{BUS,TGT,LUN}
(noperiph:sdhci_slot1:0:0:0):  Set up the mmcprobe device...
(mmcprobe1:sdhci_slot1:0:0:0): Periph created
(mmcprobe1:sdhci_slot1:0:0:0): Probe started
(mmcprobe1:sdhci_slot1:0:0:0): Probe PROBE_INVALID to PROBE_RESET
(mmcprobe1:sdhci_slot1:0:0:0): mmcprobe_start
(mmcprobe1:sdhci_slot1:0:0:0): Start with PROBE_RESET
sdhci_bcm1-slot0: Clock => 0
sdhci_bcm1-slot0: VDD => 21
sdhci_bcm1-slot0: CS => 0
sdhci_bcm1-slot0: Bus width => 0
sdhci_bcm1-slot0: Power mode => 1
sdhci_bcm1-slot0: Bus mode => 1
sdhci_bcm1-slot0: sdhci_cam_update_ios: power_mode=1, clk=0, bus_width=0, timin0
(mmcprobe0:sdhci_slot0:0:0:0): mmcprobe_done
Starting completion of PROBE_RESET
(mmcprobe0:sdhci_slot0:0:0:0): done with PROBE_RESET
(mmcprobe0:sdhci_slot0:0:0:0): Probe PROBE_RESET to PROBE_SEND_IF_COND
mmc_probedone: remaining freezecnt 0
(mmcprobe0:sdhci_slot0:0:0:0): mmcprobe_start
(mmcprobe0:sdhci_slot0:0:0:0): Start with PROBE_SEND_IF_COND
sdhci_bcm1-slot0: Clock => 399361
sdhci_bcm1-slot0: Power mode => 2
sdhci_bcm1-slot0: Timing => 0
sdhci_bcm1-slot0: sdhci_cam_update_ios: power_mode=2, clk=399361, bus_width=0, 0
APs not started
CPU  0: ARM Cortex-A72 r0p3 affinity:  0
 Instruction Set Attributes 0 = <CRC32>
 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,16TB P>
                                                                               >
      Memory Model Features 2 = <32bit CCIDX,48bit VA>
             Debug Features 0 = <2 CTX BKPTs,4 Watchpoints,6 Breakpoints,PMUv3,>
             Debug Features 1 = <>
         Auxiliary Features 0 = <>
         Auxiliary Features 1 = <>
CPU  1: (null) (null) r0p0 affinity:  0
CPU  2: (null) (null) r0p0 affinity:  0
CPU  3: (null) (null) r0p0 affinity:  0
(mmcprobe0:sdhci_slot0:0:0:0): mmcprobe_done
(mmcprobe0:sdhci_slot0:0:0:0): SD 2.0 interface conditions: OK
(mmcprobe0:sdhci_slot0:0:0:0): Probe PROBE_SEND_IF_COND to PROBE_SDIO_RESET
mmc_probedone: remaining freezecnt 0
(mmcprobe0:sdhci_slot0:0:0:0): mmcprobe_start
(mmcprobe0:sdhci_slot0:0:0:0): Start with PROBE_SDIO_RESET
sdhci_bcm1-slot0: CS => 1
sdhci_bcm1-slot0: sdhci_cam_update_ios: power_mode=2, clk=399361, bus_width=0, 0
Root mount waiting for: CAM
(mmcprobe1:sdhci_slot1:0:0:0): Send first XPT_MMC_IO
mountroot: waiting for device /dev/ufs/rootfs...
Mounting from ufs:/dev/ufs/rootfs failed with error 19.

Loader variables:
  vfs.root.mountfrom=ufs:/dev/ufs/rootfs
  vfs.root.mountfrom.options=rw

Manual root filesystem specification:
  <fstype>:<device> [options]
      Mount <device> using filesystem <fstype>
      and with the specified (optional) option list.

    eg. ufs:/dev/da0s1a
        zfs:zroot/ROOT/default
        cd9660:/dev/cd0 ro
          (which is equivalent to: mount -t cd9660 -o ro /dev/cd0 /)

  ?               List valid disk boot devices
  .               Yield 1 second (for background tasks)
  <empty line>    Abort manual input

mountroot> sdhci_bcm0-slot0: Controller timeout
sdhci_bcm0-slot0: ============== REGISTER DUMP ==============
sdhci_bcm0-slot0: Sys addr: 0x00000000 | Version:  0x00001002
sdhci_bcm0-slot0: Blk size: 0x00000000 | Blk cnt:  0x00000000
sdhci_bcm0-slot0: Argument: 0x88000c08 | Trn mode: 0x00000000
sdhci_bcm0-slot0: Present:  0x1fff0000 | Host ctl: 0x00000000
sdhci_bcm0-slot0: Power:    0x0000000f | Blk gap:  0x00000080
sdhci_bcm0-slot0: Wake-up:  0x00000000 | Clock:    0x00007d07
sdhci_bcm0-slot0: Timeout:  0x00000000 | Int stat: 0x00018000
sdhci_bcm0-slot0: Int enab: 0x01ff003b | Sig enab: 0x01ff003b
sdhci_bcm0-slot0: AC12 err: 0x00000000 | Host ctl2:0x00000000
sdhci_bcm0-slot0: Caps:     0x45ee6432 | Caps2:    0x0000a525
sdhci_bcm0-slot0: Max curr: 0x00080008 | ADMA err: 0x00000000
sdhci_bcm0-slot0: ADMA addr:0x00000000 | Slot int: 0x00000001
sdhci_bcm0-slot0: ===========================================
sdhci_bcm1-slot0: Controller timeout
sdhci_bcm1-slot0: ============== REGISTER DUMP ==============
sdhci_bcm1-slot0: Sys addr: 0x00000000 | Version:  0x00009902
sdhci_bcm1-slot0: Blk size: 0x00000000 | Blk cnt:  0x00000000
sdhci_bcm1-slot0: Argument: 0x00000000 | Trn mode: 0x00000000
sdhci_bcm1-slot0: Present:  0x000f0001 | Host ctl: 0x00000000
sdhci_bcm1-slot0: Power:    0x0000000f | Blk gap:  0x00000000
sdhci_bcm1-slot0: Wake-up:  0x00000000 | Clock:    0x00003947
sdhci_bcm1-slot0: Timeout:  0x00000000 | Int stat: 0x00038000
sdhci_bcm1-slot0: Int enab: 0x01ff00bb | Sig enab: 0x01ff00bb
sdhci_bcm1-slot0: AC12 err: 0x00000000 | Host ctl2:0x00000000
sdhci_bcm1-slot0: Caps:     0x00000000 | Caps2:    0x00000000
sdhci_bcm1-slot0: Max curr: 0x00000001 | ADMA err: 0x00000000
sdhci_bcm1-slot0: ADMA addr:0x00000000 | Slot int: 0x00000001
sdhci_bcm1-slot0: ===========================================
(mmcprobe0:sdhci_slot0:0:0:0): mmcprobe_done
(mmcprobe0:sdhci_slot0:0:0:0): SDIO_RESET: error 1, CCCR CTL register: 00000000
(mmcprobe0:sdhci_slot0:0:0:0): Probe PROBE_SDIO_RESET to PROBE_SDIO_INIT
mmc_probedone: remaining freezecnt 0
(mmcprobe0:sdhci_slot0:0:0:0): mmcprobe_start
(mmcprobe0:sdhci_slot0:0:0:0): Start with PROBE_SDIO_INIT
(mmcprobe1:sdhci_slot1:0:0:0): mmcprobe_done
Starting completion of PROBE_RESET
(mmcprobe1:sdhci_slot1:0:0:0): done with PROBE_RESET
(mmcprobe1:sdhci_slot1:0:0:0): GO_IDLE_STATE failed with error 1
(mmcprobe1:sdhci_slot1:0:0:0): Probe PROBE_RESET to PROBE_INVALID
mmc_probedone: remaining freezecnt 0
(mmcprobe1:sdhci_slot1:0:0:0): Periph invalidated
(mmcprobe1:sdhci_slot1:0:0:0): Periph destroyed
sdhci_bcm0-slot0: Controller timeout
sdhci_bcm0-slot0: ============== REGISTER DUMP ==============
sdhci_bcm0-slot0: Sys addr: 0x00000000 | Version:  0x00001002
sdhci_bcm0-slot0: Blk size: 0x00000000 | Blk cnt:  0x00000000
sdhci_bcm0-slot0: Argument: 0x00000000 | Trn mode: 0x00000000
sdhci_bcm0-slot0: Present:  0x1fff0000 | Host ctl: 0x00000000
sdhci_bcm0-slot0: Power:    0x0000000f | Blk gap:  0x00000080
sdhci_bcm0-slot0: Wake-up:  0x00000000 | Clock:    0x00007d07
sdhci_bcm0-slot0: Timeout:  0x00000000 | Int stat: 0x00018000
sdhci_bcm0-slot0: Int enab: 0x01ff003b | Sig enab: 0x01ff003b
sdhci_bcm0-slot0: AC12 err: 0x00000000 | Host ctl2:0x00000000
sdhci_bcm0-slot0: Caps:     0x45ee6432 | Caps2:    0x0000a525
sdhci_bcm0-slot0: Max curr: 0x00080008 | ADMA err: 0x00000000
sdhci_bcm0-slot0: ADMA addr:0x00000000 | Slot int: 0x00000001
sdhci_bcm0-slot0: ===========================================
(mmcprobe0:sdhci_slot0:0:0:0): mmcprobe_done
(mmcprobe0:sdhci_slot0:0:0:0): SDIO_INIT: error 1, 00000000 00000000 00000000 00
(mmcprobe0:sdhci_slot0:0:0:0): Probe PROBE_SDIO_INIT to PROBE_SEND_APP_OP_COND
mmc_probedone: remaining freezecnt 0
(mmcprobe0:sdhci_slot0:0:0:0): mmcprobe_start
sdhci_bcm0-slot0: Controller timeout
sdhci_bcm0-slot0: ============== REGISTER DUMP ==============
sdhci_bcm0-slot0: Sys addr: 0x00000000 | Version:  0x00001002
sdhci_bcm0-slot0: Blk size: 0x00000000 | Blk cnt:  0x00000000
sdhci_bcm0-slot0: Argument: 0x00000000 | Trn mode: 0x00000000
sdhci_bcm0-slot0: Present:  0x1fff0000 | Host ctl: 0x00000000
sdhci_bcm0-slot0: Power:    0x0000000f | Blk gap:  0x00000080
sdhci_bcm0-slot0: Wake-up:  0x00000000 | Clock:    0x00007d07
sdhci_bcm0-slot0: Timeout:  0x00000000 | Int stat: 0x00018001
sdhci_bcm0-slot0: Int enab: 0x01ff003b | Sig enab: 0x01ff003b
sdhci_bcm0-slot0: AC12 err: 0x00000000 | Host ctl2:0x00000000
sdhci_bcm0-slot0: Caps:     0x45ee6432 | Caps2:    0x0000a525
sdhci_bcm0-slot0: Max curr: 0x00080008 | ADMA err: 0x00000000
sdhci_bcm0-slot0: ADMA addr:0x00000000 | Slot int: 0x00000001
sdhci_bcm0-slot0: ===========================================
(mmcprobe0:sdhci_slot0:0:0:0): mmcprobe_done
(mmcprobe0:sdhci_slot0:0:0:0): APP_OP_COND: error 1, resp 00000000
(mmcprobe0:sdhci_slot0:0:0:0): Probe PROBE_SEND_APP_OP_COND to PROBE_MMC_INIT
mmc_probedone: remaining freezecnt 0
(mmcprobe0:sdhci_slot0:0:0:0): mmcprobe_start
(mmcprobe0:sdhci_slot0:0:0:0): Start with PROBE_MMC_INIT
sdhci_bcm0-slot0: Controller timeout
sdhci_bcm0-slot0: ============== REGISTER DUMP ==============
sdhci_bcm0-slot0: Sys addr: 0x00000000 | Version:  0x00001002
sdhci_bcm0-slot0: Blk size: 0x00000000 | Blk cnt:  0x00000000
sdhci_bcm0-slot0: Argument: 0x40000000 | Trn mode: 0x00000000
sdhci_bcm0-slot0: Present:  0x1fff0000 | Host ctl: 0x00000000
sdhci_bcm0-slot0: Power:    0x0000000f | Blk gap:  0x00000080
sdhci_bcm0-slot0: Wake-up:  0x00000000 | Clock:    0x00007d07
sdhci_bcm0-slot0: Timeout:  0x00000000 | Int stat: 0x00018000
sdhci_bcm0-slot0: Int enab: 0x01ff003b | Sig enab: 0x01ff003b
sdhci_bcm0-slot0: AC12 err: 0x00000000 | Host ctl2:0x00000000
sdhci_bcm0-slot0: Caps:     0x45ee6432 | Caps2:    0x0000a525
sdhci_bcm0-slot0: Max curr: 0x00080008 | ADMA err: 0x00000000
sdhci_bcm0-slot0: ADMA addr:0x00000000 | Slot int: 0x00000001
sdhci_bcm0-slot0: ===========================================
(mmcprobe0:sdhci_slot0:0:0:0): mmcprobe_done
(mmcprobe0:sdhci_slot0:0:0:0): MMC_INIT: error 1, resp 00000000
(mmcprobe0:sdhci_slot0:0:0:0): Probe PROBE_MMC_INIT to PROBE_INVALID
mmc_probedone: remaining freezecnt 0
(mmcprobe0:sdhci_slot0:0:0:0): Periph invalidated
(mmcprobe0:sdhci_slot0:0:0:0): Periph destroyed
---

I don't follow this- how are you expecting it to work? What driver specifically are you referring to? I'm not aware of a proprietary brcmfmac driver for FreeBSD.

I'm talking about brcmfmac43455-sdio.bin and brcmfmac43455-sdio.txt
Here`s how it worked for me in netbsd via SDIO :
https://mail-index.netbsd.org/port-arm/2019/10/17/msg006228.html
(the original Broadcom didn't `t work but the one from Debian) .
there's already something prepared in src to bind that driver in fbsd :
please take a look @ /usr.bin/sdiotool/sdiotool.c

Ah, I see- so this is actually just the firmware for it -- it still needs a driver to hook into our wifi framework. On NetBSD, this should be handled by bwfm(4).

This is a separate problem, apparently. All RPi use an sdhci driver, and this doesn't need a patch like this as it just works. I'll investigate the hangs, >because it wasn't doing that a month ago. I can only use GENERIC-MMCCAM for rpi3/4 because the other stack leaves us at 400Hz and userland is >unbearably slow.

after compiling GENERIC-MMCCAM on RPI4 (customized GENERIC_MMCCAM (additionally excluding witness)) :

[dmesg omitted]

Downloading last week's image, I'm actually seeing similar on a recent non-MMCCAM kernel. =-( Can you try that same revision with just GENERIC and see if you can reproduce these results?

Downloading last week's image, I'm actually seeing similar on a recent non-MMCCAM kernel. =-( Can you try that same revision with just GENERIC and see if you can reproduce these results?

I yesterday compiled r357335 (as far as I remember) to GENERIC-NODEBUG and got the same mmc-rescan-issue ... as you assumed..
another user reported similar issue when upgrading from -r356426 to -r357356 on the mailing list.
I don't know if this D15955 could transitionally help out .. I'm a bit running out of time(probably like you:-) to reproduce this issue quickly..

@kibab I've added card insertion detection in D23267 and D23268, please have a look at those reviews.

I have removed my prior comments: they traced to a different issue that, when worked around, got rid of the behavior that I had reported. Sorry for the noise.

kibab marked an inline comment as done.

The support for this has been merged in -HEAD through other commits.
Some last bits are coming in https://reviews.freebsd.org/D25843.