diff options
Diffstat (limited to 'drivers/mmc/host/mmci.c')
-rw-r--r-- | drivers/mmc/host/mmci.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index f0fcce40cd8d..50ff19a62368 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -1216,12 +1216,7 @@ static void mmci_dt_populate_generic_pdata(struct device_node *np, | |||
1216 | int bus_width = 0; | 1216 | int bus_width = 0; |
1217 | 1217 | ||
1218 | pdata->gpio_wp = of_get_named_gpio(np, "wp-gpios", 0); | 1218 | pdata->gpio_wp = of_get_named_gpio(np, "wp-gpios", 0); |
1219 | if (!pdata->gpio_wp) | ||
1220 | pdata->gpio_wp = -1; | ||
1221 | |||
1222 | pdata->gpio_cd = of_get_named_gpio(np, "cd-gpios", 0); | 1219 | pdata->gpio_cd = of_get_named_gpio(np, "cd-gpios", 0); |
1223 | if (!pdata->gpio_cd) | ||
1224 | pdata->gpio_cd = -1; | ||
1225 | 1220 | ||
1226 | if (of_get_property(np, "cd-inverted", NULL)) | 1221 | if (of_get_property(np, "cd-inverted", NULL)) |
1227 | pdata->cd_invert = true; | 1222 | pdata->cd_invert = true; |
@@ -1276,6 +1271,12 @@ static int __devinit mmci_probe(struct amba_device *dev, | |||
1276 | return -EINVAL; | 1271 | return -EINVAL; |
1277 | } | 1272 | } |
1278 | 1273 | ||
1274 | if (!plat) { | ||
1275 | plat = devm_kzalloc(&dev->dev, sizeof(*plat), GFP_KERNEL); | ||
1276 | if (!plat) | ||
1277 | return -ENOMEM; | ||
1278 | } | ||
1279 | |||
1279 | if (np) | 1280 | if (np) |
1280 | mmci_dt_populate_generic_pdata(np, plat); | 1281 | mmci_dt_populate_generic_pdata(np, plat); |
1281 | 1282 | ||
@@ -1424,6 +1425,10 @@ static int __devinit mmci_probe(struct amba_device *dev, | |||
1424 | writel(0, host->base + MMCIMASK1); | 1425 | writel(0, host->base + MMCIMASK1); |
1425 | writel(0xfff, host->base + MMCICLEAR); | 1426 | writel(0xfff, host->base + MMCICLEAR); |
1426 | 1427 | ||
1428 | if (plat->gpio_cd == -EPROBE_DEFER) { | ||
1429 | ret = -EPROBE_DEFER; | ||
1430 | goto err_gpio_cd; | ||
1431 | } | ||
1427 | if (gpio_is_valid(plat->gpio_cd)) { | 1432 | if (gpio_is_valid(plat->gpio_cd)) { |
1428 | ret = gpio_request(plat->gpio_cd, DRIVER_NAME " (cd)"); | 1433 | ret = gpio_request(plat->gpio_cd, DRIVER_NAME " (cd)"); |
1429 | if (ret == 0) | 1434 | if (ret == 0) |
@@ -1447,6 +1452,10 @@ static int __devinit mmci_probe(struct amba_device *dev, | |||
1447 | if (ret >= 0) | 1452 | if (ret >= 0) |
1448 | host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd); | 1453 | host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd); |
1449 | } | 1454 | } |
1455 | if (plat->gpio_wp == -EPROBE_DEFER) { | ||
1456 | ret = -EPROBE_DEFER; | ||
1457 | goto err_gpio_wp; | ||
1458 | } | ||
1450 | if (gpio_is_valid(plat->gpio_wp)) { | 1459 | if (gpio_is_valid(plat->gpio_wp)) { |
1451 | ret = gpio_request(plat->gpio_wp, DRIVER_NAME " (wp)"); | 1460 | ret = gpio_request(plat->gpio_wp, DRIVER_NAME " (wp)"); |
1452 | if (ret == 0) | 1461 | if (ret == 0) |