On 13/12/11 09:25, Huang Changming-R66093 wrote:
>
>
>> -----Original Message-----
>> From: [email protected] [mailto:linux-mmc-
>> [email protected]] On Behalf Of Adrian Hunter
>> Sent: Friday, December 09, 2011 6:03 PM
>> To: Huang Changming-R66093
>> Cc: [email protected]; Huang Changming-R66093
>> Subject: Re: [PATCH 2/4] MMC/SD: Add callback function to detect card
>>
>> On 05/12/11 11:23, [email protected] wrote:
>>> From: Jerry Huang <[email protected]>
>>>
>>> In order to check whether the card has been removed, the function
>>> mmc_send_status() will send command CMD13 to card and ask the card to
>>> send its status register to sdhc driver, which will generate many
>>> interrupts repeatedly and make the system performance bad.
>>
>> That should not be true. sdhci.c will not send a command to the card if
>> the card is not present i.e. see this excerpt from
>> sdhci_request():
>>
>>
>> /* If polling, assume that the card is always present. */
>> if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
>> present = true;
>> else
>> present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
>> SDHCI_CARD_PRESENT;
>>
>> if (!present || host->flags & SDHCI_DEVICE_DEAD) {
>> host->mrq->cmd->error = -ENOMEDIUM;
>> tasklet_schedule(&host->finish_tasklet);
>> --
> But, for some controller, this field of SDHCI_PRESENT_STATE register is
> reserved and always is 1. When the card is absent, many command will try to
> send to the card, and generate many interrupt.
> If even controller can detect the card state, if the card is absent as you
> said, this command can't send to card. But, when card is present, there will
> be many command to the card and many interrupts will be generated, that will
> affect the performance.
> So, I don't think this comment is not correct.
>
>
>
You patch uses (SDHCI_CARD_PRESENT | SDHCI_CARD_CDPL)
Does that mean SDHCI_CARD_CDPL does work in that case?
If so, you could add SDHCI_QUIRK2_BROKEN_CARD_PRESENT
e.g.
/* If polling, assume that the card is always present. */
if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
present = true;
else if (host->quirks2 & SDHCI_QUIRK2_BROKEN_CARD_PRESENT)
present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
SDHCI_CARD_CDPL;
else
present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
SDHCI_CARD_PRESENT;
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html