Commit 0d81b5fa authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull MMC fixes from Ulf Hansson:
 "MMC core:
   - Disable card detect during shutdown

  MMC host:
   - mmci: Fixup tuning support for stm32_sdmmc
   - meson-mx-sdhc: Fix support for multi-block SDIO commands
   - sdhci-tegra: Fix support for eMMC HS400ES mode"

* tag 'mmc-v5.16-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  mmc: mmci: stm32: clear DLYB_CR after sending tuning command
  mmc: meson-mx-sdhc: Set MANUAL_STOP for multi-block SDIO commands
  mmc: core: Disable card detect during shutdown
  mmc: sdhci-tegra: Fix switch to HS400ES mode
parents c8cc50a9 ff31ee0a
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -2264,7 +2264,7 @@ void mmc_start_host(struct mmc_host *host)
	_mmc_detect_change(host, 0, false);
}

void mmc_stop_host(struct mmc_host *host)
void __mmc_stop_host(struct mmc_host *host)
{
	if (host->slot.cd_irq >= 0) {
		mmc_gpio_set_cd_wake(host, false);
@@ -2273,6 +2273,11 @@ void mmc_stop_host(struct mmc_host *host)

	host->rescan_disable = 1;
	cancel_delayed_work_sync(&host->detect);
}

void mmc_stop_host(struct mmc_host *host)
{
	__mmc_stop_host(host);

	/* clear pm flags now and let card drivers set them as needed */
	host->pm_flags = 0;
+1 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ static inline void mmc_delay(unsigned int ms)

void mmc_rescan(struct work_struct *work);
void mmc_start_host(struct mmc_host *host);
void __mmc_stop_host(struct mmc_host *host);
void mmc_stop_host(struct mmc_host *host);

void _mmc_detect_change(struct mmc_host *host, unsigned long delay,
+9 −0
Original line number Diff line number Diff line
@@ -80,9 +80,18 @@ static void mmc_host_classdev_release(struct device *dev)
	kfree(host);
}

static int mmc_host_classdev_shutdown(struct device *dev)
{
	struct mmc_host *host = cls_dev_to_mmc_host(dev);

	__mmc_stop_host(host);
	return 0;
}

static struct class mmc_host_class = {
	.name		= "mmc_host",
	.dev_release	= mmc_host_classdev_release,
	.shutdown_pre	= mmc_host_classdev_shutdown,
	.pm		= MMC_HOST_CLASS_DEV_PM_OPS,
};

+16 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
				    struct mmc_command *cmd)
{
	struct meson_mx_sdhc_host *host = mmc_priv(mmc);
	bool manual_stop = false;
	u32 ictl, send;
	int pack_len;

@@ -172,12 +173,27 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
		else
			/* software flush: */
			ictl |= MESON_SDHC_ICTL_DATA_XFER_OK;

		/*
		 * Mimic the logic from the vendor driver where (only)
		 * SD_IO_RW_EXTENDED commands with more than one block set the
		 * MESON_SDHC_MISC_MANUAL_STOP bit. This fixes the firmware
		 * download in the brcmfmac driver for a BCM43362/1 card.
		 * Without this sdio_memcpy_toio() (with a size of 219557
		 * bytes) times out if MESON_SDHC_MISC_MANUAL_STOP is not set.
		 */
		manual_stop = cmd->data->blocks > 1 &&
			      cmd->opcode == SD_IO_RW_EXTENDED;
	} else {
		pack_len = 0;

		ictl |= MESON_SDHC_ICTL_RESP_OK;
	}

	regmap_update_bits(host->regmap, MESON_SDHC_MISC,
			   MESON_SDHC_MISC_MANUAL_STOP,
			   manual_stop ? MESON_SDHC_MISC_MANUAL_STOP : 0);

	if (cmd->opcode == MMC_STOP_TRANSMISSION)
		send |= MESON_SDHC_SEND_DATA_STOP;

+2 −0
Original line number Diff line number Diff line
@@ -441,6 +441,8 @@ static int sdmmc_dlyb_phase_tuning(struct mmci_host *host, u32 opcode)
		return -EINVAL;
	}

	writel_relaxed(0, dlyb->base + DLYB_CR);

	phase = end_of_len - max_len / 2;
	sdmmc_dlyb_set_cfgr(dlyb, dlyb->unit, phase, false);

Loading