mmc: core: Issue with voltage switch sequence

When a broken UHS-I card is inserted, the voltage switch sequence
fails as expected but the controller is left in bad state due to
which software request timeouts are observed for further commands.
Add mmc_power_cycle() for any failure in voltage switch so it will
also help reset the controller in addition to card.

CRs-fixed: 608192
Change-Id: I332c0717b9310692799b9a4ba6570df67fcf3b6e
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
mmc: core: Exit clock scaling prior to removing the card

After removing the SD/MMC 'card' from the driver model we
are cancelling the pending clock scaling work which accesses
card->dev. This could cause NULL pointer issue as the card
is already removed.

CRs-Fixed: 640344
Change-Id: I8c5ee817e3f116dedf0bf4fb51eb6b70d52467b7
Signed-off-by: Pratibhasagar V <pratibha@codeaurora.org>
mmc: core: abort rescan if suspend is triggered

There could be a race between suspend and mmc_rescan as follows:
At resume:
-> mmc_pm_notify
  -> mmc_rescan is scheduled

Suspend is triggered:
-> mmc_pm_notify
   -> wait for mmc_rescan/cancel it
      -> rescan acquires wakelock if card is detected
         so as to give user-space a chance to respond
-> PM framework cancels suspend since wakelock is active

Hence, release the wake-lock if its active in suspend prepare
and check for rescan_disable before acquiring wake-lock.
This prefers suspend over notifying the user-space of the status
of the card, which is fine since with suspend user-space is frozen
too.

CRs-fixed: 655281
Change-Id: I83783589f9b541d3af73931e9a7b0b144a25538e
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>

Conflicts:
	drivers/mmc/core/sd.c