Skip to contentSkip to conversation

mmc: pci: Add CONFIG_MMC_PCI

PATCH Superseded Andy Shevchenko 3 participants 5 messages Feb 17, 2017 – Feb 20, 2017 MMC, SD and SDIO

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 mmc: pci: Add CONFIG_MMC_PCI

From: Felipe Balbi <[email protected]>

We don't want pci_mmc to compile every time x86 compiles, only when there's a platform that needs it. For that reason, we're adding a new CONFIG_MMC_PCI which platforms can choose to enable.

---
 configs/bayleybay_defconfig                             | 1 +
 configs/conga-qeval20-qa3-e3845-internal-uart_defconfig | 1 +
 configs/conga-qeval20-qa3-e3845_defconfig               | 1 +
 configs/crownbay_defconfig                              | 1 +
 configs/dfi-bt700-q7x-151_defconfig                     | 1 +
 configs/galileo_defconfig                               | 1 +
 configs/minnowmax_defconfig                             | 1 +
 configs/theadorable-x86-dfi-bt700_defconfig             | 1 +
 drivers/mmc/Kconfig                                     | 8 ++++++++
 drivers/mmc/Makefile                                    | 2 +-
 10 files changed, 17 insertions(+), 1 deletion(-)
configs/bayleybay_defconfig +1 -0
index c6aa24f9be..d2f9f24a19 100644
@@ -48,6 +48,7 @@ CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CPU=y
 CONFIG_MMC=y
+CONFIG_MMC_PCI=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_SPI_FLASH=y
configs/conga-qeval20-qa3-e3845-internal-uart_defconfig +1 -0
index 890d28ce69..d96bfcbe14 100644
@@ -50,6 +50,7 @@ CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_INTEL=y
 CONFIG_WINBOND_W83627=y
 CONFIG_MMC=y
+CONFIG_MMC_PCI=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_SPI_FLASH=y
configs/conga-qeval20-qa3-e3845_defconfig +1 -0
index 6e4cd843d9..1642bf2926 100644
@@ -49,6 +49,7 @@ CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_INTEL=y
 CONFIG_WINBOND_W83627=y
 CONFIG_MMC=y
+CONFIG_MMC_PCI=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_SPI_FLASH=y
configs/crownbay_defconfig +1 -0
index 13a00c2a17..4a88f5f3c5 100644
@@ -37,6 +37,7 @@ CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CPU=y
 CONFIG_MMC=y
+CONFIG_MMC_PCI=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_SPI_FLASH=y
configs/dfi-bt700-q7x-151_defconfig +1 -0
index ce447f540a..d5bd66f83c 100644
@@ -47,6 +47,7 @@ CONFIG_CPU=y
 CONFIG_DM_I2C=y
 CONFIG_NUVOTON_NCT6102D=y
 CONFIG_MMC=y
+CONFIG_MMC_PCI=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_SPI_FLASH=y
configs/galileo_defconfig +1 -0
index 570f9ea810..f60abc3422 100644
@@ -42,6 +42,7 @@ CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CPU=y
 CONFIG_MMC=y
+CONFIG_MMC_PCI=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_SPI_FLASH=y
configs/minnowmax_defconfig +1 -0
index 5f61f2a19c..8dac1d72fb 100644
@@ -47,6 +47,7 @@ CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CPU=y
 CONFIG_MMC=y
+CONFIG_MMC_PCI=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_SPI_FLASH=y
configs/theadorable-x86-dfi-bt700_defconfig +1 -0
index cde33bbfe1..1703cee841 100644
@@ -47,6 +47,7 @@ CONFIG_CPU=y
 CONFIG_DM_I2C=y
 CONFIG_NUVOTON_NCT6102D=y
 CONFIG_MMC=y
+CONFIG_MMC_PCI=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_SPI_FLASH=y
drivers/mmc/Kconfig +8 -0
index 01d1dbfb1b..af8436f337 100644
@@ -122,6 +122,14 @@ config MMC_MXS
 
 	  If unsure, say N.
 
+config MMC_PCI
+	bool "Support for MMC controllers on PCI"
+	help
+	  This selects PCI-based MMC controllers.
+	  If you have an MMC controller on a PCI bus, say Y here.
+
+	  If unsure, say N.
+
 config MMC_OMAP_HS
 	bool "TI OMAP High Speed Multimedia Card Interface support"
 	help
