aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/tifm_sd.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/drivers/mmc/tifm_sd.c b/drivers/mmc/tifm_sd.c
index 4388ee9062a0..fe236cb95e5c 100644
--- a/drivers/mmc/tifm_sd.c
+++ b/drivers/mmc/tifm_sd.c
@@ -665,32 +665,13 @@ static void tifm_sd_end_cmd_nodma(unsigned long data)
665 mmc_request_done(mmc, mrq); 665 mmc_request_done(mmc, mrq);
666} 666}
667 667
668static void tifm_sd_terminate(struct tifm_sd *host)
669{
670 struct tifm_dev *sock = host->dev;
671 unsigned long flags;
672
673 writel(0, sock->addr + SOCK_MMCSD_INT_ENABLE);
674 mmiowb();
675 spin_lock_irqsave(&sock->lock, flags);
676 host->flags |= EJECT;
677 if (host->req) {
678 writel(TIFM_FIFO_INT_SETALL,
679 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
680 writel(0, sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET);
681 tasklet_schedule(&host->finish_tasklet);
682 }
683 spin_unlock_irqrestore(&sock->lock, flags);
684}
685
686static void tifm_sd_abort(unsigned long data) 668static void tifm_sd_abort(unsigned long data)
687{ 669{
688 struct tifm_sd *host = (struct tifm_sd*)data; 670 struct tifm_sd *host = (struct tifm_sd*)data;
689 671
690 printk(KERN_ERR DRIVER_NAME 672 printk(KERN_ERR DRIVER_NAME
691 ": card failed to respond for a long period of time"); 673 ": card failed to respond for a long period of time\n");
692 674
693 tifm_sd_terminate(host);
694 tifm_eject(host->dev); 675 tifm_eject(host->dev);
695} 676}
696 677
@@ -913,9 +894,20 @@ static void tifm_sd_remove(struct tifm_dev *sock)
913{ 894{
914 struct mmc_host *mmc = tifm_get_drvdata(sock); 895 struct mmc_host *mmc = tifm_get_drvdata(sock);
915 struct tifm_sd *host = mmc_priv(mmc); 896 struct tifm_sd *host = mmc_priv(mmc);
897 unsigned long flags;
916 898
917 del_timer_sync(&host->timer); 899 del_timer_sync(&host->timer);
918 tifm_sd_terminate(host); 900 writel(0, sock->addr + SOCK_MMCSD_INT_ENABLE);
901 mmiowb();
902 spin_lock_irqsave(&sock->lock, flags);
903 host->flags |= EJECT;
904 if (host->req) {
905 writel(TIFM_FIFO_INT_SETALL,
906 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
907 writel(0, sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET);
908 tasklet_schedule(&host->finish_tasklet);
909 }
910 spin_unlock_irqrestore(&sock->lock, flags);
919 wait_event_timeout(host->notify, host->flags & EJECT_DONE, 911 wait_event_timeout(host->notify, host->flags & EJECT_DONE,
920 host->timeout_jiffies); 912 host->timeout_jiffies);
921 tasklet_kill(&host->finish_tasklet); 913 tasklet_kill(&host->finish_tasklet);