Skip to contentSkip to conversation

mmc: dw_mmc: exynos: don't use if clock isn't available

PATCH Superseded Seungwon Jeon 2 participants 3 messages Mar 21, 2014 – Mar 24, 2014

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/7 mmc: dw_mmc: exynos: don't use if clock isn't available

Adds checking whether the clock is valid.

---
 drivers/mmc/host/dw_mmc-exynos.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
drivers/mmc/host/dw_mmc-exynos.c +11 -3
index a67e784..89aa019 100644
@@ -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 */
Signature · 1 line
1.7.4.1
maintainer
#1 lore raw

Hi, Seungwon.

Quoted 14 lines · Seungwon Jeon

Adds checking whether the clock is valid.

---
 drivers/mmc/host/dw_mmc-exynos.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
drivers/mmc/host/dw_mmc-exynos.c +0 -0
index a67e784..89aa019 100644
@@ -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)
 {

drivers/mmc/host/dw_mmc-exynos.c static int dw_mci_exynos_priv_init(struct dw_mci *host) · line 127

Quoted 10 lines
drivers/mmc/host/dw_mmc-exynos.c +6 -1
 	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

Quoted 16 lines
drivers/mmc/host/dw_mmc-exynos.c +5 -2
 	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 */
#2 lore raw
Quoted 26 lines · Jaehoon Chung

Hi, Seungwon.

Quoted 23 lines · Seungwon Jeon

Adds checking whether the clock is valid.

---
 drivers/mmc/host/dw_mmc-exynos.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
drivers/mmc/host/dw_mmc-exynos.c +6 -1
index a67e784..89aa019 100644
@@ -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);
 
Quoted 5 lines

drivers/mmc/host/dw_mmc-exynos.c static int dw_mci_exynos_priv_init(struct dw_mci *host) · line 127

Quoted 1 line
drivers/mmc/host/dw_mmc-exynos.c +0 -0
 	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

Quoted 24 lines

Best Regards,
Jaehoon Chung

Quoted 6 lines
drivers/mmc/host/dw_mmc-exynos.c +0 -0
 	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);
 	}
 

drivers/mmc/host/dw_mmc-exynos.c static void dw_mci_exynos_set_ios(struct dw_mci *host, struct mmc_ios *ios) · line 211

Quoted 10 lines
drivers/mmc/host/dw_mmc-exynos.c +5 -2
-	/* 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html