Skip to contentSkip to conversation

mmc: dw_mmc: let device core setup the default pin configuration

PATCH Superseded Thomas Abraham 3 participants 5 messages Apr 5, 2013 – Apr 9, 2013

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 mmc: dw_mmc: let device core setup the default pin configuration

With device core now able to setup the default pin configuration, the pin configuration code based on the deprecated Samsung specific gpio bindings is removed.

---
Changes since v2:
- Changed patch subject from "mmc: dwmmc: let..." to "mmc: dw_mmc: let..."
- Rebased to Chris's latest mmc-next branch.

 drivers/mmc/host/dw_mmc-exynos.c |   38 --------------------------------------
 drivers/mmc/host/dw_mmc.c        |   12 ++----------
 drivers/mmc/host/dw_mmc.h        |    3 ---
 3 files changed, 2 insertions(+), 51 deletions(-)
drivers/mmc/host/dw_mmc-exynos.c +0 -38
index c7f0976..f013e7e 100644
@@ -152,43 +152,6 @@ static int dw_mci_exynos_parse_dt(struct dw_mci *host)
 	return 0;
 }
 
-static int dw_mci_exynos_setup_bus(struct dw_mci *host,
-				struct device_node *slot_np, u8 bus_width)
-{
-	int idx, gpio, ret;
-
-	if (!slot_np)
-		return -EINVAL;
-
-	/* cmd + clock + bus-width pins */
-	for (idx = 0; idx < NUM_PINS(bus_width); idx++) {
-		gpio = of_get_gpio(slot_np, idx);
-		if (!gpio_is_valid(gpio)) {
-			dev_err(host->dev, "invalid gpio: %d\n", gpio);
-			return -EINVAL;
-		}
-
-		ret = devm_gpio_request(host->dev, gpio, "dw-mci-bus");
-		if (ret) {
-			dev_err(host->dev, "gpio [%d] request failed\n", gpio);
-			return -EBUSY;
-		}
-	}
-
-	if (host->pdata->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION)
-		return 0;
-
-	gpio = of_get_named_gpio(slot_np, "samsung,cd-pinmux-gpio", 0);
-	if (gpio_is_valid(gpio)) {
-		if (devm_gpio_request(host->dev, gpio, "dw-mci-cd"))
-			dev_err(host->dev, "gpio [%d] request failed\n", gpio);
-	} else {
-		dev_info(host->dev, "cd gpio not available");
-	}
-
-	return 0;
-}
-
 /* Common capabilities of Exynos4/Exynos5 SoC */
 static unsigned long exynos_dwmmc_caps[4] = {
 	MMC_CAP_UHS_DDR50 | MMC_CAP_1_8V_DDR |
@@ -205,7 +168,6 @@ static const struct dw_mci_drv_data exynos_drv_data = {
 	.prepare_command	= dw_mci_exynos_prepare_command,
 	.set_ios		= dw_mci_exynos_set_ios,
 	.parse_dt		= dw_mci_exynos_parse_dt,
-	.setup_bus		= dw_mci_exynos_setup_bus,
 };
 
 static const struct of_device_id dw_mci_exynos_match[] = {
drivers/mmc/host/dw_mmc.c +2 -10
index a443820..2ed9989 100644
@@ -1945,14 +1945,6 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
 	else
 		bus_width = 1;
 
-	if (drv_data && drv_data->setup_bus) {
-		struct device_node *slot_np;
-		slot_np = dw_mci_of_find_slot_node(host->dev, slot->id);
-		ret = drv_data->setup_bus(host, slot_np, bus_width);
-		if (ret)
-			goto err_setup_bus;
-	}
-
 	switch (bus_width) {
 	case 8:
 		mmc->caps |= MMC_CAP_8_BIT_DATA;
@@ -2002,7 +1994,7 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
 
 	ret = mmc_add_host(mmc);
 	if (ret)
-		goto err_setup_bus;
+		goto err_add_host;
 
 #if defined(CONFIG_DEBUG_FS)
 	dw_mci_init_debugfs(slot);
@@ -2019,7 +2011,7 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
 
 	return 0;
 
-err_setup_bus:
+err_add_host:
 	mmc_free_host(mmc);
 	return -EINVAL;
 }
drivers/mmc/host/dw_mmc.h +0 -3
index 53b8fd9..0b74189 100644
@@ -190,7 +190,6 @@ extern int dw_mci_resume(struct dw_mci *host);
  * @prepare_command: handle CMD register extensions.
  * @set_ios: handle bus specific extensions.
  * @parse_dt: parse implementation specific device tree properties.
- * @setup_bus: initialize io-interface
  *
  * Provide controller implementation specific extensions. The usage of this
  * data structure is fully optional and usage of each member in this structure
@@ -203,7 +202,5 @@ struct dw_mci_drv_data {
 	void		(*prepare_command)(struct dw_mci *host, u32 *cmdr);
 	void		(*set_ios)(struct dw_mci *host, struct mmc_ios *ios);
 	int		(*parse_dt)(struct dw_mci *host);
-	int		(*setup_bus)(struct dw_mci *host,
-				struct device_node *slot_np, u8 bus_width);
 };
 #endif /* _DW_MMC_H_ */
Signature · 1 line
1.6.6.rc2
#1 lore raw

PATCH v3 1/1 mmc: dw_mmc: let device core setup the default pin configuration

Quoted 5 lines · Thomas Abraham

With device core now able to setup the default pin configuration, the pin configuration code based on the deprecated Samsung specific gpio bindings is removed.

I hope that your another patch is merged.
ARM: dts: add pinctrl nodes for Exynos5250 SoC
I didn't check whether it is applied.

Thanks,
Seungwon Jeon

#2 lore raw

PATCH v3 1/1 mmc: dw_mmc: let device core setup the default pin configuration

Quoted 11 lines · Seungwon Jeon
Quoted 5 lines · Thomas Abraham

With device core now able to setup the default pin configuration, the pin configuration code based on the deprecated Samsung specific gpio bindings is removed.

I hope that your another patch is merged.
ARM: dts: add pinctrl nodes for Exynos5250 SoC
I didn't check whether it is applied.

Hi Seungwon,

Thanks for your Ack. Yes, the pinctrl nodes for Exynos5250 have been merged through kgene's tree.

Regards,
Thomas.

Quoted 4 lines

Thanks,
Seungwon Jeon

#3 lore raw

PATCH v3 1/1 mmc: dw_mmc: let device core setup the default pin configuration

In reply to Thomas Abraham

Thomas,

Since I commented on previous versions of this patch, I would have loved to have been CCed on this new version. ;)

Quoted 10 lines · Thomas Abraham

With device core now able to setup the default pin configuration, the pin configuration code based on the deprecated Samsung specific gpio bindings is removed.

---
Changes since v2:
- Changed patch subject from "mmc: dwmmc: let..." to "mmc: dw_mmc: let..."
- Rebased to Chris's latest mmc-next branch.

Quoted 4 lines
 drivers/mmc/host/dw_mmc-exynos.c |   38 --------------------------------------
 drivers/mmc/host/dw_mmc.c        |   12 ++----------
 drivers/mmc/host/dw_mmc.h        |    3 ---
 3 files changed, 2 insertions(+), 51 deletions(-)

This patch applies fine but fails to compile on linux-next "next-20130408". You lost the race with:
f2f942c mmc: dw_mmc: Check return value of regulator_enable

...that patch adds a "goto err_setup_bus" and you've renamed that label. I guess you get another fun rebase.

NOTE: this patch is even more urgent than it was before. It looks like pincontrol stuff has now landed in linux-next which means that Exynos5 devices that need eMMC/SD will no longer boot until this patch goes in.

-Doug

#4 lore raw

PATCH v3 1/1 mmc: dw_mmc: let device core setup the default pin configuration

Quoted 4 lines · Doug Anderson

Thomas,

Since I commented on previous versions of this patch, I would have loved to have been CCed on this new version. ;)

