Skip to contentSkip to conversation

mmc: mmci: add support for STM32 SD controller

PATCH Superseded Andrea Merello 3 participants 17 messages Nov 8, 2016 – Nov 14, 2016

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover mmc: mmci: add support for STM32 SD controller

The SD controller found in STM32 MCUs happens to be yet another variant of the ARM PrimeCell PL18x SD host controller, for which the mmci driver exists.

This series adds support for it to the mmci driver.

As other varians, this one need some specific quirks, that this series address. Most notably this variant has not AMBA PrimeCell id registers, so we can't probe it using the AMBA PrimeCell generic "compatible" and mechanism; rather this series adds support to the mmci driver for register itself also as platform driver, so that specific "copatible" strings can also be used.

I tested this on my STM32F469-disco board, that is able to boot from an SD card, and write/read to/from it.

RFT for other variants (to check I didn't broke anything) and with MMC cards. In particular I tried to implement also support for open-collector communication mode, that AFAICT is used only on MMC cards, but I couldn't test it.

Andrea Merello (9):
mmc: mmci: don't pretend IP variants with only one IRQ to have two
mask regs
mmc: mmci: add support for not-amba, but still compatible, variants
mmc: mmci: don't pretend all variants to have MCI_STARBITERR flag
mmc: mmci: add support for setting pad type via pinctrl
mmc: mmci: add STM32 variant
DT: stm32f429: add pin map for SDIO controller
DT: stm32f429: add node for SDIO controller
DT: stm32f469-disco: add node for SDIO controller
Documentation: document mmci STM32 DT binding

 Documentation/devicetree/bindings/mmc/mmci.txt |   2 +-
 arch/arm/boot/dts/stm32f429.dtsi               |  45 +++-
 arch/arm/boot/dts/stm32f469-disco.dts          |  30 +++
 drivers/mmc/host/Kconfig                       |   8 +-
 drivers/mmc/host/mmci.c                        | 360 +++++++++++++++++++------
 drivers/mmc/host/mmci.h                        |   7 +-
 6 files changed, 359 insertions(+), 93 deletions(-)

--
2.7.4

#1 lore raw

PATCH 1/9 mmc: mmci: don't pretend IP variants with only one IRQ to have two mask regs

Currently the driver supports both devices with one and two IRQ lines.

Two mask registers are used in order to select which events have to actually generate an interrupt on each IRQ line.

It seems that in the single-IRQ case it's assumed that the IRQs lines are simply OR-ed, while the two mask registers are still present. The driver still programs the two mask registers separately.

However the STM32 variant has only one IRQ, and also has only one mask register.

This patch prepares for STM32 variant support by making the driver using only one mask register when only one IRQ is available.

Tested only on STM32 variant. RFT for variants other than STM32

---
 drivers/mmc/host/mmci.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/mmc/host/mmci.c +8 -9
index df990bb..b826a3a 100644
@@ -389,9 +389,9 @@ static void mmci_set_mask1(struct mmci_host *host, unsigned int mask)
 		mask0 |= mask;
 
 		writel(mask0, base + MMCIMASK0);
+	} else {
+		writel(mask, base + MMCIMASK1);
 	}
-
-	writel(mask, base + MMCIMASK1);
 }
 
 static void mmci_stop_data(struct mmci_host *host)
