Page MenuHomeFreeBSD

clk/broadcom: Add PLL and PLL channel clock nodes
Needs ReviewPublic

Authored by 3293789706_qq.com on Wed, Mar 18, 7:42 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 27, 4:06 AM
Unknown Object (File)
Thu, Mar 26, 8:03 AM
Unknown Object (File)
Tue, Mar 24, 11:42 AM
Unknown Object (File)
Tue, Mar 24, 6:08 AM
Unknown Object (File)
Tue, Mar 24, 12:16 AM
Unknown Object (File)
Mon, Mar 23, 10:38 AM
Subscribers

Details

Reviewers
emaste
mhorne
Summary

Add bcm_clk_pll and bcm_clk_pll_channel clknodes, and wire them into
the CPRMAN attach path.

bcm_clk_pll manages the A2W PLL hardware:

  • set_gate sequences power-up (clear PWRDN, clear ANARST, wait for FLOCK with timeout, set PRST_DISABLE) and power-down in reverse
  • recalc_freq computes Fout = Fosc * (ndiv + frac/frac_denom) / pdiv using integer arithmetic scaled by frac_denom to avoid floating point
  • set_freq solves for ndiv+frac given a target frequency, clamping to the hardware field widths and honouring CLK_SET_ROUND_UP/DOWN
  • The a2w_xosc_ctrl enable bit is set on power-up when present

bcm_clk_pll_channel manages the per-output divider:

  • gate logic corrected: clearing disable bit enables the output
  • min_div fixed to 1 (was erroneously set to 1 << div_width)
  • cm_offset, hold_shift, load_shift now initialised from clkdef
  • Function names aligned to bcm_clk_pll_channel_* prefix
  • BSD-2-Clause licence header added to .c and .h

bcm_cprman_clk_data gains pll_clks and pll_chan_clks arrays;
bcm_cprman_attach registers PLLs and channels before peripheral clocks.

Signed-off-by: perdixky <3293789706@qq.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 71699
Build 68582: arc lint + arc unit

Event Timeline

Similar comments to D55907. The structure looks good, but I did not review the clock method logic.

sys/dev/clk/broadcom/bcm_clk_pll.h
39–41

At least some of the fields defined in this header are not used.

Updating D55908: clk/broadcom: Add PLL and PLL channel clock nodes

Updating D55908: clk/broadcom: Add PLL and PLL channel clock nodes

Updating D55908: clk/broadcom: Add PLL and PLL channel clock nodes