diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2012-02-09 16:57:09 -0500 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-03-27 12:20:15 -0400 |
commit | c8be24c2afd3ed2445bbf8f542af35a9787fc0e8 (patch) | |
tree | e0e757bb3b6a45f55eef145484ca5707d9e45fa8 /include | |
parent | 2b1ac5c2caccbfd43bd616321cbbe21eb33c7879 (diff) |
mmc: tmio_mmc: support the generic MMC GPIO card hotplug helper
If the platform specifies the TMIO_MMC_HAS_COLD_CD flag, use the generic
MMC GPIO card hotplug helper.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mfd/tmio.h | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index 0dc98044d8b7..5a197de4aac9 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); |
@@ -98,18 +106,23 @@ struct tmio_mmc_data { | |||
98 | struct tmio_mmc_dma *dma; | 106 | struct tmio_mmc_dma *dma; |
99 | struct device *dev; | 107 | struct device *dev; |
100 | bool power; | 108 | bool power; |
109 | unsigned int cd_gpio; | ||
101 | void (*set_pwr)(struct platform_device *host, int state); | 110 | void (*set_pwr)(struct platform_device *host, int state); |
102 | void (*set_clk_div)(struct platform_device *host, int state); | 111 | void (*set_clk_div)(struct platform_device *host, int state); |
103 | int (*get_cd)(struct platform_device *host); | 112 | int (*get_cd)(struct platform_device *host); |
104 | int (*write16_hook)(struct tmio_mmc_host *host, int addr); | 113 | int (*write16_hook)(struct tmio_mmc_host *host, int addr); |
105 | }; | 114 | }; |
106 | 115 | ||
116 | /* | ||
117 | * This function is deprecated and will be removed soon. Please, convert your | ||
118 | * platform to use drivers/mmc/core/cd-gpio.c | ||
119 | */ | ||
120 | #include <linux/mmc/host.h> | ||
107 | static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata) | 121 | static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata) |
108 | { | 122 | { |
109 | if (pdata && !pdata->power) { | 123 | if (pdata) |
110 | pdata->power = true; | 124 | mmc_detect_change(dev_get_drvdata(pdata->dev), |
111 | pm_runtime_get(pdata->dev); | 125 | msecs_to_jiffies(100)); |
112 | } | ||
113 | } | 126 | } |
114 | 127 | ||
115 | /* | 128 | /* |