• Vincent Whitchurch's avatar
    mmc: debugfs: Allow host caps to be modified · ff369d7b
    Vincent Whitchurch authored
    During board verification, there is a need to test the various supported
    eMMC/SD speed modes.  However, since the framework chooses the best mode
    supported by the card and the host controller's caps, this currently
    necessitates changing the devicetree for every iteration.
    
    Allow the various speed mode host capabilities to be modified via
    debugfs in order to allow easier hardware verification.  The values to
    be written are the raw MMC_CAP* values from include/linux/mmc/host.h.
    This is rather low-level, and these defines are not guaranteed to be
    stable, but it is perhaps good enough for the intended use case.
    
    MMC_CAP_AGGRESSIVE_PM can also be set, in order to be able to
    re-initialize the card without having to physically remove and re-insert
    it.
    
     /sys/kernel/debug/mmc0# grep timing ios
     timing spec:	9 (mmc HS200)
    
     // Turn on MMC_CAP_AGGRESSIVE_PM and re-trigger runtime suspend
     /sys/kernel/debug/mmc0# echo $(($(cat caps) | (1 << 7))) > caps
     /sys/kernel/debug/mmc0# echo on > /sys/bus/mmc/devices/mmc0\:0001/power/control
     /sys/kernel/debug/mmc0# echo auto > /sys/bus/mmc/devices/mmc0\:0001/power/control
    
     // MMC_CAP2_HS200_1_8V_SDR
     /sys/kernel/debug/mmc0# echo $(($(cat caps2) & ~(1 << 5))) > caps2
     /sys/kernel/debug/mmc0# echo on > /sys/bus/mmc/devices/mmc0\:0001/power/control
     /sys/kernel/debug/mmc0# grep timing ios
     timing spec:	8 (mmc DDR52)
    Signed-off-by: default avatarVincent Whitchurch <vincent.whitchurch@axis.com>
    Link: https://lore.kernel.org/r/20230929-mmc-caps-v2-2-11a4c2d94f15@axis.comSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
    ff369d7b
debugfs.c 8.79 KB