#define HSMMC_WAKE_IRQ_ENABLED (1 << 2)
struct omap_hsmmc_next next_data;
struct omap_hsmmc_platform_data *pdata;
+
+ /* To handle board related suspend/resume functionality for MMC */
+ int (*suspend)(struct device *dev, int slot);
+ int (*resume)(struct device *dev, int slot);
+
+ /* return MMC cover switch state, can be NULL if not supported.
+ *
+ * possible return values:
+ * 0 - closed
+ * 1 - open
+ */
+ int (*get_cover_state)(struct device *dev, int slot);
+
+ /* Card detection IRQs */
+ int card_detect_irq;
+
+ int (*card_detect)(struct device *dev, int slot);
+ int (*get_ro)(struct device *dev, int slot);
+
};
struct omap_mmc_of_data {
static int omap_hsmmc_suspend_cdirq(struct device *dev, int slot)
{
struct omap_hsmmc_host *host = dev_get_drvdata(dev);
- struct omap_hsmmc_platform_data *mmc = host->pdata;
- disable_irq(mmc->card_detect_irq);
+ disable_irq(host->card_detect_irq);
return 0;
}
static int omap_hsmmc_resume_cdirq(struct device *dev, int slot)
{
struct omap_hsmmc_host *host = dev_get_drvdata(dev);
- struct omap_hsmmc_platform_data *mmc = host->pdata;
- enable_irq(mmc->card_detect_irq);
+ enable_irq(host->card_detect_irq);
return 0;
}
if (gpio_is_valid(pdata->switch_pin)) {
if (pdata->cover)
- pdata->get_cover_state =
- omap_hsmmc_get_cover_state;
+ host->get_cover_state =
+ omap_hsmmc_get_cover_state;
else
- pdata->card_detect = omap_hsmmc_card_detect;
- pdata->card_detect_irq =
+ host->card_detect = omap_hsmmc_card_detect;
+ host->card_detect_irq =
gpio_to_irq(pdata->switch_pin);
ret = gpio_request(pdata->switch_pin, "mmc_cd");
if (ret)
}
if (gpio_is_valid(pdata->gpio_wp)) {
- pdata->get_ro = omap_hsmmc_get_wp;
+ host->get_ro = omap_hsmmc_get_wp;
ret = gpio_request(pdata->gpio_wp, "mmc_wp");
if (ret)
goto err_free_cd;
{
int r = 1;
- if (mmc_pdata(host)->get_cover_state)
- r = mmc_pdata(host)->get_cover_state(host->dev, host->slot_id);
+ if (host->get_cover_state)
+ r = host->get_cover_state(host->dev, host->slot_id);
return r;
}
/* Protect the card while the cover is open */
static void omap_hsmmc_protect_card(struct omap_hsmmc_host *host)
{
- if (!mmc_pdata(host)->get_cover_state)
+ if (!host->get_cover_state)
return;
host->reqs_blocked = 0;
- if (mmc_pdata(host)->get_cover_state(host->dev, host->slot_id)) {
+ if (host->get_cover_state(host->dev, host->slot_id)) {
if (host->protect_card) {
dev_info(host->dev, "%s: cover is closed, "
"card is now accessible\n",
static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id)
{
struct omap_hsmmc_host *host = dev_id;
- struct omap_hsmmc_platform_data *pdata = host->pdata;
int carddetect;
sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch");
- if (pdata->card_detect)
- carddetect = pdata->card_detect(host->dev, host->slot_id);
+ if (host->card_detect)
+ carddetect = host->card_detect(host->dev, host->slot_id);
else {
omap_hsmmc_protect_card(host);
carddetect = -ENOSYS;
{
struct omap_hsmmc_host *host = mmc_priv(mmc);
- if (!mmc_pdata(host)->card_detect)
+ if (!host->card_detect)
return -ENOSYS;
- return mmc_pdata(host)->card_detect(host->dev, host->slot_id);
+ return host->card_detect(host->dev, host->slot_id);
}
static int omap_hsmmc_get_ro(struct mmc_host *mmc)
{
struct omap_hsmmc_host *host = mmc_priv(mmc);
- if (!mmc_pdata(host)->get_ro)
+ if (!host->get_ro)
return -ENOSYS;
- return mmc_pdata(host)->get_ro(host->dev, 0);
+ return host->get_ro(host->dev, 0);
}
static void omap_hsmmc_init_card(struct mmc_host *mmc, struct mmc_card *card)
mmc->ocr_avail = mmc_pdata(host)->ocr_mask;
/* Request IRQ for card detect */
- if ((mmc_pdata(host)->card_detect_irq)) {
+ if (host->card_detect_irq) {
ret = devm_request_threaded_irq(&pdev->dev,
- mmc_pdata(host)->card_detect_irq,
+ host->card_detect_irq,
NULL, omap_hsmmc_detect,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
mmc_hostname(mmc), host);
"Unable to grab MMC CD IRQ\n");
goto err_irq_cd;
}
- pdata->suspend = omap_hsmmc_suspend_cdirq;
- pdata->resume = omap_hsmmc_resume_cdirq;
+ host->suspend = omap_hsmmc_suspend_cdirq;
+ host->resume = omap_hsmmc_resume_cdirq;
}
omap_hsmmc_disable_irq(host);
if (ret < 0)
goto err_slot_name;
}
- if (mmc_pdata(host)->card_detect_irq &&
- mmc_pdata(host)->get_cover_state) {
+ if (host->card_detect_irq && host->get_cover_state) {
ret = device_create_file(&mmc->class_dev,
&dev_attr_cover_switch);
if (ret < 0)
{
struct omap_hsmmc_host *host = dev_get_drvdata(dev);
- if (host->pdata->suspend)
- return host->pdata->suspend(dev, host->slot_id);
+ if (host->suspend)
+ return host->suspend(dev, host->slot_id);
return 0;
}
{
struct omap_hsmmc_host *host = dev_get_drvdata(dev);
- if (host->pdata->resume)
- host->pdata->resume(dev, host->slot_id);
+ if (host->resume)
+ host->resume(dev, host->slot_id);
}
* maximum frequency on the MMC bus */
unsigned int max_freq;
- /* To handle board related suspend/resume functionality for MMC */
- int (*suspend)(struct device *dev, int slot);
- int (*resume)(struct device *dev, int slot);
-
/* Integrating attributes from the omap_hwmod layer */
u8 controller_flags;
int (*set_power)(struct device *dev, int slot,
int power_on, int vdd);
- int (*get_ro)(struct device *dev, int slot);
void (*remux)(struct device *dev, int slot, int power_on);
/* Call back before enabling / disabling regulators */
void (*before_set_reg)(struct device *dev, int slot,
/* if we have special card, init it using this callback */
void (*init_card)(struct mmc_card *card);
- /* return MMC cover switch state, can be NULL if not supported.
- *
- * possible return values:
- * 0 - closed
- * 1 - open
- */
- int (*get_cover_state)(struct device *dev, int slot);
-
const char *name;
u32 ocr_mask;
-
- /* Card detection IRQs */
- int card_detect_irq;
-
- int (*card_detect)(struct device *dev, int slot);
};