diff options
Diffstat (limited to 'drivers/mmc/core/core.c')
-rw-r--r-- | drivers/mmc/core/core.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index f95d41ffc..9eba56c68 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -868,11 +868,11 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card) /* * Some cards require longer data read timeout than indicated in CSD. * Address this by setting the read timeout to a "reasonably high" - * value. For the cards tested, 300ms has proven enough. If necessary, + * value. For the cards tested, 600ms has proven enough. If necessary, * this value can be increased if other problematic cards require this. */ if (mmc_card_long_read_time(card) && data->flags & MMC_DATA_READ) { - data->timeout_ns = 300000000; + data->timeout_ns = 600000000; data->timeout_clks = 0; } @@ -1033,7 +1033,7 @@ static inline void mmc_set_ios(struct mmc_host *host) "width %u timing %u\n", mmc_hostname(host), ios->clock, ios->bus_mode, ios->power_mode, ios->chip_select, ios->vdd, - ios->bus_width, ios->timing); + 1 << ios->bus_width, ios->timing); host->ops->set_ios(host, ios); } @@ -1079,7 +1079,8 @@ int mmc_execute_tuning(struct mmc_card *card) err = host->ops->execute_tuning(host, opcode); if (err) - pr_err("%s: tuning execution failed\n", mmc_hostname(host)); + pr_err("%s: tuning execution failed: %d\n", + mmc_hostname(host), err); else mmc_retune_enable(host); @@ -1204,8 +1205,9 @@ EXPORT_SYMBOL(mmc_vddrange_to_ocrmask); * @np: The device node need to be parsed. * @mask: mask of voltages available for MMC/SD/SDIO * - * 1. Return zero on success. - * 2. Return negative errno: voltage-range is invalid. + * Parse the "voltage-ranges" DT property, returning zero if it is not + * found, negative errno if the voltage-range specification is invalid, + * or one if the voltage-range is specified and successfully parsed. */ int mmc_of_parse_voltage(struct device_node *np, u32 *mask) { @@ -1214,8 +1216,12 @@ int mmc_of_parse_voltage(struct device_node *np, u32 *mask) voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges); num_ranges = num_ranges / sizeof(*voltage_ranges) / 2; - if (!voltage_ranges || !num_ranges) { - pr_info("%s: voltage-ranges unspecified\n", np->full_name); + if (!voltage_ranges) { + pr_debug("%s: voltage-ranges unspecified\n", np->full_name); + return 0; + } + if (!num_ranges) { + pr_err("%s: voltage-ranges empty\n", np->full_name); return -EINVAL; } @@ -1234,7 +1240,7 @@ int mmc_of_parse_voltage(struct device_node *np, u32 *mask) *mask |= ocr_mask; } - return 0; + return 1; } EXPORT_SYMBOL(mmc_of_parse_voltage); @@ -2532,7 +2538,7 @@ int mmc_detect_card_removed(struct mmc_host *host) if (!card) return 1; - if (host->caps & MMC_CAP_NONREMOVABLE) + if (!mmc_card_is_removable(host)) return 0; ret = mmc_card_removed(card); @@ -2570,7 +2576,7 @@ void mmc_rescan(struct work_struct *work) return; /* If there is a non-removable card registered, only scan once */ - if ((host->caps & MMC_CAP_NONREMOVABLE) && host->rescan_entered) + if (!mmc_card_is_removable(host) && host->rescan_entered) return; host->rescan_entered = 1; @@ -2587,8 +2593,7 @@ void mmc_rescan(struct work_struct *work) * if there is a _removable_ card registered, check whether it is * still present */ - if (host->bus_ops && !host->bus_dead - && !(host->caps & MMC_CAP_NONREMOVABLE)) + if (host->bus_ops && !host->bus_dead && mmc_card_is_removable(host)) host->bus_ops->detect(host); host->detect_change = 0; @@ -2613,7 +2618,7 @@ void mmc_rescan(struct work_struct *work) mmc_bus_put(host); mmc_claim_host(host); - if (!(host->caps & MMC_CAP_NONREMOVABLE) && host->ops->get_cd && + if (mmc_card_is_removable(host) && host->ops->get_cd && host->ops->get_cd(host) == 0) { mmc_power_off(host); mmc_release_host(host); |