]> git.openfabrics.org - ~shefty/rdma-dev.git/commit
wlcore: Fix sdio out-of-sync power state
authorIdo Yariv <ido@wizery.com>
Sun, 20 May 2012 07:38:16 +0000 (10:38 +0300)
committerLuciano Coelho <coelho@ti.com>
Fri, 22 Jun 2012 07:46:33 +0000 (10:46 +0300)
commit645865fc377c9ac73df590abf8e6af65824390a3
tree57ed4f4716a2b1be2415a397f0692b7bb17b47c2
parent41844076c5c3a33636b5c26d19b16c6141c5d6cd
wlcore: Fix sdio out-of-sync power state

wl12xx_sdio_power_off() manually powers down the card regardless of the
runtime pm state. If wl12xx_sdio_power_on() is called before the card
was suspended by runtime PM, it will not power up the card.

As part of the HW detection, the chip's power is toggled. Since this
happens in the context of probing sdio, the power reference counter will
be higher than zero. As a result, when wl12xx_sdio_power_off() is
called, the chip will be powered down while still having a positive
power reference counter. If the interface is quickly activated, the
driver might try to transfer data to a powered off chip.

Fix this by ensuring that wl12xx_sdio_power_on() explicitly powers on
the chip in case runtime pm claims the chip is already powered on. To
avoid cases in which it is not possible to determine if the chip was
really powered on (card's power reference counter is positive), operate
on the mmc_card instead of the function.

Also verify that the chip is indeed powered on before powering off, to
avoid wrong reference counter values in error cases.

Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/ti/wlcore/io.h
drivers/net/wireless/ti/wlcore/sdio.c