All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] mmc: mmci: add support for STM32 SD controller
@ 2016-11-08 13:43 Andrea Merello
  2016-11-08 13:43 ` [PATCH 1/9] mmc: mmci: don't pretend IP variants with only one IRQ to have two mask regs Andrea Merello
                   ` (8 more replies)
  0 siblings, 9 replies; 17+ messages in thread
From: Andrea Merello @ 2016-11-08 13:43 UTC (permalink / raw)
  To: ulf.hansson, mcoquelin.stm32, alexandre.torgue; +Cc: linux-mmc, Andrea Merello

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/9] mmc: mmci: don't pretend IP variants with only one IRQ to have two mask regs
  2016-11-08 13:43 [PATCH 0/9] mmc: mmci: add support for STM32 SD controller Andrea Merello
@ 2016-11-08 13:43 ` Andrea Merello
  2016-11-08 13:43 ` [PATCH 2/9] mmc: mmci: add support for not-amba, but still compatible, variants Andrea Merello
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Andrea Merello @ 2016-11-08 13:43 UTC (permalink / raw)
  To: ulf.hansson, mcoquelin.stm32, alexandre.torgue; +Cc: linux-mmc, Andrea Merello

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

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
---
 drivers/mmc/host/mmci.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index df990bb..b826a3a 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -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);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/9] mmc: mmci: add support for not-amba, but still compatible, variants
  2016-11-08 13:43 [PATCH 0/9] mmc: mmci: add support for STM32 SD controller Andrea Merello
  2016-11-08 13:43 ` [PATCH 1/9] mmc: mmci: don't pretend IP variants with only one IRQ to have two mask regs Andrea Merello
@ 2016-11-08 13:43 ` Andrea Merello
  2016-11-08 17:39   ` kbuild test robot
  2016-11-08 17:41   ` kbuild test robot
  2016-11-08 13:43 ` [PATCH 3/9] mmc: mmci: don't pretend all variants to have MCI_STARBITERR flag Andrea Merello
                   ` (6 subsequent siblings)
  8 siblings, 2 replies; 17+ messages in thread
