From patchwork Fri May 20 07:35:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Changming-R66093 X-Patchwork-Id: 802692 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4K8NP2E027205 for ; Fri, 20 May 2011 08:23:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934699Ab1ETIXb (ORCPT ); Fri, 20 May 2011 04:23:31 -0400 Received: from va3ehsobe001.messaging.microsoft.com ([216.32.180.11]:44213 "EHLO VA3EHSOBE008.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934688Ab1ETIXb (ORCPT ); Fri, 20 May 2011 04:23:31 -0400 Received: from mail16-va3-R.bigfish.com (10.7.14.237) by VA3EHSOBE008.bigfish.com (10.7.40.28) with Microsoft SMTP Server id 14.1.225.22; Fri, 20 May 2011 08:23:30 +0000 Received: from mail16-va3 (localhost.localdomain [127.0.0.1]) by mail16-va3-R.bigfish.com (Postfix) with ESMTP id 900331280202 for ; Fri, 20 May 2011 08:23:30 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail16-va3 (localhost.localdomain [127.0.0.1]) by mail16-va3 (MessageSwitch) id 1305879809117105_1015; Fri, 20 May 2011 08:23:29 +0000 (UTC) Received: from VA3EHSMHS007.bigfish.com (unknown [10.7.14.247]) by mail16-va3.bigfish.com (Postfix) with ESMTP id 149431598052 for ; Fri, 20 May 2011 08:23:29 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS007.bigfish.com (10.7.99.17) with Microsoft SMTP Server (TLS) id 14.1.225.22; Fri, 20 May 2011 08:23:24 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server id 14.1.270.2; Fri, 20 May 2011 03:23:24 -0500 Received: from localhost (rock.ap.freescale.net [10.193.20.106]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p4K8NLrJ025788; Fri, 20 May 2011 03:23:22 -0500 (CDT) From: To: CC: Jerry Huang Subject: [PATCH 2/3] MMC/SD: add callback function to detect card Date: Fri, 20 May 2011 15:35:13 +0800 Message-ID: <1305876914-23714-2-git-send-email-r66093@freescale.com> X-Mailer: git-send-email 1.6.4 In-Reply-To: <1305876914-23714-1-git-send-email-r66093@freescale.com> References: <1305876914-23714-1-git-send-email-r66093@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 20 May 2011 08:23:32 +0000 (UTC) From: Jerry Huang Add callback function to check if the card has been removed. in order to check if the card has been removed, the function mmc_send_status will send commad CMD13 to card and ask the card to send its status register to sdhc driver, which will generate interrupt repeatly and make the performance of the system bad. Therefore, get_cd callback is used to detect the card if the driver has. Signed-off-by: Jerry Huang --- drivers/mmc/core/mmc.c | 5 ++++- drivers/mmc/core/sd.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 772d0d0..137d529 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -713,7 +713,10 @@ static void mmc_detect(struct mmc_host *host) /* * Just check if our card has been removed. */ - err = mmc_send_status(host->card, NULL); + if (host->ops->get_cd) + err = !host->ops->get_cd(host); + else + err = mmc_send_status(host->card, NULL); mmc_release_host(host); diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 6dac89f..b85df32 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -673,7 +673,10 @@ static void mmc_sd_detect(struct mmc_host *host) /* * Just check if our card has been removed. */ - err = mmc_send_status(host->card, NULL); + if (host->ops->get_cd) + err = !host->ops->get_cd(host); + else + err = mmc_send_status(host->card, NULL); mmc_release_host(host);