summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-12-13 13:41:26 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2022-12-13 13:41:26 -0800
commit71946a25f357a51dcce849367501d7fb04c0465b (patch)
treea9d09be0ea5ac152679a2730cfdc074e3679788f /drivers/mmc/core
parent90b12f423d3c8a89424c7bdde18e1923dfd0941e (diff)
parentff874dbc4f868af128b412a9bd92637103cf11d7 (diff)
downloadlinux-stable-71946a25f357a51dcce849367501d7fb04c0465b.tar.gz
linux-stable-71946a25f357a51dcce849367501d7fb04c0465b.tar.bz2
linux-stable-71946a25f357a51dcce849367501d7fb04c0465b.zip
Merge tag 'mmc-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC and MEMSTICK updates from Ulf Hansson: "MMC core: - A few minor improvements and cleanups MMC host: - Remove some redundant calls to local_irq_{save,restore}() - Replace kmap_atomic() with kmap_local_page() - Take return values from mmc_add_host() into account - dw_mmc-pltfm: Add support to configure clk-phase for socfpga - hsq: Minimize latency by using a fifo to dispatch requests - litex_mmc: Fixup corner case for polling mode - mtk-sd: Add inline crypto engine clock control - mtk-sd: Add support for the mediatek MT7986 variant - renesas_sdhi: Improve reset from HS400 mode - renesas_sdhi: Take DMA end interrupts into account - sdhci: Avoid unnecessary update of clock - sdhci: Fix an SD tuning issue - sdhci-brcmst: Add Kamal Dasu as maintainer for the Broadcom driver - sdhci-esdhc-imx: Improve tuning logic - sdhci-esdhc-imx: Improve support for the imxrt1050 variant - sdhci_f_sdh30: Add support for non-removable media - sdhci_f_sdh30: Add support for the Socionext F_SDH30_E51 variant - sdhci_f_sdh30: Add reset control support - sdhci-msm: Add support for the Qcom SM8550/SM8350/SM6375 variants - sdhci-msm: Add support for the Qcom MSM8976 variant - sdhci-of-arasan: Add support for dynamic configuration - sdhci-of-esdhc: Limit the clock frequency to confirm to spec - sdhci-pci: Enable asynchronous probe - sdhci-sprd: Improve card detection - sdhci-tegra: Improve reset support - sdhci-tegra: Add support to program MC stream ID - sunplus-mmc: Add new mmc driver for the Sunplus SP7021 controller - vub300: Fix warning splat for SDIO irq MEMSTICK core: - memstick: A few minor improvements and cleanups CLK/IOMMU: - clk: socfpga: Drop redundant support for clk-phase for the SD/MMC clk - iommu: Add tegra specific helper to get stream_id" * tag 'mmc-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (108 commits) mmc: sdhci-sprd: Disable CLK_AUTO when the clock is less than 400K mmc: sdhci-of-esdhc: Modify mismatched function name memstick/mspro_block: Convert to use sysfs_emit()/sysfs_emit_at() APIs mmc: sdhci-tegra: Issue CMD and DAT resets together mmc: sdhci-tegra: Add support to program MC stream ID mmc: sdhci-tegra: Separate Tegra194 and Tegra234 SoC data mmc: sdhci-tegra: Sort includes alphabetically iommu/tegra: Add tegra_dev_iommu_get_stream_id() helper iommu: Add note about struct iommu_fwspec usage mmc: sdhci-brcmstb: Resolve "unused" warnings with CONFIG_OF=n dt-bindings: mmc: sdhci-msm: allow dma-coherent dt-bindings: mmc: sdhci-msm: drop properties mentioned in common MMC dt-bindings: mmc: sdhci-msm: cleanup style dt-bindings: mmc: sdhci-am654: cleanup style dt-bindings: mmc: sdhci: document sdhci-caps and sdhci-caps-mask mmc: vub300: fix warning - do not call blocking ops when !TASK_RUNNING MAINTAINERS: Update maintainer for SDHCI Broadcom BRCMSTB driver mmc: sdhci-of-esdhc: limit the SDHC clock frequency mmc: sdhci: Remove unneeded semicolon mmc: core: Normalize the error handling branch in sd_read_ext_regs() ...
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r--drivers/mmc/core/block.c13
-rw-r--r--drivers/mmc/core/bus.c4
-rw-r--r--drivers/mmc/core/core.c7
-rw-r--r--drivers/mmc/core/core.h15
-rw-r--r--drivers/mmc/core/host.c6
-rw-r--r--drivers/mmc/core/mmc_test.c5
-rw-r--r--drivers/mmc/core/pwrseq.c2
-rw-r--r--drivers/mmc/core/sd.c11
8 files changed, 28 insertions, 35 deletions
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index db6d8a099910..20da7ed43e6d 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -514,19 +514,6 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
if (idata->ic.data_timeout_ns)
data.timeout_ns = idata->ic.data_timeout_ns;
- if ((cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B) {
- /*
- * Pretend this is a data transfer and rely on the
- * host driver to compute timeout. When all host
- * drivers support cmd.cmd_timeout for R1B, this
- * can be changed to:
- *
- * mrq.data = NULL;
- * cmd.cmd_timeout = idata->ic.cmd_timeout_ms;
- */
- data.timeout_ns = idata->ic.cmd_timeout_ms * 1000000;
- }
-
mrq.data = &data;
}
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index d8762fa3d5cd..36679f4e9acc 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -359,9 +359,7 @@ int mmc_add_card(struct mmc_card *card)
uhs_bus_speed_mode, type, card->rca);
}
-#ifdef CONFIG_DEBUG_FS
mmc_add_card_debugfs(card);
-#endif
card->dev.of_node = mmc_of_find_child_device(card->host, 0);
device_enable_async_suspend(&card->dev);
@@ -383,9 +381,7 @@ void mmc_remove_card(struct mmc_card *card)
{
struct mmc_host *host = card->host;
-#ifdef CONFIG_DEBUG_FS
mmc_remove_card_debugfs(card);
-#endif
if (mmc_card_present(card)) {
if (mmc_host_is_spi(card->host)) {
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index f0d19356ad76..426c7f66b349 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -56,7 +56,7 @@ static const unsigned freqs[] = { 400000, 300000, 200000, 100000 };
/*
* Enabling software CRCs on the data blocks can be a significant (30%)
* performance cost, and for other reasons may not always be desired.
- * So we allow it it to be disabled.
+ * So we allow it to be disabled.
*/
bool use_spi_crc = 1;
module_param(use_spi_crc, bool, 0);
@@ -142,8 +142,7 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
int err = cmd->error;
/* Flag re-tuning needed on CRC errors */
- if (cmd->opcode != MMC_SEND_TUNING_BLOCK &&
- cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200 &&
+ if (!mmc_op_tuning(cmd->opcode) &&
!host->retune_crc_disable &&
(err == -EILSEQ || (mrq->sbc && mrq->sbc->error == -EILSEQ) ||
(mrq->data && mrq->data->error == -EILSEQ) ||
@@ -527,7 +526,7 @@ EXPORT_SYMBOL(mmc_cqe_post_req);
* mmc_cqe_recovery - Recover from CQE errors.
* @host: MMC host to recover
*
- * Recovery consists of stopping CQE, stopping eMMC, discarding the queue in
+ * Recovery consists of stopping CQE, stopping eMMC, discarding the queue
* in eMMC, and discarding the queue in CQE. CQE must call
* mmc_cqe_request_done() on all requests. An error is returned if the eMMC
* fails to discard its queue.
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index f5f3f623ea49..37091a6589ed 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -86,11 +86,26 @@ int mmc_attach_sdio(struct mmc_host *host);
extern bool use_spi_crc;
/* Debugfs information for hosts and cards */
+#ifdef CONFIG_DEBUG_FS
void mmc_add_host_debugfs(struct mmc_host *host);
void mmc_remove_host_debugfs(struct mmc_host *host);
void mmc_add_card_debugfs(struct mmc_card *card);
void mmc_remove_card_debugfs(struct mmc_card *card);
+#else
+static inline void mmc_add_host_debugfs(struct mmc_host *host)
+{
+}
+static inline void mmc_remove_host_debugfs(struct mmc_host *host)
+{
+}
+static inline void mmc_add_card_debugfs(struct mmc_card *card)
+{
+}
+static inline void mmc_remove_card_debugfs(struct mmc_card *card)
+{
+}
+#endif
int mmc_execute_tuning(struct mmc_card *card);
int mmc_hs200_to_hs400(struct mmc_card *card);
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index b89dca1f15e9..d17eda753b7e 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -269,7 +269,7 @@ EXPORT_SYMBOL(mmc_of_parse_clk_phase);
* @host: host whose properties should be parsed.
*
* To keep the rest of the MMC subsystem unaware of whether DT has been
- * used to to instantiate and configure this host instance or not, we
+ * used to instantiate and configure this host instance or not, we
* parse the properties and set respective generic mmc-host flags and
* parameters.
*/
@@ -629,9 +629,7 @@ int mmc_add_host(struct mmc_host *host)
led_trigger_register_simple(dev_name(&host->class_dev), &host->led);
-#ifdef CONFIG_DEBUG_FS
mmc_add_host_debugfs(host);
-#endif
mmc_start_host(host);
return 0;
@@ -651,9 +649,7 @@ void mmc_remove_host(struct mmc_host *host)
{
mmc_stop_host(host);
-#ifdef CONFIG_DEBUG_FS
mmc_remove_host_debugfs(host);
-#endif
device_del(&host->class_dev);
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 155ce2bdfe62..156d34b2ed4d 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -932,7 +932,6 @@ static int mmc_test_transfer(struct mmc_test_card *test,
unsigned blocks, unsigned blksz, int write)
{
int ret, i;
- unsigned long flags;
if (write) {
for (i = 0; i < blocks * blksz; i++)
@@ -940,9 +939,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
} else {
memset(test->scratch, 0, BUFFER_SIZE);
}
- local_irq_save(flags);
sg_copy_from_buffer(sg, sg_len, test->scratch, BUFFER_SIZE);
- local_irq_restore(flags);
ret = mmc_test_set_blksize(test, blksz);
if (ret)
@@ -987,9 +984,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
return RESULT_FAIL;
}
} else {
- local_irq_save(flags);
sg_copy_to_buffer(sg, sg_len, test->scratch, BUFFER_SIZE);
- local_irq_restore(flags);
for (i = 0; i < blocks * blksz; i++) {
if (test->scratch[i] != (u8)i)
return RESULT_FAIL;
diff --git a/drivers/mmc/core/pwrseq.c b/drivers/mmc/core/pwrseq.c
index ef675f364bf0..2374669b588a 100644
--- a/drivers/mmc/core/pwrseq.c
+++ b/drivers/mmc/core/pwrseq.c
@@ -29,7 +29,7 @@ int mmc_pwrseq_alloc(struct mmc_host *host)
mutex_lock(&pwrseq_list_mutex);
list_for_each_entry(p, &pwrseq_list, pwrseq_node) {
- if (p->dev->of_node == np) {
+ if (device_match_of_node(p->dev, np)) {
if (!try_module_get(p->owner))
dev_err(host->parent,
"increasing module refcount failed\n");
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 3662bf5320ce..72b664ed90cf 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1259,7 +1259,7 @@ static int sd_read_ext_regs(struct mmc_card *card)
*/
err = sd_read_ext_reg(card, 0, 0, 0, 512, gen_info_buf);
if (err) {
- pr_warn("%s: error %d reading general info of SD ext reg\n",
+ pr_err("%s: error %d reading general info of SD ext reg\n",
mmc_hostname(card->host), err);
goto out;
}
@@ -1273,7 +1273,12 @@ static int sd_read_ext_regs(struct mmc_card *card)
/* Number of extensions to be find. */
num_ext = gen_info_buf[4];
- /* We support revision 0, but limit it to 512 bytes for simplicity. */
+ /*
+ * We only support revision 0 and limit it to 512 bytes for simplicity.
+ * No matter what, let's return zero to allow us to continue using the
+ * card, even if we can't support the features from the SD function
+ * extensions registers.
+ */
if (rev != 0 || len > 512) {
pr_warn("%s: non-supported SD ext reg layout\n",
mmc_hostname(card->host));
@@ -1288,7 +1293,7 @@ static int sd_read_ext_regs(struct mmc_card *card)
for (i = 0; i < num_ext; i++) {
err = sd_parse_ext_reg(card, gen_info_buf, &next_ext_addr);
if (err) {
- pr_warn("%s: error %d parsing SD ext reg\n",
+ pr_err("%s: error %d parsing SD ext reg\n",
mmc_hostname(card->host), err);
goto out;
}