Skip to contentSkip to conversation

mmc: dw_mmc: rockchip: Don't recalc the clock when it goes off

PATCH Applied Doug Anderson 3 participants 3 messages Oct 14, 2014 – Oct 27, 2014

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

PATCH 1/1 mmc: dw_mmc: rockchip: Don't recalc the clock when it goes off

The "set_ios" function is called with a clock of 0 when the clock is turning off. There's no reason to go through all the extra Rockchip logic (whose goal is to make sure DIV is 0 or 1) in that case. The Rockchip logic happened to work because the CCF will pick the lowest possible rate when you ask it for a clock of 0, but it's silly to go through all the remuxing and adjusting for no reason.

---
 drivers/mmc/host/dw_mmc-rockchip.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mmc/host/dw_mmc-rockchip.c +3 -0
index f0c2cb1..bbb4ec3 100644
@@ -37,6 +37,9 @@ static void dw_mci_rk3288_set_ios(struct dw_mci *host, struct mmc_ios *ios)
 	unsigned int cclkin;
 	u32 bus_hz;
 
+	if (ios->clock == 0)
+		return;
+
 	/*
 	 * cclkin: source clock of mmc controller
 	 * bus_hz: card interface clock generated by CLKGEN
Signature · 1 line
2.1.0.rc2.206.gedb03e5
maintainer Acked-by on v1 1/1
#1 lore raw

Hi, Doug.

It looks good to me.

Quoted 27 lines · Doug Anderson

The "set_ios" function is called with a clock of 0 when the clock is turning off. There's no reason to go through all the extra Rockchip logic (whose goal is to make sure DIV is 0 or 1) in that case. The Rockchip logic happened to work because the CCF will pick the lowest possible rate when you ask it for a clock of 0, but it's silly to go through all the remuxing and adjusting for no reason.

---
 drivers/mmc/host/dw_mmc-rockchip.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mmc/host/dw_mmc-rockchip.c +3 -0
index f0c2cb1..bbb4ec3 100644
@@ -37,6 +37,9 @@ static void dw_mci_rk3288_set_ios(struct dw_mci *host, struct mmc_ios *ios)
 	unsigned int cclkin;
 	u32 bus_hz;
 
+	if (ios->clock == 0)
+		return;
+
 	/*
 	 * cclkin: source clock of mmc controller
 	 * bus_hz: card interface clock generated by CLKGEN
Applied
#2 lore raw
In reply to Doug Anderson
Quoted 8 lines · Doug Anderson

The "set_ios" function is called with a clock of 0 when the clock is turning off. There's no reason to go through all the extra Rockchip logic (whose goal is to make sure DIV is 0 or 1) in that case. The Rockchip logic happened to work because the CCF will pick the lowest possible rate when you ask it for a clock of 0, but it's silly to go through all the remuxing and adjusting for no reason.

Thanks! Applied for next!

Kind regards
Uffe

Quoted 21 lines
---
 drivers/mmc/host/dw_mmc-rockchip.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mmc/host/dw_mmc-rockchip.c +3 -1
index f0c2cb1..bbb4ec3 100644
@@ -37,6 +37,9 @@ static void dw_mci_rk3288_set_ios(struct dw_mci *host, struct mmc_ios *ios)
        unsigned int cclkin;
        u32 bus_hz;
 
+       if (ios->clock == 0)
+               return;
+
        /*
         * cclkin: source clock of mmc controller
         * bus_hz: card interface clock generated by CLKGEN
--

2.1.0.rc2.206.gedb03e5