jkson
Posts: 3
Joined: Sun Jan 21, 2018 6:15 am

mmc1 SDIO clock changing

Sun Jan 21, 2018 7:27 am

Hi!
I've connected second SD card via SDIO 1-bit bus. Works well with sdio overlay. But, how I can change clock frequency for this interface? I want to make some diagnosis with my oscilloscope and need a clock lowest as possible.
I've tried change the parameter sdio_overclock, but nothing was changed. Clock frequency is always 25MHz.

Code: Select all

[email protected]:~ $ sudo cat /sys/kernel/debug/mmc1/ios
clock:          25000000 Hz
actual clock:   25000000 Hz
vdd:            21 (3.3 ~ 3.4 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      0 (1 bits)
timing spec:    0 (legacy)
signal voltage: 0 (3.30 V)
driver type:    0 (driver type B)
What is wrong? How I can change SDIO clock frequency in RPi3? Maybe with core clock?
Last edited by jkson on Sun Jan 21, 2018 6:00 pm, edited 1 time in total.

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

Re: mmc1 SDIO clock changing

Sun Jan 21, 2018 3:48 pm

The DT bindings documentation for mmc says:

Code: Select all

...
- max-frequency: maximum operating clock frequency
...
I believe you should be able to use this property to limit the frequency requested by the MMC subsystem. However, reading the driver suggests this value is ignored, being overwritten by the maximum clock achievable by the interface given its master clock.

If you'd like to use this clock limiting facility, please create an issue in our Linux repo.

jkson
Posts: 3
Joined: Sun Jan 21, 2018 6:15 am

Re: mmc1 SDIO clock changing

Sun Jan 21, 2018 5:20 pm

Thank you! I think you have many another things to do, this question is not so important for community, only for me. I will use primary SD interface, because mmc overlay works fine with it, and I can use it with 1-bit width and underclocking with minor changes:

Code: Select all

[email protected]:~ $ sudo cat /sys/kernel/debug/mmc0/ios
clock:          50000000 Hz
actual clock:   5952381 Hz
vdd:            21 (3.3 ~ 3.4 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      0 (1 bits)
I just want to understand, why underclocking works with mmc overlay and never with sdio overlay?

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

Re: mmc1 SDIO clock changing

Mon Jan 22, 2018 9:40 am

The overclock mechanism in the bcm2835-sdhost driver is more complicated because it will automatically back-off the overclock if it sees an error. To prevent this backing-off continuing indefinitely it gets cancelled when the overclock reaches 50MHz, i.e. no longer overclocked. Because of a concern about rounding issues, and for simplicity, the overclock is cancelled when the clock is <= 50MHz, meaning it is currently not possible to underclock. If underclocking via the same mechanism is seen as a useful property then it wouldn't be hard to make it possible - it's the transisition from > to <= that should trigger the cancellation.

I'll fix this limitation at the same time as honouring the max-frequency property - there's an issue to track this.

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

Re: mmc1 SDIO clock changing

Mon Jan 22, 2018 12:32 pm

A pair of patches have gone into the kernel tree to add a max-frequency support to both downstream MMC drivers and to support sd_overclock underclocking in bcm2835-sdhost.

jkson
Posts: 3
Joined: Sun Jan 21, 2018 6:15 am

Re: mmc1 SDIO clock changing

Tue Jan 23, 2018 5:35 pm

Thank you very much! I've compiled kernel and tried it. Sd_overclock works for underclocking sdhost. And max-frequency even better! I was able to set sdio to 0,5 MHz, make diagnosis and take a big step in my project)

Return to “Device Tree”

Who is online

Users browsing this forum: No registered users and 3 guests