Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5fe23c7f authored by Anton Vorontsov's avatar Anton Vorontsov Committed by Pierre Ossman
Browse files

sdhci: Add support for hosts that are only capable of 1-bit transfers



Some hosts (hardware configurations, or particular SD/MMC slots) may
not support 4-bit bus. For example, on MPC8569E-MDS boards we can
switch between serial (1-bit only) and nibble (4-bit) modes, thought
we have to disable more peripherals to work in 4-bit mode.

Along with some small core changes, this patch modifies sdhci-of
driver, so that now it looks for "sdhci,1-bit-only" property in the
device-tree, and if specified we enable a proper quirk.

Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: default avatarGrant Likely <grant.likely@secretlab.ca>
Signed-off-by: default avatarPierre Ossman <pierre@ossman.eu>
parent 04ac2f46
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -10,6 +10,8 @@ Required properties:
  - interrupts : should contain eSDHC interrupt.
  - interrupts : should contain eSDHC interrupt.
  - interrupt-parent : interrupt source phandle.
  - interrupt-parent : interrupt source phandle.
  - clock-frequency : specifies eSDHC base clock frequency.
  - clock-frequency : specifies eSDHC base clock frequency.
  - sdhci,1-bit-only : (optional) specifies that a controller can
    only handle 1-bit data transfers.


Example:
Example:


+3 −0
Original line number Original line Diff line number Diff line
@@ -250,6 +250,9 @@ static int __devinit sdhci_of_probe(struct of_device *ofdev,
		host->ops = &sdhci_of_data->ops;
		host->ops = &sdhci_of_data->ops;
	}
	}


	if (of_get_property(np, "sdhci,1-bit-only", NULL))
		host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA;

	clk = of_get_property(np, "clock-frequency", &size);
	clk = of_get_property(np, "clock-frequency", &size);
	if (clk && size == sizeof(*clk) && *clk)
	if (clk && size == sizeof(*clk) && *clk)
		of_host->clock = *clk;
		of_host->clock = *clk;
+4 −1
Original line number Original line Diff line number Diff line
@@ -1761,7 +1761,10 @@ int sdhci_add_host(struct sdhci_host *host)
	mmc->ops = &sdhci_ops;
	mmc->ops = &sdhci_ops;
	mmc->f_min = host->max_clk / 256;
	mmc->f_min = host->max_clk / 256;
	mmc->f_max = host->max_clk;
	mmc->f_max = host->max_clk;
	mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ;
	mmc->caps = MMC_CAP_SDIO_IRQ;

	if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
		mmc->caps |= MMC_CAP_4_BIT_DATA;


	if (caps & SDHCI_CAN_DO_HISPD)
	if (caps & SDHCI_CAN_DO_HISPD)
		mmc->caps |= MMC_CAP_SD_HIGHSPEED;
		mmc->caps |= MMC_CAP_SD_HIGHSPEED;
+2 −0
Original line number Original line Diff line number Diff line
@@ -228,6 +228,8 @@ struct sdhci_host {
#define SDHCI_QUIRK_FORCE_BLK_SZ_2048			(1<<20)
#define SDHCI_QUIRK_FORCE_BLK_SZ_2048			(1<<20)
/* Controller cannot do multi-block transfers */
/* Controller cannot do multi-block transfers */
#define SDHCI_QUIRK_NO_MULTIBLOCK			(1<<21)
#define SDHCI_QUIRK_NO_MULTIBLOCK			(1<<21)
/* Controller can only handle 1-bit data transfers */
#define SDHCI_QUIRK_FORCE_1_BIT_DATA			(1<<22)


	int			irq;		/* Device IRQ */
	int			irq;		/* Device IRQ */
	void __iomem *		ioaddr;		/* Mapped address */
	void __iomem *		ioaddr;		/* Mapped address */