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>
This commit is contained in:

committed by
Chris Ball

parent
2b1ac5c2ca
commit
c8be24c2af
@@ -1,8 +1,10 @@
|
||||
#ifndef MFD_TMIO_H
|
||||
#define MFD_TMIO_H
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
|
||||
@@ -64,8 +66,8 @@
|
||||
#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.
|
||||
* down, using a GPIO IRQ, in which case they have to fill in cd_irq, cd_gpio,
|
||||
* and cd_flags fields of struct tmio_mmc_data.
|
||||
*/
|
||||
#define TMIO_MMC_HAS_COLD_CD (1 << 3)
|
||||
/*
|
||||
@@ -73,6 +75,12 @@
|
||||
* idle before writing to some registers.
|
||||
*/
|
||||
#define TMIO_MMC_HAS_IDLE_WAIT (1 << 4)
|
||||
/*
|
||||
* A GPIO is used for card hotplug detection. We need an extra flag for this,
|
||||
* because 0 is a valid GPIO number too, and requiring users to specify
|
||||
* cd_gpio < 0 to disable GPIO hotplug would break backwards compatibility.
|
||||
*/
|
||||
#define TMIO_MMC_USE_GPIO_CD (1 << 5)
|
||||
|
||||
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);
|
||||
@@ -98,18 +106,23 @@ struct tmio_mmc_data {
|
||||
struct tmio_mmc_dma *dma;
|
||||
struct device *dev;
|
||||
bool power;
|
||||
unsigned int cd_gpio;
|
||||
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);
|
||||
int (*write16_hook)(struct tmio_mmc_host *host, int addr);
|
||||
};
|
||||
|
||||
/*
|
||||
* This function is deprecated and will be removed soon. Please, convert your
|
||||
* platform to use drivers/mmc/core/cd-gpio.c
|
||||
*/
|
||||
#include <linux/mmc/host.h>
|
||||
static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata)
|
||||
{
|
||||
if (pdata && !pdata->power) {
|
||||
pdata->power = true;
|
||||
pm_runtime_get(pdata->dev);
|
||||
}
|
||||
if (pdata)
|
||||
mmc_detect_change(dev_get_drvdata(pdata->dev),
|
||||
msecs_to_jiffies(100));
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user