Skip to contentSkip to conversation

Move sdhci-s3c platform helper into driver

PATCH Superseded Thomas Abraham 3 participants 8 messages Sep 14, 2011 – Sep 21, 2011

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v2 cover Move sdhci-s3c platform helper into driver

Changes since v1:
- Rebased with 'for-next' branch of
http://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
(tested with commit id a08b7e19811181309da2306338027fe1d3f8001d at the tip of the for-next branch, not sure if there have been further commits after that).

The platform helper that sets up the default sdhci-s3c controller configuration can be removed and moved into the sdhci-s3c driver. This platform helper is removed for s3c2416, s3c64xx, s5pc100, s5pv210 and Exynos4 platforms.

Since the platform helper function pointer was being passed in the platform data of sdhci-s3c driver, the removal of this pointer from the platform data is step closer to complete device tree support for sdhci-s3c driver.

This patchset has been tested on the following platforms. SMDK2416, SMDK6410, SMDKC100, SMDKV210 and SMDKV310.

#1 lore raw

PATCH v2 1/2 mmc: sdhci-s3c: add default controller configuration

The default controller configuration which was previously setup by platform helper functions is moved into the driver.

---
 drivers/mmc/host/sdhci-s3c.c |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)
drivers/mmc/host/sdhci-s3c.c +17 -11
index 2bd7bf4..d891682 100644
@@ -203,17 +203,23 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock)
 		writel(ctrl, host->ioaddr + S3C_SDHCI_CONTROL2);
 	}
 
-	/* reconfigure the hardware for new clock rate */
-
-	{
-		struct mmc_ios ios;
-
-		ios.clock = clock;
-
-		if (ourhost->pdata->cfg_card)
-			(ourhost->pdata->cfg_card)(ourhost->pdev, host->ioaddr,
-						   &ios, NULL);
-	}
+	/* reprogram default hardware configuration */
+	writel(S3C64XX_SDHCI_CONTROL4_DRIVE_9mA,
+		host->ioaddr + S3C64XX_SDHCI_CONTROL4);
+
+	ctrl = readl(host->ioaddr + S3C_SDHCI_CONTROL2);
+	ctrl |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |
+		  S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |
+		  S3C_SDHCI_CTRL2_ENFBCLKRX |
+		  S3C_SDHCI_CTRL2_DFCNT_NONE |
+		  S3C_SDHCI_CTRL2_ENCLKOUTHOLD);
+	writel(ctrl, host->ioaddr + S3C_SDHCI_CONTROL2);
+
+	/* reconfigure the controller for new clock rate */
+	ctrl = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0);
+	if (clock < 25 * 1000000)
+		ctrl |= (S3C_SDHCI_CTRL3_FCSEL3 | S3C_SDHCI_CTRL3_FCSEL2);
+	writel(ctrl, host->ioaddr + S3C_SDHCI_CONTROL3);
 }
 
 /**
Signature · 1 line
1.6.6.rc2
#2 lore raw

PATCH v2 2/2 arm: samsung: remove sdhci default configuration setup platform helper

The sdhci platform helper function that sets up the default controller configuration is removed for all Samsung platforms since such default controller configuration can be handled by the driver.

---
 arch/arm/mach-exynos4/setup-sdhci.c        |   47 -----------------------
 arch/arm/mach-s3c2416/setup-sdhci.c        |   37 ------------------
 arch/arm/mach-s3c64xx/setup-sdhci.c        |   48 -----------------------
 arch/arm/mach-s5pc100/setup-sdhci.c        |   42 --------------------
 arch/arm/mach-s5pv210/setup-sdhci.c        |   41 --------------------
 arch/arm/plat-samsung/include/plat/sdhci.h |   57 ----------------------------
 arch/arm/plat-samsung/platformdata.c       |    2 -
 7 files changed, 0 insertions(+), 274 deletions(-)
arch/arm/mach-exynos4/setup-sdhci.c +0 -47
index 1e83f8c..92937b4 100644
@@ -10,16 +10,7 @@
  * published by the Free Software Foundation.
 */
 
-#include <linux/kernel.h>
 #include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-
-#include <linux/mmc/card.h>
-#include <linux/mmc/host.h>
-
-#include <plat/regs-sdhci.h>
 
 /* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */
 
@@ -29,41 +20,3 @@ char *exynos4_hsmmc_clksrcs[4] = {
 	[2] = "sclk_mmc",	/* mmc_bus */
 	[3] = NULL,
 };