drivers/mmc/Makefile +1 -1
index 8e922db3f1..9fccac8ead 100644
@@ -34,7 +34,7 @@ obj-$(CONFIG_MVEBU_MMC) += mvebu_mmc.o
 obj-$(CONFIG_MMC_OMAP_HS)		+= omap_hsmmc.o
 obj-$(CONFIG_MMC_MXC)			+= mxcmmc.o
 obj-$(CONFIG_MMC_MXS)			+= mxsmmc.o
-obj-$(CONFIG_X86) += pci_mmc.o
+obj-$(CONFIG_MMC_PCI)			+= pci_mmc.o
 obj-$(CONFIG_PXA_MMC_GENERIC) += pxa_mmc_gen.o
 obj-$(CONFIG_SUPPORT_EMMC_RPMB) += rpmb.o
 obj-$(CONFIG_S3C_SDI) += s3c_sdi.o
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 2/2 mmc: tangier: Add Intel Tangier eMMC/SDHCI driver

From: Felipe Balbi <[email protected]>

This patch adds Intel Tangier eMMC/SDHCI driver.

---
 drivers/mmc/Kconfig         |  5 ++++
 drivers/mmc/Makefile        |  1 +
 drivers/mmc/tangier_sdhci.c | 72 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 78 insertions(+)
 create mode 100644 drivers/mmc/tangier_sdhci.c
drivers/mmc/Kconfig +5 -0
index af8436f337..e060547b1d 100644
@@ -318,6 +318,11 @@ config MMC_SDHCI_XENON
 
 	  If unsure, say N.
 
+config MMC_SDHCI_TANGIER
+	bool "Tangier SDHCI controller support"
+	depends on DM_MMC && BLK
+	depends on MMC_SDHCI
+
 config MMC_SDHCI_TEGRA
 	bool "SDHCI platform support for the Tegra SD/MMC Controller"
 	depends on TEGRA
drivers/mmc/Makefile +1 -0
index 9fccac8ead..b210d2c3b3 100644
@@ -61,6 +61,7 @@ obj-$(CONFIG_MMC_SDHCI_PIC32)		+= pic32_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_ROCKCHIP)	+= rockchip_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_S5P)		+= s5p_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_SPEAR)		+= spear_sdhci.o
+obj-$(CONFIG_MMC_SDHCI_TANGIER)		+= tangier_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_TEGRA)		+= tegra_mmc.o
 obj-$(CONFIG_MMC_SDHCI_XENON)		+= xenon_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_ZYNQ)		+= zynq_sdhci.o
drivers/mmc/tangier_sdhci.c new file +72 -0

72 lines not on this page · raw message

Signature · 1 line
2.11.0
#2 lore raw

PATCH v2 2/2 mmc: tangier: Add Intel Tangier eMMC/SDHCI driver

Hi Andy,

Quoted 3 lines · Andy Shevchenko

From: Felipe Balbi <[email protected]>

This patch adds Intel Tangier eMMC/SDHCI driver.

So this eMMC/SDHC controller is not on PCI bus, correct? If so, can you add more comments to the commit message?

Quoted 16 lines
---
 drivers/mmc/Kconfig         |  5 ++++
 drivers/mmc/Makefile        |  1 +
 drivers/mmc/tangier_sdhci.c | 72 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 78 insertions(+)
 create mode 100644 drivers/mmc/tangier_sdhci.c
drivers/mmc/Kconfig +0 -0
index af8436f337..e060547b1d 100644

drivers/mmc/Kconfig config MMC_SDHCI_XENON · line 324

Quoted 7 lines
drivers/mmc/Kconfig +4 -0
@@ -318,6 +318,11 @@ config MMC_SDHCI_XENON
 
          If unsure, say N.
 
+config MMC_SDHCI_TANGIER
+       bool "Tangier SDHCI controller support"
+       depends on DM_MMC && BLK
+       depends on MMC_SDHCI

Please add a "help" here, like mentioning it's not on PCI bus (if I am correct)?

drivers/mmc/tangier_sdhci.c

Quoted 22 lines
drivers/mmc/Kconfig +1 -0
+
 config MMC_SDHCI_TEGRA
        bool "SDHCI platform support for the Tegra SD/MMC Controller"
        depends on TEGRA