From: Andrea Merello @ 2016-11-08 13:43 UTC (permalink / raw)
  To: ulf.hansson, mcoquelin.stm32, alexandre.torgue; +Cc: linux-mmc, 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

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
---
 drivers/mmc/host/Kconfig |   8 +-
 drivers/mmc/host/mmci.c  | 259 +++++++++++++++++++++++++++++++++++------------
 2 files changed, 199 insertions(+), 68 deletions(-)

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 5cf7eba..0f51de3 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -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.
 
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index b826a3a..b1dfde3 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -1,5 +1,6 @@
 /*
- *  linux/drivers/mmc/host/mmci.c - ARM PrimeCell MMCI PL180/1 driver
+ *  linux/drivers/mmc/host/mmci.c - ARM PrimeCell MMCI PL180/1 and
+ *  comaptible driver
  *
  *  Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
  *  Copyright (C) 2010 ST-Ericsson SA
@@ -37,6 +38,8 @@
 #include <linux/pm_runtime.h>
 #include <linux/types.h>
 #include <linux/pinctrl/consumer.h>
+#include <linux/platform_device.h>
+#include <linux/of_device.h>
 
 #include <asm/div64.h>
 #include <asm/io.h>
@@ -105,7 +108,7 @@ struct variant_data {
 	bool			reversed_irq_handling;
 };
 
-static struct variant_data variant_arm = {
+static __maybe_unused struct variant_data variant_arm = {
 	.fifosize		= 16 * 4,
 	.fifohalfsize		= 8 * 4,
 	.datalength_bits	= 16,
@@ -114,7 +117,7 @@ static struct variant_data variant_arm = {
 	.reversed_irq_handling	= true,
 };
 
-static struct variant_data variant_arm_extended_fifo = {
+static __maybe_unused struct variant_data variant_arm_extended_fifo = {
 	.fifosize		= 128 * 4,
 	.fifohalfsize		= 64 * 4,
 	.datalength_bits	= 16,
@@ -122,7 +125,7 @@ static struct variant_data variant_arm_extended_fifo = {
 	.f_max			= 100000000,
 };
 
-static struct variant_data variant_arm_extended_fifo_hwfc = {
+static __maybe_unused struct variant_data variant_arm_extended_fifo_hwfc = {
 	.fifosize		= 128 * 4,
 	.fifohalfsize		= 64 * 4,
 	.clkreg_enable		= MCI_ARM_HWFCEN,
@@ -131,7 +134,7 @@ static struct variant_data variant_arm_extended_fifo_hwfc = {
 	.f_max			= 100000000,
 };
 
-static struct variant_data variant_u300 = {
+static __maybe_unused struct variant_data variant_u300 = {
 	.fifosize		= 16 * 4,
 	.fifohalfsize		= 8 * 4,
 	.clkreg_enable		= MCI_ST_U300_HWFCEN,
@@ -146,7 +149,7 @@ static struct variant_data variant_u300 = {
 	.pwrreg_nopower		= true,
 };
 
-static struct variant_data variant_nomadik = {
+static __maybe_unused struct variant_data variant_nomadik = {
 	.fifosize		= 16 * 4,
 	.fifohalfsize		= 8 * 4,
 	.clkreg			= MCI_CLK_ENABLE,
@@ -162,7 +165,7 @@ static struct variant_data variant_nomadik = {
 	.pwrreg_nopower		= true,
 };
 
-static struct variant_data variant_ux500 = {
+static __maybe_unused struct variant_data variant_ux500 = {
 	.fifosize		= 30 * 4,
 	.fifohalfsize		= 8 * 4,
 	.clkreg			= MCI_CLK_ENABLE,
@@ -181,7 +184,7 @@ static struct variant_data variant_ux500 = {
 	.pwrreg_nopower		= true,
 };
 
-static struct variant_data variant_ux500v2 = {
+static __maybe_unused struct variant_data variant_ux500v2 = {
 	.fifosize		= 30 * 4,
 	.fifohalfsize		= 8 * 4,
 	.clkreg			= MCI_CLK_ENABLE,
@@ -202,7 +205,7 @@ static struct variant_data variant_ux500v2 = {
 	.pwrreg_nopower		= true,
 };
 
-static struct variant_data variant_qcom = {
+static __maybe_unused struct variant_data variant_qcom = {
 	.fifosize		= 16 * 4,
 	.fifohalfsize		= 8 * 4,
 	.clkreg			= MCI_CLK_ENABLE,
@@ -1483,31 +1486,32 @@ static int mmci_of_parse(struct device_node *np, struct mmc_host *mmc)
 	return 0;
 }
 
-static int mmci_probe(struct amba_device *dev,
-	const struct amba_id *id)
+static struct mmci_host *mmci_probe(struct device *dev,
+				    struct variant_data *variant,
+				    struct resource *res,
+				    unsigned int irq0, unsigned int irq1)
 {
-	struct mmci_platform_data *plat = dev->dev.platform_data;
-	struct device_node *np = dev->dev.of_node;
-	struct variant_data *variant = id->data;
-	struct mmci_host *host;
+	struct device_node *np = dev->of_node;
+	struct mmci_platform_data *plat = dev->platform_data;
 	struct mmc_host *mmc;
+	struct mmci_host *host;
 	int ret;
 
 	/* Must have platform data or Device Tree. */
 	if (!plat && !np) {
-		dev_err(&dev->dev, "No plat data or DT found\n");
-		return -EINVAL;
+		dev_err(dev, "No plat data or DT found\n");
+		return ERR_PTR(-EINVAL);
 	}
 
 	if (!plat) {
-		plat = devm_kzalloc(&dev->dev, sizeof(*plat), GFP_KERNEL);
+		plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL);
 		if (!plat)
-			return -ENOMEM;
+			return ERR_PTR(-ENOMEM);
 	}
 
-	mmc = mmc_alloc_host(sizeof(struct mmci_host), &dev->dev);
+	mmc = mmc_alloc_host(sizeof(struct mmci_host), dev);
 	if (!mmc)
-		return -ENOMEM;
+		return ERR_PTR(-ENOMEM);
 
 	ret = mmci_of_parse(np, mmc);
 	if (ret)
@@ -1516,12 +1520,7 @@ static int mmci_probe(struct amba_device *dev,
 	host = mmc_priv(mmc);
 	host->mmc = mmc;
 
-	host->hw_designer = amba_manf(dev);
-	host->hw_revision = amba_rev(dev);
-	dev_dbg(mmc_dev(mmc), "designer ID = 0x%02x\n", host->hw_designer);
-	dev_dbg(mmc_dev(mmc), "revision = 0x%01x\n", host->hw_revision);
-
-	host->clk = devm_clk_get(&dev->dev, NULL);
+	host->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(host->clk)) {
 		ret = PTR_ERR(host->clk);
 		goto host_free;
@@ -1553,8 +1552,8 @@ static int mmci_probe(struct amba_device *dev,
 			host->mclk);
 	}
 
-	host->phybase = dev->res.start;
-	host->base = devm_ioremap_resource(&dev->dev, &dev->res);
+	host->phybase = res->start;
+	host->base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(host->base)) {
 		ret = PTR_ERR(host->base);
 		goto clk_disable;
@@ -1688,49 +1687,41 @@ static int mmci_probe(struct amba_device *dev,
 		}
 	}
 
