From 0a70ec0d75c1db05002ef64fd00a9a4339eab3b6 Mon Sep 17 00:00:00 2001 From: lhh Date: Thu, 27 Jan 2011 17:07:03 +0800 Subject: [PATCH] delay 2s for the same sdcard check --- drivers/mmc/host/rk29_sdmmc.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/host/rk29_sdmmc.c b/drivers/mmc/host/rk29_sdmmc.c index cf846eec5fc6..55c07dbd9b34 100755 --- a/drivers/mmc/host/rk29_sdmmc.c +++ b/drivers/mmc/host/rk29_sdmmc.c @@ -1150,7 +1150,7 @@ static irqreturn_t rk29_sdmmc_interrupt(int irq, void *dev_id) u32 status, pending; unsigned int pass_count = 0; bool present; - //bool present_old; + bool present_old; spin_lock(&host->lock); do { @@ -1161,16 +1161,17 @@ static irqreturn_t rk29_sdmmc_interrupt(int irq, void *dev_id) if(pending & SDMMC_INT_CD) { rk29_sdmmc_write(host->regs, SDMMC_RINTSTS, SDMMC_INT_CD); // clear sd detect int present = rk29_sdmmc_get_cd(host->mmc); - //present_old = test_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); - //if(present != present_old) { - if (present != 0) { - set_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); + present_old = test_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); + if (present != 0) { + set_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); + if(present == present_old) + mod_timer(&host->detect_timer, jiffies + msecs_to_jiffies(2000)); + else mod_timer(&host->detect_timer, jiffies + msecs_to_jiffies(200)); - } else { - clear_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); - mod_timer(&host->detect_timer, jiffies + msecs_to_jiffies(10)); - } - //} + } else { + clear_bit(RK29_SDMMC_CARD_PRESENT, &host->flags); + mod_timer(&host->detect_timer, jiffies + msecs_to_jiffies(10)); + } } if(pending & RK29_SDMMC_CMD_ERROR_FLAGS) { rk29_sdmmc_write(host->regs, SDMMC_RINTSTS,RK29_SDMMC_CMD_ERROR_FLAGS); // clear interrupt -- 2.34.1