Skip to contentSkip to conversation

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

PATCH In review Seungwon Jeon 2 participants 2 messages Mar 26, 2014 – Apr 14, 2014

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

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

Add checking whether the clock is valid.

---
 drivers/mmc/host/dw_mmc-exynos.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/mmc/host/dw_mmc-exynos.c +7 -4
index a67e784..a2d06c5 100644
@@ -117,9 +117,9 @@ 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);
 
-	host->bus_hz = rate / (priv->ciu_div + 1);
+	host->bus_hz /= (priv->ciu_div + 1);
+
 	return 0;
 }
 
@@ -196,8 +196,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 Acked-by on v2 2/7
#1 lore raw
Quoted 38 lines · Seungwon Jeon

Add checking whether the clock is valid.

---
 drivers/mmc/host/dw_mmc-exynos.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/mmc/host/dw_mmc-exynos.c +7 -4
index a67e784..a2d06c5 100644
@@ -117,9 +117,9 @@ 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);
 
-	host->bus_hz = rate / (priv->ciu_div + 1);
+	host->bus_hz /= (priv->ciu_div + 1);
+
 	return 0;
 }
 
@@ -196,8 +196,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 */