@@ -541,6 +541,17 @@ EXPORT_SYMBOL_GPL(__clk_is_enabled);
static bool mux_is_better_rate(unsigned long rate, unsigned long now,
unsigned long best, unsigned long flags)
{
+ if (rate == ULONG_MAX) {
+ // select the highest clock rate
+ if (best == ULONG_MAX)
+ return true;
+ else
+ return now > best;
+ }
+
+ if (best == ULONG_MAX && now <= rate)
+ return true;
+
if (flags & CLK_MUX_ROUND_CLOSEST)
return abs(now - rate) < abs(best - rate);
@@ -600,7 +611,7 @@ int clk_mux_determine_rate_flags(struct clk_hw *hw,
{
struct clk_core *core = hw->core, *parent, *best_parent = NULL;
int i, num_parents, ret;
- unsigned long best = 0;
+ unsigned long best = ULONG_MAX;
/* if NO_REPARENT flag set, pass through to current parent */
if (core->flags & CLK_SET_RATE_NO_REPARENT) {