mmc: dt: Consolidate DT bindings

This patch unifies the current DT MMC bindings documentation and code,
adds generic MMC DT bindings documentation, and updates .dts files for
consistency.

[cjb: typo fixes, addition of max-frequency property]
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2012-05-13 00:14:24 -04:00
parent e6511df4f2
commit 7f217794ff
20 changed files with 66 additions and 21 deletions

View File

@ -11,9 +11,11 @@ Required properties:
- 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,wp-inverted : (optional) specifies that eSDHC controller - sdhci,wp-inverted : (optional) specifies that eSDHC controller
reports inverted write-protect state; reports inverted write-protect state; New devices should use
the generic "wp-inverted" property.
- sdhci,1-bit-only : (optional) specifies that a controller can - sdhci,1-bit-only : (optional) specifies that a controller can
only handle 1-bit data transfers. only handle 1-bit data transfers. New devices should use the
generic "bus-width = <1>" property.
- sdhci,auto-cmd12: (optional) specifies that a controller can - sdhci,auto-cmd12: (optional) specifies that a controller can
only handle auto CMD12. only handle auto CMD12.

View File

@ -9,7 +9,7 @@ Required properties:
- interrupts : Should contain eSDHC interrupt - interrupts : Should contain eSDHC interrupt
Optional properties: Optional properties:
- fsl,card-wired : Indicate the card is wired to host permanently - non-removable : Indicate the card is wired to host permanently
- fsl,cd-internal : Indicate to use controller internal card detection - fsl,cd-internal : Indicate to use controller internal card detection
- fsl,wp-internal : Indicate to use controller internal write protection - fsl,wp-internal : Indicate to use controller internal write protection
- cd-gpios : Specify GPIOs for card detection - cd-gpios : Specify GPIOs for card detection

View File

@ -10,7 +10,8 @@ Required properties:
Optional properties: Optional properties:
- gpios : may specify GPIOs in this order: Card-Detect GPIO, - gpios : may specify GPIOs in this order: Card-Detect GPIO,
Write-Protect GPIO. Write-Protect GPIO. Note that this does not follow the
binding from mmc.txt, for historic reasons.
- interrupts : the interrupt of a card detect interrupt. - interrupts : the interrupt of a card detect interrupt.
- interrupt-parent : the phandle for the interrupt controller that - interrupt-parent : the phandle for the interrupt controller that
services interrupts for this device. services interrupts for this device.

View File

@ -0,0 +1,27 @@
These properties are common to multiple MMC host controllers. Any host
that requires the respective functionality should implement them using
these definitions.
Required properties:
- bus-width: Number of data lines, can be <1>, <4>, or <8>
Optional properties:
- cd-gpios : Specify GPIOs for card detection, see gpio binding
- wp-gpios : Specify GPIOs for write protection, see gpio binding
- cd-inverted: when present, polarity on the wp gpio line is inverted
- wp-inverted: when present, polarity on the wp gpio line is inverted
- non-removable: non-removable slot (like eMMC)
- max-frequency: maximum operating clock frequency
Example:
sdhci@ab000000 {
compatible = "sdhci";
reg = <0xab000000 0x200>;
interrupts = <23>;
bus-width = <4>;
cd-gpios = <&gpio 69 0>;
cd-inverted;
wp-gpios = <&gpio 70 0>;
max-frequency = <50000000>;
}

View File

@ -7,12 +7,12 @@ Required properties:
- compatible : Should be "nvidia,<chip>-sdhci" - compatible : Should be "nvidia,<chip>-sdhci"
- reg : Should contain SD/MMC registers location and length - reg : Should contain SD/MMC registers location and length
- interrupts : Should contain SD/MMC interrupt - interrupts : Should contain SD/MMC interrupt
- bus-width : Number of data lines, can be <1>, <4>, or <8>
Optional properties: Optional properties:
- cd-gpios : Specify GPIOs for card detection - cd-gpios : Specify GPIOs for card detection
- wp-gpios : Specify GPIOs for write protection - wp-gpios : Specify GPIOs for write protection
- power-gpios : Specify GPIOs for power control - power-gpios : Specify GPIOs for power control
- support-8bit : Boolean, indicates if 8-bit mode should be used.
Example: Example:
@ -23,5 +23,5 @@ sdhci@c8000200 {
cd-gpios = <&gpio 69 0>; /* gpio PI5 */ cd-gpios = <&gpio 69 0>; /* gpio PI5 */
wp-gpios = <&gpio 57 0>; /* gpio PH1 */ wp-gpios = <&gpio 57 0>; /* gpio PH1 */
power-gpios = <&gpio 155 0>; /* gpio PT3 */ power-gpios = <&gpio 155 0>; /* gpio PT3 */
support-8bit; bus-width = <8>;
}; };

View File