-	ret = devm_request_irq(&dev->dev, dev->irq[0], mmci_irq, IRQF_SHARED,
-			DRIVER_NAME " (cmd)", host);
+	ret = devm_request_irq(dev, irq0, mmci_irq, IRQF_SHARED,
+			       DRIVER_NAME " (cmd)", host);
 	if (ret)
 		goto clk_disable;
 
-	if (!dev->irq[1])
+	if (!irq1) {
 		host->singleirq = true;
-	else {
-		ret = devm_request_irq(&dev->dev, dev->irq[1], mmci_pio_irq,
-				IRQF_SHARED, DRIVER_NAME " (pio)", host);
+	} else {
+		ret = devm_request_irq(dev, irq1, mmci_pio_irq,
+				       IRQF_SHARED, DRIVER_NAME " (pio)", host);
 		if (ret)
 			goto clk_disable;
 	}
 
 	writel(MCI_IRQENABLE, host->base + MMCIMASK0);
 
-	amba_set_drvdata(dev, mmc);
-
-	dev_info(&dev->dev, "%s: PL%03x manf %x rev%u at 0x%08llx irq %d,%d (pio)\n",
-		 mmc_hostname(mmc), amba_part(dev), amba_manf(dev),
-		 amba_rev(dev), (unsigned long long)dev->res.start,
-		 dev->irq[0], dev->irq[1]);
-
 	mmci_dma_setup(host);
 
-	pm_runtime_set_autosuspend_delay(&dev->dev, 50);
-	pm_runtime_use_autosuspend(&dev->dev);
+	pm_runtime_set_autosuspend_delay(dev, 50);
+	pm_runtime_use_autosuspend(dev);
 
 	mmc_add_host(mmc);
 
-	pm_runtime_put(&dev->dev);
-	return 0;
+	pm_runtime_put(dev);
+	return host;
 
  clk_disable:
 	clk_disable_unprepare(host->clk);
  host_free:
 	mmc_free_host(mmc);
-	return ret;
+	return ERR_PTR(ret);
 }
 
