ARM: OMAP: mmc-twl4030: add context loss counter support
authorDenis Karpov <ext-denis.2.karpov@nokia.com>
Tue, 22 Sep 2009 23:44:40 +0000 (16:44 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Sep 2009 14:39:34 +0000 (07:39 -0700)
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 <ext-denis.2.karpov@nokia.com>
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Acked-by: Matt Fleming <matt@console-pimps.org>
Cc: Ian Molton <ian@mnementh.co.uk>
Cc: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
Cc: Jarkko Lavinen <jarkko.lavinen@nokia.com>
Cc: Denis Karpov <ext-denis.2.karpov@nokia.com>
Cc: Pierre Ossman <pierre@ossman.eu>
Cc: Philip Langdale <philipl@overt.org>
Cc: "Madhusudhan" <madhu.cr@ti.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/arm/mach-omap2/mmc-twl4030.c
arch/arm/plat-omap/include/mach/mmc.h

index 3c04c2f1b23ff2faae92630600f7c20a4ed2b57b..30d028627c5bd5eea695a1cf3c53f2ec0b6d97c1 100644 (file)
@@ -198,6 +198,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)
 {
@@ -390,6 +402,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");
index 81d5b36534b340680ffc36fde156e9cafbb70e2d..2f7cf31f9cd6165c5a37beccfd6e2289fe5754b6 100644 (file)
@@ -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 {