git: ac1d7397bf33 - main - arm64: allwinner: clk: Test with the current parent freq first
Emmanuel Vadot
manu at FreeBSD.org
Mon May 31 12:10:39 UTC 2021
The branch main has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=ac1d7397bf33acf8955fc0871ff124550bf50d1f
commit ac1d7397bf33acf8955fc0871ff124550bf50d1f
Author: Emmanuel Vadot <manu at FreeBSD.org>
AuthorDate: 2021-05-31 12:06:20 +0000
Commit: Emmanuel Vadot <manu at FreeBSD.org>
CommitDate: 2021-05-31 12:10:24 +0000
arm64: allwinner: clk: Test with the current parent freq first
Even if the clock is flagged with AW_CLK_SET_PARENT the current parent
freq might be enough to get a correct divisor.
So test first if we can get the expected freq before changing the parent
freq.
---
sys/arm/allwinner/clkng/aw_clk_m.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sys/arm/allwinner/clkng/aw_clk_m.c b/sys/arm/allwinner/clkng/aw_clk_m.c
index 4f8189d48299..9f2dea6722bc 100644
--- a/sys/arm/allwinner/clkng/aw_clk_m.c
+++ b/sys/arm/allwinner/clkng/aw_clk_m.c
@@ -175,7 +175,9 @@ aw_clk_m_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout,
best = cur = 0;
- if ((sc->flags & AW_CLK_SET_PARENT) != 0) {
+ best = aw_clk_m_find_best(sc, fparent, fout,
+ &best_m);
+ if ((best != *fout) && ((sc->flags & AW_CLK_SET_PARENT) != 0)) {
p_clk = clknode_get_parent(clk);
if (p_clk == NULL) {
printf("%s: Cannot get parent for clock %s\n",
@@ -187,9 +189,6 @@ aw_clk_m_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout,
clknode_get_freq(p_clk, &fparent);
best = aw_clk_m_find_best(sc, fparent, fout,
&best_m);
- } else {
- best = aw_clk_m_find_best(sc, fparent, fout,
- &best_m);
}
if ((flags & CLK_SET_DRYRUN) != 0) {
More information about the dev-commits-src-main
mailing list