All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: S5P: Add SCLK SDHCI configuration functionality
@ 2010-03-09 13:39 Thomas Abraham
  2010-03-09 15:24 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Abraham @ 2010-03-09 13:39 UTC (permalink / raw)
  To: linux-samsung-soc

The SDHCI SCLK clock in Samsung's S5P SoC's can be configured for required
clock speeds. This patch adds SDHCI SCLK configuration functionality for
S5P SoC's.

Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
---
 arch/arm/plat-s5p/clock.c                  |   21 +++++++++++++++++++++
 arch/arm/plat-s5p/include/plat/s5p-clock.h |    2 ++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-s5p/clock.c b/arch/arm/plat-s5p/clock.c
index aa96e33..12970ed 100644
--- a/arch/arm/plat-s5p/clock.c
+++ b/arch/arm/plat-s5p/clock.c
@@ -19,11 +19,13 @@
 #include <linux/clk.h>
 #include <linux/sysdev.h>
 #include <linux/io.h>
+#include <linux/platform_device.h>
 #include <asm/div64.h>
 
 #include <plat/clock.h>
 #include <plat/clock-clksrc.h>
 #include <plat/s5p-clock.h>
+#include <plat/sdhci.h>
 
 /* fin_apll, fin_mpll and fin_epll are all the same clock, which we call
  * clk_ext_xtal_mux.
@@ -147,3 +149,22 @@ void __init s5p_register_clocks(unsigned long xtal_freq)
 	if (ret > 0)
 		printk(KERN_ERR "Failed to register s5p clocks\n");
 }
+
+#ifdef CONFIG_MMC_SDHCI_S3C
+int s5p_setup_sdhci_sclk(struct platform_device *pdev, struct clk *parent)
+{
+	struct s3c_sdhci_platdata *pdata = pdev->dev.platform_data;
+	struct device *dev = &pdev->dev;
+	struct clk *sclk_mmc;
+
+	sclk_mmc = clk_get(dev, "mmc_bus");
+	if (IS_ERR(sclk_mmc)) {
+		dev_err(dev, "failed to get mmc_bus clock\n");
+		return PTR_ERR(sclk_mmc);
+	}
+
+	sclk_mmc->ops->set_parent(sclk_mmc, parent);
+	sclk_mmc->ops->set_rate(sclk_mmc, pdata->sclk_mmc_freq);
+	return 0;
+}
+#endif /* CONFIG_MMC_SDHCI_S3C */
diff --git a/arch/arm/plat-s5p/include/plat/s5p-clock.h b/arch/arm/plat-s5p/include/plat/s5p-clock.h
index 56fb8b4..3855f74 100644
--- a/arch/arm/plat-s5p/include/plat/s5p-clock.h
+++ b/arch/arm/plat-s5p/include/plat/s5p-clock.h
@@ -36,5 +36,7 @@ extern struct clksrc_sources clk_src_epll;
 
 extern int s5p6440_clk48m_ctrl(struct clk *clk, int enable);
 extern int s5p_gatectrl(void __iomem *reg, struct clk *clk, int enable);
+extern int s5p_setup_sdhci_sclk(struct platform_device *pdev,
+					struct clk *parent);
 
 #endif /* __ASM_PLAT_S5P_CLOCK_H */
-- 
1.6.6.rc2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: S5P: Add SCLK SDHCI configuration functionality
  2010-03-09 13:39 [PATCH] ARM: S5P: Add SCLK SDHCI configuration functionality Thomas Abraham
@ 2010-03-09 15:24 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2010-03-09 15:24 UTC (permalink / raw)
  To: Thomas Abraham; +Cc: linux-samsung-soc

On Tue, Mar 09, 2010 at 07:09:18PM +0530, Thomas Abraham wrote:

> +#ifdef CONFIG_MMC_SDHCI_S3C
> +int s5p_setup_sdhci_sclk(struct platform_device *pdev, struct clk *parent)
> +{
> +	struct s3c_sdhci_platdata *pdata = pdev->dev.platform_data;
> +	struct device *dev = &pdev->dev;
> +	struct clk *sclk_mmc;
> +
> +	sclk_mmc = clk_get(dev, "mmc_bus");
> +	if (IS_ERR(sclk_mmc)) {
> +		dev_err(dev, "failed to get mmc_bus clock\n");
> +		return PTR_ERR(sclk_mmc);
> +	}

There doesn't seem to be a matching clk_put for this.

> +	sclk_mmc->ops->set_parent(sclk_mmc, parent);

Given that the user of this API needs to know enough about the clock
structure of the chip to know which parent clock to set (and already
have that parent clock) it's not clear to me what this API is intended
to do - as far as I can see it would live as well in the SDHCI driver as
it is at present.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-09 15:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-09 13:39 [PATCH] ARM: S5P: Add SCLK SDHCI configuration functionality Thomas Abraham
2010-03-09 15:24 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.