X-Git-Url: http://plrg.eecs.uci.edu/git/?p=firefly-linux-kernel-4.4.55.git;a=blobdiff_plain;f=drivers%2Fmmc%2Fhost%2Fdw_mmc.c;h=1ed0bc865cfc5c4d8132b7f8d338e73a5c9e6520;hp=7a6cedbe48a837e7fd5800c9fe1da131d569df51;hb=aa3a72a8f8be78184d46eec4abe6c22e02140590;hpb=b44a3d2a85c64208a57362a1728efb58a6556cd6 diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 7a6cedbe48a8..1ed0bc865cfc 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -44,11 +44,11 @@ /* Common flag combinations */ #define DW_MCI_DATA_ERROR_FLAGS (SDMMC_INT_DRTO | SDMMC_INT_DCRC | \ SDMMC_INT_HTO | SDMMC_INT_SBE | \ - SDMMC_INT_EBE) + SDMMC_INT_EBE | SDMMC_INT_HLE) #define DW_MCI_CMD_ERROR_FLAGS (SDMMC_INT_RTO | SDMMC_INT_RCRC | \ - SDMMC_INT_RESP_ERR) + SDMMC_INT_RESP_ERR | SDMMC_INT_HLE) #define DW_MCI_ERROR_FLAGS (DW_MCI_DATA_ERROR_FLAGS | \ - DW_MCI_CMD_ERROR_FLAGS | SDMMC_INT_HLE) + DW_MCI_CMD_ERROR_FLAGS) #define DW_MCI_SEND_STATUS 1 #define DW_MCI_RECV_STATUS 2 #define DW_MCI_DMA_THRESHOLD 16 @@ -1446,6 +1446,28 @@ static int dw_mci_get_ro(struct mmc_host *mmc) return read_only; } +static int dw_mci_set_sdio_status(struct mmc_host *mmc, int val) +{ + struct dw_mci_slot *slot = mmc_priv(mmc); + struct dw_mci *host = slot->host; + + if (!(mmc->restrict_caps & RESTRICT_CARD_TYPE_SDIO)) + return 0; + + spin_lock_bh(&host->lock); + + if (val) + set_bit(DW_MMC_CARD_PRESENT, &slot->flags); + else + clear_bit(DW_MMC_CARD_PRESENT, &slot->flags); + + spin_unlock_bh(&host->lock); + + mmc_detect_change(slot->mmc, 20); + + return 0; +} + static int dw_mci_get_cd(struct mmc_host *mmc) { int present; @@ -1561,6 +1583,7 @@ static const struct mmc_host_ops dw_mci_ops = { .pre_req = dw_mci_pre_req, .post_req = dw_mci_post_req, .set_ios = dw_mci_set_ios, + .set_sdio_status = dw_mci_set_sdio_status, .get_ro = dw_mci_get_ro, .get_cd = dw_mci_get_cd, .enable_sdio_irq = dw_mci_enable_sdio_irq,