From patchwork Fri Aug 1 06:08:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chuanxiao.Dong" X-Patchwork-Id: 4660661 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EDE349F36A for ; Fri, 1 Aug 2014 06:10:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 24F79201F4 for ; Fri, 1 Aug 2014 06:10:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0398E201ED for ; Fri, 1 Aug 2014 06:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751025AbaHAGKJ (ORCPT ); Fri, 1 Aug 2014 02:10:09 -0400 Received: from mga11.intel.com ([192.55.52.93]:33866 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750745AbaHAGKI (ORCPT ); Fri, 1 Aug 2014 02:10:08 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 31 Jul 2014 23:10:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,778,1400050800"; d="scan'208";a="570324935" Received: from cxdong-dev.bj.intel.com (HELO intel.com) ([172.16.118.193]) by fmsmga001.fm.intel.com with ESMTP; 31 Jul 2014 23:10:06 -0700 Date: Fri, 1 Aug 2014 14:08:16 +0800 From: Chuanxiao Dong To: linux-mmc@vger.kernel.org, chris@printf.org, ulf.hansson@linaro.org Cc: yunpeng.gao@intel.com Subject: [PATCH] mmc: core: use 1.8v signling in ddr mode for some special host Message-ID: <20140801060816.GA3172@intel.com> Reply-To: Chuanxiao Dong MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Even eMMC card can support 3.3v to 1.2v vccq in DDR, but not all host controller can support this, like some of the SDHCI host which connect to an eMMC device. Some of these host controller still needs to use 1.8v vccq for supporting DDR mode. If a host controller cannot support 3.3v for DDR, try 1.8v. Signed-off-by: Chuanxiao Dong Signed-off-by: Yunpeng Gao --- drivers/mmc/core/mmc.c | 19 +++++++++++++++++++ include/linux/mmc/host.h | 1 + 2 files changed, 20 insertions(+) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 793c6f7..13a5b24 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1000,6 +1000,25 @@ static int mmc_select_hs_ddr(struct mmc_card *card) return err; } + /* + * Even eMMC card can support 3.3v to 1.2v vccq, but not all + * host controller can support this, like some of the SDHCI + * controller which connect to an eMMC device. Some of these + * host controller still needs to use 1.8v vccq for supporting + * DDR mode. + * + * If a host controller cannot support 3.3v for DDR, try 1.8v + */ + if (unlikely(host->caps2 & MMC_CAP2_NO_3_3V_DDR)) { + if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200_1_8V) { + err = __mmc_set_signal_voltage(host, + MMC_SIGNAL_VOLTAGE_180); + if (err) + return err; + } else + return -EOPNOTSUPP; + } + mmc_set_timing(host, MMC_TIMING_MMC_DDR52); return err; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 7960424..e5d3ada 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -283,6 +283,7 @@ struct mmc_host { #define MMC_CAP2_HS400 (MMC_CAP2_HS400_1_8V | \ MMC_CAP2_HS400_1_2V) #define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17) +#define MMC_CAP2_NO_3_3V_DDR (1 << 18) /* doesn't support 3.3v vccq in ddr */ mmc_pm_flag_t pm_caps; /* supported pm features */