Commit d3e64792 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull MMC host fixes from Ulf Hansson:

 - mmc_spi: Add SPI IDs to silence warning

 - sdhci: Fix ADMA for PAGE_SIZE >= 64KiB

 - sdhci-esdhc-imx: Disable broken CMDQ for imx8qm/imx8qxp/imx8mm

* tag 'mmc-v5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  mmc: spi: Add device-tree SPI IDs
  mmc: sdhci: Fix ADMA for PAGE_SIZE >= 64KiB
  mmc: sdhci-esdhc-imx: disable CMDQ support
parents 80d75202 5f719948
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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,
};
+0 −2
Original line number Diff line number Diff line
@@ -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,
};

+18 −3
Original line number Diff line number Diff line
@@ -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;
	}
+3 −1
Original line number Diff line number Diff line
@@ -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 */