Skip to content

Commit

Permalink
clk/zynq/pll: Use #defines for fbdiv min/max values
Browse files Browse the repository at this point in the history
Use more descriptive #defines for the minimum and maximum PLL
feedback divider.

Signed-off-by: Soren Brinkmann <[email protected]>
Signed-off-by: Michal Simek <[email protected]>
  • Loading branch information
sorenb-xlnx authored and Michal Simek committed Aug 20, 2013
1 parent 14924ba commit 353dc6c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/clk/zynq/pll.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ struct zynq_pll {
#define PLLCTRL_RESET_MASK 1
#define PLLCTRL_RESET_SHIFT 0

#define PLL_FBDIV_MIN 13
#define PLL_FBDIV_MAX 66

/**
* zynq_pll_round_rate() - Round a clock frequency
* @hw: Handle between common and hardware-specific interfaces
Expand All @@ -63,10 +66,10 @@ static long zynq_pll_round_rate(struct clk_hw *hw, unsigned long rate,
u32 fbdiv;

fbdiv = DIV_ROUND_CLOSEST(rate, *prate);
if (fbdiv < 13)
fbdiv = 13;
else if (fbdiv > 66)
fbdiv = 66;
if (fbdiv < PLL_FBDIV_MIN)
fbdiv = PLL_FBDIV_MIN;
else if (fbdiv > PLL_FBDIV_MAX)
fbdiv = PLL_FBDIV_MAX;

return *prate * fbdiv;
}
Expand Down

0 comments on commit 353dc6c

Please sign in to comment.