From patchwork Fri Apr 5 11:10:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasanna NAVARATNA X-Patchwork-Id: 2402391 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 95D413FE81 for ; Sat, 6 Apr 2013 19:08:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765812Ab3DFTI4 (ORCPT ); Sat, 6 Apr 2013 15:08:56 -0400 Received: from plane.gmane.org ([80.91.229.3]:51458 "EHLO plane.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1765499Ab3DFTIt (ORCPT ); Sat, 6 Apr 2013 15:08:49 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UOYQQ-0004aF-6i for linux-mmc@vger.kernel.org; Sat, 06 Apr 2013 21:05:18 +0200 Received: from 202.122.18.226 ([202.122.18.226]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 06 Apr 2013 21:05:18 +0200 Received: from prasanna.navaratna by 202.122.18.226 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 06 Apr 2013 21:05:18 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: linux-mmc@vger.kernel.org From: Prasanna NAVARATNA Subject: [PATCH] mmc: core: proper ocr negotiation during resume Date: Fri, 5 Apr 2013 11:10:17 +0000 (UTC) Lines: 99 Message-ID: Mime-Version: 1.0 X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 202.122.18.226 (Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31) Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From ad70dbd00db355d1e8ca08e7ad12e73cb41df960 Mon Sep 17 00:00:00 2001 From: Prasanna NAVARATNA Date: Thu, 4 Apr 2013 19:55:19 +0530 Subject: [PATCH] mmc: core: proper ocr negotiation during resume Save the card ocr into struct mmc_card when read from card during initialization of sd/mmc/sdio. Druing mmc_resume_host, supply saved card's ocr to mmc_select_voltage so as to negotiate voltage appropriately. --- drivers/mmc/core/core.c | 2 +- drivers/mmc/core/mmc.c | 3 +++ drivers/mmc/core/sd.c | 3 +++ drivers/mmc/core/sdio.c | 3 +++ include/linux/mmc/card.h | 1 + 5 files changed, 11 insertions(+), 1 deletions(-) specific */ diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index ad7decc..aad511a 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2680,7 +2680,7 @@ int mmc_resume_host(struct mmc_host *host) if (host->bus_ops && !host->bus_dead) { if (!mmc_card_keep_power(host)) { mmc_power_up(host); - mmc_select_voltage(host, host->ocr); + mmc_select_voltage(host, host->card->ocr); /* * Tell runtime PM core we just powered up the card, * since it still believes the card is powered off. diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index d584f7c..923eb53 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1566,6 +1566,9 @@ int mmc_attach_mmc(struct mmc_host *host) ocr &= ~0x7F; } + /* Save the card OCR */ + host->card->ocr = ocr; + host->ocr = mmc_select_voltage(host, ocr); /* diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 9e645e1..965504b 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -1185,6 +1185,9 @@ int mmc_attach_sd(struct mmc_host *host) ocr &= ~MMC_VDD_165_195; } + /* Save the card OCR */ + host->card->ocr = ocr; + host->ocr = mmc_select_voltage(host, ocr); /* diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index aa0719a..3f9e08d 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -1090,6 +1090,9 @@ int mmc_attach_sdio(struct mmc_host *host) ocr &= ~0x7F; } + /* Save the card OCR */ + host->card->ocr = ocr; + host->ocr = mmc_select_voltage(host, ocr); /* diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index f31725b..1bbec2f 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -273,6 +273,7 @@ struct mmc_card { u32 raw_cid[4]; /* raw card CID */ u32 raw_csd[4]; /* raw card CSD */ u32 raw_scr[2]; /* raw card SCR */ + u32 ocr; /* card OCR */ struct mmc_cid cid; /* card identification */ struct mmc_csd csd; /* card specific */ struct mmc_ext_csd ext_csd; /* mmc v4 extended card