Skip to contentSkip to conversation

dm/mmc: gen_atmel_mci: Add driver model support for mci

PATCH Superseded Wenyou Yang 3 participants 3 messages Sep 20, 2016 – Sep 21, 2016

Subsystems (2)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dm/mmc: gen_atmel_mci: Add driver model support for mci

Add the driver model support for Atmel mci while retaining the existing legacy code. This allows the driver to support boards that have converted to driver model as well as those that have not.

---

Changes in v2:
- Change the return type of atmel_mci_setup_cfg() from int to void.
- Add comments on the features depends on the IP version.
- Add the error handle path of clock.
- Fix the missing use priv->bus_clk_rate.
- Return from mmc_bind() directly, instead of checking its return.

 drivers/mmc/Kconfig         |   9 +++
 drivers/mmc/gen_atmel_mci.c | 164 +++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 172 insertions(+), 1 deletion(-)
drivers/mmc/Kconfig +9 -0
index a71afa5..e56eb94 100644
@@ -44,6 +44,15 @@ config ATMEL_SDHCI
 	  It is compliant with the SD Host Controller Standard V3.0
 	  specification.
 
+config GENERIC_ATMEL_MCI
+	bool "Atmel Multimedia Card Interface support"
+	depends on DM_MMC && BLK && DM_MMC_OPS && ARCH_AT91
+	help
+	  This enables support for Atmel High Speed Multimedia Card Interface
+	  (HSMCI), which supports the MultiMedia Card (MMC) Specification V4.3,
+	  the SD Memory Card Specification V2.0, the SDIO V2.0 specification
+	  and CE-ATA V1.1.
+
 config ROCKCHIP_DWMMC
 	bool "Rockchip SD/MMC controller support"
 	depends on DM_MMC && OF_CONTROL
drivers/mmc/gen_atmel_mci.c +163 -1

248 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 dm/mmc: gen_atmel_mci: Add driver model support for mci

Quoted 5 lines · Wenyou Yang

Add the driver model support for Atmel mci while retaining the existing legacy code. This allows the driver to support boards that have converted to driver model as well as those that have not.

drivers/mmc/Kconfig config ATMEL_SDHCI · line 54

Quoted 9 lines
drivers/mmc/Kconfig +8 -0
 
+config GENERIC_ATMEL_MCI
+	bool "Atmel Multimedia Card Interface support"
+	depends on DM_MMC && BLK && DM_MMC_OPS && ARCH_AT91
+	help
+	  This enables support for Atmel High Speed Multimedia Card Interface
+	  (HSMCI), which supports the MultiMedia Card (MMC) Specification V4.3,
+	  the SD Memory Card Specification V2.0, the SDIO V2.0 specification
+	  and CE-ATA V1.1.

This seems unrelated to the actual driver conversion. It's more like part of a convert-the-option-to-Kconfig patch. I suspect it should be removed for now?

I think you need to remove "#define GENERIC_ATMEL_MCI" from include/configs/*.h and add it to configs/*_defconfig as part of the patch that adds this Kconfig option.

drivers/mmc/Kconfig

Quoted 13 lines
drivers/mmc/Kconfig +7 -1
+#ifndef CONFIG_DM_MMC
 /* Setup for MCI Clock and Block Size */
 static void mci_set_mode(struct mmc *mmc, u32 hz, u32 blklen)
 {
 	struct atmel_mci_priv *priv = mmc->priv;
-	atmel_mci_t *mci = priv->mci;
 	u32 bus_hz = get_mci_clk_rate();
+#else
+static void mci_set_mode(struct atmel_mci_priv *priv, u32 hz, u32 blklen)
+{
+	struct mmc *mmc = &priv->mmc;
+	u32 bus_hz = priv->bus_clk_rate;
+#endif

It's technically CONFIG_DM_MMC_OPS that changes that function signature, I believe. This code could allow someone to enable just CONFIG_DM_MMC but not CONFIG_DM_MMC_OPS and then see a build error. Once everything is converted to Kconfig that won't be possible due to the "depends on" you added above, but while the option is still selected by config.h files, this is possible.

Still, this is a minor issue so if you're going to do the config.h -> defconfig conversion soon, maybe just ignore this.

#2 lore raw

PATCH v2 1/1 dm/mmc: gen_atmel_mci: Add driver model support for mci

Hi Stephen,

Quoted 16 lines

-----Original Message-----
From: Stephen Warren [mailto:swarren at wwwdotorg.org]
Sent: 2016?9?21? 5:15
To: Wenyou Yang - A41535 <[email protected]>
Cc: U-Boot Mailing List <[email protected]>; Stephen Warren <[email protected]>
Subject: Re: [U-Boot] [PATCH v2] dm/mmc: gen_atmel_mci: Add driver model support for mci

Quoted 5 lines · Wenyou Yang

Add the driver model support for Atmel mci while retaining the existing legacy code. This allows the driver to support boards that have converted to driver model as well as those that have not.

drivers/mmc/Kconfig +0 -0
Quoted 11 lines

drivers/mmc/Kconfig config ATMEL_SDHCI · line 54

Quoted 8 lines
drivers/mmc/Kconfig +8 -0
+config GENERIC_ATMEL_MCI
+	bool "Atmel Multimedia Card Interface support"
+	depends on DM_MMC && BLK && DM_MMC_OPS && ARCH_AT91
+	help
+	  This enables support for Atmel High Speed Multimedia Card Interface
+	  (HSMCI), which supports the MultiMedia Card (MMC) Specification V4.3,
+	  the SD Memory Card Specification V2.0, the SDIO V2.0 specification
+	  and CE-ATA V1.1.

This seems unrelated to the actual driver conversion. It's more like part of a convert-the-option-to-Kconfig patch. I suspect it should be removed for now?

Yes, it is unrelated. It seems not good on this patch.

But here, only add the option, doesn't enable.

I think it is somewhat acceptable.

Quoted 24 lines

I think you need to remove "#define GENERIC_ATMEL_MCI" from include/configs/*.h and add it to configs/*_defconfig as part of the patch that adds this Kconfig option.

drivers/mmc/Kconfig

Quoted 12 lines

+#ifndef CONFIG_DM_MMC
/* Setup for MCI Clock and Block Size */ static void
mci_set_mode(struct mmc *mmc, u32 hz, u32 blklen) {

drivers/mmc/Kconfig +6 -1
 	struct atmel_mci_priv *priv = mmc->priv;
-	atmel_mci_t *mci = priv->mci;
 	u32 bus_hz = get_mci_clk_rate();
+#else
+static void mci_set_mode(struct atmel_mci_priv *priv, u32 hz, u32
+blklen) {
+	struct mmc *mmc = &priv->mmc;
+	u32 bus_hz = priv->bus_clk_rate;
+#endif

It's technically CONFIG_DM_MMC_OPS that changes that function signature, I believe. This code could allow someone to enable just CONFIG_DM_MMC but not CONFIG_DM_MMC_OPS and then see a build error. Once everything is converted to Kconfig that won't be possible due to the "depends on" you added above, but while the option is still selected by config.h files, this is possible.

Quoted 2 lines

Still, this is a minor issue so if you're going to do the config.h -> defconfig conversion soon, maybe just ignore this.

Yes, I will do the config.h soon.

Best Regards,
Wenyou Yang