Re: Recent and not-so problems with tifm_sd driver

From: Alex Dubov
Date: Mon Feb 12 2007 - 19:44:58 EST



--- Pierre Ossman <drzeus-mmc@xxxxxxxxx> wrote:

> Alex Dubov wrote:
> > I removed that line altogether (it does not really needed as mmc host will not be accessed
> > anymore). The problem is more elaborate. Here, the card fails, mmc_host_remove is called
> without
> > sleep beforehand, and "after remove" message is printed immediately after it. Only then,
> mmc_block
> > remembers to finish its business. If I leave the sleep in place, mmc_block's stuff will get
> > scheduled before the mmc_remove_host and everything will be all right.
> > You may also notice that host is already powered off ("Setting ... power 0" message) and still
> > mmc_block continues to make requests like nothing happened.
> >
>
> How did you do the "after remove" detection? Patch?
>
(Power message is printed by ios callback)
Here's my current (SVN) remove function:

static void tifm_sd_remove(struct tifm_dev *sock)
{
struct mmc_host *mmc = tifm_get_drvdata(sock);
struct tifm_sd *host = mmc_priv(mmc);
unsigned long flags;

tasklet_kill(&host->finish_tasklet);
spin_lock_irqsave(&sock->lock, flags);
host->flags |= EJECT;
writel(0, sock->addr + SOCK_MMCSD_INT_ENABLE);
mmiowb();

if (host->req) {
writel(TIFM_FIFO_INT_SETALL,
sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
writel(0, sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET);
host->req->cmd->error = MMC_ERR_TIMEOUT;
if (host->req->stop)
host->req->stop->error = MMC_ERR_TIMEOUT;
tasklet_schedule(&host->finish_tasklet);
}
spin_unlock_irqrestore(&sock->lock, flags);
// temporary hack
msleep(1000);
mmc_remove_host(mmc);
dev_dbg(&sock->dev, "after remove\n");

/* The meaning of the bit majority in this constant is unknown. */
writel(0xfff8 & readl(sock->addr + SOCK_CONTROL),
sock->addr + SOCK_CONTROL);

mmc_free_host(mmc);
}



____________________________________________________________________________________
Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.
http://farechase.yahoo.com/promo-generic-14795097
-
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/