LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* mmc card detection
@ 2008-03-06 13:39 shri
  2008-03-14 22:54 ` Pierre Ossman
  0 siblings, 1 reply; 5+ messages in thread
From: shri @ 2008-03-06 13:39 UTC (permalink / raw)
  To: linux-kernel

Hi,
   My proto board does not have a mmc card detect line to the mmc controller.

   So, I have to insert the card before i insmod the mmc drivers.
   If i change a card i have to rmmod and insmod the driver.

   I would like to know is there anyway i can make mmc to free up all the
   resources for the removed card. entries and reinitialise the new
card inserted if any
   without rmmod or insmod.

   I thought of using mmc_remove_host and mmc_add_host in the driver
which could be triggered by
   an application through sysfs entry.


   Are the calls mmc_remove_host and mmc_add_host the correct call to
use in this case?


Regards,
shri

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mmc card detection
  2008-03-06 13:39 mmc card detection shri
@ 2008-03-14 22:54 ` Pierre Ossman
  0 siblings, 0 replies; 5+ messages in thread
From: Pierre Ossman @ 2008-03-14 22:54 UTC (permalink / raw)
  To: shri; +Cc: linux-kernel

Please always add the relevant maintainer as cc if you want to be sure
that you get a response.

On Thu, 6 Mar 2008 19:09:57 +0530
shri <shree0007@gmail.com> wrote:

> Hi,
>    My proto board does not have a mmc card detect line to the mmc controller.
> 
>    So, I have to insert the card before i insmod the mmc drivers.
>    If i change a card i have to rmmod and insmod the driver.
> 
>    I would like to know is there anyway i can make mmc to free up all the
>    resources for the removed card. entries and reinitialise the new
> card inserted if any
>    without rmmod or insmod.
> 

Let the driver call mmc_detect_change() on a timer. See mmci.c for an
example.

Rgds
-- 
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  PulseAudio, core developer          http://pulseaudio.org
  rdesktop, core developer          http://www.rdesktop.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: MMC card detection
  2008-02-21 18:46 MMC " Haavard Skinnemoen
  2008-02-21 20:31 ` Haavard Skinnemoen
@ 2008-02-25 17:24 ` Pierre Ossman
  1 sibling, 0 replies; 5+ messages in thread
From: Pierre Ossman @ 2008-02-25 17:24 UTC (permalink / raw)
  To: Haavard Skinnemoen; +Cc: linux-kernel, kernel

[-- Attachment #1: Type: text/plain, Size: 825 bytes --]

On Thu, 21 Feb 2008 19:46:20 +0100
Haavard Skinnemoen <hskinnemoen@atmel.com> wrote:

> 
> When the card is reinserted, the MMC core will try to send a
> SEND_STATUS command again. This time, the card won't respond because it
> is in the "idle" state, and the MMC core will think the card is gone.
> 
> In order to fix this problem, I think I need a way to tell the MMC core
> that the card really is gone and that there's no point trying to
> communicate with it. Is there any way I can do that?
> 

As you found out, you can. But the MMC core doesn't treat it
differently.

What is really needed is that the core should make an extra pass and
see if the card has been replaced by something else (and not just check
if it is gone). It's on my todo, but I haven't had time to implement it.

Rgds
Pierre

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: MMC card detection
  2008-02-21 18:46 MMC " Haavard Skinnemoen
@ 2008-02-21 20:31 ` Haavard Skinnemoen
  2008-02-25 17:24 ` Pierre Ossman
  1 sibling, 0 replies; 5+ messages in thread
From: Haavard Skinnemoen @ 2008-02-21 20:31 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: linux-kernel, kernel

On Thu, 21 Feb 2008 19:46:20 +0100
Haavard Skinnemoen <hskinnemoen@atmel.com> wrote:

> In order to fix this problem, I think I need a way to tell the MMC core
> that the card really is gone and that there's no point trying to
> communicate with it. Is there any way I can do that?

Never mind, I figured it out. I can simply fail the command right away
with -ENOMEDIUM if I know the card isn't present. Seems to work like a
charm.

Haavard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* MMC card detection
@ 2008-02-21 18:46 Haavard Skinnemoen
  2008-02-21 20:31 ` Haavard Skinnemoen
  2008-02-25 17:24 ` Pierre Ossman
  0 siblings, 2 replies; 5+ messages in thread
From: Haavard Skinnemoen @ 2008-02-21 18:46 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: linux-kernel, kernel

Hi Pierre,

I've been trying to debug some card detection problems in the atmel-mci
driver. Sometimes, when I remove a card, the event doesn't seem to get
detected properly, and the MMC core thinks the card is still there.
When I re-insert the card, the MMC core thinks the card is gone.

I've tried to add a debouncing timer to avoid glitches on the card
detect pin. This helps a bit, but it does not eliminate the problem
altogether.

It seems like the problem only occurs if the card is removed very
slowly. If I increase the debouncing or detection delay, I have to
remove the card more slowly to trigger the problem.

I think the real problem is that the card detection interrupt triggers
while there is still electrical contact with the card. So when the MMC
core tries to send a SEND_STATUS command to check if it's still there,
the card will respond even though it's about to be removed. Since there
will be no more interrupts as the card is completely removed, the MMC
core will never notice that the card is gone.

When the card is reinserted, the MMC core will try to send a
SEND_STATUS command again. This time, the card won't respond because it
is in the "idle" state, and the MMC core will think the card is gone.

In order to fix this problem, I think I need a way to tell the MMC core
that the card really is gone and that there's no point trying to
communicate with it. Is there any way I can do that?

Haavard

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-14 22:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-06 13:39 mmc card detection shri
2008-03-14 22:54 ` Pierre Ossman
  -- strict thread matches above, loose matches on Subject: below --
2008-02-21 18:46 MMC " Haavard Skinnemoen
2008-02-21 20:31 ` Haavard Skinnemoen
2008-02-25 17:24 ` Pierre Ossman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).