MMC core:
- Fix card detection regression. The MMC_CAP2_CD_ACTIVE_HIGH and MMC_CAP2_RO_ACTIVE_HIGH could under some circumstances be set incorrectly, causing the card detection to fail. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJUW2rFAAoJEP4mhCVzWIwp4C8QALVu9YPuWEFMmW2MZD2D4UyH b/1Y0e8VJ7DasJis0irtEEntibnE4BhhkMqW+kXgu+/8X8m9RuabIW4b30sWVZ0/ qrIXrCFmk9DqL3v/6N7yoVWBJgtqOnT69ITz2mR0+qZ03qyyLduoVxysjuXcpYnH 1JvYjwNeUEYl4w/kyG6rkAMzvR61n2WuORO/Zx+9QQYbgOHwZ2WbHTlemBjpeSfE d7M24f64wO832M+zuFP8iQ3WTqodWYPm2BYKLovxrG3aln237meVlCmm8QE5aUvI qF8UPP/1QrpseQvZn4qs45KsjplOfoUaEROTSnEVazWY3vJtuSLNDrGuMS/eQwke XRr3OlTqd9kBf9u1eXo3xLdSHEUpgSvo8mOpdYlh4kcOxOCVdvHmTdRNpA4HiktW pzmQeQMSEjHBQiOMD/250jjrorbuawlDyY7Qz3ec3KeVnkOpeuQDz3BQKOJ+PvGG Da2CQK2uFc/iVTZv8gHVaYyoZT0xwoiMLzsGBYJTz18i4Rfvf7XJaA/Vb88QK1J7 DgpURhWyZsrZKdIFtx0Eu7eJ8JF9diNeL/3qnm8/XRmixbAZydeJVXEkYTSW05h7 fhJ5YJpLcgvLwjaayKWeB+tAB5NKaSHc+R6vcbWYB5zRK26Mz5BiUiO03LFYWx/H 6fZabmspBzjnWPgmbjPZ =libf -----END PGP SIGNATURE----- Merge tag 'mmc-v3.18-2' of git://git.linaro.org/people/ulf.hansson/mmc Pull MMC fix from Ulf Hansson: "Fix card detection regression in the MMC core. The MMC_CAP2_CD_ACTIVE_HIGH and MMC_CAP2_RO_ACTIVE_HIGH could under some circumstances be set incorrectly, causing the card detection to fail" * tag 'mmc-v3.18-2' of git://git.linaro.org/people/ulf.hansson/mmc: mmc: core: fix card detection regression
This commit is contained in:
commit
381e355475
1 changed files with 8 additions and 13 deletions
|
@ -311,7 +311,8 @@ int mmc_of_parse(struct mmc_host *host)
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
u32 bus_width;
|
u32 bus_width;
|
||||||
int len, ret;
|
int len, ret;
|
||||||
bool cap_invert, gpio_invert;
|
bool cd_cap_invert, cd_gpio_invert = false;
|
||||||
|
bool ro_cap_invert, ro_gpio_invert = false;
|
||||||
|
|
||||||
if (!host->parent || !host->parent->of_node)
|
if (!host->parent || !host->parent->of_node)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -359,16 +360,13 @@ int mmc_of_parse(struct mmc_host *host)
|
||||||
if (of_find_property(np, "non-removable", &len)) {
|
if (of_find_property(np, "non-removable", &len)) {
|
||||||
host->caps |= MMC_CAP_NONREMOVABLE;
|
host->caps |= MMC_CAP_NONREMOVABLE;
|
||||||
} else {
|
} else {
|
||||||
if (of_property_read_bool(np, "cd-inverted"))
|
cd_cap_invert = of_property_read_bool(np, "cd-inverted");
|
||||||
cap_invert = true;
|
|
||||||
else
|
|
||||||
cap_invert = false;
|
|
||||||
|
|
||||||
if (of_find_property(np, "broken-cd", &len))
|
if (of_find_property(np, "broken-cd", &len))
|
||||||
host->caps |= MMC_CAP_NEEDS_POLL;
|
host->caps |= MMC_CAP_NEEDS_POLL;
|
||||||
|
|
||||||
ret = mmc_gpiod_request_cd(host, "cd", 0, true,
|
ret = mmc_gpiod_request_cd(host, "cd", 0, true,
|
||||||
0, &gpio_invert);
|
0, &cd_gpio_invert);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (ret == -EPROBE_DEFER)
|
if (ret == -EPROBE_DEFER)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -391,17 +389,14 @@ int mmc_of_parse(struct mmc_host *host)
|
||||||
* both inverted, the end result is that the CD line is
|
* both inverted, the end result is that the CD line is
|
||||||
* not inverted.
|
* not inverted.
|
||||||
*/
|
*/
|
||||||
if (cap_invert ^ gpio_invert)
|
if (cd_cap_invert ^ cd_gpio_invert)
|
||||||
host->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH;
|
host->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse Write Protection */
|
/* Parse Write Protection */
|
||||||
if (of_property_read_bool(np, "wp-inverted"))
|
ro_cap_invert = of_property_read_bool(np, "wp-inverted");
|
||||||
cap_invert = true;
|
|
||||||
else
|
|
||||||
cap_invert = false;
|
|
||||||
|
|
||||||
ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &gpio_invert);
|
ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &ro_gpio_invert);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (ret == -EPROBE_DEFER)
|
if (ret == -EPROBE_DEFER)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -414,7 +409,7 @@ int mmc_of_parse(struct mmc_host *host)
|
||||||
dev_info(host->parent, "Got WP GPIO\n");
|
dev_info(host->parent, "Got WP GPIO\n");
|
||||||
|
|
||||||
/* See the comment on CD inversion above */
|
/* See the comment on CD inversion above */
|
||||||
if (cap_invert ^ gpio_invert)
|
if (ro_cap_invert ^ ro_gpio_invert)
|
||||||
host->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
|
host->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
|
||||||
|
|
||||||
if (of_find_property(np, "cap-sd-highspeed", &len))
|
if (of_find_property(np, "cap-sd-highspeed", &len))
|
||||||
|
|
Loading…
Add table
Reference in a new issue