drivers/mmc/Makefile +1 -0
index 9fccac8ead..b210d2c3b3 100644
@@ -61,6 +61,7 @@ obj-$(CONFIG_MMC_SDHCI_PIC32)         += pic32_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_ROCKCHIP)       += rockchip_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_S5P)            += s5p_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_SPEAR)          += spear_sdhci.o
+obj-$(CONFIG_MMC_SDHCI_TANGIER)                += tangier_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_TEGRA)          += tegra_mmc.o
 obj-$(CONFIG_MMC_SDHCI_XENON)          += xenon_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_ZYNQ)           += zynq_sdhci.o
drivers/mmc/tangier_sdhci.c new file +0 -0
new file mode 100644
index 0000000000..5ab2afa8b5
@@ -0,0 +1,72 @@

Please add a file header with author and license information here.

Quoted 37 lines
drivers/mmc/tangier_sdhci.c new file +37 -0
+#include <common.h>
+#include <dm.h>
+#include <dm/device.h>
+#include <linux/io.h>
+#include <linux/sizes.h>
+#include <malloc.h>
+#include <mmc.h>
+#include <sdhci.h>
+
+struct sdhci_tangier_plat {
+       struct mmc_config cfg;
+       struct mmc mmc;
+       void __iomem *ioaddr;
+};
+
+static int sdhci_tangier_bind(struct udevice *dev)
+{
+       struct sdhci_tangier_plat *plat = dev_get_platdata(dev);
+
+       return sdhci_bind(dev, &plat->mmc, &plat->cfg);
+}
+
+static int sdhci_tangier_probe(struct udevice *dev)
+{
+       struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+       struct sdhci_tangier_plat *plat = dev_get_platdata(dev);
+       struct sdhci_host *host = dev_get_priv(dev);
+       fdt_addr_t base;
+       int ret;
+
+       base = dev_get_addr(dev);
+       if (base == FDT_ADDR_T_NONE)
+               return -EINVAL;
+
+       plat->ioaddr = devm_ioremap(dev, base, SZ_1K);
+       if (!plat->ioaddr)
+               return -ENOMEM;

drivers/mmc/tangier_sdhci.c line 47

Quoted 10 lines
drivers/mmc/tangier_sdhci.c new file +10 -0
+
+       host->name = dev->name;
+       host->ioaddr = plat->ioaddr;
+       host->quirks = SDHCI_QUIRK_NO_HISPD_BIT | SDHCI_QUIRK_BROKEN_VOLTAGE |
+                      SDHCI_QUIRK_32BIT_DMA_ADDR | SDHCI_QUIRK_WAIT_SEND_CMD;
+
+       /* MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195 */
+       host->voltages = MMC_VDD_165_195;
+
+       ret = sdhci_setup_cfg(&plat->cfg, host, 200000000, 400000);

Can we use some defines for 200000000 and 400000?

Quoted 16 lines
drivers/mmc/tangier_sdhci.c new file +16 -0
+       if (ret)
+               return ret;
+
+       upriv->mmc = &plat->mmc;
+       host->mmc = &plat->mmc;
+       host->mmc->priv = host;
+
+       return sdhci_probe(dev);
+}
+
+static const struct udevice_id sdhci_tangier_match[] = {
+       { .compatible = "intel,sdhci-tangier" },
+       { /* sentinel */ }
+};
+
+U_BOOT_DRIVER(sdhci_tangier) = {

drivers/mmc/tangier_sdhci.c

Quoted 10 lines
drivers/mmc/tangier_sdhci.c new file +9 -1
+       .name           = "sdhci-tangier",
+       .id             = UCLASS_MMC,
+       .of_match       = sdhci_tangier_match,
+       .bind           = sdhci_tangier_bind,
+       .probe          = sdhci_tangier_probe,
+       .ops            = &sdhci_ops,
+       .priv_auto_alloc_size = sizeof(struct sdhci_host),
+       .platdata_auto_alloc_size = sizeof(struct sdhci_tangier_plat),
+};
--

Regards,
Bin

#3 lore raw

PATCH v2 2/2 mmc: tangier: Add Intel Tangier eMMC/SDHCI driver

Quoted 9 lines · Bin Meng

Hi Andy,

Quoted 3 lines · Andy Shevchenko

