This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/DRA74: [MMC][SDIO] enable irq mode instead of default polling method in mmc sdio driver

Part Number: DRA74

Tool/software: Linux

Hi,

Kernel Version : 4.4.84

We have Marvel wifi Chip  its connected to MMC3 controller via sdio interface.

 And Our observation is: 

mmc sdio driver uses the polling mode instead of irq mode.

As sdio irq thead(ksdioirqd) polls to process the pending interrupts from mmc3 node, which may take time to process the interrupts 

Due to which we are getting very less throughput when we run iperf(around 15Mbps)

Could any body please tell me how to configure/enable sdio interrupt mode in mmc3 driver instead of default polling method.

  • Hi Yashwantaray,

    Are you sure that this is what is causing the throughput to be less?

    Could you guys check if the below patch is present in your code base? if not, could you add this and check the throughput
    git.omapzoom.org/

    I have to check on the polling part of your query and get back to you.

    Regards,
    Vishal
  • Hi Vishal,

    Yes ,We have taken kernel lttng traces and we found fallowing observation.

    1. Periodically the iperf write() takes more than 115ms time to transfer the data.
    2. During that time, the ksdioirqd daemon is blocked on something which delayed the completion of write() call.
    3. This kind of behavior is always happened after every 250ms to 300ms during transfer.
    4. Below trace shows write call is delayed 186ms due to IO block.

     Even after  applying your patch no improvement has been observed.

  • Hi,

    What speed mode is MMC3 operating at (SDR50, SDR25, HS, etc..)?

    Regards,
    Vishal
  • Hi  Vishal,

    Its operating in  SDR50.

    Fallowing is the MMC3 configuration.

    mmc@480ad000 {
    compatible = "ti,dra7-hsmmc", "ti,omap4-hsmmc";
    reg = <0x480ad000 0x400>;
    interrupts = <0x0 0x59 0x4>;
    ti,hwmods = "mmc3";
    ti,needs-special-reset;
    dmas = <0xc6 0x4d 0xc6 0x4e>;
    dma-names = "tx", "rx";
    status = "okay";
    sd-uhs-sdr12;
    sd-uhs-sdr25;
    sd-uhs-sdr50;
    vmmc-supply = <0xc7>;
    bus-width = <0x4>;
    no-1-8-v;
    ti,non-removable;
    keep-power-in-suspend;
    max-frequency = <0xb71b000>;
    wlan-pd-gpio = <0xc2 0x5 0x1>;
    };

  • Hi Vishal,

    Can you please update on this..?

  • Hi,

    SDIO interrupt mode is already enabled in omap_hsmmc.

    Some SDIO cards use (like WiLink on our EVM) a dedicated gpio irq line (which is used for most of our testing). In this case the interrupts will be handled by wilink driver without intervention from omap_hsmmc or SDIO.

    For cards which doesn't have dedicated irq line, in-band interrupts will be used. KSDIOIRQD is a thread created by SDIO core to process SDIO interrupts.This thread will be woken up by CIRQ interrupt from omap_hsmmc.

    Please note the throughput also depends on the frequency in which the card is operating and the mode.

    Regards,
    Vishal

  • Hello Vishal,

    In the above case, we use the MV8887 chip for WiFi and set the sdio clock to 48MHz.
    We use the in-band interrupt mode(dat1 line as interrupt) and no additional gpio for interrupt signalling from wlan chip.
    Internally, sets 3.3V signalling for sdio data lines and configure the MMC2 node as HS mode.
    mmc2: new high speed SDIO card at address 0001

    Few registers dump can be found the sys entry, which shows polling method.
    # cat /sys/kernel/debug/mmc2/regs
    mmc2:
    sdio irq mode polling
    ctx_loss: 1
    regs:
    CON: 0x00000600
    PSTATE: 0x01f00000
    HCTL: 0x00000d02
    SYSCTL: 0x000d0047
    IE: 0x00000000
    ISE: 0x00000000
    CAPA: 0x22e10080

    cat /sys/kernel/debug/mmc2/ios
    clock: 50000000 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: 2 (4 bits)
    timing spec: 2 (sd high-speed)
    signal voltage: 0 (3.30 V)
    driver type: 0 (driver type B)

    Any reason to show its polling mode in the above dump?
    Please check this register dump info helps to get some additional info.

    We could see a very low throughput on WiFi on J6 platform.


    Regards,
    Anil
  • Hi,

    Could you guys try adding "cap-sdio-irq;" property to mmc3 node?
    According to devicetree documentation for mmc [1] this is needed for sdio irq.

    Another observation from your device tree settings for mmc3, Why is the max frequency of mmc3 set to to 192MHz, this is wrong, it should be set to 64 MHz for mmc3. Snippet from your device tree below
    max-frequency = <0xb71b000>;

    [1] https://www.kernel.org/doc/Documentation/devicetree/bindings/mmc/mmc.txt

    Regards,
    Vishal

  • Hi,

    Any update on the suggestions provided earlier?
  • Hello Vishal,

    >> "cap-sdio-irq;" property to mmc3 node
    With the suggestion of irq enable helped to improve the WiFi throughput.

    Since we configure the card HS speed mode, the default clock set to 48MHz internally by host mmc driver.
    So removed the max-clock option from the MMC3 node.
    Also, removed the UHS options(sd-uhs-sdrXX) from the MMC3 node due to the HS configuration is used.
    Otherwise host mmc driver needs modification to avoid the mmc3 device setting in UHS mode.

    Thank you for your help.

    --
    Regards,
    Anil
  • Hi Anil,

    Please mark the thread as resolved.

    Regards,
    Vishal