Lines Matching +full:tbg +full:- +full:a +full:- +full:s
1 // SPDX-License-Identifier: GPL-2.0+
7 * Gregory CLEMENT <gregory.clement@free-electrons.com>
10 #include <linux/clk-provider.h>
47 static const struct tbg_def tbg[NUM_TBG] = { variable
48 {"TBG-A-P", TBG_A_REFDIV, TBG_A_FBDIV, TBG_CTRL8, TBG_A_VCODIV_DIFF},
49 {"TBG-B-P", TBG_B_REFDIV, TBG_B_FBDIV, TBG_CTRL8, TBG_B_VCODIV_DIFF},
50 {"TBG-A-S", TBG_A_REFDIV, TBG_A_FBDIV, TBG_CTRL1, TBG_A_VCODIV_SE},
51 {"TBG-B-S", TBG_B_REFDIV, TBG_B_FBDIV, TBG_CTRL1, TBG_B_VCODIV_SE},
60 return ((val >> ptbg->fbdiv_offset) & TBG_DIV_MASK) << 2; in tbg_get_mult()
70 div = (val >> ptbg->refdiv_offset) & TBG_DIV_MASK; in tbg_get_div()
73 val = readl(reg + ptbg->vcodiv_reg); in tbg_get_div()
75 div *= 1 << ((val >> ptbg->vcodiv_offset) & TBG_DIV_MASK); in tbg_get_div()
83 struct device_node *np = pdev->dev.of_node; in armada_3700_tbg_clock_probe()
85 struct device *dev = &pdev->dev; in armada_3700_tbg_clock_probe()
91 hw_tbg_data = devm_kzalloc(&pdev->dev, in armada_3700_tbg_clock_probe()
95 return -ENOMEM; in armada_3700_tbg_clock_probe()
96 hw_tbg_data->num = NUM_TBG; in armada_3700_tbg_clock_probe()
102 return -EINVAL; in armada_3700_tbg_clock_probe()
115 name = tbg[i].name; in armada_3700_tbg_clock_probe()
116 mult = tbg_get_mult(reg, &tbg[i]); in armada_3700_tbg_clock_probe()
117 div = tbg_get_div(reg, &tbg[i]); in armada_3700_tbg_clock_probe()
118 hw_tbg_data->hws[i] = clk_hw_register_fixed_factor(NULL, name, in armada_3700_tbg_clock_probe()
120 if (IS_ERR(hw_tbg_data->hws[i])) in armada_3700_tbg_clock_probe()
121 dev_err(dev, "Can't register TBG clock %s\n", name); in armada_3700_tbg_clock_probe()
132 of_clk_del_provider(pdev->dev.of_node); in armada_3700_tbg_clock_remove()
133 for (i = 0; i < hw_tbg_data->num; i++) in armada_3700_tbg_clock_remove()
134 clk_hw_unregister_fixed_factor(hw_tbg_data->hws[i]); in armada_3700_tbg_clock_remove()
138 { .compatible = "marvell,armada-3700-tbg-clock", },
146 .name = "marvell-armada-3700-tbg-clock",