Commit 7531f570 authored by Ulf Hansson's avatar Ulf Hansson
Browse files

mmc: Merge branch fixes into next



Merge the mmc fixes for v6.16-rc[n] into the next branch, to allow them to
get tested together with the new mmc changes that are targeted for v6.17.

Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parents 120ffe25 49b14db0
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -44,6 +44,12 @@ static const struct mmc_fixup __maybe_unused mmc_sd_fixups[] = {
		   0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd,
		   MMC_QUIRK_NO_UHS_DDR50_TUNING, EXT_CSD_REV_ANY),

	/*
	 * Some SD cards reports discard support while they don't
	 */
	MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd,
		  MMC_QUIRK_BROKEN_SD_DISCARD),

	END_FIXUP
};

@@ -147,12 +153,6 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
	MMC_FIXUP("M62704", CID_MANFID_KINGSTON, 0x0100, add_quirk_mmc,
		  MMC_QUIRK_TRIM_BROKEN),

	/*
	 * Some SD cards reports discard support while they don't
	 */
	MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd,
		  MMC_QUIRK_BROKEN_SD_DISCARD),

	END_FIXUP
};

+2 −2
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ static int sd_uhs2_phy_init(struct mmc_host *host)

	err = host->ops->uhs2_control(host, UHS2_PHY_INIT);
	if (err) {
		pr_err("%s: failed to initial phy for UHS-II!\n",
		pr_debug("%s: failed to initial phy for UHS-II!\n",
			 mmc_hostname(host));
	}

+18 −2
Original line number Diff line number Diff line
@@ -846,10 +846,16 @@ static inline void msdc_dma_setup(struct msdc_host *host, struct msdc_dma *dma,
static void msdc_prepare_data(struct msdc_host *host, struct mmc_data *data)
{
	if (!(data->host_cookie & MSDC_PREPARE_FLAG)) {
		data->host_cookie |= MSDC_PREPARE_FLAG;
		data->sg_count = dma_map_sg(host->dev, data->sg, data->sg_len,
					    mmc_get_dma_dir(data));
		if (data->sg_count)
			data->host_cookie |= MSDC_PREPARE_FLAG;
	}
}

static bool msdc_data_prepared(struct mmc_data *data)
{
	return data->host_cookie & MSDC_PREPARE_FLAG;
}

static void msdc_unprepare_data(struct msdc_host *host, struct mmc_data *data)
@@ -1483,8 +1489,18 @@ static void msdc_ops_request(struct mmc_host *mmc, struct mmc_request *mrq)
	WARN_ON(!host->hsq_en && host->mrq);
	host->mrq = mrq;

	if (mrq->data)
	if (mrq->data) {
		msdc_prepare_data(host, mrq->data);
		if (!msdc_data_prepared(mrq->data)) {
			/*
			 * Failed to prepare DMA area, fail fast before
			 * starting any commands.
			 */
			mrq->cmd->error = -ENOSPC;
			mmc_request_done(mmc_from_priv(host), mrq);
			return;
		}
	}

	/* if SBC is required, we have HW option and SW option.
	 * if HW option is enabled, and SBC does not have "special" flags,
+2 −1
Original line number Diff line number Diff line
@@ -280,7 +280,8 @@ static int spacemit_sdhci_probe(struct platform_device *pdev)

	host->mmc->caps |= MMC_CAP_NEED_RSP_BUSY;

	if (spacemit_sdhci_get_clocks(dev, pltfm_host))
	ret = spacemit_sdhci_get_clocks(dev, pltfm_host);
	if (ret)
		goto err_pltfm;

	ret = sdhci_add_host(host);
+10 −10
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ void sdhci_uhs2_reset(struct sdhci_host *host, u16 mask)
	/* hw clears the bit when it's done */
	if (read_poll_timeout_atomic(sdhci_readw, val, !(val & mask), 10,
				     UHS2_RESET_TIMEOUT_100MS, true, host, SDHCI_UHS2_SW_RESET)) {
		pr_warn("%s: %s: Reset 0x%x never completed. %s: clean reset bit.\n", __func__,
		pr_debug("%s: %s: Reset 0x%x never completed. %s: clean reset bit.\n", __func__,
			 mmc_hostname(host->mmc), (int)mask, mmc_hostname(host->mmc));
		sdhci_writeb(host, 0, SDHCI_UHS2_SW_RESET);
		return;
@@ -335,8 +335,8 @@ static int sdhci_uhs2_interface_detect(struct sdhci_host *host)
	if (read_poll_timeout(sdhci_readl, val, (val & SDHCI_UHS2_IF_DETECT),
			      100, UHS2_INTERFACE_DETECT_TIMEOUT_100MS, true,
			      host, SDHCI_PRESENT_STATE)) {
		pr_warn("%s: not detect UHS2 interface in 100ms.\n", mmc_hostname(host->mmc));
		sdhci_dumpregs(host);
		pr_debug("%s: not detect UHS2 interface in 100ms.\n", mmc_hostname(host->mmc));
		sdhci_dbg_dumpregs(host, "UHS2 interface detect timeout in 100ms");
		return -EIO;
	}

@@ -345,8 +345,8 @@ static int sdhci_uhs2_interface_detect(struct sdhci_host *host)

	if (read_poll_timeout(sdhci_readl, val, (val & SDHCI_UHS2_LANE_SYNC),
			      100, UHS2_LANE_SYNC_TIMEOUT_150MS, true, host, SDHCI_PRESENT_STATE)) {
		pr_warn("%s: UHS2 Lane sync fail in 150ms.\n", mmc_hostname(host->mmc));
		sdhci_dumpregs(host);
		pr_debug("%s: UHS2 Lane sync fail in 150ms.\n", mmc_hostname(host->mmc));
		sdhci_dbg_dumpregs(host, "UHS2 Lane sync fail in 150ms");
		return -EIO;
	}

@@ -417,12 +417,12 @@ static int sdhci_uhs2_do_detect_init(struct mmc_host *mmc)
		host->ops->uhs2_pre_detect_init(host);

	if (sdhci_uhs2_interface_detect(host)) {
		pr_warn("%s: cannot detect UHS2 interface.\n", mmc_hostname(host->mmc));
		pr_debug("%s: cannot detect UHS2 interface.\n", mmc_hostname(host->mmc));
		return -EIO;
	}

	if (sdhci_uhs2_init(host)) {
		pr_warn("%s: UHS2 init fail.\n", mmc_hostname(host->mmc));
		pr_debug("%s: UHS2 init fail.\n", mmc_hostname(host->mmc));
		return -EIO;
	}

@@ -504,8 +504,8 @@ static int sdhci_uhs2_check_dormant(struct sdhci_host *host)
	if (read_poll_timeout(sdhci_readl, val, (val & SDHCI_UHS2_IN_DORMANT_STATE),
			      100, UHS2_CHECK_DORMANT_TIMEOUT_100MS, true, host,
			      SDHCI_PRESENT_STATE)) {
		pr_warn("%s: UHS2 IN_DORMANT fail in 100ms.\n", mmc_hostname(host->mmc));
		sdhci_dumpregs(host);
		pr_debug("%s: UHS2 IN_DORMANT fail in 100ms.\n", mmc_hostname(host->mmc));
		sdhci_dbg_dumpregs(host, "UHS2 IN_DORMANT fail in 100ms");
		return -EIO;
	}
	return 0;
Loading