]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - include/linux/mfd/tmio.h
mmc: tmio: runtime suspend the controller, where possible
[mv-sheeva.git] / include / linux / mfd / tmio.h
index 8e70310ee9453c6d5abdcd514345479055d8d684..5a90266c3a5a7061a0e3639082d106ffbe72ff01 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/fb.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 
 #define tmio_ioread8(addr) readb(addr)
 #define tmio_ioread16(addr) readw(addr)
  * Some controllers can support SDIO IRQ signalling.
  */
 #define TMIO_MMC_SDIO_IRQ              (1 << 2)
+/*
+ * Some platforms can detect card insertion events with controller powered
+ * down, in which case they have to call tmio_mmc_cd_wakeup() to power up the
+ * controller and report the event to the driver.
+ */
+#define TMIO_MMC_HAS_COLD_CD           (1 << 3)
 
 int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
 int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
@@ -82,11 +89,21 @@ struct tmio_mmc_data {
        unsigned long                   flags;
        u32                             ocr_mask;       /* available voltages */
        struct tmio_mmc_dma             *dma;
+       struct device                   *dev;
+       bool                            power;
        void (*set_pwr)(struct platform_device *host, int state);
        void (*set_clk_div)(struct platform_device *host, int state);
        int (*get_cd)(struct platform_device *host);
 };
 
+static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata)
+{
+       if (pdata && !pdata->power) {
+               pdata->power = true;
+               pm_runtime_get(pdata->dev);
+       }
+}
+
 /*
  * data for the NAND controller
  */