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.

AM335x MMC cannot switch to HS after suspend

Other Parts Discussed in Thread: SYSCONFIG

Hi all,

We are using am335x-rowboat-linux-kernel-3.2 based on original TI SDK on sitara am335x powered custom board. We have trouble with hsmmc. We have nonremovable sdxc v2 (highspeed support) sdcard on board. After boot, it can switch to HS mode with 50 Mhz. data rate (DDR50). However, after suspend/resume, it cannot switch to HS mode and kernel freezes.

Sdcard is connected to hsmmc.2 with correct pinmux config. After suspend, on mmc_sd_init_card() function (drivers/mmc/core/sd.c) we can skip switching to highspeed mode and kernel resumes normally with DDR25 sdcard speed (no highspeed).

I tried different sdxc sdhc sdcards on both am335x evm and our custom board and there is no HS switching problem on evm after suspend. It seems that the problem is on our board or kernel config. However, I checked and compared hardware design and kernel configs of evm and our board and no important difference. The only difference related with MMC is we are using mmc.2 for sdcard while evm is using mmc.0

In my search, there is a command sequence in sdcard specs. to switch an sdcard to HS mode. CMD6 command is the most important command to switch speed mode or current of an sdcard. Sending CMD6 Switch command causes our kernel to infinite wait for completion of sdcard command.

Is there anybody who has any idea about this problem?

  • Hi Kadir,

    DDR is not supported by the AM335X MMC interface, and 48MHz is the maximum clock frequency.

  • Hi Biser,

    Thanks for reply. Sorry, it is my mistake, you are right DDR is related with UHS and not supported in am335x. Also, ourcard supports only HS.

    However, after boot linux mmc-core sets the clock freq 50 MHz for our sdxc hs card placed into mmc.2 port. It is same also in TI gen. purpose am335x evm. Here is the debugfs output of mmc after boot:

    cat /sys/kernel/debug/mmc0/ios

    clock:           50000000 Hz

    vdd:             20 (3.2 ~ 3.3 V)

    bus mode:        2 (push-pull)

    chip select:     0 (dont care)

    power mode :     2 (on)

    bus width:       2 (4 bits)

    timing spec:     2 (sd high-speed)

    After suspend, it cannot switch to same speed. That's our problem.

    Thanks

  • Hi Kadir,

    I haven't encountered such problem, but I have some thoughts that may help in debugging the issue.

    Is it possible to dump the values of: SD_CON, SD_PWCNT, SD_CMD, SD_HCTL, SD_SYSCTL register and Pad Cotrol registers related to MMC2 (not the settings of MuxMode, but pull type field, slwerate ...) before & after suspend, to see if any change in the settings is invoked?

    Best Regards,

    Yordan

  • Hi Yordan,

    I have dumped the hsmmc registers and control registers for mmc2 before suspending the module and before resuming in mmc_sd_suspend(struct mmc_host *host) and mmc_sd_resume(struct mmc_host *host) functions in drivers/mmc/core/sd.c Here are the values:

    Before suspending mmc module:

    SYSCONFIG: 00002015
    SYSSTATUS: 00000001
    CON: 00000700
    CON: 00000000
    BLK: 00000000
    CMD: 0D020001
    HCTL: 00000D06
    SYSCTL: 000E0087
    CAPA: 06E10080
    REV: 31010000
    ARG: B3680000
    RSP10: 00000900
    RSP32: DC8D7F80
    RSP54: 5B590001
    RSP76: 400E0032
    DATA: 00000000
    STAT: 00000000
    IE: 00000000
    ISE: 00000000
    PSTATE: 01FF0000

    // Control registers (4 bit data)

    CMD: 00000033
    CLK: 00000033
    DAT0: 00000033
    DAT1: 00000033
    DAT2: 00000033
    DAT3: 00000033

    // after suspend, resuming the mmc module

    SYSCONFIG: 00002015
    SYSSTATUS: 00000001
    CON: 00000700
    CON: 00000000
    BLK: 00000000
    CMD: 00000000
    HCTL: 00000D00
    SYSCTL: 000E3C07
    CAPA: 06E10080
    REV: 31010000
    ARG: 00000000
    RSP10: 00000000
    RSP32: 00000000
    RSP54: 00000000
    RSP76: 00000000
    DATA: 00000000
    STAT: 20008000
    IE: 307F00F3
    ISE: 00000000
    PSTATE: 01FF0000

    CMD: 00000033
    CLK: 00000033
    DAT0: 00000033
    DAT1: 00000033
    DAT2: 00000033
    DAT3: 00000033

    After invoking resume callback of mmc module, sdcard cannot be switched to High-speed mode by sending CMD6 command in mmc_sd_init_card() function and kernel waits forever.

    Thanks

  • Hi,

    I see that some of the bits are set to their default values after suspend.

    What is the behaviour if you hardcode the values of SYSCTL = 000E0087  &  especially bits HCTL[2:1] = 11 ?

    Also, have you, by any chance, changed your am335x defconfig? It is important to preserve the CONFIG_MMC_UNSAFE_RESUME=y setting so that your sd card is not treated as NOT removed.

    Best Regards,

    Yordan