@ -15,7 +15,7 @@ Optional properties:
ti,dual-volt: boolean, supports dual voltage cards ti,dual-volt: boolean, supports dual voltage cards
<supply-name>-supply: phandle to the regulator device tree node <supply-name>-supply: phandle to the regulator device tree node
"supply-name" examples are "vmmc", "vmmc_aux" etc "supply-name" examples are "vmmc", "vmmc_aux" etc
ti,bus-width: Number of data lines, default assumed is 1 if the property is missing. bus-width: Number of data lines, default assumed is 1 if the property is missing.
cd-gpios: GPIOs for card detection cd-gpios: GPIOs for card detection
wp-gpios: GPIOs for write protection wp-gpios: GPIOs for write protection
ti,non-removable: non-removable slot (like eMMC) ti,non-removable: non-removable slot (like eMMC)
@ -27,7 +27,7 @@ Example:
reg = <0x4809c000 0x400>; reg = <0x4809c000 0x400>;
ti,hwmods = "mmc1"; ti,hwmods = "mmc1";
ti,dual-volt; ti,dual-volt;
ti,bus-width = <4>; bus-width = <4>;
vmmc-supply = <&vmmc>; /* phandle to regulator node */ vmmc-supply = <&vmmc>; /* phandle to regulator node */
ti,non-removable; ti,non-removable;
}; };

View File

@ -35,7 +35,7 @@
}; };
esdhc@50008000 { /* ESDHC2 */ esdhc@50008000 { /* ESDHC2 */
fsl,card-wired; non-removable;
status = "okay"; status = "okay";
}; };
@ -76,7 +76,7 @@
}; };
esdhc@50020000 { /* ESDHC3 */ esdhc@50020000 { /* ESDHC3 */
fsl,card-wired; non-removable;
status = "okay"; status = "okay";
}; };
}; };

View File

@ -41,7 +41,7 @@
}; };
usdhc@0219c000 { /* uSDHC4 */ usdhc@0219c000 { /* uSDHC4 */
fsl,card-wired; non-removable;
vmmc-supply = <&reg_3p3v>; vmmc-supply = <&reg_3p3v>;
status = "okay"; status = "okay";
}; };

View File

@ -57,7 +57,7 @@
&mmc1 { &mmc1 {
vmmc-supply = <&vmmc1>; vmmc-supply = <&vmmc1>;
vmmc_aux-supply = <&vsim>; vmmc_aux-supply = <&vsim>;
ti,bus-width = <8>; bus-width = <8>;
}; };
&mmc2 { &mmc2 {

View File

@ -55,7 +55,7 @@
&mmc1 { &mmc1 {
vmmc-supply = <&vmmc>; vmmc-supply = <&vmmc>;
ti,bus-width = <8>; bus-width = <8>;
}; };
&mmc2 { &mmc2 {
@ -72,5 +72,5 @@
&mmc5 { &mmc5 {
ti,non-removable; ti,non-removable;
ti,bus-width = <4>; bus-width = <4>;
}; };

View File

@ -94,12 +94,12 @@
&mmc1 { &mmc1 {
vmmc-supply = <&vmmc>; vmmc-supply = <&vmmc>;
ti,bus-width = <8>; bus-width = <8>;
}; };
&mmc2 { &mmc2 {
vmmc-supply = <&vaux1>; vmmc-supply = <&vaux1>;
ti,bus-width = <8>; bus-width = <8>;
ti,non-removable; ti,non-removable;
}; };
@ -112,6 +112,6 @@
}; };
&mmc5 { &mmc5 {
ti,bus-width = <4>; bus-width = <4>;
ti,non-removable; ti,non-removable;
}; };

View File

@ -54,6 +54,7 @@
cd-gpios = <&gpio 69 0>; /* gpio PI5 */ cd-gpios = <&gpio 69 0>; /* gpio PI5 */
wp-gpios = <&gpio 155 0>; /* gpio PT3 */ wp-gpios = <&gpio 155 0>; /* gpio PT3 */
power-gpios = <&gpio 31 0>; /* gpio PD7 */ power-gpios = <&gpio 31 0>; /* gpio PD7 */
bus-width = <4>;
}; };
sdhci@78000200 { sdhci@78000200 {
@ -66,5 +67,6 @@
sdhci@78000400 { sdhci@78000400 {
support-8bit; support-8bit;
bus-width = <8>;
}; };
}; };

View File

@ -100,6 +100,7 @@
cd-gpios = <&gpio 69 0>; /* gpio PI5 */ cd-gpios = <&gpio 69 0>; /* gpio PI5 */
wp-gpios = <&gpio 57 0>; /* gpio PH1 */ wp-gpios = <&gpio 57 0>; /* gpio PH1 */
power-gpios = <&gpio 155 0>; /* gpio PT3 */ power-gpios = <&gpio 155 0>; /* gpio PT3 */
bus-width = <4>;
}; };
sdhci@c8000400 { sdhci@c8000400 {
@ -111,5 +112,6 @@
wp-gpios = <&gpio 59 0>; /* gpio PH3 */ wp-gpios = <&gpio 59 0>; /* gpio PH3 */
power-gpios = <&gpio 70 0>; /* gpio PI6 */ power-gpios = <&gpio 70 0>; /* gpio PI6 */
support-8bit; support-8bit;
bus-width = <8>;
}; };
}; };

