linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Huang Changming-R66093 <r66093@freescale.com>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH 2/4] MMC/SD: Add callback function to detect card
Date: Tue, 13 Dec 2011 12:26:36 +0200	[thread overview]
Message-ID: <4EE7285C.3070503@intel.com> (raw)
In-Reply-To: <8A2FC72B45BB5A4C9F801431E06AE48F11644F37@039-SN1MPN1-006.039d.mgd.msft.net>

On 13/12/11 11:55, Huang Changming-R66093 wrote:
> 
> 
>> -----Original Message-----
>> From: Adrian Hunter [mailto:adrian.hunter@intel.com]
>> Sent: Tuesday, December 13, 2011 4:54 PM
>> To: Huang Changming-R66093
>> Cc: linux-mmc@vger.kernel.org
>> Subject: Re: [PATCH 2/4] MMC/SD: Add callback function to detect card
>>
>> On 13/12/11 10:26, Huang Changming-R66093 wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Adrian Hunter [mailto:adrian.hunter@intel.com]
>>>> Sent: Tuesday, December 13, 2011 4:01 PM
>>>> To: Huang Changming-R66093
>>>> Cc: linux-mmc@vger.kernel.org
>>>> Subject: Re: [PATCH 2/4] MMC/SD: Add callback function to detect card
>>>>
>>>> On 13/12/11 09:25, Huang Changming-R66093 wrote:
>>>>>
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: linux-mmc-owner@vger.kernel.org [mailto:linux-mmc-
>>>>>> owner@vger.kernel.org] On Behalf Of Adrian Hunter
>>>>>> Sent: Friday, December 09, 2011 6:03 PM
>>>>>> To: Huang Changming-R66093
>>>>>> Cc: linux-mmc@vger.kernel.org; Huang Changming-R66093
>>>>>> Subject: Re: [PATCH 2/4] MMC/SD: Add callback function to detect
>>>>>> card
>>>>>>
>>>>>> On 05/12/11 11:23, r66093@freescale.com wrote:
>>>>>>> From: Jerry Huang <Chang-Ming.Huang@freescale.com>
>>>>>>>
>>>>>>> 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?
>>> No.
>>> The SDHCI_CARD_CDPL[bit13] reflect the pin level:
>>> CDPL: Card detect pin level. This bit reflects the inverse value of the
>> SDHC_CD pin for the card socket.
>>> 0 No card present (SDHC_CD = 1)
>>> 1 Card present (SDHC_CD = 0)
>>>
>>> So, this bit has the same effect as SDHCI_CARD_PRESENT[bit15], the
>> difference is that debouncing is not performed on this bit.
>>>
>>> Freescale's controller supports the card detection, if card is present,
>> none-zero will be returned, otherwise, zero will be returned.
>>>
>>> You can see my other patch [3/4], I add one callback to detect the card
>> state in special platform: if the controller supports card detection,
>> this callback will be performed in special platform (e.g. sdhci-of-
>> esdhc.c) and return the card state (present or absent), if controller
>> doesn't support card detection, this callback will be not performed and
>> return -ENOSYS.
>>
>> OK, but the point is, the request can be stopped in sdhci_request().
>> Can you just add your callback there?
> Why can the request be stopped? Just because of card absent or SDHCI_DEVICE_DEAD?

Yes, both


  reply	other threads:[~2011-12-13 10:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-05  9:23 [PATCH 1/4] SDHCI: add sdhci_get_cd callback to detect the card r66093
2011-12-05  9:23 ` [PATCH 2/4] MMC/SD: Add callback function to detect card r66093
2011-12-05  9:23   ` [PATCH 3/4] MMC/core: Make sure the power is up, when detect the card r66093
2011-12-05  9:23     ` [PATCH 4/4] MMC/core: Add f_min to mmc_power_on() r66093
2011-12-05 15:48     ` [PATCH 3/4] MMC/core: Make sure the power is up, when detect the card Ulf Hansson
2011-12-06  5:40       ` Huang Changming-R66093
2011-12-07  9:04     ` Linus Walleij
2011-12-09  3:16       ` Huang Changming-R66093
2011-12-09 10:03   ` [PATCH 2/4] MMC/SD: Add callback function to detect card Adrian Hunter
2011-12-13  7:25     ` Huang Changming-R66093
2011-12-13  8:01       ` Adrian Hunter
2011-12-13  8:26         ` Huang Changming-R66093
2011-12-13  8:54           ` Adrian Hunter
2011-12-13  9:55             ` Huang Changming-R66093
2011-12-13 10:26               ` Adrian Hunter [this message]
2011-12-14  2:21                 ` Huang Changming-R66093
2011-12-05 11:25 ` [PATCH 1/4] SDHCI: add sdhci_get_cd callback to detect the card Dong, Chuanxiao
2011-12-06  5:43   ` Huang Changming-R66093
2011-12-05 18:48 ` Philip Rakity
2011-12-06  5:35   ` Huang Changming-R66093
2011-12-13 18:06   ` Chris Ball
2011-12-14  2:31     ` Huang Changming-R66093

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EE7285C.3070503@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=r66093@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).