-static int mmci_remove(struct amba_device *dev)
+static int mmc_remove(struct mmc_host *mmc)
 {
-	struct mmc_host *mmc = amba_get_drvdata(dev);
 
 	if (mmc) {
 		struct mmci_host *host = mmc_priv(mmc);
@@ -1739,7 +1730,7 @@ static int mmci_remove(struct amba_device *dev)
 		 * Undo pm_runtime_put() in probe.  We use the _sync
 		 * version here so that we can access the primecell.
 		 */
-		pm_runtime_get_sync(&dev->dev);
+		pm_runtime_get_sync(mmc->parent);
 
 		mmc_remove_host(mmc);
 
@@ -1793,14 +1784,11 @@ static void mmci_restore(struct mmci_host *host)
 	spin_unlock_irqrestore(&host->lock, flags);
 }
 
-static int mmci_runtime_suspend(struct device *dev)
+static int mmci_runtime_suspend(struct mmc_host *mmc)
 {
-	struct amba_device *adev = to_amba_device(dev);
-	struct mmc_host *mmc = amba_get_drvdata(adev);
-
 	if (mmc) {
 		struct mmci_host *host = mmc_priv(mmc);
-		pinctrl_pm_select_sleep_state(dev);
+		pinctrl_pm_select_sleep_state(mmc->parent);
 		mmci_save(host);
 		clk_disable_unprepare(host->clk);
 	}
@@ -1808,28 +1796,77 @@ static int mmci_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int mmci_runtime_resume(struct device *dev)
+static int mmci_runtime_resume(struct mmc_host *mmc)
 {
-	struct amba_device *adev = to_amba_device(dev);
-	struct mmc_host *mmc = amba_get_drvdata(adev);
 
 	if (mmc) {
 		struct mmci_host *host = mmc_priv(mmc);
 		clk_prepare_enable(host->clk);
 		mmci_restore(host);
-		pinctrl_pm_select_default_state(dev);
+		pinctrl_pm_select_default_state(mmc->parent);
 	}
 
 	return 0;
 }
 #endif
 
-static const struct dev_pm_ops mmci_dev_pm_ops = {
+#ifdef CONFIG_ARM_AMBA
+static int mmci_remove_amba(struct amba_device *dev)
+{
+	struct mmc_host *mmc = amba_get_drvdata(dev);
+
+	return mmc_remove(mmc);
+}
+
+static int mmci_runtime_resume_amba(struct device *dev)
+{
+	struct amba_device *adev = to_amba_device(dev);
+	struct mmc_host *mmc = amba_get_drvdata(adev);
+
+	return mmci_runtime_resume(mmc);
+}
+
+static int mmci_runtime_suspend_amba(struct device *dev)
+{
+	struct amba_device *adev = to_amba_device(dev);
+	struct mmc_host *mmc = amba_get_drvdata(adev);
+
+	return mmci_runtime_suspend(mmc);
+}
+
+static const struct dev_pm_ops mmci_dev_pm_ops_amba = {
 	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
 				pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(mmci_runtime_suspend, mmci_runtime_resume, NULL)
+	SET_RUNTIME_PM_OPS(mmci_runtime_suspend_amba, mmci_runtime_resume_amba,
+			   NULL)
 };
 
+static int mmci_probe_amba(struct amba_device *dev, const struct amba_id *id)
+{
+	struct mmci_host *host;
+	struct variant_data *variant = id->data;
+
+	host = mmci_probe(&pdev->dev, variant, &dev->res,
+			  dev->irq[0], dev->irq[1]);
+	if (IS_ERR(ret))
+		return PTR_ERR(host);
+
+	host->hw_designer = amba_manf(dev);
+	host->hw_revision = amba_rev(dev);
+	dev_dbg(mmc_dev(host->mmc), "designer ID = 0x%02x\n",
+		host->hw_designer);
+	dev_dbg(mmc_dev(host->mmc), "revision = 0x%01x\n", host->hw_revision);
+
+	amba_set_drvdata(dev, host->mmc);
+
+	dev_info(&dev->dev, "%s: PL%03x manf %x rev%u at 0x%08llx irq %d,%d (pio)\n",
+		 mmc_hostname(host->mmc), amba_part(dev), amba_manf(dev),
+		 amba_rev(dev), (unsigned long long)dev->res.start,
+		 dev->irq[0], dev->irq[1]);
+
+	return 0;
+}
+
 static struct amba_id mmci_ids[] = {
 	{
 		.id	= 0x00041180,
@@ -1891,14 +1928,108 @@ MODULE_DEVICE_TABLE(amba, mmci_ids);
 static struct amba_driver mmci_driver = {
 	.drv		= {
 		.name	= DRIVER_NAME,
-		.pm	= &mmci_dev_pm_ops,
+		.pm	= &mmci_dev_pm_ops_amba,
 	},
-	.probe		= mmci_probe,
-	.remove		= mmci_remove,
+	.probe		= mmci_probe_amba,
+	.remove		= mmci_remove_amba,
 	.id_table	= mmci_ids,
 };
 
 module_amba_driver(mmci_driver);
+#endif
+
+static const struct of_device_id mmci_pltfm_match[] = {
+	{},
+};
+
+static int mmci_probe_pltfm(struct platform_device *pdev)
+{
+	struct mmci_host *host;
+	struct variant_data *variant;
+	const struct of_device_id *match;
+	int irq0, irq1;
+	struct resource *res;
+
+	irq0 = platform_get_irq(pdev, 0);
+	if (irq0 < 0) {
+		dev_err(&pdev->dev, "Can't get IRQ");
+		return -EINVAL;
+	}
+
+	irq1 = platform_get_irq(pdev, 1);
+	/* optional. set to 0 to be compatible with original amba probe code */
+	if (irq1 < 0)
+		irq1 = 0;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "Can't get MMIO range");
+		return -EINVAL;
+	}
+
+	match = of_match_device(mmci_pltfm_match, &pdev->dev);
+	if (!match) {
+		dev_err(&pdev->dev, "Can't get variant data\n");
+		return -EINVAL;
+	}
+	variant = (struct variant_data *)match->data;
+
+	host = mmci_probe(&pdev->dev, variant, res,
+			  irq0, irq1);
+	if (IS_ERR(host))
+		return PTR_ERR(host);
+
+	platform_set_drvdata(pdev, host->mmc);
+	dev_info(&pdev->dev, "%s: PL81x compatible SDIO at 0x%08llx irq %d,%d (pio)\n",
+		 mmc_hostname(host->mmc),
+		 (unsigned long long)res->start, irq0, irq1);
+
+	return 0;
+}
+
+static int mmci_remove_pltfm(struct platform_device *pdev)
+{
+	struct mmc_host *mmc = platform_get_drvdata(pdev);
+
+	return mmc_remove(mmc);
+}
+
+static int mmci_runtime_resume_pltfm(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct mmc_host *mmc = platform_get_drvdata(pdev);
+
+	return mmci_runtime_resume(mmc);
+}
+
+static int mmci_runtime_suspend_pltfm(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct mmc_host *mmc = platform_get_drvdata(pdev);
+
+	return mmci_runtime_suspend(mmc);
+}
+
+MODULE_DEVICE_TABLE(of, mmci_pltfm_match);
+
+static const struct dev_pm_ops mmci_dev_pm_ops_pltfm = {
+	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+				pm_runtime_force_resume)
+	SET_RUNTIME_PM_OPS(mmci_runtime_suspend_pltfm,
+			   mmci_runtime_resume_pltfm, NULL)
+};
+
+static struct platform_driver mmci_pltfm_driver = {
+	.probe		= mmci_probe_pltfm,
+	.remove		= mmci_remove_pltfm,
+	.driver		= {
+		.name		= DRIVER_NAME,
+		.of_match_table	= mmci_pltfm_match,
+		.pm		= &mmci_dev_pm_ops_pltfm,
+	},
+};
+
+module_platform_driver(mmci_pltfm_driver);
 
 module_param(fmax, uint, 0444);
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/9] mmc: mmci: don't pretend all variants to have MCI_STARBITERR flag
  2016-11-08 13:43 [PATCH 0/9] mmc: mmci: add support for STM32 SD controller Andrea Merello
  2016-11-08 13:43 ` [PATCH 1/9] mmc: mmci: don't pretend IP variants with only one IRQ to have two mask regs Andrea Merello
  2016-11-08 13:43 ` [PATCH 2/9] mmc: mmci: add support for not-amba, but still compatible, variants Andrea Merello
@ 2016-11-08 13:43 ` Andrea Merello
  2016-11-08 13:43 ` [PATCH 4/9] mmc: mmci: add support for setting pad type via pinctrl Andrea Merello
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Andrea Merello @ 2016-11-08 13:43 UTC (permalink / raw)
  To: ulf.hansson, mcoquelin.stm32, alexandre.torgue; +Cc: linux-mmc, Andrea Merello

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

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
---
 drivers/mmc/host/mmci.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index b1dfde3..0c629e3 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -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 */
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 4/9] mmc: mmci: add support for setting pad type via pinctrl
  2016-11-08 13:43 [PATCH 0/9] mmc: mmci: add support for STM32 SD controller Andrea Merello
                   ` (2 preceding siblings ...)
  2016-11-08 13:43 ` [PATCH 3/9] mmc: mmci: don't pretend all variants to have MCI_STARBITERR flag Andrea Merello
