diff options
Diffstat (limited to 'include/linux/mfd')
| -rw-r--r-- | include/linux/mfd/tmio.h | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index 0dc98044d8b7..f5171dbf8850 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | #ifndef MFD_TMIO_H | 1 | #ifndef MFD_TMIO_H |
| 2 | #define MFD_TMIO_H | 2 | #define MFD_TMIO_H |
| 3 | 3 | ||
| 4 | #include <linux/device.h> | ||
| 4 | #include <linux/fb.h> | 5 | #include <linux/fb.h> |
| 5 | #include <linux/io.h> | 6 | #include <linux/io.h> |
| 7 | #include <linux/jiffies.h> | ||
| 6 | #include <linux/platform_device.h> | 8 | #include <linux/platform_device.h> |
| 7 | #include <linux/pm_runtime.h> | 9 | #include <linux/pm_runtime.h> |
| 8 | 10 | ||
| @@ -64,8 +66,8 @@ | |||
| 64 | #define TMIO_MMC_SDIO_IRQ (1 << 2) | 66 | #define TMIO_MMC_SDIO_IRQ (1 << 2) |
| 65 | /* | 67 | /* |
| 66 | * Some platforms can detect card insertion events with controller powered | 68 | * Some platforms can detect card insertion events with controller powered |
| 67 | * down, in which case they have to call tmio_mmc_cd_wakeup() to power up the | 69 | * down, using a GPIO IRQ, in which case they have to fill in cd_irq, cd_gpio, |
| 68 | * controller and report the event to the driver. | 70 | * and cd_flags fields of struct tmio_mmc_data. |
| 69 | */ | 71 | */ |
| 70 | #define TMIO_MMC_HAS_COLD_CD (1 << 3) | 72 | #define TMIO_MMC_HAS_COLD_CD (1 << 3) |
| 71 | /* | 73 | /* |
| @@ -73,6 +75,12 @@ | |||
| 73 | * idle before writing to some registers. | 75 | * idle before writing to some registers. |
| 74 | */ | 76 | */ |
| 75 | #define TMIO_MMC_HAS_IDLE_WAIT (1 << 4) | 77 | #define TMIO_MMC_HAS_IDLE_WAIT (1 << 4) |
| 78 | /* | ||
| 79 | * A GPIO is used for card hotplug detection. We need an extra flag for this, | ||
| 80 | * because 0 is a valid GPIO number too, and requiring users to specify | ||
| 81 | * cd_gpio < 0 to disable GPIO hotplug would break backwards compatibility. | ||
| 82 | */ | ||
| 83 | #define TMIO_MMC_USE_GPIO_CD (1 << 5) | ||
| 76 | 84 | ||
| 77 | int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); | 85 | int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); |
| 78 | int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); | 86 | int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); |
| @@ -97,19 +105,23 @@ struct tmio_mmc_data { | |||
| 97 | u32 ocr_mask; /* available voltages */ | 105 | u32 ocr_mask; /* available voltages */ |
| 98 | struct tmio_mmc_dma *dma; | 106 | struct tmio_mmc_dma *dma; |
| 99 | struct device *dev; | 107 | struct device *dev; |
| 100 | bool power; | 108 | unsigned int cd_gpio; |
| 101 | void (*set_pwr)(struct platform_device *host, int state); | 109 | void (*set_pwr)(struct platform_device *host, int state); |
| 102 | void (*set_clk_div)(struct platform_device *host, int state); | 110 | void (*set_clk_div)(struct platform_device *host, int state); |
| 103 | int (*get_cd)(struct platform_device *host); | 111 | int (*get_cd)(struct platform_device *host); |
| 104 | int (*write16_hook)(struct tmio_mmc_host *host, int addr); | 112 | int (*write16_hook)(struct tmio_mmc_host *host, int addr); |
| 105 | }; | 113 | }; |
| 106 | 114 | ||
| 115 | /* | ||
| 116 | * This function is deprecated and will be removed soon. Please, convert your | ||
| 117 | * platform to use drivers/mmc/core/cd-gpio.c | ||
| 118 | */ | ||
| 119 | #include <linux/mmc/host.h> | ||
| 107 | static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata) | 120 | static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata) |
| 108 | { | 121 | { |
| 109 | if (pdata && !pdata->power) { | 122 | if (pdata) |
| 110 | pdata->power = true; | 123 | mmc_detect_change(dev_get_drvdata(pdata->dev), |
| 111 | pm_runtime_get(pdata->dev); | 124 | msecs_to_jiffies(100)); |
| 112 | } | ||
| 113 | } | 125 | } |
| 114 | 126 | ||
| 115 | /* | 127 | /* |