-
-void exynos4_setup_sdhci_cfg_card(struct platform_device *dev, void __iomem *r,
-				  struct mmc_ios *ios, struct mmc_card *card)
-{
-	u32 ctrl2, ctrl3;
-
-	/* don't need to alter anything according to card-type */
-
-	ctrl2 = readl(r + S3C_SDHCI_CONTROL2);
-
-	/* select base clock source to HCLK */
-
-	ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK;
-
-	/*
-	 * clear async mode, enable conflict mask, rx feedback ctrl, SD
-	 * clk hold and no use debounce count
-	 */
-
-	ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |
-		  S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |
-		  S3C_SDHCI_CTRL2_ENFBCLKRX |
-		  S3C_SDHCI_CTRL2_DFCNT_NONE |
-		  S3C_SDHCI_CTRL2_ENCLKOUTHOLD);
-
-	/* Tx and Rx feedback clock delay control */
-
-	if (ios->clock < 25 * 1000000)
-		ctrl3 = (S3C_SDHCI_CTRL3_FCSEL3 |
-			 S3C_SDHCI_CTRL3_FCSEL2 |
-			 S3C_SDHCI_CTRL3_FCSEL1 |
-			 S3C_SDHCI_CTRL3_FCSEL0);
-	else
-		ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0);
-
-	writel(ctrl2, r + S3C_SDHCI_CONTROL2);
-	writel(ctrl3, r + S3C_SDHCI_CONTROL3);
-}
arch/arm/mach-s3c2416/setup-sdhci.c +0 -37
index ed34fad..cee5395 100644
@@ -12,17 +12,7 @@
  * published by the Free Software Foundation.
 */
 
-#include <linux/kernel.h>
 #include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-
-#include <linux/mmc/card.h>
-#include <linux/mmc/host.h>
-
-#include <plat/regs-sdhci.h>
-#include <plat/sdhci.h>
 
 /* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */
 
@@ -32,30 +22,3 @@ char *s3c2416_hsmmc_clksrcs[4] = {
 	[2] = "hsmmc-if",
 	/* [3] = "48m", - note not successfully used yet */
 };
-
-void s3c2416_setup_sdhci_cfg_card(struct platform_device *dev,
-				  void __iomem *r,
-				  struct mmc_ios *ios,
-				  struct mmc_card *card)
-{
-	u32 ctrl2, ctrl3;
-
-	ctrl2 = __raw_readl(r + S3C_SDHCI_CONTROL2);
-	ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK;
-	ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |
-		  S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |
-		  S3C_SDHCI_CTRL2_ENFBCLKRX |
-		  S3C_SDHCI_CTRL2_DFCNT_NONE |
-		  S3C_SDHCI_CTRL2_ENCLKOUTHOLD);
-
-	if (ios->clock < 25 * 1000000)
-		ctrl3 = (S3C_SDHCI_CTRL3_FCSEL3 |
-			 S3C_SDHCI_CTRL3_FCSEL2 |
-			 S3C_SDHCI_CTRL3_FCSEL1 |
-			 S3C_SDHCI_CTRL3_FCSEL0);
-	else
-		ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0);
-
-	__raw_writel(ctrl2, r + S3C_SDHCI_CONTROL2);
-	__raw_writel(ctrl3, r + S3C_SDHCI_CONTROL3);
-}
arch/arm/mach-s3c64xx/setup-sdhci.c +0 -48

58 lines not on this page · raw message

arch/arm/mach-s5pc100/setup-sdhci.c +0 -42

52 lines not on this page · raw message

arch/arm/mach-s5pv210/setup-sdhci.c +0 -41

51 lines not on this page · raw message

arch/arm/plat-samsung/include/plat/sdhci.h +0 -57

210 lines not on this page · raw message

arch/arm/plat-samsung/platformdata.c +0 -2
index 6de1a38..4c9a207 100644
@@ -50,8 +50,6 @@ void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
 		set->max_width = pd->max_width;
 	if (pd->cfg_gpio)
 		set->cfg_gpio = pd->cfg_gpio;
-	if (pd->cfg_card)
-		set->cfg_card = pd->cfg_card;
 	if (pd->host_caps)
 		set->host_caps |= pd->host_caps;
 	if (pd->clk_type)
Signature · 1 line
1.6.6.rc2
#3 lore raw

PATCH v2 1/2 mmc: sdhci-s3c: add default controller configuration

In reply to Thomas Abraham
Quoted 6 lines · Thomas Abraham

The default controller configuration which was previously setup by platform helper functions is moved into the driver.

Hi Chris,

This is ok to me. Could you please pick this up in your tree so that I can pick 2nd patch up in my tree.

As you know, this patch has no dependency with patch2/2 so that you can handle without any conflicts.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

drivers/mmc/host/sdhci-s3c.c static void sdhci_s3c_set_clock(struct sdhci_host

Quoted 9 lines
---
 drivers/mmc/host/sdhci-s3c.c |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)
drivers/mmc/host/sdhci-s3c.c +0 -0
index 2bd7bf4..d891682 100644
@@ -203,17 +203,23 @@ static void sdhci_s3c_set_clock(struct sdhci_host

*host,

Quoted 39 lines
drivers/mmc/host/sdhci-s3c.c +17 -11
 unsigned int clock)
 		writel(ctrl, host->ioaddr + S3C_SDHCI_CONTROL2);
 	}
 
