• Aaro Koskinen's avatar
    MMC: OMAP: fix broken MMC on OMAP15XX/OMAP5910/OMAP310 · 30d358d8
    Aaro Koskinen authored
    commit e8cde625 upstream.
    
    Since v2.6.22 or so there has been reports [1] about OMAP MMC being
    broken on OMAP15XX based hardware (OMAP5910 and OMAP310). The breakage
    seems to have been caused by commit 46a6730e ("mmc-omap: Fix
    omap to use MMC_POWER_ON") that changed clock enabling to be done
    on MMC_POWER_ON. This can happen multiple times in a row, and on 15XX
    the hardware doesn't seem to like it and the MMC just stops responding.
    Fix by memorizing the power mode and do the init only when necessary.
    
    Before the patch (on Palm TE):
    
    	mmc0: new SD card at address b368
    	mmcblk0: mmc0:b368 SDC   977 MiB
    	mmci-omap mmci-omap.0: command timeout (CMD18)
    	mmci-omap mmci-omap.0: command timeout (CMD13)
    	mmci-omap mmci-omap.0: command timeout (CMD13)
    	mmci-omap mmci-omap.0: command timeout (CMD12) [x 6]
    	mmci-omap mmci-omap.0: command timeout (CMD13) [x 6]
    	mmcblk0: error -110 requesting status
    	mmci-omap mmci-omap.0: command timeout (CMD8)
    	mmci-omap mmci-omap.0: command timeout (CMD18)
    	mmci-omap mmci-omap.0: command timeout (CMD13)
    	mmci-omap mmci-omap.0: command timeout (CMD13)
    	mmci-omap mmci-omap.0: command timeout (CMD12) [x 6]
    	mmci-omap mmci-omap.0: command timeout (CMD13) [x 6]
    	mmcblk0: error -110 requesting status
    	mmcblk0: recovery failed!
    	print_req_error: I/O error, dev mmcblk0, sector 0
    	Buffer I/O error on dev mmcblk0, logical block 0, async page read
    	 mmcblk0: unable to read partition table
    
    After the patch:
    
    	mmc0: new SD card at address b368
    	mmcblk0: mmc0:b368 SDC   977 MiB
    	 mmcblk0: p1
    
    The patch is based on a fix and analysis done by Ladislav Michl.
    
    Tested on OMAP15XX/OMAP310 (Palm TE), OMAP1710 (Nokia 770)
    and OMAP2420 (Nokia N810).
    
    [1] https://marc.info/?t=123175197000003&r=1&w=2
    
    Fixes: 46a6730e ("mmc-omap: Fix omap to use MMC_POWER_ON")
    Reported-by: default avatarLadislav Michl <ladis@linux-mips.org>
    Reported-by: default avatarAndrzej Zaborowski <balrogg@gmail.com>
    Tested-by: default avatarLadislav Michl <ladis@linux-mips.org>
    Acked-by: default avatarTony Lindgren <tony@atomide.com>
    Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    30d358d8
omap.c 36.7 KB