Thale
Thale

Reputation: 123

Force SD card Detection as SDR50 in linux using device tree

I am tasked to test a SD/MMC driver in ARM linux environment. I am trying to test the SDR50 functionality of the driver. My SD-card supports both SDR104 and also SDR50. By default is detected as a SDR104 device.

I am very new to device tree. I wonder if I can disable the SDR104 support of the driver in the device tree to force the detection of my SD-card as a SDR50 device ?

I could not find any online examples to do so. Please assist.

Thank you.

sdhci@ff160000 {
    compatible = "xlnx,zynqmp-8.9a", "arasan,sdhci-8.9a";
    interrupt-parent = <&gic>;
    interrupts = <0x0 0x30 0x4>;
    reg = <0x0 0xff160000 0x0 0x1000>;
    clock-names = "clk_xin", "clk_ahb";
    xlnx,device_id = <0x0>; };

Upvotes: 2

Views: 2417

Answers (2)

Angelo Dureghello
Angelo Dureghello

Reputation: 330

Mode is a tradeoff (negotiation) between host controller capabilities and detected card capabilities. In any case, host side can be forced to a slower mode.

The mode selection is host driver related, may be not always possible by devicetree. I suggest to open proper driver and disable the HS200/HS400 capabilities/flags so that mode is limited to sdr50, or whatever needed.

Upvotes: 0

John Moon
John Moon

Reputation: 924

In the device tree binding documentation for the arasan,sdhci-8.9a device, you can find all the device tree properties specific to that device. At the top of that documentation, you'll notice that the bindings simply add on to generic device tree bindings for MMC cards, located at Documentation/devicetree/bindings/mmc/mmc.txt in the kernel source tree.

So now, you'll want to check out that file. Specifically, I think the following bindings will be of interest to you:

  • max-frequency: maximum operating clock frequency
  • sd-uhs-sdr50: SD UHS SDR50 speed is supported
  • sd-uhs-sdr104: SD UHS SDR104 speed is supported

I think your best bet to force SDR50 speed is to set the max-frequency to SDR50's max frequency. According to my research, SDR50 supports up to 100 MHz, so you can set your max frequency to that:

/* Frequency in Hz - can be decimal or hex */
max-frequency = <100000000>

Upvotes: 1

Related Questions