diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-04-20 18:14:24 +0900 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-04-24 00:35:34 +0900 |
commit | 30b5d9aa9aee9853b6b51d93ddf16d762d20c538 (patch) | |
tree | 5961aa337e8a9ca3d61744b0e064b1b36327d417 /drivers/mmc/uniphier-sd.c | |
parent | 58d702274c09c8dc45c14141acd2c70bb578c5b2 (diff) |
mmc: tmio: move clk_enable() to each driver's probe function
I need to differentiate the clock handling for uniphier-sd. Move it
to each driver's probe function from the tmio common code so that
renesas-sdhi will not be affected.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'drivers/mmc/uniphier-sd.c')
-rw-r--r-- | drivers/mmc/uniphier-sd.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c index 47379b0328..bc6e41dbf6 100644 --- a/drivers/mmc/uniphier-sd.c +++ b/drivers/mmc/uniphier-sd.c @@ -32,6 +32,31 @@ static const struct udevice_id uniphier_sd_match[] = { static int uniphier_sd_probe(struct udevice *dev) { + struct tmio_sd_priv *priv = dev_get_priv(dev); + struct clk clk; + int ret; + + ret = clk_get_by_index(dev, 0, &clk); + if (ret < 0) { + dev_err(dev, "failed to get host clock\n"); + return ret; + } + + /* set to max rate */ + priv->mclk = clk_set_rate(&clk, ULONG_MAX); + if (IS_ERR_VALUE(priv->mclk)) { + dev_err(dev, "failed to set rate for host clock\n"); + clk_free(&clk); + return priv->mclk; + } + + ret = clk_enable(&clk); + clk_free(&clk); + if (ret) { + dev_err(dev, "failed to enable host clock\n"); + return ret; + } + return tmio_sd_probe(dev, 0); } |