projects
/
platform
/
kernel
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git://git.denx.de/u-boot-spi
[platform/kernel/u-boot.git]
/
drivers
/
mmc
/
uniphier-sd.c
diff --git
a/drivers/mmc/uniphier-sd.c
b/drivers/mmc/uniphier-sd.c
index
813c284
..
6539880
100644
(file)
--- a/
drivers/mmc/uniphier-sd.c
+++ b/
drivers/mmc/uniphier-sd.c
@@
-31,35
+31,45
@@
static const struct udevice_id uniphier_sd_match[] = {
{ /* sentinel */ }
};
{ /* sentinel */ }
};
+static ulong uniphier_sd_clk_get_rate(struct tmio_sd_priv *priv)
+{
+#if CONFIG_IS_ENABLED(CLK)
+ return clk_get_rate(&priv->clk);
+#elif CONFIG_SPL_BUILD
+ return 100000000;
+#else
+ return 0;
+#endif
+}
+
static int uniphier_sd_probe(struct udevice *dev)
{
struct tmio_sd_priv *priv = dev_get_priv(dev);
static int uniphier_sd_probe(struct udevice *dev)
{
struct tmio_sd_priv *priv = dev_get_priv(dev);
+
+ priv->clk_get_rate = uniphier_sd_clk_get_rate;
+
#ifndef CONFIG_SPL_BUILD
#ifndef CONFIG_SPL_BUILD
- struct clk clk;
int ret;
int ret;
- ret = clk_get_by_index(dev, 0, &clk);
+ ret = clk_get_by_index(dev, 0, &
priv->
clk);
if (ret < 0) {
dev_err(dev, "failed to get host clock\n");
return ret;
}
/* set to max rate */
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)
) {
+
ret = clk_set_rate(&priv->
clk, ULONG_MAX);
+ if (
ret < 0
) {
dev_err(dev, "failed to set rate for host clock\n");
dev_err(dev, "failed to set rate for host clock\n");
- clk_free(&clk);
- return
priv->mclk
;
+ clk_free(&
priv->
clk);
+ return
ret
;
}
}
- ret = clk_enable(&clk);
- clk_free(&clk);
+ ret = clk_enable(&priv->clk);
if (ret) {
dev_err(dev, "failed to enable host clock\n");
return ret;
}
if (ret) {
dev_err(dev, "failed to enable host clock\n");
return ret;
}
-#else
- priv->mclk = 100000000;
#endif
return tmio_sd_probe(dev, 0);
#endif
return tmio_sd_probe(dev, 0);