View File

@ -97,6 +97,7 @@
cd-gpios = <&gpio 173 0>; /* gpio PV5 */ cd-gpios = <&gpio 173 0>; /* gpio PV5 */
wp-gpios = <&gpio 57 0>; /* gpio PH1 */ wp-gpios = <&gpio 57 0>; /* gpio PH1 */
power-gpios = <&gpio 169 0>; /* gpio PV1 */ power-gpios = <&gpio 169 0>; /* gpio PV1 */
bus-width = <4>;
}; };
sdhci@c8000200 { sdhci@c8000200 {
@ -109,6 +110,7 @@
sdhci@c8000600 { sdhci@c8000600 {
support-8bit; support-8bit;
bus-width = <8>;
}; };
gpio-keys { gpio-keys {

View File

@ -104,10 +104,12 @@
cd-gpios = <&gpio 69 0>; /* gpio PI5 */ cd-gpios = <&gpio 69 0>; /* gpio PI5 */
wp-gpios = <&gpio 57 0>; /* gpio PH1 */ wp-gpios = <&gpio 57 0>; /* gpio PH1 */
power-gpios = <&gpio 70 0>; /* gpio PI6 */ power-gpios = <&gpio 70 0>; /* gpio PI6 */
bus-width = <4>;
}; };
sdhci@c8000600 { sdhci@c8000600 {
support-8bit; support-8bit;
bus-width = <8>;
}; };
usb@c5000000 { usb@c5000000 {

View File

@ -100,9 +100,11 @@
cd-gpios = <&gpio 69 0>; /* gpio PI5 */ cd-gpios = <&gpio 69 0>; /* gpio PI5 */
wp-gpios = <&gpio 57 0>; /* gpio PH1 */ wp-gpios = <&gpio 57 0>; /* gpio PH1 */
power-gpios = <&gpio 70 0>; /* gpio PI6 */ power-gpios = <&gpio 70 0>; /* gpio PI6 */
bus-width = <4>;
}; };
sdhci@c8000600 { sdhci@c8000600 {
support-8bit; support-8bit;
bus-width = <8>;
}; };
}; };

View File

@ -119,6 +119,7 @@
sdhc@2e000 { sdhc@2e000 {
status = "disabled"; status = "disabled";
sdhci,1-bit-only; sdhci,1-bit-only;
bus-width = <1>;
}; };
par_io@e0100 { par_io@e0100 {

View File

@ -1766,7 +1766,7 @@ static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
pdata->slots[0].nonremovable = true; pdata->slots[0].nonremovable = true;
pdata->slots[0].no_regulator_off_init = true; pdata->slots[0].no_regulator_off_init = true;
} }
of_property_read_u32(np, "ti,bus-width", &bus_width); of_property_read_u32(np, "bus-width", &bus_width);
if (bus_width == 4) if (bus_width == 4)
pdata->slots[0].caps |= MMC_CAP_4_BIT_DATA; pdata->slots[0].caps |= MMC_CAP_4_BIT_DATA;
else if (bus_width == 8) else if (bus_width == 8)

View File

@ -402,7 +402,7 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
if (!np) if (!np)
return -ENODEV; return -ENODEV;
if (of_get_property(np, "fsl,card-wired", NULL)) if (of_get_property(np, "non-removable", NULL))
boarddata->cd_type = ESDHC_CD_PERMANENT; boarddata->cd_type = ESDHC_CD_PERMANENT;
if (of_get_property(np, "fsl,cd-controller", NULL)) if (of_get_property(np, "fsl,cd-controller", NULL))

View File

@ -42,7 +42,8 @@ static struct sdhci_ops sdhci_pltfm_ops = {
#ifdef CONFIG_OF #ifdef CONFIG_OF
static bool sdhci_of_wp_inverted(struct device_node *np) static bool sdhci_of_wp_inverted(struct device_node *np)
{ {
if (of_get_property(np, "sdhci,wp-inverted", NULL)) if (of_get_property(np, "sdhci,wp-inverted", NULL) ||
of_get_property(np, "wp-inverted", NULL))
return true; return true;
/* Old device trees don't have the wp-inverted property. */ /* Old device trees don't have the wp-inverted property. */
@ -59,13 +60,16 @@ void sdhci_get_of_property(struct platform_device *pdev)
struct sdhci_host *host = platform_get_drvdata(pdev); struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
const __be32 *clk; const __be32 *clk;
u32 bus_width;
int size; int size;
if (of_device_is_available(np)) { if (of_device_is_available(np)) {
if (of_get_property(np, "sdhci,auto-cmd12", NULL)) if (of_get_property(np, "sdhci,auto-cmd12", NULL))
host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12; host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;
if (of_get_property(np, "sdhci,1-bit-only", NULL)) if (of_get_property(np, "sdhci,1-bit-only", NULL) ||
(of_property_read_u32(np, "bus-width", &bus_width) == 0 &&
bus_width == 1))
host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA; host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA;
if (sdhci_of_wp_inverted(np)) if (sdhci_of_wp_inverted(np))