From patchwork Wed Dec 1 12:49:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chuanxiao.Dong" X-Patchwork-Id: 371091 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 oB1Crsfx010706 for ; Wed, 1 Dec 2010 12:53:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755079Ab0LAMwy (ORCPT ); Wed, 1 Dec 2010 07:52:54 -0500 Received: from mga01.intel.com ([192.55.52.88]:52927 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755077Ab0LAMwx convert rfc822-to-8bit (ORCPT ); Wed, 1 Dec 2010 07:52:53 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 01 Dec 2010 04:52:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.59,283,1288594800"; d="scan'208,223";a="863095128" Received: from unknown (HELO intel.com) ([172.16.120.128]) by fmsmga001.fm.intel.com with ESMTP; 01 Dec 2010 04:52:40 -0800 Date: Wed, 1 Dec 2010 20:49:37 +0800 From: Chuanxiao Dong To: linux-mmc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, cjb@laptop.org, arjan@linux.intel.com, alan@linux.intel.com, akpm@linux-foundation.org Subject: [PATCH v4 3/4]implement hardware_reset callback for sdhci host Message-ID: <20101201124937.GD5421@intel.com> Reply-To: Chuanxiao Dong MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) 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.3 (demeter1.kernel.org [140.211.167.41]); Wed, 01 Dec 2010 12:53:56 +0000 (UTC) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 8a74fcb..d40b16c 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1283,11 +1283,34 @@ out: spin_unlock_irqrestore(&host->lock, flags); } +/* + * HW reset callback for eMMC4.4 card + * In this function, HC will do the real HW reset + * for eMMC4.4 card + * + * RETURN VALUE: + * 0: reset emmc successfully + * -ENODEV: no valid hardware to do so + */ +static int sdhci_hardware_reset(struct mmc_host *mmc) +{ + int err = 1; + struct sdhci_host *host; + + host = mmc_priv(mmc); + + if (host->ops && host->ops->reset_emmc) + err = host->ops->reset_emmc(host); + + return err; +} + static const struct mmc_host_ops sdhci_ops = { .request = sdhci_request, .set_ios = sdhci_set_ios, .get_ro = sdhci_get_ro, .enable_sdio_irq = sdhci_enable_sdio_irq, + .hardware_reset = sdhci_hardware_reset, }; /*****************************************************************************\ diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 1efe7dc..2a9b20c 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -221,6 +221,18 @@ struct sdhci_ops { void (*platform_send_init_74_clocks)(struct sdhci_host *host, u8 power_mode); unsigned int (*get_ro)(struct sdhci_host *host); + + /* + * eMMC card reset callback. + * This callback can be used by sdhci layer to support eMMC4.4 + * hardware reset feature. In this function, should trigger a + * RST_n signal to reset eMMC card. + * + * return value: + * 0: successfully reset eMMC card. + * -ENODEV: no valid hardware to reset eMMC card. + */ + int (*reset_emmc)(struct sdhci_host *host); }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS