13 #include <linux/slab.h>
22 static int ls1x_pll_clk_enable(
struct clk_hw *
hw)
27 static void ls1x_pll_clk_disable(
struct clk_hw *
hw)
31 static unsigned long ls1x_pll_recalc_rate(
struct clk_hw *
hw,
32 unsigned long parent_rate)
37 rate = ((12 + (pll & 0x3f)) * 1000000) +
38 ((((pll >> 8) & 0x3ff) * 1000000) >> 10);
45 static const struct clk_ops ls1x_pll_clk_ops = {
46 .enable = ls1x_pll_clk_enable,
47 .disable = ls1x_pll_clk_disable,
48 .recalc_rate = ls1x_pll_recalc_rate,
52 const char *
name,
const char *parent_name,
unsigned long flags)
56 struct clk_init_data
init;
59 hw = kzalloc(
sizeof(
struct clk_hw),
GFP_KERNEL);
61 pr_err(
"%s: could not allocate clk_hw\n", __func__);
66 init.ops = &ls1x_pll_clk_ops;
67 init.flags = flags | CLK_IS_BASIC;
68 init.parent_names = (parent_name ? &parent_name :
NULL);
69 init.num_parents = (parent_name ? 1 : 0);
85 clk = clk_register_pll(
NULL,
"pll_clk",
NULL, CLK_IS_ROOT);
86 clk_prepare_enable(clk);
90 DIV_CPU_WIDTH, CLK_DIVIDER_ONE_BASED, &_lock);
91 clk_prepare_enable(clk);
96 DIV_DC_WIDTH, CLK_DIVIDER_ONE_BASED, &_lock);
97 clk_prepare_enable(clk);
102 DIV_DDR_WIDTH, CLK_DIVIDER_ONE_BASED, &_lock);
103 clk_prepare_enable(clk);
108 clk_prepare_enable(clk);