#include <asm/arch/board.h>
#include <asm/io.h>
-#ifdef CONFIG_MMC_OMAP_HS
+#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
#define VMMC1_DEV_GRP 0x27
#define P1_DEV_GRP 0x20
#define MMC1_CD_IRQ 0
#define MMC2_CD_IRQ 1
-static irqreturn_t mmc_omap_cd_handler(int irq, void *dev_id)
+static int sdp_mmc_card_detect(int irq)
{
- int detect;
-
- detect = twl4030_get_gpio_datain(MMC1_CD_IRQ);
- omap_mmc_notify_card_detect(dev_id, 0, detect);
- return IRQ_HANDLED;
+ return twl4030_get_gpio_datain(irq - IH_TWL4030_GPIO_BASE);
}
/*
if (ret != 0)
goto err;
- ret = request_irq(TWL4030_GPIO_IRQ_NO(MMC1_CD_IRQ),
- mmc_omap_cd_handler, IRQF_DISABLED, "MMC1_CD_IRQ", dev);
- if (ret < 0)
- goto err;
-
return ret;
err:
dev_err(dev, "Failed to configure TWL4030 GPIO IRQ\n");
int ret = 0;
ret = twl4030_free_gpio(MMC1_CD_IRQ);
- free_irq(TWL4030_GPIO_IRQ_NO(MMC1_CD_IRQ), dev);
if (ret != 0)
dev_err(dev, "Failed to configure TWL4030 GPIO IRQ\n");
}
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34 |
MMC_VDD_165_195,
.name = "first slot",
+
+ .card_detect_irq = TWL4030_GPIO_IRQ_NO(MMC1_CD_IRQ),
+ .card_detect = sdp_mmc_card_detect,
},
};
/*
* ISR for handling card insertion and removal
*/
-void omap_mmc_notify_card_detect(struct device *dev, int slot, int detected)
+static irqreturn_t omap_mmc_cd_handler(int irq, void *dev_id)
{
- struct mmc_omap_host *host = dev_get_drvdata(dev);
- host->carddetect = detected;
+ struct mmc_omap_host *host = (struct mmc_omap_host *)dev_id;
+
+ host->carddetect = mmc_slot(host).card_detect(irq);
schedule_work(&host->mmc_carddetect_work);
+
+ return IRQ_HANDLED;
}
/*
goto irq_err;
}
+ /* Request IRQ for card detect */
+ if ((mmc_slot(host).card_detect_irq) && (mmc_slot(host).card_detect)) {
+ ret = request_irq(mmc_slot(host).card_detect_irq,
+ omap_mmc_cd_handler, IRQF_DISABLED, "MMC CD",
+ host);
+ if (ret) {
+ dev_dbg(mmc_dev(host->mmc),
+ "Unable to grab MMC CD IRQ");
+ free_irq(host->irq, host);
+ goto irq_err;
+ }
+ }
+
INIT_WORK(&host->mmc_carddetect_work, mmc_omap_detect);
if (pdata->init != NULL) {
if (pdata->init(&pdev->dev) != 0) {
+ free_irq(mmc_slot(host).card_detect_irq, host);
free_irq(host->irq, host);
goto irq_err;
}
if (host) {
host->pdata->cleanup(&pdev->dev);
free_irq(host->irq, host);
+ if (mmc_slot(host).card_detect_irq)
+ free_irq(mmc_slot(host).card_detect_irq, host);
flush_scheduled_work();
clk_disable(host->fclk);
const char *name;
u32 ocr_mask;
+
+ /* Card detection IRQs */
+ int card_detect_irq;
+ int (* card_detect)(int irq);
} slots[OMAP_MMC_MAX_SLOTS];
};
extern void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info);
/* called from board-specific card detection service routine */
-extern void omap_mmc_notify_card_detect(struct device *dev, int slot, int detected);
extern void omap_mmc_notify_cover_event(struct device *dev, int slot, int is_closed);
#endif