[U-Boot] [PATCH v1 9/9] mmc: arm_pl180_mmci: Sync compatible with kernel

Patrice Chotard patrice.chotard at st.com
Fri Feb 22 14:00:16 UTC 2019


Initially the compatible string was wrongly set to "st,stm32f4xx-sdio".
Use compatible string used by kernel instead and identify mmci variant
using "arm,primecell-periphid" property.

Currently, the DM part of mmci driver is only used by STM32 SoCs,
that's why the switch case gets only one entry. It will be populated
easily with new variant in the future.

Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
---

 drivers/mmc/arm_pl180_mmci.c | 14 ++++++++++++--
 drivers/mmc/arm_pl180_mmci.h |  3 +--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
index f71d79ecd6ba..ea8eb0d5091d 100644
--- a/drivers/mmc/arm_pl180_mmci.c
+++ b/drivers/mmc/arm_pl180_mmci.c
@@ -422,6 +422,7 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
 	struct mmc_config *cfg = &pdata->cfg;
 	struct clk clk;
 	u32 bus_width;
+	u32 periphid;
 	int ret;
 
 	ret = clk_get_by_index(dev, 0, &clk);
@@ -439,7 +440,15 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
 	host->clkdiv_init = SDI_CLKCR_CLKDIV_INIT_V1 | SDI_CLKCR_CLKEN |
 			    SDI_CLKCR_HWFC_EN;
 	host->clock_in = clk_get_rate(&clk);
-	host->version2 = dev_get_driver_data(dev);
+
+	periphid = dev_read_u32_default(dev, "arm,primecell-periphid", 0);
+	switch (periphid) {
+	case STM32_MMCI_ID: /* stm32 variant */
+		host->version2 = false;
+		break;
+	default:
+		host->version2 = true;
+	}
 
 	cfg->name = dev->name;
 	cfg->voltages = VOLTAGE_WINDOW_SD;
@@ -526,7 +535,8 @@ static int arm_pl180_mmc_ofdata_to_platdata(struct udevice *dev)
 }
 
 static const struct udevice_id arm_pl180_mmc_match[] = {
-	{ .compatible = "st,stm32f4xx-sdio", .data = VERSION1 },
+	{ .compatible = "arm,pl180" },
+	{ .compatible = "arm,primecell" },
 	{ /* sentinel */ }
 };
 
diff --git a/drivers/mmc/arm_pl180_mmci.h b/drivers/mmc/arm_pl180_mmci.h
index 36487be288b2..61ee96a112d9 100644
--- a/drivers/mmc/arm_pl180_mmci.h
+++ b/drivers/mmc/arm_pl180_mmci.h
@@ -141,8 +141,7 @@
 
 #define SDI_FIFO_BURST_SIZE	8
 
-#define VERSION1	false
-#define VERSION2	true
+#define STM32_MMCI_ID		0x00880180
 
 struct sdi_registers {
 	u32 power;		/* 0x00*/
-- 
1.9.1



More information about the U-Boot mailing list