@@ -1231,12 +1231,10 @@ static irqreturn_t mmci_irq(int irq, void *dev_id)
 
 	do {
 		status = readl(host->base + MMCISTATUS);
+		status &= readl(host->base + MMCIMASK0);
 
 		if (host->singleirq) {
-			if (status & readl(host->base + MMCIMASK1))
-				mmci_pio_irq(irq, dev_id);
-
-			status &= ~MCI_IRQ1MASK;
+			mmci_pio_irq(irq, dev_id);
 		}
 
 		/*
@@ -1244,7 +1242,6 @@ static irqreturn_t mmci_irq(int irq, void *dev_id)
 		 * enabled) since the HW seems to be triggering the IRQ on both
 		 * edges while monitoring DAT0 for busy completion.
 		 */
-		status &= readl(host->base + MMCIMASK0);
 		writel(status, host->base + MMCICLEAR);
 
 		dev_dbg(mmc_dev(host->mmc), "irq0 (data+cmd) %08x\n", status);
@@ -1656,7 +1653,8 @@ static int mmci_probe(struct amba_device *dev,
 	spin_lock_init(&host->lock);
 
 	writel(0, host->base + MMCIMASK0);
-	writel(0, host->base + MMCIMASK1);
+	if (!host->singleirq)
+		writel(0, host->base + MMCIMASK1);
 	writel(0xfff, host->base + MMCICLEAR);
 
 	/*
@@ -1746,7 +1744,8 @@ static int mmci_remove(struct amba_device *dev)
 		mmc_remove_host(mmc);
 
 		writel(0, host->base + MMCIMASK0);
-		writel(0, host->base + MMCIMASK1);
+		if (!host->singleirq)
+			writel(0, host->base + MMCIMASK1);
 
 		writel(0, host->base + MMCICOMMAND);
 		writel(0, host->base + MMCIDATACTRL);
Signature · 1 line
2.7.4
#5 lore raw

PATCH 3/9 mmc: mmci: don't pretend all variants to have MCI_STARBITERR flag

In reply to Andrea Merello

This patch prepares for supporting the STM32 variant, that has no such bit in the status register.

---
 drivers/mmc/host/mmci.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/mmc/host/mmci.c +12 -2
index b1dfde3..0c629e3 100644
@@ -106,6 +106,7 @@ struct variant_data {
 	bool			qcom_fifo;
 	bool			qcom_dml;
 	bool			reversed_irq_handling;
+	bool			has_start_err;
 };
 
 static __maybe_unused struct variant_data variant_arm = {
@@ -115,6 +116,7 @@ static __maybe_unused struct variant_data variant_arm = {
 	.pwrreg_powerup		= MCI_PWR_UP,
 	.f_max			= 100000000,
 	.reversed_irq_handling	= true,
+	.has_start_err		= true,
 };
 
 static __maybe_unused struct variant_data variant_arm_extended_fifo = {
@@ -123,6 +125,7 @@ static __maybe_unused struct variant_data variant_arm_extended_fifo = {
 	.datalength_bits	= 16,
 	.pwrreg_powerup		= MCI_PWR_UP,
 	.f_max			= 100000000,
+	.has_start_err		= true,
 };
 
 static __maybe_unused struct variant_data variant_arm_extended_fifo_hwfc = {
@@ -132,6 +135,7 @@ static __maybe_unused struct variant_data variant_arm_extended_fifo_hwfc = {
 	.datalength_bits	= 16,
 	.pwrreg_powerup		= MCI_PWR_UP,
 	.f_max			= 100000000,
+	.has_start_err		= true,
 };
 
 static __maybe_unused struct variant_data variant_u300 = {
@@ -147,6 +151,7 @@ static __maybe_unused struct variant_data variant_u300 = {
 	.signal_direction	= true,
 	.pwrreg_clkgate		= true,
 	.pwrreg_nopower		= true,
+	.has_start_err		= true,
 };
 
 static __maybe_unused struct variant_data variant_nomadik = {
@@ -163,6 +168,7 @@ static __maybe_unused struct variant_data variant_nomadik = {
 	.signal_direction	= true,
 	.pwrreg_clkgate		= true,
 	.pwrreg_nopower		= true,
+	.has_start_err		= true,
 };
 
 static __maybe_unused struct variant_data variant_ux500 = {
@@ -182,6 +188,7 @@ static __maybe_unused struct variant_data variant_ux500 = {
 	.pwrreg_clkgate		= true,
 	.busy_detect		= true,
 	.pwrreg_nopower		= true,
+	.has_start_err		= true,
 };
 
 static __maybe_unused struct variant_data variant_ux500v2 = {
@@ -203,6 +210,7 @@ static __maybe_unused struct variant_data variant_ux500v2 = {
 	.pwrreg_clkgate		= true,
 	.busy_detect		= true,
 	.pwrreg_nopower		= true,
+	.has_start_err		= true,
 };
 
 static __maybe_unused struct variant_data variant_qcom = {
@@ -221,6 +229,7 @@ static __maybe_unused struct variant_data variant_qcom = {
 	.explicit_mclk_control	= true,
 	.qcom_fifo		= true,
 	.qcom_dml		= true,
+	.has_start_err		= true,
 };
 
 static int mmci_card_busy(struct mmc_host *mmc)
@@ -909,8 +918,9 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
 		return;
 
 	/* First check for errors */
-	if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_STARTBITERR|
-		      MCI_TXUNDERRUN|MCI_RXOVERRUN)) {
+	if (status & (MCI_DATACRCFAIL | MCI_DATATIMEOUT |
+			(host->variant->has_start_err ? MCI_STARTBITERR : 0) |
+			MCI_TXUNDERRUN | MCI_RXOVERRUN)) {
 		u32 remain, success;
 
 		/* Terminate the DMA transfer */
Signature · 1 line
2.7.4
#6 lore raw

PATCH 4/9 mmc: mmci: add support for setting pad type via pinctrl

In reply to Andrea Merello

The STM32 variant hasn't the control bit to switch pads in opendrain mode. In this case we can achive the same result by askint to the pinmux driver to configure pins for us.

This patch make the mmci driver able to do this whenever needed.

---
 drivers/mmc/host/mmci.c | 52 +++++++++++++++++++++++++++++++++++++++----------
 drivers/mmc/host/mmci.h |  7 +++++--
 2 files changed, 47 insertions(+), 12 deletions(-)
drivers/mmc/host/mmci.c +42 -10
index 0c629e3..170c78a 100644
@@ -107,6 +107,7 @@ struct variant_data {
 	bool			qcom_dml;
 	bool			reversed_irq_handling;
 	bool			has_start_err;
+	bool			has_pad_config;
 };
 
 static __maybe_unused struct variant_data variant_arm = {
@@ -117,6 +118,7 @@ static __maybe_unused struct variant_data variant_arm = {
 	.f_max			= 100000000,
 	.reversed_irq_handling	= true,
 	.has_start_err		= true,
+	.has_pad_config		= true,
 };
 
 static __maybe_unused struct variant_data variant_arm_extended_fifo = {
@@ -126,6 +128,7 @@ static __maybe_unused struct variant_data variant_arm_extended_fifo = {
 	.pwrreg_powerup		= MCI_PWR_UP,
 	.f_max			= 100000000,
 	.has_start_err		= true,
+	.has_pad_config		= true,
 };
 
 static __maybe_unused struct variant_data variant_arm_extended_fifo_hwfc = {
@@ -136,6 +139,7 @@ static __maybe_unused struct variant_data variant_arm_extended_fifo_hwfc = {
 	.pwrreg_powerup		= MCI_PWR_UP,
 	.f_max			= 100000000,
 	.has_start_err		= true,
+	.has_pad_config		= true,
 };
 
 static __maybe_unused struct variant_data variant_u300 = {
@@ -152,6 +156,7 @@ static __maybe_unused struct variant_data variant_u300 = {
 	.pwrreg_clkgate		= true,
 	.pwrreg_nopower		= true,
 	.has_start_err		= true,
+	.has_pad_config		= true,
 };
 
 static __maybe_unused struct variant_data variant_nomadik = {
@@ -169,6 +174,7 @@ static __maybe_unused struct variant_data variant_nomadik = {
 	.pwrreg_clkgate		= true,
 	.pwrreg_nopower		= true,
 	.has_start_err		= true,
+	.has_pad_config		= true,
 };
 
 static __maybe_unused struct variant_data variant_ux500 = {
@@ -189,6 +195,7 @@ static __maybe_unused struct variant_data variant_ux500 = {
 	.busy_detect		= true,
 	.pwrreg_nopower		= true,
 	.has_start_err		= true,
+	.has_pad_config		= true,
 };
 
 static __maybe_unused struct variant_data variant_ux500v2 = {
@@ -211,6 +218,7 @@ static __maybe_unused struct variant_data variant_ux500v2 = {
 	.busy_detect		= true,
 	.pwrreg_nopower		= true,
 	.has_start_err		= true,
+	.has_pad_config		= true,
 };
 
 static __maybe_unused struct variant_data variant_qcom = {
@@ -230,6 +238,7 @@ static __maybe_unused struct variant_data variant_qcom = {
 	.qcom_fifo		= true,
 	.qcom_dml		= true,
 	.has_start_err		= true,
+	.has_pad_config		= true,
 };
 
 static int mmci_card_busy(struct mmc_host *mmc)
@@ -1317,6 +1326,8 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	u32 pwr = 0;
 	unsigned long flags;
 	int ret;
+	struct pinctrl_state *pins;
+	bool is_opendrain;
 
 	if (host->plat->ios_handler &&
 		host->plat->ios_handler(mmc_dev(mmc), ios))
@@ -1375,16 +1386,31 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 				~MCI_ST_DATA2DIREN);
 	}
 
-	if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN) {
-		if (host->hw_designer != AMBA_VENDOR_ST)
-			pwr |= MCI_ROD;
-		else {
-			/*
-			 * The ST Micro variant use the ROD bit for something
-			 * else and only has OD (Open Drain).
-			 */
-			pwr |= MCI_OD;
+	if (host->variant->has_pad_config) {
+		if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN) {
+			if (host->hw_designer != AMBA_VENDOR_ST) {
+				pwr |= MCI_ROD;
+			} else {
+				/*
+				 * The ST Micro variant use the ROD bit for
+				 * something else and only has OD (Open Drain).
+				 */
+				pwr |= MCI_OD;
+			}
 		}
+	} else {
+		/*
+		 * If the variant cannot configure the pads by its own, then we
+		 * expect the pinctrl to be able to do that for us
+		 */
+		is_opendrain = (ios->bus_mode == MMC_BUSMODE_OPENDRAIN);
+		pins = pinctrl_lookup_state(host->pinctrl, is_opendrain ?
+					MMCI_PINCTRL_STATE_OPENDRAIN :
+					MMCI_PINCTRL_STATE_PUSHPULL);
+		if (IS_ERR(pins))
+			dev_warn(mmc_dev(mmc), "Cannot select pin drive type via pinctrl\n");
+		else
+			pinctrl_select_state(host->pinctrl, pins);
 	}
 
 	/*
@@ -1492,7 +1518,6 @@ static int mmci_of_parse(struct device_node *np, struct mmc_host *mmc)
 		mmc->caps |= MMC_CAP_MMC_HIGHSPEED;
 	if (of_get_property(np, "mmc-cap-sd-highspeed", NULL))
 		mmc->caps |= MMC_CAP_SD_HIGHSPEED;
-
 	return 0;
 }
 
@@ -1530,6 +1555,13 @@ static struct mmci_host *mmci_probe(struct device *dev,
 	host = mmc_priv(mmc);
 	host->mmc = mmc;
 
+	if (!variant->has_pad_config) {
+		host->pinctrl = devm_pinctrl_get(dev);
+		if (IS_ERR(host->pinctrl)) {
+			dev_err(dev, "failed to get pinctrl");
+			goto host_free;
+		}
+	}
 	host->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(host->clk)) {
 		ret = PTR_ERR(host->clk);
drivers/mmc/host/mmci.h +5 -2
index a1f5e4f..d06c048 100644
@@ -185,6 +185,10 @@
 
 #define NR_SG		128
 
+/* pinctrl configs */
+#define MMCI_PINCTRL_STATE_PUSHPULL "default"
+#define MMCI_PINCTRL_STATE_OPENDRAIN "opendrain"
+
 struct clk;
 struct variant_data;
 struct dma_chan;
@@ -219,7 +223,7 @@ struct mmci_host {
 	bool			vqmmc_enabled;
 	struct mmci_platform_data *plat;
 	struct variant_data	*variant;
-
+	struct pinctrl		*pinctrl;
 	u8			hw_designer;
 	u8			hw_revision:4;
 
@@ -244,4 +248,3 @@ struct mmci_host {
 #define dma_inprogress(host)	(0)
 #endif
 };
-
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/9 mmc: mmci: add support for not-amba, but still compatible, variants

In reply to Andrea Merello

The STM32F4xx family contain a SDIO IP that looks like a variant of the PL180, however, inspite it's actually attached to a APB bus, it cannot be handled by the AMBA bus code, because it lacks of the ID registers that AMBA primecell IPs have.

This patch prepares for supporting the STM32 variant by letting the driver register also as a platform driver, that can be matched from the OF with specific "compatible" strings

---
 drivers/mmc/host/Kconfig |   8 +-
 drivers/mmc/host/mmci.c  | 259 +++++++++++++++++++++++++++++++++++------------
 2 files changed, 199 insertions(+), 68 deletions(-)
drivers/mmc/host/Kconfig +4 -4
index 5cf7eba..0f51de3 100644
@@ -5,12 +5,12 @@
 comment "MMC/SD/SDIO Host Controller Drivers"
 
 config MMC_ARMMMCI
-	tristate "ARM AMBA Multimedia Card Interface support"
-	depends on ARM_AMBA
+	tristate "ARM AMBA Multimedia Card Interface and compatible support"
 	help
 	  This selects the ARM(R) AMBA(R) PrimeCell Multimedia Card
-	  Interface (PL180 and PL181) support.  If you have an ARM(R)
-	  platform with a Multimedia Card slot, say Y or M here.
+	  Interface (PL180, PL181 and compatible) support.
+	  If you have an ARM(R) platform with a Multimedia Card slot,
+	  say Y or M here.
 
 	  If unsure, say N.
 
drivers/mmc/host/mmci.c +195 -64

425 lines not on this page · raw message

Signature · 1 line
2.7.4
#7 lore raw

PATCH 5/9 mmc: mmci: add STM32 variant

In reply to Andrea Merello

STM32 mcu has a SDIO controller that looks like an ARM pl810. This patch adds the STM32 variant so that mmci driver supports it.

---
 drivers/mmc/host/mmci.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/mmc/host/mmci.c +18 -0
index 170c78a..3e67cdd 100644
@@ -221,6 +221,23 @@ static __maybe_unused struct variant_data variant_ux500v2 = {
 	.has_pad_config		= true,
 };
 
+static __maybe_unused struct variant_data variant_stm32 = {
+	.fifosize		= 32 * 4,
+	.fifohalfsize		= 8 * 4,
+	.clkreg			= MCI_CLK_ENABLE,
+	.clkreg_enable		= MCI_ST_UX500_HWFCEN,
+	.clkreg_8bit_bus_enable = MCI_ST_8BIT_BUS,
+	.clkreg_neg_edge_enable	= MCI_ST_UX500_NEG_EDGE,
+	.datalength_bits	= 24,
+	.datactrl_mask_sdio	= MCI_ST_DPSM_SDIOEN,
+	.st_sdio		= true,
+	.st_clkdiv		= true,
+	.pwrreg_powerup		= MCI_PWR_ON,
+	.f_max			= 48000000,
+	.pwrreg_clkgate		= true,
+	.pwrreg_nopower		= true,
+};
+
 static __maybe_unused struct variant_data variant_qcom = {
 	.fifosize		= 16 * 4,
 	.fifohalfsize		= 8 * 4,
@@ -1981,6 +1998,7 @@ module_amba_driver(mmci_driver);
 #endif
 
 static const struct of_device_id mmci_pltfm_match[] = {
+	{ .compatible = "st,stm32f4xx-sdio", .data = &variant_stm32},
 	{},
 };
 
Signature · 1 line
2.7.4
#8 lore raw

PATCH 6/9 DT: stm32f429: add pin map for SDIO controller

In reply to Andrea Merello
---
 arch/arm/boot/dts/stm32f429.dtsi | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
arch/arm/boot/dts/stm32f429.dtsi +31 -0
index 336ee4f..961bc0c 100644
@@ -313,6 +313,37 @@
 				};
 			};
 
+			sdio_pins:sdio_pins@0 {
+				pins {
+					pinmux = <STM32F429_PC8_FUNC_SDIO_D0>,
+						 <STM32F429_PC9_FUNC_SDIO_D1>,
+						 <STM32F429_PC10_FUNC_SDIO_D2>,
+						 <STM32F429_PC11_FUNC_SDIO_D3>,
+						 <STM32F429_PC12_FUNC_SDIO_CK>,
+						 <STM32F429_PD2_FUNC_SDIO_CMD>;
+					drive-push-pull;
+					slew-rate = <2>;
+				};
+			};
+
+			sdio_pins_od:sdio_pins_od@0 {
+				pins {
+					pinmux = <STM32F429_PC8_FUNC_SDIO_D0>,
+						 <STM32F429_PC9_FUNC_SDIO_D1>,
+						 <STM32F429_PC10_FUNC_SDIO_D2>,
+						 <STM32F429_PC11_FUNC_SDIO_D3>,
+						 <STM32F429_PC12_FUNC_SDIO_CK>;
+					drive-push-pull;
+					slew-rate = <2>;
+				};
+
+				pins_od {
+					pinmux = <STM32F429_PD2_FUNC_SDIO_CMD>;
+					drive-open-drain;
+					slew-rate = <2>;
+				};
+			};
+
 			ethernet0_mii: mii@0 {
 				pins {
 					pinmux = <STM32F429_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0>,
Signature · 1 line
2.7.4
#11 lore raw

PATCH 7/9 DT: stm32f429: add node for SDIO controller

In reply to Andrea Merello
---
 arch/arm/boot/dts/stm32f429.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/stm32f429.dtsi +12 -0
index 961bc0c..d6d0548 100644
@@ -365,6 +365,18 @@
 			};
 		};
 
+		sdio: sdio@40012c00 {
+			compatible = "st,stm32f4xx-sdio";
+			reg = <0x40012c00 0x400>;
+			clocks = <&rcc 0 171>;
+			interrupts = <49>;
+			status = "disabled";
+			pinctrl-0 = <&sdio_pins>;
+			pinctrl-1 = <&sdio_pins_od>;
+			pinctrl-names = "default", "opendrain";
+			max-frequency = <48000000>;
+		};
+
 		rcc: rcc@40023810 {
 			#reset-cells = <1>;
 			#clock-cells = <2>;
Signature · 1 line
2.7.4
#12 lore raw

PATCH 8/9 DT: stm32f469-disco: add node for SDIO controller

In reply to Andrea Merello
---
 arch/arm/boot/dts/stm32f429.dtsi      |  2 +-
 arch/arm/boot/dts/stm32f469-disco.dts | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)
arch/arm/boot/dts/stm32f429.dtsi +1 -1
index d6d0548..23e6a5e 100644
@@ -185,7 +185,7 @@
 			interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>;
 		};
 
-		pin-controller {
+		pinctrl:pin-controller {
 			#address-cells = <1>;
 			#size-cells = <1>;
 			compatible = "st,stm32f429-pinctrl";
arch/arm/boot/dts/stm32f469-disco.dts +30 -0
index e911af8..e16dfc3 100644
@@ -64,12 +64,42 @@
 	aliases {
 		serial0 = &usart3;
 	};
+
+	mmc_vcard: mmc_vcard {
+		compatible = "regulator-fixed";
+		regulator-name = "mmc_vcard";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+
+	};
 };
 
 &clk_hse {
 	clock-frequency = <8000000>;
 };
 
+&pinctrl {
+	sdio-cd {
+		sdio_cd: sdio-cd {
+			pins {
+				pinmux = <STM32F429_PG2_FUNC_GPIO>;
+				bias-pull-up;
+			};
+		};
+	};
+};
+
+&sdio {
+	status = "okay";
+	vmmc-supply = <&mmc_vcard>;
+	cd-gpios = <&gpiog 2 0>;
+	cd-inverted;
+	pinctrl-names = "default", "opendrain", "cd";
+	pinctrl-0 = <&sdio_pins>, <&sdio_cd>;
+	pinctrl-1 = <&sdio_pins_od>, <&sdio_cd>;
+	bus-width = <4>;
+};
+
 &usart3 {
 	status = "okay";
 };
Signature · 1 line
2.7.4
#16 lore raw

PATCH 9/9 Documentation: document mmci STM32 DT binding

In reply to Andrea Merello
---
 Documentation/devicetree/bindings/mmc/mmci.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/mmc/mmci.txt +1 -1
index 03796cf..d6b5127 100644
@@ -8,7 +8,7 @@ by mmc.txt and the properties used by the mmci driver. Using "st" as
 the prefix for a property, indicates support by the ST Micro variant.
 
 Required properties:
-- compatible             : contains "arm,pl18x", "arm,primecell".
+- compatible             : contains "arm,pl18x", "arm,primecell" or "st,stm32f4xx-sdio"
 - vmmc-supply            : phandle to the regulator device tree node, mentioned
                            as the VCC/VDD supply in the eMMC/SD specs.
 
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH 2/9] mmc: mmci: add support for not-amba, but still compatible, variants

In reply to Andrea Merello
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Andrea,

[auto build test ERROR on ulf.hansson-mmc/next]
[also build test ERROR on v4.9-rc4 next-20161108]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Andrea-Merello/mmc-mmci-add-support-for-STM32-SD-controller/20161108-234358
base:   https://git.linaro.org/people/ulf.hansson/mmc next
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=alpha

All errors (new ones prefixed by >>):

drivers/mmc/host/mmci.c: In function 'mmci_runtime_resume_pltfm':

>> drivers/mmc/host/mmci.c:2002:9: error: implicit declaration of function 'mmci_runtime_resume' [-Werror=implicit-function-declaration]
     return mmci_runtime_resume(mmc);
            ^~~~~~~~~~~~~~~~~~~
   drivers/mmc/host/mmci.c: In function 'mmci_runtime_suspend_pltfm':
>> drivers/mmc/host/mmci.c:2010:9: error: implicit declaration of function 'mmci_runtime_suspend' [-Werror=implicit-function-declaration]
     return mmci_runtime_suspend(mmc);
            ^~~~~~~~~~~~~~~~~~~~

At top level:
drivers/mmc/host/mmci.c:2005:12: warning: 'mmci_runtime_suspend_pltfm' defined but not used [-Wunused-function]
static int mmci_runtime_suspend_pltfm(struct device *dev)
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mmc/host/mmci.c:1997:12: warning: 'mmci_runtime_resume_pltfm' defined but not used [-Wunused-function]
static int mmci_runtime_resume_pltfm(struct device *dev)
^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/mmci_runtime_resume +2002 drivers/mmc/host/mmci.c

1996
1997 static int mmci_runtime_resume_pltfm(struct device *dev)
1998 {
1999 struct platform_device *pdev = to_platform_device(dev);
2000 struct mmc_host *mmc = platform_get_drvdata(pdev);
2001

> 2002		return mmci_runtime_resume(mmc);
  2003	}
  2004	
  2005	static int mmci_runtime_suspend_pltfm(struct device *dev)
  2006	{
  2007		struct platform_device *pdev = to_platform_device(dev);
  2008		struct mmc_host *mmc = platform_get_drvdata(pdev);
  2009	
> 2010		return mmci_runtime_suspend(mmc);

2011 }
2012
2013 MODULE_DEVICE_TABLE(of, mmci_pltfm_match);

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#4 lore raw

Re: [PATCH 2/9] mmc: mmci: add support for not-amba, but still compatible, variants

In reply to Andrea Merello
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Andrea,

[auto build test ERROR on ulf.hansson-mmc/next]
[also build test ERROR on v4.9-rc4 next-20161108]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Andrea-Merello/mmc-mmci-add-support-for-STM32-SD-controller/20161108-234358
base:   https://git.linaro.org/people/ulf.hansson/mmc next
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All error/warnings (new ones prefixed by >>):

drivers/mmc/host/mmci.c: In function 'mmci_probe_amba':
drivers/mmc/host/mmci.c:1849:21: error: 'pdev' undeclared (first use in this function)

     host = mmci_probe(&pdev->dev, variant, &dev->res,
                        ^~~~
   drivers/mmc/host/mmci.c:1849:21: note: each undeclared identifier is reported only once for each function it appears in
   drivers/mmc/host/mmci.c:1851:13: error: 'ret' undeclared (first use in this function)
     if (IS_ERR(ret))
                ^~~
   In file included from drivers/mmc/host/mmci.c:12:0:
   drivers/mmc/host/mmci.c: At top level:
>> include/linux/module.h:130:27: error: redefinition of '__inittest'
     static inline initcall_t __inittest(void)  \
                              ^
   include/linux/device.h:1353:1: note: in expansion of macro 'module_init'
    module_init(__driver##_init); \
    ^~~~~~~~~~~
>> include/linux/platform_device.h:228:2: note: in expansion of macro 'module_driver'
     module_driver(__platform_driver, platform_driver_register, \
     ^~~~~~~~~~~~~
>> drivers/mmc/host/mmci.c:2032:1: note: in expansion of macro 'module_platform_driver'
    module_platform_driver(mmci_pltfm_driver);
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/module.h:130:27: note: previous definition of '__inittest' was here
     static inline initcall_t __inittest(void)  \
                              ^
   include/linux/device.h:1353:1: note: in expansion of macro 'module_init'
    module_init(__driver##_init); \
    ^~~~~~~~~~~
>> include/linux/amba/bus.h:170:2: note: in expansion of macro 'module_driver'
     module_driver(__amba_drv, amba_driver_register, amba_driver_unregister)
     ^~~~~~~~~~~~~
>> drivers/mmc/host/mmci.c:1938:1: note: in expansion of macro 'module_amba_driver'
    module_amba_driver(mmci_driver);
    ^~~~~~~~~~~~~~~~~~
>> include/linux/module.h:132:6: error: redefinition of 'init_module'
     int init_module(void) __attribute__((alias(#initfn)));
         ^
   include/linux/device.h:1353:1: note: in expansion of macro 'module_init'
    module_init(__driver##_init); \
    ^~~~~~~~~~~
>> include/linux/platform_device.h:228:2: note: in expansion of macro 'module_driver'
     module_driver(__platform_driver, platform_driver_register, \
     ^~~~~~~~~~~~~
>> drivers/mmc/host/mmci.c:2032:1: note: in expansion of macro 'module_platform_driver'
    module_platform_driver(mmci_pltfm_driver);
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/module.h:132:6: note: previous definition of 'init_module' was here
     int init_module(void) __attribute__((alias(#initfn)));
         ^
   include/linux/device.h:1353:1: note: in expansion of macro 'module_init'
    module_init(__driver##_init); \
    ^~~~~~~~~~~
>> include/linux/amba/bus.h:170:2: note: in expansion of macro 'module_driver'
     module_driver(__amba_drv, amba_driver_register, amba_driver_unregister)
     ^~~~~~~~~~~~~
>> drivers/mmc/host/mmci.c:1938:1: note: in expansion of macro 'module_amba_driver'
    module_amba_driver(mmci_driver);
    ^~~~~~~~~~~~~~~~~~
>> include/linux/module.h:136:27: error: redefinition of '__exittest'
     static inline exitcall_t __exittest(void)  \
                              ^
   include/linux/device.h:1358:1: note: in expansion of macro 'module_exit'
    module_exit(__driver##_exit);
    ^~~~~~~~~~~
>> include/linux/platform_device.h:228:2: note: in expansion of macro 'module_driver'
     module_driver(__platform_driver, platform_driver_register, \
     ^~~~~~~~~~~~~
>> drivers/mmc/host/mmci.c:2032:1: note: in expansion of macro 'module_platform_driver'
    module_platform_driver(mmci_pltfm_driver);
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/module.h:136:27: note: previous definition of '__exittest' was here
     static inline exitcall_t __exittest(void)  \
                              ^
   include/linux/device.h:1358:1: note: in expansion of macro 'module_exit'
    module_exit(__driver##_exit);
    ^~~~~~~~~~~
>> include/linux/amba/bus.h:170:2: note: in expansion of macro 'module_driver'
     module_driver(__amba_drv, amba_driver_register, amba_driver_unregister)
     ^~~~~~~~~~~~~
>> drivers/mmc/host/mmci.c:1938:1: note: in expansion of macro 'module_amba_driver'
    module_amba_driver(mmci_driver);
    ^~~~~~~~~~~~~~~~~~
>> include/linux/module.h:138:7: error: redefinition of 'cleanup_module'
     void cleanup_module(void) __attribute__((alias(#exitfn)));
          ^
   include/linux/device.h:1358:1: note: in expansion of macro 'module_exit'
    module_exit(__driver##_exit);
    ^~~~~~~~~~~
>> include/linux/platform_device.h:228:2: note: in expansion of macro 'module_driver'
     module_driver(__platform_driver, platform_driver_register, \
     ^~~~~~~~~~~~~
>> drivers/mmc/host/mmci.c:2032:1: note: in expansion of macro 'module_platform_driver'
    module_platform_driver(mmci_pltfm_driver);
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/module.h:138:7: note: previous definition of 'cleanup_module' was here
     void cleanup_module(void) __attribute__((alias(#exitfn)));
          ^
   include/linux/device.h:1358:1: note: in expansion of macro 'module_exit'
    module_exit(__driver##_exit);
    ^~~~~~~~~~~
>> include/linux/amba/bus.h:170:2: note: in expansion of macro 'module_driver'
     module_driver(__amba_drv, amba_driver_register, amba_driver_unregister)
     ^~~~~~~~~~~~~
>> drivers/mmc/host/mmci.c:1938:1: note: in expansion of macro 'module_amba_driver'
    module_amba_driver(mmci_driver);
    ^~~~~~~~~~~~~~~~~~

vim +/module_driver +228 include/linux/platform_device.h

71d642908 Marc Kleine-Budde  2011-02-16  212  {
71d642908 Marc Kleine-Budde  2011-02-16  213  	return dev_get_drvdata(&pdev->dev);
71d642908 Marc Kleine-Budde  2011-02-16  214  }
71d642908 Marc Kleine-Budde  2011-02-16  215  
6ae07f27a Fabio Porcedda     2013-03-26  216  static inline void platform_set_drvdata(struct platform_device *pdev,
6ae07f27a Fabio Porcedda     2013-03-26  217  					void *data)
71d642908 Marc Kleine-Budde  2011-02-16  218  {
71d642908 Marc Kleine-Budde  2011-02-16  219  	dev_set_drvdata(&pdev->dev, data);
71d642908 Marc Kleine-Budde  2011-02-16  220  }
00d3dcdd9 Russell King       2005-11-09  221  
940ab8896 Grant Likely       2011-10-05  222  /* module_platform_driver() - Helper macro for drivers that don't do
940ab8896 Grant Likely       2011-10-05  223   * anything special in module init/exit.  This eliminates a lot of
940ab8896 Grant Likely       2011-10-05  224   * boilerplate.  Each module may only use this macro once, and
940ab8896 Grant Likely       2011-10-05  225   * calling it replaces module_init() and module_exit()
940ab8896 Grant Likely       2011-10-05  226   */
940ab8896 Grant Likely       2011-10-05  227  #define module_platform_driver(__platform_driver) \
907d0ed1c Lars-Peter Clausen 2011-11-16 @228  	module_driver(__platform_driver, platform_driver_register, \
907d0ed1c Lars-Peter Clausen 2011-11-16  229  			platform_driver_unregister)
940ab8896 Grant Likely       2011-10-05  230  
f309d4443 Paul Gortmaker     2015-05-01  231  /* builtin_platform_driver() - Helper macro for builtin drivers that
f309d4443 Paul Gortmaker     2015-05-01  232   * don't do anything special in driver init.  This eliminates some
f309d4443 Paul Gortmaker     2015-05-01  233   * boilerplate.  Each driver may only use this macro once, and
f309d4443 Paul Gortmaker     2015-05-01  234   * calling it replaces device_initcall().  Note this is meant to be
f309d4443 Paul Gortmaker     2015-05-01  235   * a parallel of module_platform_driver() above, but w/o _exit stuff.
f309d4443 Paul Gortmaker     2015-05-01  236   */

:::::: The code at line 228 was first introduced by commit
:::::: 907d0ed1c84114d4e8dafd66af982515d3739c90 drivercore: Generalize module_platform_driver

:::::: TO: Lars-Peter Clausen <[email protected]> :::::: CC: Greg Kroah-Hartman <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#9 lore raw

Re: [PATCH 6/9] DT: stm32f429: add pin map for SDIO controller

In reply to Andrea Merello

Hi Andrea,

Some minor remarks.

Quoted 10 lines · Andrea Merello
---
 arch/arm/boot/dts/stm32f429.dtsi | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
arch/arm/boot/dts/stm32f429.dtsi +0 -0
index 336ee4f..961bc0c 100644

arch/arm/boot/dts/stm32f429.dtsi line 316

Quoted 4 lines
arch/arm/boot/dts/stm32f429.dtsi +1 -0
@@ -313,6 +313,37 @@
 				};
 			};
 
+			sdio_pins:sdio_pins@0 {

Add a space after ":"

arch/arm/boot/dts/stm32f429.dtsi line 329

Quoted 13 lines
arch/arm/boot/dts/stm32f429.dtsi +13 -0
+				pins {
+					pinmux = <STM32F429_PC8_FUNC_SDIO_D0>,
+						 <STM32F429_PC9_FUNC_SDIO_D1>,
+						 <STM32F429_PC10_FUNC_SDIO_D2>,
+						 <STM32F429_PC11_FUNC_SDIO_D3>,
+						 <STM32F429_PC12_FUNC_SDIO_CK>,
+						 <STM32F429_PD2_FUNC_SDIO_CMD>;
+					drive-push-pull;
+					slew-rate = <2>;
+				};
+			};
+
+			sdio_pins_od:sdio_pins_od@0 {

same

Quoted 5 lines
arch/arm/boot/dts/stm32f429.dtsi +5 -0
+				pins {
+					pinmux = <STM32F429_PC8_FUNC_SDIO_D0>,
+						 <STM32F429_PC9_FUNC_SDIO_D1>,
+						 <STM32F429_PC10_FUNC_SDIO_D2>,
+						 <STM32F429_PC11_FUNC_SDIO_D3>,

arch/arm/boot/dts/stm32f429.dtsi line 344

Quoted 10 lines
arch/arm/boot/dts/stm32f429.dtsi +10 -0
+						 <STM32F429_PC12_FUNC_SDIO_CK>;
+					drive-push-pull;
+					slew-rate = <2>;
+				};
+
+				pins_od {
+					pinmux = <STM32F429_PD2_FUNC_SDIO_CMD>;
+					drive-open-drain;
+					slew-rate = <2>;
+				};

Why don't use "pins1" and "pins2" instead of "pins" and "pins_od" like it is done for usart1?

regards
Alex

Quoted 10 lines
arch/arm/boot/dts/stm32f429.dtsi +2 -0
+			};
+
 
 
 
arch/arm/boot/dts/stm32f429.dtsi +0 -0
 			ethernet0_mii: mii@0 {
 				pins {
 					pinmux = <STM32F429_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0>,
#13 lore raw

Re: [PATCH 8/9] DT: stm32f469-disco: add node for SDIO controller

In reply to Andrea Merello

Hi Andrea

Quoted 24 lines · Andrea Merello
---
 arch/arm/boot/dts/stm32f429.dtsi      |  2 +-
 arch/arm/boot/dts/stm32f469-disco.dts | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)
arch/arm/boot/dts/stm32f429.dtsi +1 -1
index d6d0548..23e6a5e 100644
@@ -185,7 +185,7 @@
 			interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>;
 		};
 
-		pin-controller {
+		pinctrl:pin-controller {
 			#address-cells = <1>;
 			#size-cells = <1>;
 			compatible = "st,stm32f429-pinctrl";
arch/arm/boot/dts/stm32f469-disco.dts +0 -0
index e911af8..e16dfc3 100644

arch/arm/boot/dts/stm32f469-disco.dts line 72

Quoted 9 lines
arch/arm/boot/dts/stm32f469-disco.dts +6 -0
@@ -64,12 +64,42 @@
 	aliases {
 		serial0 = &usart3;
 	};
+
+	mmc_vcard: mmc_vcard {
+		compatible = "regulator-fixed";
+		regulator-name = "mmc_vcard";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;

As I assume you will send a v2 (due to kbuild issue) remove empty line please.

Quoted 34 lines
arch/arm/boot/dts/stm32f469-disco.dts +24 -0
+
+	};
 };
 
 &clk_hse {
 	clock-frequency = <8000000>;
 };
 
+&pinctrl {
+	sdio-cd {
+		sdio_cd: sdio-cd {
+			pins {
+				pinmux = <STM32F429_PG2_FUNC_GPIO>;
+				bias-pull-up;
+			};
+		};
+	};
+};
+
+&sdio {
+	status = "okay";
+	vmmc-supply = <&mmc_vcard>;
+	cd-gpios = <&gpiog 2 0>;
+	cd-inverted;
+	pinctrl-names = "default", "opendrain", "cd";
+	pinctrl-0 = <&sdio_pins>, <&sdio_cd>;
+	pinctrl-1 = <&sdio_pins_od>, <&sdio_cd>;
+	bus-width = <4>;
+};
+
 &usart3 {
 	status = "okay";
 };
#10 lore raw

Re: [PATCH 6/9] DT: stm32f429: add pin map for SDIO controller

In reply to Alexandre Torgue
Quoted 3 lines · Alexandre Torgue

Hi Andrea,

Some minor remarks.

Hi, thank you for reviewing :)
Also adding Bruno Herrera in CC..

Quoted 16 lines · Andrea Merello
Quoted 15 lines
---
 arch/arm/boot/dts/stm32f429.dtsi | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
arch/arm/boot/dts/stm32f429.dtsi +0 -0
index 336ee4f..961bc0c 100644
@@ -313,6 +313,37 @@
                                };
                        };
 
Quoted 3 lines

arch/arm/boot/dts/stm32f429.dtsi line 316

Quoted 1 line
arch/arm/boot/dts/stm32f429.dtsi +1 -0
+                       sdio_pins:sdio_pins@0 {

Add a space after ":"

OK

Quoted 14 lines
Quoted 14 lines
arch/arm/boot/dts/stm32f429.dtsi +5 -0
+                               pins {
+                                       pinmux =
 <STM32F429_PC8_FUNC_SDIO_D0>,
+
 <STM32F429_PC9_FUNC_SDIO_D1>,
+
 <STM32F429_PC10_FUNC_SDIO_D2>,
+

<STM32F429_PC11_FUNC_SDIO_D3>,
+
<STM32F429_PC12_FUNC_SDIO_CK>,
+
<STM32F429_PD2_FUNC_SDIO_CMD>;

Quoted 8 lines

arch/arm/boot/dts/stm32f429.dtsi line 329

Quoted 6 lines
arch/arm/boot/dts/stm32f429.dtsi +6 -0
+                                       drive-push-pull;
+                                       slew-rate = <2>;
+                               };
+                       };
+
+                       sdio_pins_od:sdio_pins_od@0 {

same

OK

Quoted 17 lines
Quoted 17 lines
arch/arm/boot/dts/stm32f429.dtsi +2 -0
+                               pins {
+                                       pinmux =

<STM32F429_PC8_FUNC_SDIO_D0>,
+
<STM32F429_PC9_FUNC_SDIO_D1>,
+
<STM32F429_PC10_FUNC_SDIO_D2>,
+
<STM32F429_PC11_FUNC_SDIO_D3>,
+
<STM32F429_PC12_FUNC_SDIO_CK>;

arch/arm/boot/dts/stm32f429.dtsi +5 -0
+                                       drive-push-pull;
+                                       slew-rate = <2>;
+                               };
+
+                               pins_od {
Quoted 8 lines

arch/arm/boot/dts/stm32f429.dtsi line 344

Quoted 5 lines

+ pinmux =
<STM32F429_PD2_FUNC_SDIO_CMD>;

arch/arm/boot/dts/stm32f429.dtsi +3 -0
+                                       drive-open-drain;
+                                       slew-rate = <2>;
+                               };

Why don't use "pins1" and "pins2" instead of "pins" and "pins_od" like it is done for usart1?

OK

Quoted 17 lines

regards
Alex

Quoted 12 lines
arch/arm/boot/dts/stm32f429.dtsi +2 -0
+                       };
+
 
 
 
 
 
                        ethernet0_mii: mii@0 {
                                pins {
                                        pinmux =

<STM32F429_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0>,

#14 lore raw

Re: [PATCH 8/9] DT: stm32f469-disco: add node for SDIO controller

In reply to Alexandre Torgue
Quoted 36 lines · Alexandre Torgue

Hi Andrea

Quoted 32 lines · Andrea Merello
---
 arch/arm/boot/dts/stm32f429.dtsi      |  2 +-
 arch/arm/boot/dts/stm32f469-disco.dts | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)
arch/arm/boot/dts/stm32f429.dtsi +1 -1
index d6d0548..23e6a5e 100644
@@ -185,7 +185,7 @@
                        interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>,
 <10>, <23>, <40>, <41>, <42>, <62>, <76>;
                };
 
-               pin-controller {
+               pinctrl:pin-controller {
                        #address-cells = <1>;
                        #size-cells = <1>;
                        compatible = "st,stm32f429-pinctrl";
arch/arm/boot/dts/stm32f469-disco.dts +1 -0
index e911af8..e16dfc3 100644
@@ -64,12 +64,42 @@
        aliases {
                serial0 = &usart3;
        };
+
Quoted 8 lines

arch/arm/boot/dts/stm32f469-disco.dts line 72

Quoted 5 lines
arch/arm/boot/dts/stm32f469-disco.dts +5 -0
+       mmc_vcard: mmc_vcard {
+               compatible = "regulator-fixed";
+               regulator-name = "mmc_vcard";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;

As I assume you will send a v2 (due to kbuild issue) remove empty line please.

Sure. I will do. (But unfortunately it will not happen very soon :( )

In the meantime comments and testing are appreciated. Also, I forgot to say that, if one wants to try this, he/she will need the bootloader to set properly the 48MHz clk for SD (for afboot use my tree - pull-req pending on Maxime Coquelin tree). For clk driver probably my patch for making it aware of the 48MHz setting is still needed (I've not looked into other recent clk patches yet)..

Quoted 35 lines
Quoted 34 lines
arch/arm/boot/dts/stm32f469-disco.dts +24 -0
+
+       };
 };
 
 &clk_hse {
        clock-frequency = <8000000>;
 };
 
+&pinctrl {
+       sdio-cd {
+               sdio_cd: sdio-cd {
+                       pins {
+                               pinmux = <STM32F429_PG2_FUNC_GPIO>;
+                               bias-pull-up;
+                       };
+               };
+       };
+};
+
+&sdio {
+       status = "okay";
+       vmmc-supply = <&mmc_vcard>;
+       cd-gpios = <&gpiog 2 0>;
+       cd-inverted;
+       pinctrl-names = "default", "opendrain", "cd";
+       pinctrl-0 = <&sdio_pins>, <&sdio_cd>;
+       pinctrl-1 = <&sdio_pins_od>, <&sdio_cd>;
+       bus-width = <4>;
+};
+
 &usart3 {
        status = "okay";
 };
#15 lore raw

Re: [PATCH 8/9] DT: stm32f469-disco: add node for SDIO controller

Hi Andrea

Quoted 47 lines · Andrea Merello
Quoted 36 lines · Alexandre Torgue

Hi Andrea

Quoted 32 lines · Andrea Merello
---
 arch/arm/boot/dts/stm32f429.dtsi      |  2 +-
 arch/arm/boot/dts/stm32f469-disco.dts | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)
arch/arm/boot/dts/stm32f429.dtsi +1 -1
index d6d0548..23e6a5e 100644
@@ -185,7 +185,7 @@
                        interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>,
 <10>, <23>, <40>, <41>, <42>, <62>, <76>;
                };
 
-               pin-controller {
+               pinctrl:pin-controller {
                        #address-cells = <1>;
                        #size-cells = <1>;
                        compatible = "st,stm32f429-pinctrl";
arch/arm/boot/dts/stm32f469-disco.dts +1 -0
index e911af8..e16dfc3 100644
@@ -64,12 +64,42 @@
        aliases {
                serial0 = &usart3;
        };
+
Quoted 8 lines

arch/arm/boot/dts/stm32f469-disco.dts line 72

Quoted 5 lines
arch/arm/boot/dts/stm32f469-disco.dts +5 -0
+       mmc_vcard: mmc_vcard {
+               compatible = "regulator-fixed";
+               regulator-name = "mmc_vcard";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;

As I assume you will send a v2 (due to kbuild issue) remove empty line please.

Quoted 1 line

Sure. I will do. (But unfortunately it will not happen very soon :( )

No pb.

Quoted 7 lines

In the meantime comments and testing are appreciated. Also, I forgot to say that, if one wants to try this, he/she will need the bootloader to set properly the 48MHz clk for SD (for afboot use my tree - pull-req pending on Maxime Coquelin tree). For clk driver probably my patch for making it aware of the 48MHz setting is still needed (I've not looked into other recent clk patches yet)..

did you see patches sent by Gabriel Fernandez: "[PATCH 0/6] Add STM32F4 missing clocks". This series should add support for 48 MHz. So it is needed to check first if Gabriel's series is enough.

Thanks
Alex

Quoted 36 lines
Quoted 36 lines
Quoted 35 lines
arch/arm/boot/dts/stm32f469-disco.dts +24 -0
+
+       };
 };
 
 &clk_hse {
        clock-frequency = <8000000>;
 };
 
+&pinctrl {
+       sdio-cd {
+               sdio_cd: sdio-cd {
+                       pins {
+                               pinmux = <STM32F429_PG2_FUNC_GPIO>;
+                               bias-pull-up;
+                       };
+               };
+       };
+};
+
+&sdio {
+       status = "okay";
+       vmmc-supply = <&mmc_vcard>;
+       cd-gpios = <&gpiog 2 0>;
+       cd-inverted;
+       pinctrl-names = "default", "opendrain", "cd";
+       pinctrl-0 = <&sdio_pins>, <&sdio_cd>;
+       pinctrl-1 = <&sdio_pins_od>, <&sdio_cd>;
+       bus-width = <4>;
+};
+
 &usart3 {
        status = "okay";
 };