Re: [PATCH] mmc: mxs: fix card detection function for broken card detect
From: Ulf Hansson
Date: Mon May 05 2014 - 05:14:53 EST
On 28 April 2014 11:36, Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote:
> On Mon, Apr 28, 2014 at 11:31:03AM +0200, Ulf Hansson wrote:
>> On 28 April 2014 11:13, Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote:
>> > On Sat, Apr 19, 2014 at 11:59:18PM +0200, Daniel Willmann wrote:
>> >> Return -ENOSYS in get_cd if broken-cd is specified in the device tree.
>> >>
>> >> Commit a91fe279ae75 (mmc: mxs: use standard flag for broken card
>> >> detection) sets MMC_CAP_NEEDS_POLL when broken-cd is specified. This
>> >> driver sets this flag unconditionally as it does not support a card
>> >> detect interrupt. Instead, broken-cd means that there is no card detect
>> >> signal connected.
>> >>
>> >> The mmc core checks the get_cd function return value to determine if a
>> >> card is present. Only for a non-zero return value it will attempt to
>> >> initialize the card. So retuning -ENOSYS will allow the card to be
>> >> initialized.
>> >> For comparison, mmc_gpio_get_cd in slot-gpio.c also returns -ENOSYS if
>> >> the card detect GPIO is not valid.
>> >
>> > Short answer for fixing this regression:
>> >
>> > Acked-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
>> >
>> > Long answer:
>> >
>> > This is broken in the MMC OF parser. When the parser finds the
>> > 'broken-cd' property it just sets the MMC_CAP_NEEDS_POLL flag. This is
>> > wrong. broken-cd means that we cannot rely on any card detection, but
>> > instead have to talk to the card to find out if it's available.
>> > Currently there is no flag to signal this situation, so the host driver
>> > has to handle this by returning true in the get_cd callback, just like
>> > the patch below does.
>> >
>> > IMO the correct solution would be to add a MMC_CAP_CD_NEEDS_TALK_TO_CARD
>> > flag to the core.
>> >
>>
>> So if I understand correct, you want the host-ops->get_cd function to
>> be invoked from the mmc rescan - only when it actually can provide
>> useful information?
>
> Yes.
Until/if that happens, I suggest to go ahead with Daniel's patch as well.
Acked-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
>
> Sascha
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
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/