diff options
Diffstat (limited to 'drivers/mmc/host')
| -rw-r--r-- | drivers/mmc/host/meson-mx-sdhc-mmc.c | 16 | ||||
| -rw-r--r-- | drivers/mmc/host/mmc_spi.c | 7 | ||||
| -rw-r--r-- | drivers/mmc/host/mmci_stm32_sdmmc.c | 2 | ||||
| -rw-r--r-- | drivers/mmc/host/mtk-sd.c | 4 | ||||
| -rw-r--r-- | drivers/mmc/host/renesas_sdhi_core.c | 2 | ||||
| -rw-r--r-- | drivers/mmc/host/sdhci-esdhc-imx.c | 2 | ||||
| -rw-r--r-- | drivers/mmc/host/sdhci-tegra.c | 43 | ||||
| -rw-r--r-- | drivers/mmc/host/sdhci.c | 21 | ||||
| -rw-r--r-- | drivers/mmc/host/sdhci.h | 4 | 
9 files changed, 76 insertions, 25 deletions
| diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c index 7cd9c0ec2fcf..8fdd0bbbfa21 100644 --- a/drivers/mmc/host/meson-mx-sdhc-mmc.c +++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c @@ -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; diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index f4c8e1a61f53..b431cdd27353 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c @@ -1514,6 +1514,12 @@ static int mmc_spi_remove(struct spi_device *spi)  	return 0;  } +static const struct spi_device_id mmc_spi_dev_ids[] = { +	{ "mmc-spi-slot"}, +	{ }, +}; +MODULE_DEVICE_TABLE(spi, mmc_spi_dev_ids); +  static const struct of_device_id mmc_spi_of_match_table[] = {  	{ .compatible = "mmc-spi-slot", },  	{}, @@ -1525,6 +1531,7 @@ static struct spi_driver mmc_spi_driver = {  		.name =		"mmc_spi",  		.of_match_table = mmc_spi_of_match_table,  	}, +	.id_table =	mmc_spi_dev_ids,  	.probe =	mmc_spi_probe,  	.remove =	mmc_spi_remove,  }; diff --git a/drivers/mmc/host/mmci_stm32_sdmmc.c b/drivers/mmc/host/mmci_stm32_sdmmc.c index fdaa11f92fe6..a75d3dd34d18 100644 --- a/drivers/mmc/host/mmci_stm32_sdmmc.c +++ b/drivers/mmc/host/mmci_stm32_sdmmc.c @@ -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); diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 943940b44e83..632775217d35 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -2291,8 +2291,10 @@ static int msdc_execute_hs400_tuning(struct mmc_host *mmc, struct mmc_card *card  			sdr_set_field(host->base + PAD_DS_TUNE,  				      PAD_DS_TUNE_DLY1, i);  		ret = mmc_get_ext_csd(card, &ext_csd); -		if (!ret) +		if (!ret) {  			result_dly1 |= (1 << i); +			kfree(ext_csd); +		}  	}  	host->hs400_tuning = false; diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index a4407f391f66..f5b2684ad805 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -673,7 +673,7 @@ static int renesas_sdhi_execute_tuning(struct mmc_host *mmc, u32 opcode)  	/* Issue CMD19 twice for each tap */  	for (i = 0; i < 2 * priv->tap_num; i++) { -		int cmd_error; +		int cmd_error = 0;  		/* Set sampling clock position */  		sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TAPSET, i % priv->tap_num); diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index afaf33707d46..764ee1b761d9 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -310,7 +310,6 @@ static struct esdhc_soc_data usdhc_imx8qxp_data = {  	.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING  			| ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200  			| ESDHC_FLAG_HS400 | ESDHC_FLAG_HS400_ES -			| ESDHC_FLAG_CQHCI  			| ESDHC_FLAG_STATE_LOST_IN_LPMODE  			| ESDHC_FLAG_CLK_RATE_LOST_IN_PM_RUNTIME,  }; @@ -319,7 +318,6 @@ static struct esdhc_soc_data usdhc_imx8mm_data = {  	.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING  			| ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200  			| ESDHC_FLAG_HS400 | ESDHC_FLAG_HS400_ES -			| ESDHC_FLAG_CQHCI  			| ESDHC_FLAG_STATE_LOST_IN_LPMODE,  }; diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index a5001875876b..9762ffab2e23 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -356,23 +356,6 @@ static void tegra_sdhci_set_tap(struct sdhci_host *host, unsigned int tap)  	}  } -static void tegra_sdhci_hs400_enhanced_strobe(struct mmc_host *mmc, -					      struct mmc_ios *ios) -{ -	struct sdhci_host *host = mmc_priv(mmc); -	u32 val; - -	val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL); - -	if (ios->enhanced_strobe) -		val |= SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE; -	else -		val &= ~SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE; - -	sdhci_writel(host, val, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL); - -} -  static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask)  {  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); @@ -793,6 +776,32 @@ static void tegra_sdhci_set_clock(struct sdhci_host *host, unsigned int clock)  	}  } +static void tegra_sdhci_hs400_enhanced_strobe(struct mmc_host *mmc, +					      struct mmc_ios *ios) +{ +	struct sdhci_host *host = mmc_priv(mmc); +	u32 val; + +	val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL); + +	if (ios->enhanced_strobe) { +		val |= SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE; +		/* +		 * When CMD13 is sent from mmc_select_hs400es() after +		 * switching to HS400ES mode, the bus is operating at +		 * either MMC_HIGH_26_MAX_DTR or MMC_HIGH_52_MAX_DTR. +		 * To meet Tegra SDHCI requirement at HS400ES mode, force SDHCI +		 * interface clock to MMC_HS200_MAX_DTR (200 MHz) so that host +		 * controller CAR clock and the interface clock are rate matched. +		 */ +		tegra_sdhci_set_clock(host, MMC_HS200_MAX_DTR); +	} else { +		val &= ~SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE; +	} + +	sdhci_writel(host, val, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL); +} +  static unsigned int tegra_sdhci_get_max_clock(struct sdhci_host *host)  {  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 269c86569402..07c6da1f2f0f 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -771,7 +771,19 @@ static void sdhci_adma_table_pre(struct sdhci_host *host,  			len -= offset;  		} -		BUG_ON(len > 65536); +		/* +		 * The block layer forces a minimum segment size of PAGE_SIZE, +		 * so 'len' can be too big here if PAGE_SIZE >= 64KiB. Write +		 * multiple descriptors, noting that the ADMA table is sized +		 * for 4KiB chunks anyway, so it will be big enough. +		 */ +		while (len > host->max_adma) { +			int n = 32 * 1024; /* 32KiB*/ + +			__sdhci_adma_write_desc(host, &desc, addr, n, ADMA2_TRAN_VALID); +			addr += n; +			len -= n; +		}  		/* tran, valid */  		if (len) @@ -3968,6 +3980,7 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,  	 * descriptor for each segment, plus 1 for a nop end descriptor.  	 */  	host->adma_table_cnt = SDHCI_MAX_SEGS * 2 + 1; +	host->max_adma = 65536;  	host->max_timeout_count = 0xE; @@ -4633,10 +4646,12 @@ int sdhci_setup_host(struct sdhci_host *host)  	 * be larger than 64 KiB though.  	 */  	if (host->flags & SDHCI_USE_ADMA) { -		if (host->quirks & SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC) +		if (host->quirks & SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC) { +			host->max_adma = 65532; /* 32-bit alignment */  			mmc->max_seg_size = 65535; -		else +		} else {  			mmc->max_seg_size = 65536; +		}  	} else {  		mmc->max_seg_size = mmc->max_req_size;  	} diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index bb883553d3b4..d7929d725730 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -340,7 +340,8 @@ struct sdhci_adma2_64_desc {  /*   * Maximum segments assuming a 512KiB maximum requisition size and a minimum - * 4KiB page size. + * 4KiB page size. Note this also allows enough for multiple descriptors in + * case of PAGE_SIZE >= 64KiB.   */  #define SDHCI_MAX_SEGS		128 @@ -543,6 +544,7 @@ struct sdhci_host {  	unsigned int blocks;	/* remaining PIO blocks */  	int sg_count;		/* Mapped sg entries */ +	int max_adma;		/* Max. length in ADMA descriptor */  	void *adma_table;	/* ADMA descriptor table */  	void *align_buffer;	/* Bounce buffer */ |