@ 2016-11-08 13:43 ` Andrea Merello
  2016-11-08 13:43 ` [PATCH 5/9] mmc: mmci: add STM32 variant Andrea Merello
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Andrea Merello @ 2016-11-08 13:43 UTC (permalink / raw)
  To: ulf.hansson, mcoquelin.stm32, alexandre.torgue; +Cc: linux-mmc, 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.

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
---
 drivers/mmc/host/mmci.c | 52 +++++++++++++++++++++++++++++++++++++++----------
 drivers/mmc/host/mmci.h |  7 +++++--
 2 files changed, 47 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 0c629e3..170c78a 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -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);
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index a1f5e4f..d06c048 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -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
 };
-
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 5/9] mmc: mmci: add STM32 variant
  2016-11-08 13:43 [PATCH 0/9] mmc: mmci: add support for STM32 SD controller Andrea Merello
                   ` (3 preceding siblings ...)
  2016-11-08 13:43 ` [PATCH 4/9] mmc: mmci: add support for setting pad type via pinctrl Andrea Merello
@ 2016-11-08 13:43 ` Andrea Merello
  2016-11-08 13:43 ` [PATCH 6/9] DT: stm32f429: add pin map for SDIO controller Andrea Merello
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Andrea Merello @ 2016-11-08 13:43 UTC (permalink / raw)
  To: ulf.hansson, mcoquelin.stm32, alexandre.torgue; +Cc: linux-mmc, 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.

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
---
 drivers/mmc/host/mmci.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 170c78a..3e67cdd 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -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},
 	{},
 };
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 6/9] DT: stm32f429: add pin map for SDIO controller
  2016-11-08 13:43 [PATCH 0/9] mmc: mmci: add support for STM32 SD controller Andrea Merello
                   ` (4 preceding siblings ...)
  2016-11-08 13:43 ` [PATCH 5/9] mmc: mmci: add STM32 variant Andrea Merello
@ 2016-11-08 13:43 ` Andrea Merello
  2016-11-10 10:51   ` Alexandre Torgue
  2016-11-08 13:43 ` [PATCH 7/9] DT: stm32f429: add node " Andrea Merello
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 17+ messages in thread
From: Andrea Merello @ 2016-11-08 13:43 UTC (permalink / raw)
  To: ulf.hansson, mcoquelin.stm32, alexandre.torgue; +Cc: linux-mmc, Andrea Merello

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
---
 arch/arm/boot/dts/stm32f429.dtsi | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
index 336ee4f..961bc0c 100644
--- a/arch/arm/boot/dts/stm32f429.dtsi
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -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>,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 7/9] DT: stm32f429: add node for SDIO controller
  2016-11-08 13:43 [PATCH 0/9] mmc: mmci: add support for STM32 SD controller Andrea Merello
                   ` (5 preceding siblings ...)
  2016-11-08 13:43 ` [PATCH 6/9] DT: stm32f429: add pin map for SDIO controller Andrea Merello
@ 2016-11-08 13:43 ` Andrea Merello
  2016-11-08 13:43 ` [PATCH 8/9] DT: stm32f469-disco: " Andrea Merello
  2016-11-08 13:43 ` [PATCH 9/9] Documentation: document mmci STM32 DT binding Andrea Merello
  8 siblings, 0 replies; 17+ messages in thread
From: Andrea Merello @ 2016-11-08 13:43 UTC (permalink / raw)
  To: ulf.hansson, mcoquelin.stm32, alexandre.torgue; +Cc: linux-mmc, Andrea Merello

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
---
 arch/arm/boot/dts/stm32f429.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
index 961bc0c..d6d0548 100644
--- a/arch/arm/boot/dts/stm32f429.dtsi
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -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>;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 8/9] DT: stm32f469-disco: add node for SDIO controller
  2016-11-08 13:43 [PATCH 0/9] mmc: mmci: add support for STM32 SD controller Andrea Merello
                   ` (6 preceding siblings ...)
  2016-11-08 13:43 ` [PATCH 7/9] DT: stm32f429: add node " Andrea Merello
@ 2016-11-08 13:43 ` Andrea Merello
  2016-11-10 10:54   ` Alexandre Torgue
  2016-11-08 13:43 ` [PATCH 9/9] Documentation: document mmci STM32 DT binding Andrea Merello
  8 siblings, 1 reply; 17+ messages in thread
From: Andrea Merello @ 2016-11-08 13:43 UTC (permalink / raw)
  To: ulf.hansson, mcoquelin.stm32, alexandre.torgue; +Cc: linux-mmc, Andrea Merello

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
---
 arch/arm/boot/dts/stm32f429.dtsi      |  2 +-
 arch/arm/boot/dts/stm32f469-disco.dts | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
index d6d0548..23e6a5e 100644
--- a/arch/arm/boot/dts/stm32f429.dtsi
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -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";
diff --git a/arch/arm/boot/dts/stm32f469-disco.dts b/arch/arm/boot/dts/stm32f469-disco.dts
index e911af8..e16dfc3 100644
--- a/arch/arm/boot/dts/stm32f469-disco.dts
+++ b/arch/arm/boot/dts/stm32f469-disco.dts
@@ -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";
 };
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 9/9] Documentation: document mmci STM32 DT binding
  2016-11-08 13:43 [PATCH 0/9] mmc: mmci: add support for STM32 SD controller Andrea Merello
                   ` (7 preceding siblings ...)
  2016-11-08 13:43 ` [PATCH 8/9] DT: stm32f469-disco: " Andrea Merello
@ 2016-11-08 13:43 ` Andrea Merello
  8 siblings, 0 replies; 17+ messages in thread
From: Andrea Merello @ 2016-11-08 13:43 UTC (permalink / raw)
  To: ulf.hansson, mcoquelin.stm32, alexandre.torgue; +Cc: linux-mmc, Andrea Merello

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
---
 Documentation/devicetree/bindings/mmc/mmci.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mmc/mmci.txt b/Documentation/devicetree/bindings/mmc/mmci.txt
index 03796cf..d6b5127 100644
--- a/Documentation/devicetree/bindings/mmc/mmci.txt
+++ b/Documentation/devicetree/bindings/mmc/mmci.txt
@@ -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.
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/9] mmc: mmci: add support for not-amba, but still compatible, variants
  2016-11-08 13:43 ` [PATCH 2/9] mmc: mmci: add support for not-amba, but still compatible, variants Andrea Merello
@ 2016-11-08 17:39   ` kbuild test robot
  2016-11-08 17:41   ` kbuild test robot
  1 sibling, 0 replies; 17+ messages in thread
From: kbuild test robot @ 2016-11-08 17:39 UTC (permalink / raw)
  Cc: kbuild-all, ulf.hansson, mcoquelin.stm32, alexandre.torgue,
	linux-mmc, Andrea Merello

[-- Attachment #1: Type: text/plain, Size: 8792 bytes --]

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 <lars@metafoo.de>
:::::: CC: Greg Kroah-Hartman <gregkh@suse.de>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 59383 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/9] mmc: mmci: add support for not-amba, but still compatible, variants
  2016-11-08 13:43 ` [PATCH 2/9] mmc: mmci: add support for not-amba, but still compatible, variants Andrea Merello
  2016-11-08 17:39   ` kbuild test robot
@ 2016-11-08 17:41   ` kbuild test robot
  1 sibling, 0 replies; 17+ messages in thread
From: kbuild test robot @ 2016-11-08 17:41 UTC (permalink / raw)
  Cc: kbuild-all, ulf.hansson, mcoquelin.stm32, alexandre.torgue,
	linux-mmc, Andrea Merello

[-- Attachment #1: Type: text/plain, Size: 2652 bytes --]

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 47827 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 6/9] DT: stm32f429: add pin map for SDIO controller
  2016-11-08 13:43 ` [PATCH 6/9] DT: stm32f429: add pin map for SDIO controller Andrea Merello
@ 2016-11-10 10:51   ` Alexandre Torgue
  2016-11-14 10:19     ` Andrea Merello
  0 siblings, 1 reply; 17+ messages in thread
From: Alexandre Torgue @ 2016-11-10 10:51 UTC (permalink / raw)
  To: Andrea Merello, ulf.hansson, mcoquelin.stm32; +Cc: linux-mmc

Hi Andrea,

Some minor remarks.

On 11/08/2016 02:43 PM, Andrea Merello wrote:
> Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
> ---
>  arch/arm/boot/dts/stm32f429.dtsi | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
>
> diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
> index 336ee4f..961bc0c 100644
> --- a/arch/arm/boot/dts/stm32f429.dtsi
> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> @@ -313,6 +313,37 @@
>  				};
>  			};
>
> +			sdio_pins:sdio_pins@0 {
Add a space after ":"
> +				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
> +				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>;
> +				};
Why don't use "pins1" and "pins2" instead of "pins" and "pins_od" like 
it is done for usart1?

regards
Alex

> +			};
> +




>  			ethernet0_mii: mii@0 {
>  				pins {
>  					pinmux = <STM32F429_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0>,
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 8/9] DT: stm32f469-disco: add node for SDIO controller
  2016-11-08 13:43 ` [PATCH 8/9] DT: stm32f469-disco: " Andrea Merello
@ 2016-11-10 10:54   ` Alexandre Torgue
  2016-11-14 10:36     ` Andrea Merello
  0 siblings, 1 reply; 17+ messages in thread
From: Alexandre Torgue @ 2016-11-10 10:54 UTC (permalink / raw)
  To: Andrea Merello, ulf.hansson, mcoquelin.stm32; +Cc: linux-mmc

Hi Andrea

On 11/08/2016 02:43 PM, Andrea Merello wrote:
> Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
> ---
>  arch/arm/boot/dts/stm32f429.dtsi      |  2 +-
>  arch/arm/boot/dts/stm32f469-disco.dts | 30 ++++++++++++++++++++++++++++++
>  2 files changed, 31 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
> index d6d0548..23e6a5e 100644
> --- a/arch/arm/boot/dts/stm32f429.dtsi
> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> @@ -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";
> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts b/arch/arm/boot/dts/stm32f469-disco.dts
> index e911af8..e16dfc3 100644
> --- a/arch/arm/boot/dts/stm32f469-disco.dts
> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
> @@ -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.
> +
> +	};
>  };
>
>  &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";
>  };
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 6/9] DT: stm32f429: add pin map for SDIO controller
  2016-11-10 10:51   ` Alexandre Torgue
@ 2016-11-14 10:19     ` Andrea Merello
  0 siblings, 0 replies; 17+ messages in thread
From: Andrea Merello @ 2016-11-14 10:19 UTC (permalink / raw)
  To: Alexandre Torgue; +Cc: Ulf Hansson, Maxime Coquelin, linux-mmc, Bruno Herrera

On Thu, Nov 10, 2016 at 11:51 AM, Alexandre Torgue
<alexandre.torgue@st.com> wrote:
> Hi Andrea,
>
> Some minor remarks.

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

> On 11/08/2016 02:43 PM, Andrea Merello wrote:
>>
>> Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
>> ---
>>  arch/arm/boot/dts/stm32f429.dtsi | 31 +++++++++++++++++++++++++++++++
>>  1 file changed, 31 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> b/arch/arm/boot/dts/stm32f429.dtsi
>> index 336ee4f..961bc0c 100644
>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> @@ -313,6 +313,37 @@
>>                                 };
>>                         };
>>
>> +                       sdio_pins:sdio_pins@0 {
>
> Add a space after ":"

OK

>>
>> +                               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

OK

>>
>> +                               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>;
>> +                               };
>
> Why don't use "pins1" and "pins2" instead of "pins" and "pins_od" like it is
> done for usart1?


OK

> regards
> Alex
>
>
>> +                       };
>> +
>
>
>
>
>
>>                         ethernet0_mii: mii@0 {
>>                                 pins {
>>                                         pinmux =
>> <STM32F429_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0>,
>>
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 8/9] DT: stm32f469-disco: add node for SDIO controller
  2016-11-10 10:54   ` Alexandre Torgue
@ 2016-11-14 10:36     ` Andrea Merello
  2016-11-14 10:42       ` Alexandre Torgue
  0 siblings, 1 reply; 17+ messages in thread
From: Andrea Merello @ 2016-11-14 10:36 UTC (permalink / raw)
  To: Alexandre Torgue; +Cc: Ulf Hansson, Maxime Coquelin, linux-mmc, Bruno Herrera

On Thu, Nov 10, 2016 at 11:54 AM, Alexandre Torgue
<alexandre.torgue@st.com> wrote:
> Hi Andrea
>
>
> On 11/08/2016 02:43 PM, Andrea Merello wrote:
>>
>> Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
>> ---
>>  arch/arm/boot/dts/stm32f429.dtsi      |  2 +-
>>  arch/arm/boot/dts/stm32f469-disco.dts | 30 ++++++++++++++++++++++++++++++
>>  2 files changed, 31 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> b/arch/arm/boot/dts/stm32f429.dtsi
>> index d6d0548..23e6a5e 100644
>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> @@ -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";
>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>> b/arch/arm/boot/dts/stm32f469-disco.dts
>> index e911af8..e16dfc3 100644
>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>> @@ -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.

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)..

>> +
>> +       };
>>  };
>>
>>  &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";
>>  };
>>
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 8/9] DT: stm32f469-disco: add node for SDIO controller
  2016-11-14 10:36     ` Andrea Merello
@ 2016-11-14 10:42       ` Alexandre Torgue
  0 siblings, 0 replies; 17+ messages in thread
From: Alexandre Torgue @ 2016-11-14 10:42 UTC (permalink / raw)
  To: andrea.merello; +Cc: Ulf Hansson, Maxime Coquelin, linux-mmc, Bruno Herrera

Hi Andrea

On 11/14/2016 11:36 AM, Andrea Merello wrote:
> On Thu, Nov 10, 2016 at 11:54 AM, Alexandre Torgue
> <alexandre.torgue@st.com> wrote:
>> Hi Andrea
>>
>>
>> On 11/08/2016 02:43 PM, Andrea Merello wrote:
>>>
>>> Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
>>> ---
>>>  arch/arm/boot/dts/stm32f429.dtsi      |  2 +-
>>>  arch/arm/boot/dts/stm32f469-disco.dts | 30 ++++++++++++++++++++++++++++++
>>>  2 files changed, 31 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>> index d6d0548..23e6a5e 100644
>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>> @@ -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";
>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>> index e911af8..e16dfc3 100644
>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>> @@ -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.
>
> Sure. I will do. (But unfortunately it will not happen very soon :( )
No pb.
>
> 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


>
>>> +
>>> +       };
>>>  };
>>>
>>>  &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";
>>>  };
>>>
>>

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-11-14 10:42 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-08 13:43 [PATCH 0/9] mmc: mmci: add support for STM32 SD controller Andrea Merello
2016-11-08 13:43 ` [PATCH 1/9] mmc: mmci: don't pretend IP variants with only one IRQ to have two mask regs Andrea Merello
2016-11-08 13:43 ` [PATCH 2/9] mmc: mmci: add support for not-amba, but still compatible, variants Andrea Merello
2016-11-08 17:39   ` kbuild test robot
2016-11-08 17:41   ` kbuild test robot
2016-11-08 13:43 ` [PATCH 3/9] mmc: mmci: don't pretend all variants to have MCI_STARBITERR flag Andrea Merello
2016-11-08 13:43 ` [PATCH 4/9] mmc: mmci: add support for setting pad type via pinctrl Andrea Merello
2016-11-08 13:43 ` [PATCH 5/9] mmc: mmci: add STM32 variant Andrea Merello
2016-11-08 13:43 ` [PATCH 6/9] DT: stm32f429: add pin map for SDIO controller Andrea Merello
2016-11-10 10:51   ` Alexandre Torgue
2016-11-14 10:19     ` Andrea Merello
2016-11-08 13:43 ` [PATCH 7/9] DT: stm32f429: add node " Andrea Merello
2016-11-08 13:43 ` [PATCH 8/9] DT: stm32f469-disco: " Andrea Merello
2016-11-10 10:54   ` Alexandre Torgue
2016-11-14 10:36     ` Andrea Merello
2016-11-14 10:42       ` Alexandre Torgue
2016-11-08 13:43 ` [PATCH 9/9] Documentation: document mmci STM32 DT binding Andrea Merello

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.