From: Felipe Balbi <[email protected]>

This patch adds Intel Tangier eMMC/SDHCI driver.

So this eMMC/SDHC controller is not on PCI bus, correct?

Yes and no.

It's so called "fake PCI". Intel MID have couple of real PCI devices and many "fake" ones.
They have (semi-)complaint programming interface, but do not fully follow PCI spec.

To implement it as a PCI controller we need a PCI bus quirk. I dunno if on this stage it makes sense for U-Boot.

Our goal is to have minimum support of Intel Edison board in U-Boot upstream from which we (or anybody else) might continue to enhance.

Quoted 2 lines

If so, can
you add more comments to the commit message?

I would add something as per this discussion.

Quoted 44 lines
Quoted 17 lines
---
 drivers/mmc/Kconfig         |  5 ++++
 drivers/mmc/Makefile        |  1 +
 drivers/mmc/tangier_sdhci.c | 72 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 78 insertions(+)
 create mode 100644 drivers/mmc/tangier_sdhci.c
drivers/mmc/Kconfig +0 -0
index af8436f337..e060547b1d 100644

drivers/mmc/Kconfig config MMC_SDHCI_XENON · line 324

Quoted 7 lines
drivers/mmc/Kconfig +4 -0
@@ -318,6 +318,11 @@ config MMC_SDHCI_XENON
 
          If unsure, say N.
 
+config MMC_SDHCI_TANGIER
+       bool "Tangier SDHCI controller support"
+       depends on DM_MMC && BLK
+       depends on MMC_SDHCI

Please add a "help" here, like mentioning it's not on PCI bus (if I am correct)?

Quoted 17 lines
drivers/mmc/Kconfig +1 -0
+
 config MMC_SDHCI_TEGRA
        bool "SDHCI platform support for the Tegra SD/MMC Controller"
        depends on TEGRA
drivers/mmc/Makefile +1 -0
index 9fccac8ead..b210d2c3b3 100644
@@ -61,6 +61,7 @@ obj-$(CONFIG_MMC_SDHCI_PIC32)         += pic32_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_ROCKCHIP)       += rockchip_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_S5P)            += s5p_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_SPEAR)          += spear_sdhci.o
+obj-$(CONFIG_MMC_SDHCI_TANGIER)                += tangier_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_TEGRA)          += tegra_mmc.o
 obj-$(CONFIG_MMC_SDHCI_XENON)          += xenon_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_ZYNQ)           += zynq_sdhci.o
drivers/mmc/tangier_sdhci.c +0 -0
Quoted 8 lines

drivers/mmc/tangier_sdhci.c

Quoted 5 lines

new file mode 100644
index 0000000000..5ab2afa8b5

drivers/mmc/tangier_sdhci.c new file +0 -0
@@ -0,0 +1,72 @@

Please add a file header with author and license information here.

I will ask Felipe.

Quoted 3 lines

drivers/mmc/tangier_sdhci.c line 47

Quoted 1 line
drivers/mmc/tangier_sdhci.c new file +1 -0
+       ret = sdhci_setup_cfg(&plat->cfg, host, 200000000, 400000);

Can we use some defines for 200000000 and 400000?

Ditto.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

PATCH v2 1/2 mmc: pci: Add CONFIG_MMC_PCI

In reply to Andy Shevchenko
Quoted 9 lines · Andy Shevchenko

From: Felipe Balbi <[email protected]>

We don't want pci_mmc to compile every time x86 compiles, only when there's a platform that needs it. For that reason, we're adding a new CONFIG_MMC_PCI which platforms can choose to enable.

Quoted 13 lines
---
 configs/bayleybay_defconfig                             | 1 +
 configs/conga-qeval20-qa3-e3845-internal-uart_defconfig | 1 +
 configs/conga-qeval20-qa3-e3845_defconfig               | 1 +
 configs/crownbay_defconfig                              | 1 +
 configs/dfi-bt700-q7x-151_defconfig                     | 1 +
 configs/galileo_defconfig                               | 1 +
 configs/minnowmax_defconfig                             | 1 +
 configs/theadorable-x86-dfi-bt700_defconfig             | 1 +
 drivers/mmc/Kconfig                                     | 8 ++++++++
 drivers/mmc/Makefile                                    | 2 +-
 10 files changed, 17 insertions(+), 1 deletion(-)