2009-03-10 15:08:46     SD MMC card removal not detected

Document created by Aaronwu Employee on Aug 14, 2013
Version 1Show Document
  • View in full screen mode

2009-03-10 15:08:46     SD MMC card removal not detected

Tim Shearer (UNITED STATES)

Message: 70715   

 

More SD/MMC troubles

 

I'm using the driver in trunk.  The card detection (or rather, removal), is causing me grief. 

 

The platform data is configured as per the wiki, except I'm using PF7 as my card detect line.  The card is detected ok, and the hotplugging works fine.

 

However, the driver fails to recognise when the card is ejected.  In fact, I only get an "SPI card removed" message after I reinsert the card.

 

I appears to me that the card detect line isn't used by the driver to determine when the card is removed, since the IRQ in the board.c file is only configured for falling edge (i.e. insertion) triggers.

 

In sd.c, I can see a number of cases where the card is removed:

 

[snip]

       err = mmc_select_card(card);

        if (err)

            goto free_card;

[\snip]

 

[snip]

    if (!oldcard) {

        /*

         * Fetch SCR from card.

         */

        err = mmc_app_send_scr(card, card->raw_scr);

        if (err)

            goto free_card;

 

        err = mmc_decode_scr(card);

        if (err < 0)

            goto free_card;

 

        /*

         * Fetch switch information from card.

         */

        err = mmc_read_switch(card);

        if (err)

            goto free_card;

    }

[\snip]

    /*

     * Attempt to change to high-speed (if supported)

     */

[snip]

    err = mmc_switch_hs(card);

    if (err)

        goto free_card;

[\snip]

 

 

So, I'm hoping someone might be able to tell me how the driver is supposed to be configured to detect when the card is removed, in case I have some kind of hardware conflict.

 

Apologies for the bump.

 

Tim

 

QuoteReplyEditDelete

 

 

2009-03-11 01:59:44     Re: SD MMC card removal not detected

Sonic Zhang (CHINA)

Message: 70736   

 

Which blackfin developing board do you test? We run mmc SPI test on bf537-stamp. SD card removal can be detected properly.

 

 

QuoteReplyEditDelete

 

 

2009-03-11 04:57:38     Re: SD MMC card removal not detected

Yi Li (CHINA)

Message: 70755   

 

Tim,

 

To understand your issue, your card can be detected when the card is inserted into the slot, but your card cannot be detected when card is ejected?

 

Can you observe the card detect irq by look at: /proc/interrupts? Also, maybe you can also try to set the detection irq type as: IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING.

 

-Yi

QuoteReplyEditDelete

 

 

2009-03-11 09:01:22     Re: SD MMC card removal not detected

Tim Shearer (UNITED STATES)

Message: 70772   

 

Thanks for the response.

 

I actually got it working with that configuration last night, I had tried it before but with an detect delay of 500ms... and that had stopped it working reliably.  So setting it back to 100ms and changing the interrupt mask to IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING works ok for now.

 

Cheers,

 

Tim

Attachments

    Outcomes