public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/7] mmc: dw_mmc: exynos: don't use if clock isn't available
@ 2014-03-21 14:03 Seungwon Jeon
  2014-03-24  4:19 ` Jaehoon Chung
  0 siblings, 1 reply; 3+ messages in thread
From: Seungwon Jeon @ 2014-03-21 14:03 UTC (permalink / raw)
  To: linux-samsung-soc, linux-mmc
  Cc: 'Chris Ball', 'Kukjin Kim',
	'Jaehoon Chung', 'Ulf Hansson',
	'Alim Akhtar'

Adds checking whether the clock is valid.

Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
---
 drivers/mmc/host/dw_mmc-exynos.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
index a67e784..89aa019 100644
--- a/drivers/mmc/host/dw_mmc-exynos.c
+++ b/drivers/mmc/host/dw_mmc-exynos.c
@@ -117,7 +117,12 @@ static int dw_mci_exynos_priv_init(struct dw_mci *host)
 static int dw_mci_exynos_setup_clock(struct dw_mci *host)
 {
 	struct dw_mci_exynos_priv_data *priv = host->priv;
-	unsigned long rate = clk_get_rate(host->ciu_clk);
+	unsigned long rate;
+
+	if (IS_ERR(host->ciu_clk))
+		rate = host->bus_hz;
+	else
+		rate = clk_get_rate(host->ciu_clk);
 
 	host->bus_hz = rate / (priv->ciu_div + 1);
 	return 0;
@@ -196,8 +201,11 @@ static void dw_mci_exynos_set_ios(struct dw_mci *host, struct mmc_ios *ios)
 		mci_writel(host, CLKSEL, priv->sdr_timing);
 	}
 
-	/* Don't care if wanted clock is zero */
-	if (!wanted)
+	/*
+	 * Don't care if wanted clock is zero or
+	 * ciu clock is unavailable
+	 */
+	if (!wanted || IS_ERR(host->ciu_clk))
 		return;
 
 	/* Guaranteed minimum frequency for cclkin */
-- 
1.7.4.1



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

* Re: [PATCH 2/7] mmc: dw_mmc: exynos: don't use if clock isn't available
  2014-03-21 14:03 [PATCH 2/7] mmc: dw_mmc: exynos: don't use if clock isn't available Seungwon Jeon
@ 2014-03-24  4:19 ` Jaehoon Chung
  2014-03-24  6:39   ` Seungwon Jeon
  0 siblings, 1 reply; 3+ messages in thread
From: Jaehoon Chung @ 2014-03-24  4:19 UTC (permalink / raw)
  To: Seungwon Jeon, linux-samsung-soc, linux-mmc
  Cc: 'Chris Ball', 'Kukjin Kim',
	'Jaehoon Chung', 'Ulf Hansson',
	'Alim Akhtar'

Hi, Seungwon.

On 03/21/2014 11:03 PM, Seungwon Jeon wrote:
> Adds checking whether the clock is valid.
> 
> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc-exynos.c |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
> index a67e784..89aa019 100644
> --- a/drivers/mmc/host/dw_mmc-exynos.c
> +++ b/drivers/mmc/host/dw_mmc-exynos.c
> @@ -117,7 +117,12 @@ static int dw_mci_exynos_priv_init(struct dw_mci *host)
>  static int dw_mci_exynos_setup_clock(struct dw_mci *host)
>  {
>  	struct dw_mci_exynos_priv_data *priv = host->priv;
> -	unsigned long rate = clk_get_rate(host->ciu_clk);
> +	unsigned long rate;
> +
> +	if (IS_ERR(host->ciu_clk))
> +		rate = host->bus_hz;
> +	else
> +		rate = clk_get_rate(host->ciu_clk);
>  
>  	host->bus_hz = rate / (priv->ciu_div + 1);
how about this?
host->bus_hz /= (priv->ciu_div + 1);

host->bus_hz is already set to "host->bus_hz" or "clk_get_rate()" into dw_mmc.c.

Best Regards,
Jaehoon Chung
>  	return 0;
> @@ -196,8 +201,11 @@ static void dw_mci_exynos_set_ios(struct dw_mci *host, struct mmc_ios *ios)
>  		mci_writel(host, CLKSEL, priv->sdr_timing);
>  	}
>  
> -	/* Don't care if wanted clock is zero */
> -	if (!wanted)
> +	/*
> +	 * Don't care if wanted clock is zero or
> +	 * ciu clock is unavailable
> +	 */
> +	if (!wanted || IS_ERR(host->ciu_clk))
>  		return;
>  
>  	/* Guaranteed minimum frequency for cclkin */
> 

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

* RE: [PATCH 2/7] mmc: dw_mmc: exynos: don't use if clock isn't available
  2014-03-24  4:19 ` Jaehoon Chung
@ 2014-03-24  6:39   ` Seungwon Jeon
  0 siblings, 0 replies; 3+ messages in thread
From: Seungwon Jeon @ 2014-03-24  6:39 UTC (permalink / raw)
  To: 'Jaehoon Chung', linux-samsung-soc, linux-mmc
  Cc: 'Chris Ball', 'Kukjin Kim', 'Ulf Hansson',
	'Alim Akhtar'

On Mon, March 24, 2014, Jaehoon Chung wrote:
> Hi, Seungwon.
> 
> On 03/21/2014 11:03 PM, Seungwon Jeon wrote:
> > Adds checking whether the clock is valid.
> >
> > Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> > ---
> >  drivers/mmc/host/dw_mmc-exynos.c |   14 +++++++++++---
> >  1 files changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
> > index a67e784..89aa019 100644
> > --- a/drivers/mmc/host/dw_mmc-exynos.c
> > +++ b/drivers/mmc/host/dw_mmc-exynos.c
> > @@ -117,7 +117,12 @@ static int dw_mci_exynos_priv_init(struct dw_mci *host)
> >  static int dw_mci_exynos_setup_clock(struct dw_mci *host)
> >  {
> >  	struct dw_mci_exynos_priv_data *priv = host->priv;
> > -	unsigned long rate = clk_get_rate(host->ciu_clk);
> > +	unsigned long rate;
> > +
> > +	if (IS_ERR(host->ciu_clk))
> > +		rate = host->bus_hz;
> > +	else
> > +		rate = clk_get_rate(host->ciu_clk);
> >
> >  	host->bus_hz = rate / (priv->ciu_div + 1);
> how about this?
> host->bus_hz /= (priv->ciu_div + 1);
> 
> host->bus_hz is already set to "host->bus_hz" or "clk_get_rate()" into dw_mmc.c.
OK. It would be better.

Thanks,
Seungwon Jeon

> 
> Best Regards,
> Jaehoon Chung
> >  	return 0;
> > @@ -196,8 +201,11 @@ static void dw_mci_exynos_set_ios(struct dw_mci *host, struct mmc_ios *ios)
> >  		mci_writel(host, CLKSEL, priv->sdr_timing);
> >  	}
> >
> > -	/* Don't care if wanted clock is zero */
> > -	if (!wanted)
> > +	/*
> > +	 * Don't care if wanted clock is zero or
> > +	 * ciu clock is unavailable
> > +	 */
> > +	if (!wanted || IS_ERR(host->ciu_clk))
> >  		return;
> >
> >  	/* Guaranteed minimum frequency for cclkin */
> >
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

end of thread, other threads:[~2014-03-24  6:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-21 14:03 [PATCH 2/7] mmc: dw_mmc: exynos: don't use if clock isn't available Seungwon Jeon
2014-03-24  4:19 ` Jaehoon Chung
2014-03-24  6:39   ` Seungwon Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox