int sdio_irq_en;
int wp_gpio;
bool wp_inverted;
- bool cd_inverted;
};
static int mxs_mmc_get_ro(struct mmc_host *mmc)
{
struct mxs_mmc_host *host = mmc_priv(mmc);
struct mxs_ssp *ssp = &host->ssp;
+ int present;
- return !(readl(ssp->base + HW_SSP_STATUS(ssp)) &
- BM_SSP_STATUS_CARD_DETECT) ^ host->cd_inverted;
+ present = !(readl(ssp->base + HW_SSP_STATUS(ssp)) &
+ BM_SSP_STATUS_CARD_DETECT);
+
+ if (mmc->caps2 & MMC_CAP2_CD_ACTIVE_HIGH)
+ present = !present;
+
+ return present;
}
static int mxs_mmc_reset(struct mxs_mmc_host *host)
if (flags & OF_GPIO_ACTIVE_LOW)
host->wp_inverted = 1;
- host->cd_inverted = of_property_read_bool(np, "cd-inverted");
+ if (of_property_read_bool(np, "cd-inverted"))
+ mmc->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH;
mmc->f_min = 400000;
mmc->f_max = 288000000;