#include <linux/array_size.h>
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/clk-provider.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/platform_device.h>
#include <asm/div64.h>
#include <dt-bindings/clock/sophgo,sg2042-pll.h>
#include "clk-sg2042.h"
#define R_PLL_BEGIN …
#define R_PLL_STAT …
#define R_PLL_CLKEN_CONTROL …
#define R_MPLL_CONTROL …
#define R_FPLL_CONTROL …
#define R_DPLL0_CONTROL …
#define R_DPLL1_CONTROL …
struct sg2042_pll_clock { … };
#define to_sg2042_pll_clk(_hw) …
#define KHZ …
#define MHZ …
#define REFDIV_MIN …
#define REFDIV_MAX …
#define FBDIV_MIN …
#define FBDIV_MAX …
#define PLL_FREF_SG2042 …
#define PLL_FOUTPOSTDIV_MIN …
#define PLL_FOUTPOSTDIV_MAX …
#define PLL_FOUTVCO_MIN …
#define PLL_FOUTVCO_MAX …
struct sg2042_pll_ctrl { … };
#define PLLCTRL_FBDIV_MASK …
#define PLLCTRL_POSTDIV2_MASK …
#define PLLCTRL_POSTDIV1_MASK …
#define PLLCTRL_REFDIV_MASK …
static inline u32 sg2042_pll_ctrl_encode(struct sg2042_pll_ctrl *ctrl)
{ … }
static inline void sg2042_pll_ctrl_decode(unsigned int reg_value,
struct sg2042_pll_ctrl *ctrl)
{ … }
static inline void sg2042_pll_enable(struct sg2042_pll_clock *pll, bool en)
{ … }
static unsigned long sg2042_pll_recalc_rate(unsigned int reg_value,
unsigned long parent_rate)
{ … }
static int sg2042_pll_get_postdiv_1_2(unsigned long rate,
unsigned long prate,
unsigned int fbdiv,
unsigned int refdiv,
unsigned int *postdiv1,
unsigned int *postdiv2)
{ … }
static int sg2042_get_pll_ctl_setting(struct sg2042_pll_ctrl *best,
unsigned long req_rate,
unsigned long parent_rate)
{ … }
static unsigned long sg2042_clk_pll_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{ … }
static long sg2042_clk_pll_round_rate(struct clk_hw *hw,
unsigned long req_rate,
unsigned long *prate)
{ … }
static int sg2042_clk_pll_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{ … }
static int sg2042_clk_pll_set_rate(struct clk_hw *hw,
unsigned long rate,
unsigned long parent_rate)
{ … }
static const struct clk_ops sg2042_clk_pll_ops = …;
static const struct clk_ops sg2042_clk_pll_ro_ops = …;
#define SG2042_PLL_FW(_id, _name, _parent, _r_ctrl, _shift) …
#define SG2042_PLL_FW_RO(_id, _name, _parent, _r_ctrl, _shift) …
static struct sg2042_pll_clock sg2042_pll_clks[] = …;
static DEFINE_SPINLOCK(sg2042_clk_lock);
static int sg2042_clk_register_plls(struct device *dev,
struct sg2042_clk_data *clk_data,
struct sg2042_pll_clock pll_clks[],
int num_pll_clks)
{ … }
static int sg2042_init_clkdata(struct platform_device *pdev,
int num_clks,
struct sg2042_clk_data **pp_clk_data)
{ … }
static int sg2042_pll_probe(struct platform_device *pdev)
{ … }
static const struct of_device_id sg2042_pll_match[] = …;
MODULE_DEVICE_TABLE(of, sg2042_pll_match);
static struct platform_driver sg2042_pll_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;