-	/* reconfigure the hardware for new clock rate */
-
-	{
-		struct mmc_ios ios;
-
-		ios.clock = clock;
-
-		if (ourhost->pdata->cfg_card)
-			(ourhost->pdata->cfg_card)(ourhost->pdev, host-
 >ioaddr,
-						   &ios, NULL);
-	}
+	/* reprogram default hardware configuration */
+	writel(S3C64XX_SDHCI_CONTROL4_DRIVE_9mA,
+		host->ioaddr + S3C64XX_SDHCI_CONTROL4);
+
+	ctrl = readl(host->ioaddr + S3C_SDHCI_CONTROL2);
+	ctrl |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |
+		  S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |
+		  S3C_SDHCI_CTRL2_ENFBCLKRX |
+		  S3C_SDHCI_CTRL2_DFCNT_NONE |
+		  S3C_SDHCI_CTRL2_ENCLKOUTHOLD);
+	writel(ctrl, host->ioaddr + S3C_SDHCI_CONTROL2);
+
+	/* reconfigure the controller for new clock rate */
+	ctrl = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0);
+	if (clock < 25 * 1000000)
+		ctrl |= (S3C_SDHCI_CTRL3_FCSEL3 |
 S3C_SDHCI_CTRL3_FCSEL2);
+	writel(ctrl, host->ioaddr + S3C_SDHCI_CONTROL3);

}

/**
--
1.6.6.rc2

#4 lore raw

PATCH v2 1/2 mmc: sdhci-s3c: add default controller configuration

Hi,

Quoted 9 lines · Kukjin Kim

Hi Chris,

This is ok to me. Could you please pick this up in your tree so that I can pick 2nd patch up in my tree.

As you know, this patch has no dependency with patch2/2 so that you can handle without any conflicts.

Thanks, pushed to mmc-next for 3.2.

I've been waiting for kernel.org to come back up, but I think later today I'll just move mmc-next to git://dev.laptop.org/users/cjb/mmc,
so this will be available in linux-next soon.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#5 lore raw

PATCH v2 1/2 mmc: sdhci-s3c: add default controller configuration

Quoted 9 lines · Chris Ball

Hi,

Quoted 5 lines · Kukjin Kim

Hi Chris,

This is ok to me. Could you please pick this up in your tree so that I

can

Quoted 7 lines
Quoted 4 lines

pick 2nd patch up in my tree.

As you know, this patch has no dependency with patch2/2 so that you can handle without any conflicts.

Thanks, pushed to mmc-next for 3.2.

Thanks!

Quoted 1 line

I've been waiting for kernel.org to come back up, but I think later

Yeah, I know...

Quoted 3 lines

today I'll just move mmc-next to git://dev.laptop.org/users/cjb/mmc,
so this will be available in linux-next soon.

Yes, I also moved my tree to git://github.com/kgene/linux-samsung.git...

Anyway, thanks for your information.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#6 lore raw

v2 cover Move sdhci-s3c platform helper into driver

In reply to Thomas Abraham
Quoted 13 lines · Thomas Abraham

Changes since v1:
- Rebased with 'for-next' branch of
http://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
(tested with commit id a08b7e19811181309da2306338027fe1d3f8001d at the tip of the for-next branch, not sure if there have been further commits after that).

The platform helper that sets up the default sdhci-s3c controller configuration can be removed and moved into the sdhci-s3c driver. This platform helper is removed for s3c2416, s3c64xx, s5pc100, s5pv210 and Exynos4 platforms.

Quoted 7 lines

Since the platform helper function pointer was being passed in the platform data of sdhci-s3c driver, the removal of this pointer from the platform data is step closer to complete device tree support for sdhci-s3c driver.

This patchset has been tested on the following platforms. SMDK2416, SMDK6410, SMDKC100, SMDKV210 and SMDKV310.

Oh, I found :)
Looks ok to me, will apply.

As a note, please kindly ignore previous my comments on v.1 patch.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#7 lore raw

v2 cover Move sdhci-s3c platform helper into driver

Quoted 19 lines · Kukjin Kim
Quoted 18 lines · Thomas Abraham

Changes since v1:
- Rebased with 'for-next' branch of
? http://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
? (tested with commit id a08b7e19811181309da2306338027fe1d3f8001d at the ? tip of the for-next branch, not sure if there have been further ? commits after that).

The platform helper that sets up the default sdhci-s3c controller configuration can be removed and moved into the sdhci-s3c driver. This platform helper is removed for s3c2416, s3c64xx, s5pc100, s5pv210 and Exynos4 platforms.

Since the platform helper function pointer was being passed in the platform data of sdhci-s3c driver, the removal of this pointer from the platform data is step closer to complete device tree support for sdhci-s3c driver.

Quoted 5 lines
Quoted 2 lines

This patchset has been tested on the following platforms. SMDK2416, SMDK6410, SMDKC100, SMDKV210 and SMDKV310.

Oh, I found :)
Looks ok to me, will apply.

Thank you Mr. Kim.

Regards,
Thomas

[...]