Lines Matching +full:mmc +full:- +full:card

1 // SPDX-License-Identifier: GPL-2.0-only
14 #include <linux/fault-inject.h>
17 #include <linux/mmc/card.h>
18 #include <linux/mmc/host.h>
19 #include <linux/mmc/mmc.h>
20 #include <linux/mmc/sd.h>
23 #include "card.h"
58 struct mmc_host *host = s->private; in mmc_ios_show()
59 struct mmc_ios *ios = &host->ios; in mmc_ios_show()
62 seq_printf(s, "clock:\t\t%u Hz\n", ios->clock); in mmc_ios_show()
63 if (host->actual_clock) in mmc_ios_show()
64 seq_printf(s, "actual clock:\t%u Hz\n", host->actual_clock); in mmc_ios_show()
65 seq_printf(s, "vdd:\t\t%u ", ios->vdd); in mmc_ios_show()
66 if ((1 << ios->vdd) & MMC_VDD_165_195) in mmc_ios_show()
67 seq_printf(s, "(1.65 - 1.95 V)\n"); in mmc_ios_show()
68 else if (ios->vdd < (ARRAY_SIZE(vdd_str) - 1) in mmc_ios_show()
69 && vdd_str[ios->vdd] && vdd_str[ios->vdd + 1]) in mmc_ios_show()
70 seq_printf(s, "(%s ~ %s V)\n", vdd_str[ios->vdd], in mmc_ios_show()
71 vdd_str[ios->vdd + 1]); in mmc_ios_show()
75 switch (ios->bus_mode) { in mmc_ios_show()
80 str = "push-pull"; in mmc_ios_show()
86 seq_printf(s, "bus mode:\t%u (%s)\n", ios->bus_mode, str); in mmc_ios_show()
88 switch (ios->chip_select) { in mmc_ios_show()
102 seq_printf(s, "chip select:\t%u (%s)\n", ios->chip_select, str); in mmc_ios_show()
104 switch (ios->power_mode) { in mmc_ios_show()
118 seq_printf(s, "power mode:\t%u (%s)\n", ios->power_mode, str); in mmc_ios_show()
120 ios->bus_width, 1 << ios->bus_width); in mmc_ios_show()
122 switch (ios->timing) { in mmc_ios_show()
127 str = "mmc high-speed"; in mmc_ios_show()
130 str = "sd high-speed"; in mmc_ios_show()
148 str = "mmc DDR52"; in mmc_ios_show()
151 str = "mmc HS200"; in mmc_ios_show()
154 str = mmc_card_hs400es(host->card) ? in mmc_ios_show()
155 "mmc HS400 enhanced strobe" : "mmc HS400"; in mmc_ios_show()
161 seq_printf(s, "timing spec:\t%u (%s)\n", ios->timing, str); in mmc_ios_show()
163 switch (ios->signal_voltage) { in mmc_ios_show()
177 seq_printf(s, "signal voltage:\t%u (%s)\n", ios->signal_voltage, str); in mmc_ios_show()
179 switch (ios->drv_type) { in mmc_ios_show()
196 seq_printf(s, "driver type:\t%u (%s)\n", ios->drv_type, str); in mmc_ios_show()
206 *val = host->ios.clock; in mmc_clock_opt_get()
216 if (val != 0 && (val > host->f_max || val < host->f_min)) in mmc_clock_opt_set()
217 return -EINVAL; in mmc_clock_opt_set()
235 return -EINVAL; in mmc_err_state_get()
239 if (host->err_stats[i]) { in mmc_err_state_get()
252 struct mmc_host *host = file->private; in mmc_err_stats_show()
258 [MMC_ERR_AUTO_CMD] = "Auto-Cmd Error Occurred", in mmc_err_stats_show()
275 desc[i], host->err_stats[i]); in mmc_err_stats_show()
283 return single_open(file, mmc_err_stats_show, inode->i_private); in mmc_err_stats_open()
289 struct mmc_host *host = filp->f_mapping->host->i_private; in mmc_err_stats_write()
291 pr_debug("%s: Resetting MMC error statistics\n", __func__); in mmc_err_stats_write()
292 memset(host->err_stats, 0, sizeof(host->err_stats)); in mmc_err_stats_write()
321 return -EINVAL; in mmc_caps_set()
335 return -EINVAL; in mmc_caps2_set()
352 host->debugfs_root = root; in mmc_add_host_debugfs()
355 debugfs_create_file("caps", 0600, root, &host->caps, &mmc_caps_fops); in mmc_add_host_debugfs()
356 debugfs_create_file("caps2", 0600, root, &host->caps2, in mmc_add_host_debugfs()
369 host->fail_mmc_request = fail_default_attr; in mmc_add_host_debugfs()
371 &host->fail_mmc_request); in mmc_add_host_debugfs()
377 debugfs_remove_recursive(host->debugfs_root); in mmc_remove_host_debugfs()
380 void mmc_add_card_debugfs(struct mmc_card *card) in mmc_add_card_debugfs() argument
382 struct mmc_host *host = card->host; in mmc_add_card_debugfs()
385 if (!host->debugfs_root) in mmc_add_card_debugfs()
388 root = debugfs_create_dir(mmc_card_id(card), host->debugfs_root); in mmc_add_card_debugfs()
389 card->debugfs_root = root; in mmc_add_card_debugfs()
391 debugfs_create_x32("state", 0400, root, &card->state); in mmc_add_card_debugfs()
392 debugfs_create_x32("quirks", 0400, root, &card->quirks); in mmc_add_card_debugfs()
395 void mmc_remove_card_debugfs(struct mmc_card *card) in mmc_remove_card_debugfs() argument
397 debugfs_remove_recursive(card->debugfs_root); in mmc_remove_card_debugfs()
398 card->debugfs_root = NULL; in mmc_remove_card_debugfs()