[PATCH 0/2] Add hw reset support for DesignWare MMC controller.
From: Shawn Lin
Date: Thu Oct 22 2015 - 02:21:38 EST
MMC core stack and blk layer can do some recovery if mmc
device runs into broken state for any reasons. So we implement it
for DesignWare MMC host controller.
>From Synopsys DesignWare Cores Mobile Storage Host Databook
(Section 7.4.4), we get the details:
1. Program CMD12 to end any transfer in process.
2. Wait for DTO, even if no response is sent back by the card.
3. Set the following resets:
Software reset â BMOD[0] for IDMAC only
DMA resetâ CTRL[2]
FIFO reset â CTRL[1] bits
4. Program the CARD_RESET register with a value of 0 for the bit
corresponding to the card number; This can be done at any time when
the card is connected to the controller. This programming asserts the
RST_n signal and resets the card.
5. Wait for minimum of 1 Îs or cclk_in period, which ever is greater
6. After a minimum of 1 Îs, the application should program a value of
0 into the CARD_RESET register for the bit corresponding to the card
number. This de-asserts the RST_n signal and takes the card out of reset.
7. The application can program a new CMD only after a minimum of 200 us
after the de-assertion of the RST_n signal, as per the MMC 4.41 standard.
HW reset producer will be call in mmc_init_card before mmc_go_idle. At that
timeïdw mmc hasn't update clk for itself, so CMD12 is inappropriate and
unnecessary. Moreover, if mmc device runs into broken states, DRTO or RTO
generated by previous cmd w/ data will make mmc core issue stop already. Then
it will retry again and again, issue stop and card status again until the
cmd's retry number decrease to zero. That will finally trigger HW reset producer
if we declare MMC_CAP_HW_RESET. So there's no need to do step 1 and 2 for the
reasons we mentioned above.
This implementation can be easily tested by cutting off->On vmmc while doing data
accessing in background to simulate that case. And dw_mmc can generate timeout
interrupt and make mmc core trigger hw reset producer before re-init mmc card
to recover itself.
This patchset do following things:
- add hw reset for dw_mmc
- implement specific hw_reset extention
Shawn Lin (2):
mmc: dw_mmc: add hw_reset support
mmc: dw_mmc: add hw_reset extension hook
drivers/mmc/host/dw_mmc.c | 33 +++++++++++++++++++++++++++++++++
drivers/mmc/host/dw_mmc.h | 6 ++++++
2 files changed, 39 insertions(+)
--
2.3.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/