Hi Doug,

Sorry for missing out on CC'ing you in the v3 patch. It just slipped my mind.

Quoted 22 lines
Quoted 10 lines · Thomas Abraham

With device core now able to setup the default pin configuration, the pin configuration code based on the deprecated Samsung specific gpio bindings is removed.

---
Changes since v2:
- Changed patch subject from "mmc: dwmmc: let..." to "mmc: dw_mmc: let..."
- Rebased to Chris's latest mmc-next branch.

Quoted 4 lines
 drivers/mmc/host/dw_mmc-exynos.c |   38 --------------------------------------
 drivers/mmc/host/dw_mmc.c        |   12 ++----------
 drivers/mmc/host/dw_mmc.h        |    3 ---
 3 files changed, 2 insertions(+), 51 deletions(-)

This patch applies fine but fails to compile on linux-next "next-20130408". You lost the race with:
f2f942c mmc: dw_mmc: Check return value of regulator_enable

Quoted 7 lines

...that patch adds a "goto err_setup_bus" and you've renamed that label. I guess you get another fun rebase.

NOTE: this patch is even more urgent than it was before. It looks like pincontrol stuff has now landed in linux-next which means that Exynos5 devices that need eMMC/SD will no longer boot until this patch goes in.

Ok. I have posted the v4 version of this patch taking care of this. Thanks for pointing this out.

Regards,
Thomas.

Quoted 2 lines

-Doug