Merge branch 'develop' of 10.10.10.29:/home/rockchip/kernel into develop
authorlhh <lhh@rock-chips.com>
Thu, 27 Jan 2011 09:07:17 +0000 (17:07 +0800)
committerlhh <lhh@rock-chips.com>
Thu, 27 Jan 2011 09:07:17 +0000 (17:07 +0800)
drivers/mmc/host/rk29_sdmmc.c

index cf846eec5fc65349a279e7f3f361beac199bd8bd..55c07dbd9b34679c4ba7c192a22bc9122f16990f 100755 (executable)
@@ -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