Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1721681
| From | Jerome Brunet <jbrunet@baylibre.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 04/13] mmc: meson-gx: rework clk_set function |
| Date | 2017-08-28 16:40 +0200 |
| Message-ID | <ujtmO-6J9-27@gated-at.bofh.it> (permalink) |
| References | <ujtd7-6G2-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Clean-up clk_set function to prepare the next changes (DDR and clk-stop)
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
drivers/mmc/host/meson-gx-mmc.c | 30 +++++++++---------------------
1 file changed, 9 insertions(+), 21 deletions(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 0d29f1f347eb..cd5964aa4f58 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -139,7 +139,7 @@ struct meson_host {
struct clk *core_clk;
struct clk_mux mux;
struct clk *mux_clk;
- unsigned long current_clock;
+ unsigned long req_rate;
struct clk_divider cfg_div;
struct clk *cfg_div_clk;
@@ -275,29 +275,18 @@ static int meson_mmc_clk_set(struct meson_host *host, unsigned long clk_rate)
int ret;
u32 cfg;
- if (clk_rate) {
- if (WARN_ON(clk_rate > mmc->f_max))
- clk_rate = mmc->f_max;
- else if (WARN_ON(clk_rate < mmc->f_min))
- clk_rate = mmc->f_min;
- }
-
- if (clk_rate == host->current_clock)
+ /* Same request - bail-out */
+ if (host->req_rate == clk_rate)
return 0;
/* stop clock */
cfg = readl(host->regs + SD_EMMC_CFG);
- if (!(cfg & CFG_STOP_CLOCK)) {
- cfg |= CFG_STOP_CLOCK;
- writel(cfg, host->regs + SD_EMMC_CFG);
- }
-
- dev_dbg(host->dev, "change clock rate %u -> %lu\n",
- mmc->actual_clock, clk_rate);
+ cfg |= CFG_STOP_CLOCK;
+ writel(cfg, host->regs + SD_EMMC_CFG);
+ host->req_rate = 0;
if (!clk_rate) {
mmc->actual_clock = 0;
- host->current_clock = 0;
/* return with clock being stopped */
return 0;
}
@@ -309,13 +298,12 @@ static int meson_mmc_clk_set(struct meson_host *host, unsigned long clk_rate)
return ret;
}
+ host->req_rate = clk_rate;
mmc->actual_clock = clk_get_rate(host->cfg_div_clk);
- host->current_clock = clk_rate;
+ dev_dbg(host->dev, "clk rate: %u Hz\n", mmc->actual_clock);
if (clk_rate != mmc->actual_clock)
- dev_dbg(host->dev,
- "divider requested rate %lu != actual rate %u\n",
- clk_rate, mmc->actual_clock);
+ dev_dbg(host->dev, "requested rate was %lu\n", clk_rate);
/* (re)start clock */
cfg = readl(host->regs + SD_EMMC_CFG);
--
2.9.5
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 00/13] mmc: meson-gx: driver fixups and upgrades Jerome Brunet <jbrunet@baylibre.com> - 2017-08-28 16:30 +0200
[PATCH v3 11/13] mmc: meson-gx: implement voltage switch callback Jerome Brunet <jbrunet@baylibre.com> - 2017-08-28 16:40 +0200
[PATCH v3 03/13] mmc: meson-gx: rework set_ios function Jerome Brunet <jbrunet@baylibre.com> - 2017-08-28 16:40 +0200
[PATCH v3 12/13] mmc: meson-gx: change default tx phase Jerome Brunet <jbrunet@baylibre.com> - 2017-08-28 16:40 +0200
[PATCH v3 10/13] mmc: meson-gx: use CCF to handle the clock phases Jerome Brunet <jbrunet@baylibre.com> - 2017-08-28 16:40 +0200
[PATCH v3 05/13] mmc: meson-gx: rework clock init function Jerome Brunet <jbrunet@baylibre.com> - 2017-08-28 16:40 +0200
[PATCH v3 08/13] mmc: meson-gx: simplify interrupt handler Jerome Brunet <jbrunet@baylibre.com> - 2017-08-28 16:40 +0200
[PATCH v3 07/13] mmc: meson-gx: work around clk-stop issue Jerome Brunet <jbrunet@baylibre.com> - 2017-08-28 16:40 +0200
[PATCH v3 04/13] mmc: meson-gx: rework clk_set function Jerome Brunet <jbrunet@baylibre.com> - 2017-08-28 16:40 +0200
[PATCH v3 01/13] mmc: meson-gx: initialize sane clk default before clock register Jerome Brunet <jbrunet@baylibre.com> - 2017-08-28 16:40 +0200
[PATCH v3 06/13] mmc: meson-gx: fix dual data rate mode frequencies Jerome Brunet <jbrunet@baylibre.com> - 2017-08-28 16:40 +0200
[PATCH v3 02/13] mmc: meson-gx: cfg init overwrite values Jerome Brunet <jbrunet@baylibre.com> - 2017-08-28 16:40 +0200
Re: [PATCH v3 00/13] mmc: meson-gx: driver fixups and upgrades Ulf Hansson <ulf.hansson@linaro.org> - 2017-08-30 15:20 +0200
Re: [PATCH v3 00/13] mmc: meson-gx: driver fixups and upgrades Kevin Hilman <khilman@baylibre.com> - 2017-08-30 21:10 +0200
Re: [PATCH v3 00/13] mmc: meson-gx: driver fixups and upgrades Ulf Hansson <ulf.hansson@linaro.org> - 2017-08-31 12:50 +0200
csiph-web