mmc: tmio: Don't access hardware registers after stopping clocks
mmc: tmio: Don't access hardware registers after stopping clocks

The tmio_mmc_set_ios() function configures the MMC power, clock and bus
width. When the mmc core requests the driver to power off the card, we
inform runtime PM, that the controller can be suspended. This can lead
to the MSTP clock being turned off.

Writing to any 16-bit hardware registers with the MSTP clock off leads
to timeouts and errors being printed to the kernel log. This can occur
both when stopping the MMC clock and when configuring the bus width.

To fix this, stop the MMC clock before calling put_runtime_pm(), and
skip bus width configuration when power is off.

Signed-off-by: Laurent Pinchart <3ded2f39a78f0d7044839546f95841842b4d7c96@ideasonboard.com>
Tested-by: Kuninori Morimoto <a3b51ccb87d18302c1692defcfbf83319d1737eb@renesas.com>
Tested-by: Simon Horman <a105fd58f578dea0be108941d4c59d15396e1855@verge.net.au>
Acked-by: Guennadi Liakhovetski <50875182aae23d69ca7738697596f18a14e926fc@gmx.de>
Signed-off-by: Chris Ball <6ca7faee6ca9a094b1ee341f11b840a5608a8746@laptop.org>

TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs