2010-11-05 17:32:03     HotPlug events

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

2010-11-05 17:32:03     HotPlug events

Dale Gifford (UNITED STATES)

Message: 95599   

 

I have a micro MMC card connector that has a card detect switch on it. The card detect pin is grounded when the MMC card is inserted and pulled high when the card is removed. The MMC_SPI driver works well with the card, and the simple GPIO driver provides the correct status of the card detect signal.

 

What would be the "best" way to have the changes on the GPIO pin either cause the MMC_SPI driver module to load or unload, ot if the MMC_SPI driver is already loaded, force it to re-scan the SPI bus and try to detect a newly inserted/removed card?

 

Thanks in advance.

 

Dale

QuoteReplyEditDelete

 

 

2010-11-08 06:10:49     Re: HotPlug events

Aaron Wu (CHINA)

Message: 95641   

 

If you have special request for the hotplug action, you may need to change the hotplug script as needed. for details of the hotplug pls refer to   linux-hotplug.sourceforge.net/.

 

An example script looks like:

 

#!/bin/sh

 

#

#

case $ACTION in

 

add)

        #echo $ACTION>/dev/tts/0

        DIR="/dev/ub"

        for I in "$DIR/"*;do

                #echo $I>/dev/tts/0

                if [ -d $I -a -e $I/part1 ];then

                        #echo "found&mount $I/part1">/dev/tts/0

                        mount -t vfat $I/part1 /mnt 2>/dev/tts/0

                else

                        #echo "$I/part1 not found">/dev/tts/0

                        sleep 1;

                        if [ -d $I -a -e $I/part1 ];then

                                #echo "found&mount $I/part1">/dev/tts/0

                                mount -t vfat $I/part1 /mnt 2>/dev/tts/0

                        fi

                fi

        done

    ;;

 

remove)

        #echo $ACTION>/dev/tts/0

        #echo "umount /mnt">/dev/tts/0

        umount /mnt 2>/dev/tts/0

    ;;

 

*)

    exit 1

    ;;

 

esac

QuoteReplyEditDelete

 

 

2010-11-08 19:28:40     Re: HotPlug events

Mike Frysinger (UNITED STATES)

Message: 95653   

 

we have a hotplug page in our wiki we should be pointing people to instead:

  docs.blackfin.uclinux.org/doku.php?id=linux-kernel:hotplug

QuoteReplyEditDelete

 

 

2010-11-08 19:32:37     Re: HotPlug events

Mike Frysinger (UNITED STATES)

Message: 95654   

 

changes in GPIO lines do not bubble up into userspace hotplug events.  if you wanted to manually manage the card detect line yourself, you'd probably want to use the gpio-keys driver on the GPIO and have a small userspace app watch for those events.  then you'd load/unload/whatever based on that.

 

however, the mmc spi driver already has support for card insertion detection.  is this not sufficient for your needs ?  please see the example in our wiki:

  docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:spi_mmc

QuoteReplyEditDelete

 

 

2010-11-09 15:51:54     Re: HotPlug events

Dale Gifford (UNITED STATES)

Message: 95710   

 

Thanks for the pointer to the documentation page. I had been using the Bluetechnix BF527 platform as a reference and they did not have support for the card insertion and removal detection. I implemented the necesary rotuines to support the card detect and it works great.

 

Thanks

Attachments

    Outcomes