From patchwork Mon Oct 11 09:43:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 245121 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 o9B9i0GX002147 for ; Mon, 11 Oct 2010 09:44:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751304Ab0JKJoA (ORCPT ); Mon, 11 Oct 2010 05:44:00 -0400 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]:20198 "EHLO mgw-sa02.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752494Ab0JKJn7 (ORCPT ); Mon, 11 Oct 2010 05:43:59 -0400 Received: from nokia.com (localhost [127.0.0.1]) by mgw-sa02.nokia.com (Switch-3.4.3/Switch-3.4.3) with ESMTP id o9B9httN026334; Mon, 11 Oct 2010 12:43:55 +0300 Received: from ahunter-work.research.nokia.com ([esdhcp035202.research.nokia.com [172.21.35.202]]) by mgw-sa02.nokia.com with RELAY id o9B9hnvf026215 ; Mon, 11 Oct 2010 12:43:51 +0300 From: Adrian Hunter To: Chris Ball Cc: linux-mmc Mailing List , Adrian Hunter Date: Mon, 11 Oct 2010 12:43:50 +0300 Message-Id: <20101011094350.27911.9006.sendpatchset@ahunter-work.research.nokia.com> In-Reply-To: <20101011094342.27911.94016.sendpatchset@ahunter-work.research.nokia.com> References: <20101011094342.27911.94016.sendpatchset@ahunter-work.research.nokia.com> Subject: [PATCH 1/1] mmc: refine DDR support X-Nokia-AV: Clean 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]); Mon, 11 Oct 2010 09:44:00 +0000 (UTC) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index c94565d..ce5f4a5 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -653,10 +653,11 @@ void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode) /* * Change data bus width and DDR mode of a host. */ -void mmc_set_bus_width_ddr(struct mmc_host *host, unsigned int width, int ddr) +void mmc_set_bus_width_ddr(struct mmc_host *host, unsigned int width, + unsigned int ddr) { host->ios.bus_width = width; - host->ios.ddr = ddr ? MMC_DDR_MODE : MMC_SDR_MODE; + host->ios.ddr = ddr; mmc_set_ios(host); } @@ -665,7 +666,7 @@ void mmc_set_bus_width_ddr(struct mmc_host *host, unsigned int width, int ddr) */ void mmc_set_bus_width(struct mmc_host *host, unsigned int width) { - mmc_set_bus_width_ddr(host, width, 0); + mmc_set_bus_width_ddr(host, width, MMC_SDR_MODE); } /** diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 90e0ac7..77240cd 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -35,7 +35,8 @@ void mmc_set_chip_select(struct mmc_host *host, int mode); void mmc_set_clock(struct mmc_host *host, unsigned int hz); void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode); void mmc_set_bus_width(struct mmc_host *host, unsigned int width); -void mmc_set_bus_width_ddr(struct mmc_host *host, unsigned int width, int ddr); +void mmc_set_bus_width_ddr(struct mmc_host *host, unsigned int width, + unsigned int ddr); u32 mmc_select_voltage(struct mmc_host *host, u32 ocr); void mmc_set_timing(struct mmc_host *host, unsigned int timing); diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 31a8bbe..995261f 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -375,7 +375,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, struct mmc_card *oldcard) { struct mmc_card *card; - int err, ddr = 0; + int err, ddr = MMC_SDR_MODE; u32 cid[4]; unsigned int max_dtr; @@ -523,10 +523,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, if (mmc_card_highspeed(card)) { if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_8V) && (host->caps & (MMC_CAP_1_8V_DDR))) - ddr = 1; + ddr = MMC_1_8V_DDR_MODE; else if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_2V) && (host->caps & (MMC_CAP_1_2V_DDR))) - ddr = 1; + ddr = MMC_1_2V_DDR_MODE; } /* diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index c3ffad8..6d87f68 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -54,7 +54,8 @@ struct mmc_ios { unsigned char ddr; /* dual data rate used */ #define MMC_SDR_MODE 0 -#define MMC_DDR_MODE 1 +#define MMC_1_2V_DDR_MODE 1 +#define MMC_1_8V_DDR_MODE 2 }; struct mmc_host_ops {