@@ -64,6 +64,11 @@ static int of_mmc_spi_get_cd(struct device *dev)
return of_mmc_spi_read_gpio(dev, CD_GPIO);
}
+static int of_mmc_spi_get_cd_inv(struct device *dev)
+{
+ return ! of_mmc_spi_read_gpio(dev, CD_GPIO);
+}
+
static int of_mmc_spi_get_ro(struct device *dev)
{
return of_mmc_spi_read_gpio(dev, WP_GPIO);
@@ -140,17 +145,26 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
oms->alow_gpios[i] = true;
}
- if (gpio_is_valid(oms->gpios[CD_GPIO]))
- oms->pdata.get_cd = of_mmc_spi_get_cd;
+ if (gpio_is_valid(oms->gpios[CD_GPIO])) {
+ if (of_get_property(np, "cd-inverted", NULL))
+ oms->pdata.get_cd = of_mmc_spi_get_cd_inv;
+ else
+ oms->pdata.get_cd = of_mmc_spi_get_cd;
+ }
if (gpio_is_valid(oms->gpios[WP_GPIO]))
oms->pdata.get_ro = of_mmc_spi_get_ro;
- oms->detect_irq = irq_of_parse_and_map(np, 0);
- if (oms->detect_irq != 0) {
- oms->pdata.init = of_mmc_spi_init;
- oms->pdata.exit = of_mmc_spi_exit;
- } else {
+ if (of_get_property(np, "np-removable", NULL))
+ oms->pdata.caps |= MMC_CAP_NONREMOVABLE;
+ else if (of_get_property(np, "broken-cd", NULL))
oms->pdata.caps |= MMC_CAP_NEEDS_POLL;
+ else {
+ oms->detect_irq = irq_of_parse_and_map(np, 0);
+ if (oms->detect_irq != 0) {
+ oms->pdata.init = of_mmc_spi_init;
+ oms->pdata.exit = of_mmc_spi_exit;
+ } else
+ oms->pdata.caps |= MMC_CAP_NEEDS_POLL;
}
dev->platform_data = &oms->pdata;
--
1.7.10.4