.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2016 Maxime Ripard |
---|
3 | 4 | * 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. |
---|
9 | 5 | */ |
---|
10 | 6 | |
---|
11 | 7 | #include <linux/clk-provider.h> |
---|
| 8 | +#include <linux/io.h> |
---|
12 | 9 | |
---|
13 | 10 | #include "ccu_frac.h" |
---|
14 | 11 | #include "ccu_gate.h" |
---|
.. | .. |
---|
136 | 133 | return rate; |
---|
137 | 134 | } |
---|
138 | 135 | |
---|
| 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 | + |
---|
139 | 143 | if (ccu_frac_helper_has_rate(&nm->common, &nm->frac, rate)) { |
---|
140 | 144 | if (nm->common.features & CCU_FEATURE_FIXED_POSTDIV) |
---|
141 | 145 | rate /= nm->fixed_post_div; |
---|