diff options
Diffstat (limited to 'drivers/mmc/core/host.c')
-rw-r--r-- | drivers/mmc/core/host.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 03c53b72a2d6..270d58a4c43d 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c | |||
@@ -311,7 +311,8 @@ int mmc_of_parse(struct mmc_host *host) | |||
311 | struct device_node *np; | 311 | struct device_node *np; |
312 | u32 bus_width; | 312 | u32 bus_width; |
313 | int len, ret; | 313 | int len, ret; |
314 | bool cap_invert, gpio_invert; | 314 | bool cd_cap_invert, cd_gpio_invert = false; |
315 | bool ro_cap_invert, ro_gpio_invert = false; | ||
315 | 316 | ||
316 | if (!host->parent || !host->parent->of_node) | 317 | if (!host->parent || !host->parent->of_node) |
317 | return 0; | 318 | return 0; |
@@ -359,16 +360,13 @@ int mmc_of_parse(struct mmc_host *host) | |||
359 | if (of_find_property(np, "non-removable", &len)) { | 360 | if (of_find_property(np, "non-removable", &len)) { |
360 | host->caps |= MMC_CAP_NONREMOVABLE; | 361 | host->caps |= MMC_CAP_NONREMOVABLE; |
361 | } else { | 362 | } else { |
362 | if (of_property_read_bool(np, "cd-inverted")) | 363 | cd_cap_invert = of_property_read_bool(np, "cd-inverted"); |
363 | cap_invert = true; | ||
364 | else | ||
365 | cap_invert = false; | ||
366 | 364 | ||
367 | if (of_find_property(np, "broken-cd", &len)) | 365 | if (of_find_property(np, "broken-cd", &len)) |
368 | host->caps |= MMC_CAP_NEEDS_POLL; | 366 | host->caps |= MMC_CAP_NEEDS_POLL; |
369 | 367 | ||
370 | ret = mmc_gpiod_request_cd(host, "cd", 0, true, | 368 | ret = mmc_gpiod_request_cd(host, "cd", 0, true, |
371 | 0, &gpio_invert); | 369 | 0, &cd_gpio_invert); |
372 | if (ret) { | 370 | if (ret) { |
373 | if (ret == -EPROBE_DEFER) | 371 | if (ret == -EPROBE_DEFER) |
374 | return ret; | 372 | return ret; |
@@ -391,17 +389,14 @@ int mmc_of_parse(struct mmc_host *host) | |||
391 | * both inverted, the end result is that the CD line is | 389 | * both inverted, the end result is that the CD line is |
392 | * not inverted. | 390 | * not inverted. |
393 | */ | 391 | */ |
394 | if (cap_invert ^ gpio_invert) | 392 | if (cd_cap_invert ^ cd_gpio_invert) |
395 | host->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; | 393 | host->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; |
396 | } | 394 | } |
397 | 395 | ||
398 | /* Parse Write Protection */ | 396 | /* Parse Write Protection */ |
399 | if (of_property_read_bool(np, "wp-inverted")) | 397 | ro_cap_invert = of_property_read_bool(np, "wp-inverted"); |
400 | cap_invert = true; | ||
401 | else | ||
402 | cap_invert = false; | ||
403 | 398 | ||
404 | ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &gpio_invert); | 399 | ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &ro_gpio_invert); |
405 | if (ret) { | 400 | if (ret) { |
406 | if (ret == -EPROBE_DEFER) | 401 | if (ret == -EPROBE_DEFER) |
407 | goto out; | 402 | goto out; |
@@ -414,7 +409,7 @@ int mmc_of_parse(struct mmc_host *host) | |||
414 | dev_info(host->parent, "Got WP GPIO\n"); | 409 | dev_info(host->parent, "Got WP GPIO\n"); |
415 | 410 | ||
416 | /* See the comment on CD inversion above */ | 411 | /* See the comment on CD inversion above */ |
417 | if (cap_invert ^ gpio_invert) | 412 | if (ro_cap_invert ^ ro_gpio_invert) |
418 | host->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; | 413 | host->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; |
419 | 414 | ||
420 | if (of_find_property(np, "cap-sd-highspeed", &len)) | 415 | if (of_find_property(np, "cap-sd-highspeed", &len)) |