summaryrefslogtreecommitdiff
path: root/drivers/mmc/core
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-11-02 04:55:12 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2021-11-02 04:55:12 +0300
commit8a73c77c809a7342497b78a2b4555aa40506af94 (patch)
treea3d562d0693198512678ee3f5b415f657fea9e39 /drivers/mmc/core
parent316b7eaa932d99e6421bee9a89e4f19aefddd88a (diff)
parent348ecd61770f6aca0d060fea2bb538e749775638 (diff)
downloadlinux-8a73c77c809a7342497b78a2b4555aa40506af94.tar.xz
Merge tag 'mmc-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC and MEMSTICK updates from Ulf Hansson: "MMC core: - Update maintainer and URL for the mmc-utils - Set default label for slot-gpio in case of no con-id - Convert MMC card DT bindings to a schema - Add optional host specific tuning support for eMMC HS400 - Add error handling of add_disk() MMC host: - mtk-sd: Add host specific tuning support for eMMC HS400 - mtk-sd: Make DMA handling more robust - dw_mmc: Prevent hangs for some data writes - dw_mmc: Move away from using the ->init_card() callback - mxs-mmc: Manage the regulator in the error path and in ->remove() - sdhci-cadence: Add support for the Microchip MPFS variant - sdhci-esdhc-imx: Add support for the NXP S32G2 variant - sdhci-of-arasan: Add support for the Intel Thunder Bay variant - sdhci-omap: Prepare to support more SoCs - sdhci-omap: Add support for omap3 and omap4 variants - sdhci-omap: Add support for power management - sdhci-omap: Add support for system wakeups - sdhci-msm: Add support for the msm8226 variant - sdhci-sprd: Verify that the DLL locks according to spec MEMSTICK: - Add error handling of add_disk() - A couple of small fixes and improvements" * tag 'mmc-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (60 commits) docs: mmc: update maintainer name and URL mmc: dw_mmc: exynos: Fix spelling mistake "candiates" -> candidates MAINTAINERS: drop obsolete file pattern in SDHCI DRIVER section mmc: sdhci-esdhc-imx: add NXP S32G2 support dt-bindings: mmc: fsl-imx-esdhc: add NXP S32G2 support mmc: dw_mmc: Drop use of ->init_card() callback mmc: sdhci-omap: Fix build if CONFIG_PM_SLEEP is not set mmc: sdhci-omap: Remove forward declaration of sdhci_omap_context_save() memstick: r592: Fix a UAF bug when removing the driver mmc: mxs-mmc: disable regulator on error and in the remove function mmc: sdhci-omap: Configure optional wakeirq mmc: sdhci-omap: Allow SDIO card power off and enable aggressive PM mmc: sdhci-omap: Implement PM runtime functions mmc: sdhci-omap: Add omap_offset to support omap3 and earlier mmc: sdhci-omap: Handle voltages to add support omap4 dt-bindings: sdhci-omap: Update binding for legacy SoCs mmc: sdhci-pci: Remove dead code (rst_n_gpio et al) mmc: sdhci-pci: Remove dead code (cd_gpio, cd_irq et al) mmc: sdhci-pci: Remove dead code (struct sdhci_pci_data et al) mmc: sdhci: Remove unused prototype declaration in the header ...
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r--drivers/mmc/core/block.c7
-rw-r--r--drivers/mmc/core/mmc.c8
-rw-r--r--drivers/mmc/core/mmc_ops.h1
-rw-r--r--drivers/mmc/core/slot-gpio.c42
4 files changed, 39 insertions, 19 deletions
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 74882fa0f86d..90e1bcd03b46 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -2442,9 +2442,14 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
/* used in ->open, must be set before add_disk: */
if (area_type == MMC_BLK_DATA_AREA_MAIN)
dev_set_drvdata(&card->dev, md);
- device_add_disk(md->parent, md->disk, mmc_disk_attr_groups);
+ ret = device_add_disk(md->parent, md->disk, mmc_disk_attr_groups);
+ if (ret)
+ goto err_cleanup_queue;
return md;
+ err_cleanup_queue:
+ blk_cleanup_queue(md->disk->queue);
+ blk_mq_free_tag_set(&md->queue.tag_set);
err_kfree:
kfree(md);
out:
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 29e58ffae379..b1c1716dacf0 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1224,6 +1224,14 @@ static int mmc_select_hs400(struct mmc_card *card)
mmc_set_timing(host, MMC_TIMING_MMC_HS400);
mmc_set_bus_speed(card);
+ if (host->ops->execute_hs400_tuning) {
+ mmc_retune_disable(host);
+ err = host->ops->execute_hs400_tuning(host, card);
+ mmc_retune_enable(host);
+ if (err)
+ goto out_err;
+ }
+
if (host->ops->hs400_complete)
host->ops->hs400_complete(host);
diff --git a/drivers/mmc/core/mmc_ops.h b/drivers/mmc/core/mmc_ops.h
index ae25ffc2e870..e5e94567a9a9 100644
--- a/drivers/mmc/core/mmc_ops.h
+++ b/drivers/mmc/core/mmc_ops.h
@@ -38,7 +38,6 @@ int mmc_spi_read_ocr(struct mmc_host *host, int highcap, u32 *ocrp);
int mmc_spi_set_crc(struct mmc_host *host, int use_crc);
int mmc_bus_test(struct mmc_card *card, u8 bus_width);
int mmc_can_ext_csd(struct mmc_card *card);
-int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd);
int mmc_switch_status(struct mmc_card *card, bool crc_err_fatal);
bool mmc_prepare_busy_cmd(struct mmc_host *host, struct mmc_command *cmd,
unsigned int timeout_ms);
diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
index 05e907451df9..dd2a4b6ab6ad 100644
--- a/drivers/mmc/core/slot-gpio.c
+++ b/drivers/mmc/core/slot-gpio.c
@@ -39,24 +39,24 @@ static irqreturn_t mmc_gpio_cd_irqt(int irq, void *dev_id)
int mmc_gpio_alloc(struct mmc_host *host)
{
- struct mmc_gpio *ctx = devm_kzalloc(host->parent,
- sizeof(*ctx), GFP_KERNEL);
-
- if (ctx) {
- ctx->cd_debounce_delay_ms = 200;
- ctx->cd_label = devm_kasprintf(host->parent, GFP_KERNEL,
- "%s cd", dev_name(host->parent));
- if (!ctx->cd_label)
- return -ENOMEM;
- ctx->ro_label = devm_kasprintf(host->parent, GFP_KERNEL,
- "%s ro", dev_name(host->parent));
- if (!ctx->ro_label)
- return -ENOMEM;
- host->slot.handler_priv = ctx;
- host->slot.cd_irq = -EINVAL;
- }
+ const char *devname = dev_name(host->parent);
+ struct mmc_gpio *ctx;
+
+ ctx = devm_kzalloc(host->parent, sizeof(*ctx), GFP_KERNEL);
+ if (!ctx)
+ return -ENOMEM;
+
+ ctx->cd_debounce_delay_ms = 200;
+ ctx->cd_label = devm_kasprintf(host->parent, GFP_KERNEL, "%s cd", devname);
+ if (!ctx->cd_label)
+ return -ENOMEM;
+ ctx->ro_label = devm_kasprintf(host->parent, GFP_KERNEL, "%s ro", devname);
+ if (!ctx->ro_label)
+ return -ENOMEM;
+ host->slot.handler_priv = ctx;
+ host->slot.cd_irq = -EINVAL;
- return ctx ? 0 : -ENOMEM;
+ return 0;
}
int mmc_gpio_get_ro(struct mmc_host *host)
@@ -178,6 +178,10 @@ int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id,
if (IS_ERR(desc))
return PTR_ERR(desc);
+ /* Update default label if no con_id provided */
+ if (!con_id)
+ gpiod_set_consumer_name(desc, ctx->cd_label);
+
if (debounce) {
ret = gpiod_set_debounce(desc, debounce);
if (ret < 0)
@@ -226,6 +230,10 @@ int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id,
if (IS_ERR(desc))
return PTR_ERR(desc);
+ /* Update default label if no con_id provided */
+ if (!con_id)
+ gpiod_set_consumer_name(desc, ctx->ro_label);
+
if (debounce) {
ret = gpiod_set_debounce(desc, debounce);
if (ret < 0)