diff options
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r-- | drivers/mmc/core/core.c | 29 | ||||
-rw-r--r-- | drivers/mmc/core/debugfs.c | 2 | ||||
-rw-r--r-- | drivers/mmc/core/host.c | 1 | ||||
-rw-r--r-- | drivers/mmc/core/mmc.c | 4 | ||||
-rw-r--r-- | drivers/mmc/core/mmc_ops.c | 19 | ||||
-rw-r--r-- | drivers/mmc/core/pwrseq_simple.c | 1 | ||||
-rw-r--r-- | drivers/mmc/core/sd.c | 2 | ||||
-rw-r--r-- | drivers/mmc/core/sd_ops.c | 7 | ||||
-rw-r--r-- | drivers/mmc/core/sdio.c | 2 | ||||
-rw-r--r-- | drivers/mmc/core/sdio_ops.c | 3 |
10 files changed, 27 insertions, 43 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index f95d41ffc766..41b1e761965f 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -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); diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 65cc0ac9b82d..9382a57a5aa4 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -220,7 +220,7 @@ static int mmc_clock_opt_set(void *data, u64 val) struct mmc_host *host = data; /* We need this check due to input value is u64 */ - if (val > host->f_max) + if (val != 0 && (val > host->f_max || val < host->f_min)) return -EINVAL; mmc_claim_host(host); diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 0aecd5c00b86..1d94607611d8 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -339,6 +339,7 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) host->class_dev.parent = dev; host->class_dev.class = &mmc_host_class; device_initialize(&host->class_dev); + device_enable_async_suspend(&host->class_dev); if (mmc_gpio_alloc(host)) { put_device(&host->class_dev); diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index bf49e44571f2..4dbe3df8024b 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -501,7 +501,7 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd) card->ext_csd.raw_bkops_status = ext_csd[EXT_CSD_BKOPS_STATUS]; if (!card->ext_csd.man_bkops_en) - pr_info("%s: MAN_BKOPS_EN bit is not set\n", + pr_debug("%s: MAN_BKOPS_EN bit is not set\n", mmc_hostname(card->host)); } @@ -945,7 +945,7 @@ static int mmc_select_bus_width(struct mmc_card *card) break; } else { pr_warn("%s: switch to bus width %d failed\n", - mmc_hostname(host), ext_csd_bits[idx]); + mmc_hostname(host), 1 << bus_width); } } diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 2c90635c89af..62355bda608f 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -90,7 +90,6 @@ int mmc_send_status(struct mmc_card *card, u32 *status) static int _mmc_select_card(struct mmc_host *host, struct mmc_card *card) { - int err; struct mmc_command cmd = {0}; BUG_ON(!host); @@ -105,11 +104,7 @@ static int _mmc_select_card(struct mmc_host *host, struct mmc_card *card) cmd.flags = MMC_RSP_NONE | MMC_CMD_AC; } - err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); - if (err) - return err; - - return 0; + return mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); } int mmc_select_card(struct mmc_card *card) @@ -244,7 +239,6 @@ int mmc_all_send_cid(struct mmc_host *host, u32 *cid) int mmc_set_relative_addr(struct mmc_card *card) { - int err; struct mmc_command cmd = {0}; BUG_ON(!card); @@ -254,11 +248,7 @@ int mmc_set_relative_addr(struct mmc_card *card) cmd.arg = card->rca << 16; cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; - err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); - if (err) - return err; - - return 0; + return mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); } static int @@ -743,7 +733,7 @@ mmc_send_bus_test(struct mmc_card *card, struct mmc_host *host, u8 opcode, int mmc_bus_test(struct mmc_card *card, u8 bus_width) { - int err, width; + int width; if (bus_width == MMC_BUS_WIDTH_8) width = 8; @@ -759,8 +749,7 @@ int mmc_bus_test(struct mmc_card *card, u8 bus_width) * is a problem. This improves chances that the test will work. */ mmc_send_bus_test(card, card->host, MMC_BUS_TEST_W, width); - err = mmc_send_bus_test(card, card->host, MMC_BUS_TEST_R, width); - return err; + return mmc_send_bus_test(card, card->host, MMC_BUS_TEST_R, width); } int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status) diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c index aba786daebca..bc173e18b71c 100644 --- a/drivers/mmc/core/pwrseq_simple.c +++ b/drivers/mmc/core/pwrseq_simple.c @@ -12,7 +12,6 @@ #include <linux/slab.h> #include <linux/device.h> #include <linux/err.h> -#include <linux/of_gpio.h> #include <linux/gpio/consumer.h> #include <linux/mmc/host.h> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index bb39a29b2db6..b95bd24d92f4 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -74,8 +74,6 @@ void mmc_decode_cid(struct mmc_card *card) { u32 *resp = card->raw_cid; - memset(&card->cid, 0, sizeof(struct mmc_cid)); - /* * SD doesn't currently have a version field so we will * have to assume we can parse this. diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c index 48d0c93ba25a..16b774c18e75 100644 --- a/drivers/mmc/core/sd_ops.c +++ b/drivers/mmc/core/sd_ops.c @@ -120,7 +120,6 @@ EXPORT_SYMBOL(mmc_wait_for_app_cmd); int mmc_app_set_bus_width(struct mmc_card *card, int width) { - int err; struct mmc_command cmd = {0}; BUG_ON(!card); @@ -140,11 +139,7 @@ int mmc_app_set_bus_width(struct mmc_card *card, int width) return -EINVAL; } - err = mmc_wait_for_app_cmd(card->host, card, &cmd, MMC_CMD_RETRIES); - if (err) - return err; - - return 0; + return mmc_wait_for_app_cmd(card->host, card, &cmd, MMC_CMD_RETRIES); } int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 467b3cf80c44..bd44ba8116d1 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -106,8 +106,6 @@ static int sdio_read_cccr(struct mmc_card *card, u32 ocr) unsigned char data; unsigned char speed; - memset(&card->cccr, 0, sizeof(struct sdio_cccr)); - ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_CCCR, 0, &data); if (ret) goto out; diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c index 62508b457c4f..34f6e8015306 100644 --- a/drivers/mmc/core/sdio_ops.c +++ b/drivers/mmc/core/sdio_ops.c @@ -217,7 +217,6 @@ int sdio_reset(struct mmc_host *host) else abort |= 0x08; - ret = mmc_io_rw_direct_host(host, 1, 0, SDIO_CCCR_ABORT, abort, NULL); - return ret; + return mmc_io_rw_direct_host(host, 1, 0, SDIO_CCCR_ABORT, abort, NULL); } |