From patchwork Tue Jul 28 10:39:57 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 37742 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6SAo32q012560 for ; Tue, 28 Jul 2009 10:50:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753053AbZG1Kjn (ORCPT ); Tue, 28 Jul 2009 06:39:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753035AbZG1Kjm (ORCPT ); Tue, 28 Jul 2009 06:39:42 -0400 Received: from smtp.nokia.com ([192.100.105.134]:16481 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753026AbZG1Kjk (ORCPT ); Tue, 28 Jul 2009 06:39:40 -0400 Received: from esebh106.NOE.Nokia.com (esebh106.ntc.nokia.com [172.21.138.213]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n6SAcugT005992; Tue, 28 Jul 2009 05:39:22 -0500 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 28 Jul 2009 13:39:25 +0300 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 28 Jul 2009 13:39:25 +0300 Received: from [127.0.1.1] (esdhcp04057.research.nokia.com [172.21.40.57]) by mgw-sa02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n6SAdNbB004129; Tue, 28 Jul 2009 13:39:23 +0300 From: Adrian Hunter To: Andrew Morton Cc: Jarkko Lavinen , Adrian Hunter , linux-omap Mailing List , Pierre Ossman , Denis Karpov , Matt Fleming , lkml Date: Tue, 28 Jul 2009 13:39:57 +0300 Message-Id: <20090728103957.2371.82161.sendpatchset@ahunter-laptop> In-Reply-To: <20090728103834.2371.65809.sendpatchset@ahunter-laptop> References: <20090728103834.2371.65809.sendpatchset@ahunter-laptop> Subject: [PATCH V2 11/32] ARM: OMAP: mmc-twl4030: add context loss counter support X-OriginalArrivalTime: 28 Jul 2009 10:39:25.0327 (UTC) FILETIME=[AD1791F0:01CA0F6F] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From 53270a4f00a21cdf90bc6d93fa4cfc229096cc15 Mon Sep 17 00:00:00 2001 From: Denis Karpov Date: Tue, 7 Jul 2009 15:54:44 +0300 Subject: [PATCH] ARM: OMAP: mmc-twl4030: add context loss counter support PM dynamic OFF state results in context loss. That is, the host controller has been powered off at some point, which means the registers have been reset. The driver must detect when this happens, and restore the context. This patch adds the means to detect context loss. Note, the PM side is not yet implemented. Signed-off-by: Denis Karpov Signed-off-by: Adrian Hunter --- arch/arm/mach-omap2/mmc-twl4030.c | 15 +++++++++++++++ arch/arm/plat-omap/include/mach/mmc.h | 3 +++ 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/mmc-twl4030.c b/arch/arm/mach-omap2/mmc-twl4030.c index 1541fd4..5be3111 100644 --- a/arch/arm/mach-omap2/mmc-twl4030.c +++ b/arch/arm/mach-omap2/mmc-twl4030.c @@ -192,6 +192,18 @@ static int twl_mmc_resume(struct device *dev, int slot) #define twl_mmc_resume NULL #endif +#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) + +static int twl4030_mmc_get_context_loss(struct device *dev) +{ + /* FIXME: PM DPS not implemented yet */ + return 0; +} + +#else +#define twl4030_mmc_get_context_loss NULL +#endif + static int twl_mmc1_set_power(struct device *dev, int slot, int power_on, int vdd) { @@ -384,6 +396,9 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers) } else mmc->slots[0].switch_pin = -EINVAL; + mmc->get_context_loss_count = + twl4030_mmc_get_context_loss; + /* write protect normally uses an OMAP gpio */ if (gpio_is_valid(c->gpio_wp)) { gpio_request(c->gpio_wp, "mmc_wp"); diff --git a/arch/arm/plat-omap/include/mach/mmc.h b/arch/arm/plat-omap/include/mach/mmc.h index 81d5b36..2f7cf31 100644 --- a/arch/arm/plat-omap/include/mach/mmc.h +++ b/arch/arm/plat-omap/include/mach/mmc.h @@ -59,6 +59,9 @@ struct omap_mmc_platform_data { int (*suspend)(struct device *dev, int slot); int (*resume)(struct device *dev, int slot); + /* Return context loss count due to PM states changing */ + int (*get_context_loss_count)(struct device *dev); + u64 dma_mask; struct omap_mmc_slot_data {