Download raw body.
dwmmc: support "post-power-on-delay-ms" for "mmc-pwrseq-simple"
Many board DT files specify this property so it must be essential for reliable hardware bringup. This seems to be completely fixing the intermittent boot problems on Pinebook Pro (RK3399 with AzureWave AW-CM256SM SDIO WiFi module) which manifested as a hang after showing "bwfm_sdio_buf_write: error 60". I've tried great many reboots and power cycling with varying amount of time between turning on and off and couldn't reproduce the issue anymore after making this change. I guess this might help with Raspberry Pi 3 WiFi too (can not test since I do not have that hardware handy). The fix is kind of surprising since the timeout error occurs much later after powering on the module, during firmware activation, here's the back trace in case it might be useful: Starting stack trace... locore0.S() at dwmmc_exec_command+0x538 [.../sys/dev/fdt/dwmmc.c:1043] dwmmc_exec_command() at sdmmc_io_rw_extended+0x1e0 [.../sys/dev/sdmmc/sdmmc_io.c:443] sdmmc_io_rw_extended() at bwfm_sdio_ram_read_write+0x160 [.../sys/dev/sdmmc/if_bwfm_sdio.c:903] bwfm_sdio_ram_read_write() at bwfm_sdio_buscore_activate+0x60 [.../sys/dev/sdmmc/if_bwfm_sdio.c:1052] bwfm_sdio_buscore_activate() at bwfm_chip_set_active+0xf0 [.../sys/dev/ic/bwfm.c:1277] bwfm_chip_set_active() at bwfm_sdio_load_microcode+0x24c [.../sys/dev/sdmmc/if_bwfm_sdio.c:545] bwfm_sdio_load_microcode() at bwfm_sdio_preinit+0x1f0 [.../sys/dev/sdmmc/if_bwfm_sdio.c:421] bwfm_sdio_preinit() at bwfm_attachhook+0x30 [.../sys/dev/ic/bwfm.c:238] bwfm_attachhook() at config_process_deferred_mountroot+0x58 [.../sys/kern/subr_autoconf.c:763] config_process_deferred_mountroot() at main+0x5f8 [.../sys/kern/init_main.c:528] main() at virtdone+0x70 End of stack trace. bwfm_sdio_buf_write: error 60 --- diff --git sys/dev/fdt/dwmmc.c sys/dev/fdt/dwmmc.c index a66318fb7926..5d6f22a4a28b 100644 --- sys/dev/fdt/dwmmc.c +++ sys/dev/fdt/dwmmc.c @@ -1254,6 +1254,7 @@ dwmmc_pwrseq_post(uint32_t phandle) uint32_t *gpios, *gpio; int node; int len; + int post_delay; node = OF_getnodebyphandle(phandle); if (node == 0) @@ -1275,5 +1276,9 @@ dwmmc_pwrseq_post(uint32_t phandle) gpio = gpio_controller_next_pin(gpio); } + post_delay = OF_getpropint(node, "post-power-on-delay-ms", 0); + if (post_delay) + delay(post_delay * 1000); + free(gpios, M_TEMP, len); }
dwmmc: support "post-power-on-delay-ms" for "mmc-pwrseq-simple"