__deets__
Posts: 11
Joined: Mon Aug 15, 2016 1:05 pm

MMC2/SDIO clocking

Thu Mar 01, 2018 2:03 pm

Hi,

I'm trying to get a Atmel/Microchip WILC1000 module working with my Compute Module 3 (Kernel 4.14.22). I've added the sdio overlay, and compiled the actual kernel modules from the github repo of microchip.

The system fires up a mmc2:

Code: Select all

[    2.482767] sdhci-iproc 3f300000.sdio: /aliases ID not available
[    2.541098] mmc2: SDHCI controller on 3f300000.sdio [3f300000.sdio] using PIO
After placing the firmware blob under /lib/firmware/, the driver at first starts up correctly:

Code: Select all

[    3.646592] wilc1000_sdio mmc2:0001:1: Driver Initializing success
[    3.758589] wilc1000_sdio mmc2:0001:1: chipid (001003a0)
[    3.758609] wilc1000_sdio mmc2:0001:1: has_thrpt_enh3 = 1...
[    3.759447] wilc1000_sdio mmc2:0001:1 wlan0: Detect chip WILC1000
[    3.759458] wilc1000_sdio mmc2:0001:1 wlan0: loading firmware wilc1000_wifi_firmware.bin
[    3.894843] wilc1000_sdio mmc2:0001:1 wlan0: WILC Firmware Ver = WILC_WIFI_FW_REL_15_00_RC4 Build: 8837
But after a few seconds, the log is flooded with error-messages (I have the module compiled with debugging enabled):

Code: Select all

[   59.845468] wilc1000_sdio mmc2:0001:1: Failed cmd 52, read reg (000000f1) ...
[   59.845478] wilc1000_sdio mmc2:0001:1: wilc_sdio_cmd52..failed, err(-123)
My suspicion is the MMC host controller clock-speed: the CLK signal is at 42MHz. And I fear that is too much for my flying-wire-setup.

I found the sd_overclock parameter and set that to the lowest possible value (1), and the SD-card speed is abysmal. But the CLK is still at 42MHz.

Any pointers on how to reduce the clock speed to something like 10MHz? Or other pointers to figure this one out?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3000
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: MMC2/SDIO clocking

Thu Mar 01, 2018 9:17 pm

The kernel log messages lead me to think that you are running an upstream kernel, or at least a kernel that doesn't have the downstream bcm2835-mmc driver (enabled). As such, the overclock feature won't work.

I also notice that the recently updated sdio overlay needs to include a modified alias - the second controller should be mmc1, not mmc2.

__deets__
Posts: 11
Joined: Mon Aug 15, 2016 1:05 pm

Re: MMC2/SDIO clocking

Mon Mar 05, 2018 11:00 am

Hi Phil,

the kernel is certainly from the rpi github. The commit it points to is actually yours ;) "overlays: rework sdio overlays to allow polling"

Regarding the configuration itself: this is I think the relevant section from my kernel config:

Code: Select all

#
# MMC/SD/SDIO Host Controller Drivers
#
# CONFIG_MMC_BCM2835_MMC is not set
CONFIG_MMC_BCM2835_SDHOST=y
# CONFIG_MMC_DEBUG is not set
# CONFIG_MMC_ARMMMCI is not set
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_IO_ACCESSORS=y
CONFIG_MMC_SDHCI_PLTFM=y
# CONFIG_MMC_SDHCI_OF_ARASAN is not set
# CONFIG_MMC_SDHCI_OF_AT91 is not set
# CONFIG_MMC_SDHCI_CADENCE is not set
# CONFIG_MMC_SDHCI_F_SDH30 is not set
CONFIG_MMC_SDHCI_IPROC=m
# CONFIG_MMC_SPI is not set
# CONFIG_MMC_DW is not set
# CONFIG_MMC_VUB300 is not set
# CONFIG_MMC_USHC is not set
# CONFIG_MMC_USDHI6ROL0 is not set
CONFIG_MMC_BCM2835=y
# CONFIG_MMC_MTK is not set
# CONFIG_MMC_SDHCI_XENON is not set
# CONFIG_MEMSTICK is not set
# CONFIG_NEW_LEDS is not set
# CONFIG_ACCESSIBILITY is not set
CONFIG_EDAC_ATOMIC_SCRUB=y
CONFIG_EDAC_SUPPORT=y
CONFIG_RTC_LIB=y
# CONFIG_RTC_CLASS is not set
CONFIG_DMADEVICES=y
# CONFIG_DMADEVICES_DEBUG is not set
I do see that there is the CONFIG_MMC_BCM2835_MMC missing. Is this what you are referring to? I have to admit that the layers of interdependent components here are confusing to me, but my current understanding is that I need the SDHOST because of sdio. But this might be wrong. So can/do I need to interchange these, and how does this relate to the current discussion here:

https://github.com/raspberrypi/linux/issues/2350

Thanks!

__deets__
Posts: 11
Joined: Mon Aug 15, 2016 1:05 pm

Re: MMC2/SDIO clocking

Mon Mar 05, 2018 11:08 am

I swapped SDHOST with MMC in the above shown kernel config snippet, and the boot-messages now show
[ 0.895276] mmc-bcm2835 3f300000.sdio: /aliases ID not available
[ 0.901641] mmc-bcm2835 3f300000.sdio: mmc_debug:0 mmc_debug2:0
[ 0.907704] mmc-bcm2835 3f300000.sdio: DMA channel allocated
[ 1.111023] sdhost-bcm2835 3f202000.mmc: loaded - DMA enabled (>1)
Is that what you would expect? I still have not managed to change clock though.

__deets__
Posts: 11
Joined: Mon Aug 15, 2016 1:05 pm

Re: MMC2/SDIO clocking

Mon Mar 05, 2018 1:01 pm

And the next tidbit: using debugfs I tried to set the clock. At first it appeared as if it didn't work. After putting debugging info into the mmc host source I saw bcm2835_mmc_set_clock being called. Subsequent cat'ing of of /sys/kernel/debug/mmc2/clock showed the clock being a bit all over the place. Not sure what to make out of that. The 122189 looks like some "reachable through the clock dividers" amount for my specified one although it's missing a couple of digits. Same goes for the 400000 and 300000 though.
[ 74.592551] bcm2835_mmc_set_ios: clock 12345678, pwr 0, bus_width 0, timing 0, vdd 0, drv_type 0
[ 74.592557] bcm2835_mmc_set_clock
[ 74.592587] bcm2835_mmc_set_clock
root@replace-me:~ # cat /sys/kernel/debug/mmc2/
clock ios
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
300000
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
0
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
0
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
0
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
0
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
0
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
122189
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
400000
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
122189
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
0
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
122189
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
0
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
0
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
0
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
400000
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
0
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
0
root@replace-me:~ #
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
0
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
122189
root@replace-me:~ # cat /sys/kernel/debug/mmc2/clock
0
root@replace-me:~ #

Return to “Advanced users”