forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/clk/sunxi-ng/ccu_nm.c
....@@ -1,14 +1,11 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) 2016 Maxime Ripard
34 * Maxime Ripard <maxime.ripard@free-electrons.com>
4
- *
5
- * This program is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU General Public License as
7
- * published by the Free Software Foundation; either version 2 of
8
- * the License, or (at your option) any later version.
95 */
106
117 #include <linux/clk-provider.h>
8
+#include <linux/io.h>
129
1310 #include "ccu_frac.h"
1411 #include "ccu_gate.h"
....@@ -136,6 +133,13 @@
136133 return rate;
137134 }
138135
136
+ if (nm->max_rate && rate > nm->max_rate) {
137
+ rate = nm->max_rate;
138
+ if (nm->common.features & CCU_FEATURE_FIXED_POSTDIV)
139
+ rate /= nm->fixed_post_div;
140
+ return rate;
141
+ }
142
+
139143 if (ccu_frac_helper_has_rate(&nm->common, &nm->frac, rate)) {
140144 if (nm->common.features & CCU_FEATURE_FIXED_POSTDIV)
141145 rate /= nm->fixed_post_div;