• Doug Anderson's avatar
    mmc: dw_mmc: Remove old card detect infrastructure · 6130e7a9
    Doug Anderson authored
    The dw_mmc driver had a bunch of code that ran whenever a card was
    ejected and inserted.  However, this code was old and crufty and
    should be removed.  Some evidence that it's really not needed:
    
    1. Is is supposed to be legal to use 'cd-gpio' on dw_mmc instead of
       using the built-in card detect mechanism.  The 'cd-gpio' code
       doesn't run any of the crufty old code but yet still works.
    
    2. While looking at this, I realized that my old change (369ac861 mmc:
       dw_mmc: don't queue up a card detect at slot startup) actually
       castrated the old code a little bit already and nobody noticed.
       Specifically "last_detect_state" was left as 0 at bootup.  That
       means that on the first card removal none of the crufty code ran.
    
    3. I can run "while true; do dd if=/dev/mmcblk1 of=/dev/null; done"
       while ejecting and inserting an SD Card and the world doesn't
       explode.
    
    If some of the crufty old code is actually needed, we should justify
    it and also put it in some place where it will be run even with
    "cd-gpio".
    
    Note that in my case I'm using the "cd-gpio" mechanism but for various
    reasons the hardware triggers a dw_mmc "card detect" at bootup.  That
    was actually causing a real bug.  The card detect workqueue was
    running while the system was trying to enumerate the card.  The
    "present != slot->last_detect_state" triggered and we were doing all
    kinds of crazy stuff and messing up enumeration.  The new mechanism of
    just asking the core to check the card is much safer and then the
    bogus interrupt doesn't hurt.
    Signed-off-by: default avatarDoug Anderson <dianders@chromium.org>
    Tested-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
    Acked-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
    Tested-by: default avataralim.akhtar <alim.akhtar@samsung.com>
    Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
    6130e7a9
dw_mmc.c 68.4 KB