Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | drivers/clk/baikal-t1/ccu-div.c |
static int ccu_div_dbgfs_bit_get(void *priv, u64 *val) {
const struct ccu_div_dbgfs_bit *bit = priv;
struct ccu_div *div = bit->div;
u32 data = 0;
regmap_read(div->sys_regs, div->reg_ctl, &data);
*val = !!(data & bit->mask);
return 0;
} | [
1,
0
] |
Linux Kernel | drivers/clk/baikal-t1/ccu-div.c |
static void ccu_div_buf_debug_init(struct clk_hw *hw, struct dentry *dentry) {
struct ccu_div *div = to_ccu_div(hw);
struct ccu_div_dbgfs_bit *bit;
bit = kmalloc(sizeof(*bit), GFP_KERNEL);
if (!bit)
return;
*bit = ccu_div_bits[3];
bit->div = div;
debugfs_create_file_unsafe(bit->name, ccu_div_dbgfs_... | [
0,
0
] |
Linux Kernel | drivers/clk/baikal-t1/ccu-div.c |
void ccu_div_hw_unregister(struct ccu_div *div) {
clk_hw_unregister(&div->hw);
kfree(div);
} | [
0,
0
] |
Linux Kernel | drivers/clk/baikal-t1/ccu-pll.c |
static inline unsigned long ccu_pll_calc_freq(unsigned long ref_clk,
unsigned long nr,
unsigned long nf,
unsigned long od) {
u64 tmp = ref_clk;
do_div(tmp, nr);
tmp *= nf;
... | [
0,
0
] |
Linux Kernel | drivers/clk/baikal-t1/ccu-pll.c |
static void ccu_pll_disable(struct clk_hw *hw) {
struct ccu_pll *pll = to_ccu_pll(hw);
unsigned long flags;
spin_lock_irqsave(&pll->lock, flags);
regmap_update_bits(pll->sys_regs, pll->reg_ctl, CCU_PLL_CTL_EN, 0);
spin_unlock_irqrestore(&pll->lock, flags);
} | [
0,
0
] |
Linux Kernel | drivers/clk/baikal-t1/ccu-pll.c |
static int ccu_pll_is_enabled(struct clk_hw *hw) {
struct ccu_pll *pll = to_ccu_pll(hw);
u32 val = 0;
regmap_read(pll->sys_regs, pll->reg_ctl, &val);
return !!(val & CCU_PLL_CTL_EN);
} | [
0,
0
] |
Linux Kernel | drivers/clk/baikal-t1/ccu-pll.c |
static int ccu_pll_dbgfs_fld_set(void *priv, u64 val) {
struct ccu_pll_dbgfs_fld *fld = priv;
struct ccu_pll *pll = fld->pll;
unsigned long flags;
u32 data;
val = clamp_t(u64, val, fld->min, fld->max);
data = ((val - 1) << fld->lsb) & fld->mask;
spin_lock_irqsave(&pll->lock, flags);
regmap_update_bit... | [
1,
0
] |
Linux Kernel | drivers/clk/baikal-t1/ccu-pll.c |
static int ccu_pll_dbgfs_bit_get(void *priv, u64 *val) {
struct ccu_pll_dbgfs_bit *bit = priv;
struct ccu_pll *pll = bit->pll;
u32 data = 0;
regmap_read(pll->sys_regs, pll->reg_ctl + bit->reg, &data);
*val = !!(data & bit->mask);
return 0;
} | [
1,
0
] |
Linux Kernel | drivers/clk/baikal-t1/ccu-pll.c | struct ccu_pll *ccu_pll_hw_register(const struct ccu_pll_init_data *pll_init) {
struct clk_parent_data parent_data = {};
struct clk_init_data hw_init = {};
struct ccu_pll *pll;
int ret;
if (!pll_init)
return ERR_PTR(-EINVAL);
pll = kzalloc(sizeof(*pll), GFP_KERNEL);
if (!pll)
return ERR_PTR(-ENO... | [
1,
0
] |
Linux Kernel | drivers/clk/baikal-t1/ccu-pll.h |
static inline struct clk_hw *ccu_pll_get_clk_hw(struct ccu_pll *pll) {
return pll ? &pll->hw : NULL;
} | [
0,
0
] |
Linux Kernel | drivers/clk/baikal-t1/ccu-rst.c |
static int ccu_rst_assert(struct reset_controller_dev *rcdev,
unsigned long idx) {
return ccu_rst_set(rcdev, idx, true);
} | [
0,
0
] |
Linux Kernel | drivers/clk/baikal-t1/clk-ccu-div.c |
static struct ccu_div_data *ccu_div_create_data(struct device_node *np) {
struct ccu_div_data *data;
int ret;
data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data)
return ERR_PTR(-ENOMEM);
data->np = np;
if (of_device_is_compatible(np, "baikal,bt1-ccu-axi")) {
data->divs_num = ARRAY_SIZE(axi_info... | [
1,
0
] |
Linux Kernel | drivers/clk/baikal-t1/clk-ccu-div.c |
static struct clk_hw *ccu_div_of_clk_hw_get(struct of_phandle_args *clkspec,
void *priv) {
struct ccu_div_data *data = priv;
struct ccu_div *div;
unsigned int clk_id;
clk_id = clkspec->args[0];
div = ccu_div_find_desc(data, clk_id);
if (IS_ERR(div)) {
if (di... | [
0,
0
] |
Linux Kernel | drivers/clk/baikal-t1/clk-ccu-div.c |
static int ccu_div_clk_register(struct ccu_div_data *data, bool defer) {
int idx, ret;
for (idx = 0; idx < data->divs_num; ++idx) {
const struct ccu_div_info *info = &data->divs_info[idx];
struct ccu_div_init_data init = {0};
if (!!(info->features & CCU_DIV_BASIC) ^ defer) {
if (!data->divs[idx... | [
1,
0
] |
Linux Kernel | drivers/clk/baikal-t1/clk-ccu-div.c |
static int ccu_div_of_register(struct ccu_div_data *data) {
int ret;
ret = of_clk_add_hw_provider(data->np, ccu_div_of_clk_hw_get, data);
if (ret) {
pr_err("Couldn't register dividers '%s' clock provider\n",
of_node_full_name(data->np));
}
return ret;
} | [
0,
0
] |
Linux Kernel | drivers/clk/baikal-t1/clk-ccu-div.c |
static int ccu_div_probe(struct platform_device *pdev) {
struct ccu_div_data *data;
int ret;
data = ccu_div_get_data(dev_of_node(&pdev->dev));
if (!data)
return -EINVAL;
ret = ccu_div_clk_register(data, false);
if (ret)
return ret;
ret = ccu_div_rst_register(data);
if (ret)
goto err_clk_... | [
0,
0
] |
Linux Kernel | drivers/clk/baikal-t1/clk-ccu-div.c |
static __init void ccu_div_init(struct device_node *np) {
struct ccu_div_data *data;
int ret;
data = ccu_div_create_data(np);
if (IS_ERR(data))
return;
ret = ccu_div_find_sys_regs(data);
if (ret)
goto err_free_data;
ret = ccu_div_clk_register(data, true);
if (ret)
goto err_free_data;
... | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-bcm2835.c |
static void bcm2835_debugfs_regset(struct bcm2835_cprman *cprman, u32 base,
const struct debugfs_reg32 *regs,
size_t nregs, struct dentry *dentry) {
struct debugfs_regset32 *regset;
regset = devm_kzalloc(cprman->dev, sizeof(*regset), GFP_KERNEL... | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-bcm2835.c |
static unsigned long bcm2835_pll_divider_get_rate(struct clk_hw *hw,
unsigned long parent_rate) {
return clk_divider_ops.recalc_rate(hw, parent_rate);
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-bcm2835.c |
static int bcm2835_clock_is_on(struct clk_hw *hw) {
struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
struct bcm2835_cprman *cprman = clock->cprman;
const struct bcm2835_clock_data *data = clock->data;
return (cprman_read(cprman, data->ctl_reg) & CM_ENABLE) != 0;
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-bcm2835.c |
static int bcm2835_clock_set_parent(struct clk_hw *hw, u8 index) {
struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
struct bcm2835_cprman *cprman = clock->cprman;
const struct bcm2835_clock_data *data = clock->data;
u8 src = (index << CM_SRC_SHIFT) & CM_SRC_MASK;
cprman_write(cprman, data->ctl_reg, ... | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-bcm2835.c |
static void bcm2835_clock_debug_init(struct clk_hw *hw, struct dentry *dentry) {
struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
struct bcm2835_cprman *cprman = clock->cprman;
const struct bcm2835_clock_data *data = clock->data;
bcm2835_debugfs_regset(cprman, data->ctl_reg, bcm2835_debugfs_clock_reg3... | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-bcm2835.c | static struct clk_hw *
bcm2835_register_pll_divider(struct bcm2835_cprman *cprman, const void *data) {
const struct bcm2835_pll_divider_data *divider_data = data;
struct bcm2835_pll_divider *divider;
struct clk_init_data init;
const char *divider_name;
int ret;
if (divider_data->fixed_divider != 1) {
d... | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-bcm2835.c |
static struct clk_hw *bcm2835_register_gate(struct bcm2835_cprman *cprman,
const void *data) {
const struct bcm2835_gate_data *gate_data = data;
return clk_hw_register_gate(cprman->dev, gate_data->name, gate_data->parent,
CLK_IGNORE_UNUSED ... | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-bcm2835.c | static int bcm2835_clk_probe(struct platform_device *pdev) {
struct device *dev = &pdev->dev;
struct clk_hw **hws;
struct bcm2835_cprman *cprman;
const struct bcm2835_clk_desc *desc;
const size_t asize = ARRAY_SIZE(clk_desc_array);
const struct cprman_plat_data *pdata;
size_t i;
int ret;
pdata = of_d... | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-cygnus.c |
static void __init cygnus_audiopll_clk_init(struct device_node *node) {
iproc_pll_clk_setup(node, &audiopll, NULL, 0, audiopll_clk,
ARRAY_SIZE(audiopll_clk));
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-hr2.c |
static void __init hr2_armpll_init(struct device_node *node) {
iproc_armpll_setup(node);
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-iproc-armpll.c | static unsigned long iproc_arm_pll_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) {
struct iproc_arm_pll *pll = to_iproc_arm_pll(hw);
u32 val;
int mdiv;
u64 ndiv;
unsigned int pdiv;
val = readl(pll->base + IPROC_CLK_PLLARMC_OFFSET);
if (val & (1 <... | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-iproc-asiu.c | static unsigned long iproc_asiu_clk_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) {
struct iproc_asiu_clk *clk = to_asiu_clk(hw);
struct iproc_asiu *asiu = clk->asiu;
u32 val;
unsigned int div_h, div_l;
if (parent_rate == 0) {
clk->rate = 0;
... | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-iproc-pll.c | static int pll_calc_param(unsigned long target_rate, unsigned long parent_rate,
struct iproc_pll_vco_param *vco_out) {
u64 ndiv_int, ndiv_frac, residual;
ndiv_int = target_rate / parent_rate;
if (!ndiv_int || (ndiv_int > 255))
return -EINVAL;
residual = target_rate - (ndiv_int *... | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-iproc-pll.c | static int pll_get_rate_index(struct iproc_pll *pll, unsigned int target_rate) {
int i;
for (i = 0; i < pll->num_vco_entries; i++)
if (target_rate == pll->vco_param[i].rate)
break;
if (i >= pll->num_vco_entries)
return -EINVAL;
return i;
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-iproc-pll.c |
static void iproc_clk_disable(struct clk_hw *hw) {
struct iproc_clk *clk = to_iproc_clk(hw);
const struct iproc_clk_ctrl *ctrl = clk->ctrl;
struct iproc_pll *pll = clk->pll;
u32 val;
if (ctrl->flags & IPROC_CLK_AON)
return;
val = readl(pll->control_base + ctrl->enable.offset);
val |= 1 << ctrl->ena... | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-iproc-pll.c |
static int iproc_clk_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req) {
unsigned int bestdiv;
if (req->rate == 0)
return -EINVAL;
if (req->rate == req->best_parent_rate)
return 0;
bestdiv = DIV_ROUND_CLOSEST(req->best_parent_rate, req->rate);
if (b... | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-iproc-pll.c | static void iproc_pll_sw_cfg(struct iproc_pll *pll) {
const struct iproc_pll_ctrl *ctrl = pll->ctrl;
if (ctrl->flags & IPROC_CLK_PLL_NEEDS_SW_CFG) {
u32 val;
val = readl(pll->control_base + ctrl->sw_ctrl.offset);
val |= BIT(ctrl->sw_ctrl.shift);
iproc_pll_write(pll, pll->control_base, ctrl->sw_ctr... | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona-setup.c | static bool ccu_data_offsets_valid(struct ccu_data *ccu) {
struct ccu_policy *ccu_policy = &ccu->policy;
u32 limit;
limit = ccu->range - sizeof(u32);
limit = round_down(limit, sizeof(u32));
if (ccu_policy_exists(ccu_policy)) {
if (ccu_policy->enable.offset > limit) {
pr_err("%s: bad policy enable o... | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona-setup.c | static bool bit_posn_valid(u32 bit_posn, const char *field_name,
const char *clock_name) {
u32 limit = BITS_PER_BYTE * sizeof(u32) - 1;
if (bit_posn > limit) {
pr_err("%s: bad %s bit for %s (%u > %u)\n", __func__, field_name,
clock_name, bit_posn, limit);
return false;... | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona-setup.c | static bool bitfield_valid(u32 shift, u32 width, const char *field_name,
const char *clock_name) {
u32 limit = BITS_PER_BYTE * sizeof(u32);
if (!width) {
pr_err("%s: bad %s field width 0 for %s\n", __func__, field_name,
clock_name);
return false;
}
if (shift + widt... | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona-setup.c |
static bool ccu_policy_valid(struct ccu_policy *ccu_policy,
const char *ccu_name) {
struct bcm_lvm_en *enable = &ccu_policy->enable;
struct bcm_policy_ctl *control;
if (!bit_posn_valid(enable->bit, "policy enable", ccu_name))
return false;
control = &ccu_policy->control;
if... | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona-setup.c |
static bool policy_valid(struct bcm_clk_policy *policy,
const char *clock_name) {
if (!bit_posn_valid(policy->bit, "policy", clock_name))
return false;
return true;
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona-setup.c |
static bool hyst_valid(struct bcm_clk_hyst *hyst, const char *clock_name) {
if (!bit_posn_valid(hyst->en_bit, "hysteresis enable", clock_name))
return false;
if (!bit_posn_valid(hyst->val_bit, "hysteresis value", clock_name))
return false;
return true;
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona-setup.c |
static void clk_sel_teardown(struct bcm_clk_sel *sel,
struct clk_init_data *init_data) {
kfree(sel->parent_sel);
sel->parent_sel = NULL;
sel->parent_count = 0;
init_data->num_parents = 0;
kfree(init_data->parent_names);
init_data->parent_names = NULL;
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona-setup.c |
static bool ccu_data_valid(struct ccu_data *ccu) {
struct ccu_policy *ccu_policy;
if (!ccu_data_offsets_valid(ccu))
return false;
ccu_policy = &ccu->policy;
if (ccu_policy_exists(ccu_policy))
if (!ccu_policy_valid(ccu_policy, ccu->name))
return false;
return true;
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c | u64 scaled_div_build(struct bcm_clk_div *div, u32 div_value, u32 billionths) {
u64 combined;
BUG_ON(!div_value);
BUG_ON(billionths >= BILLION);
combined = (u64)div_value * BILLION + billionths;
combined <<= div->u.s.frac_width;
return DIV_ROUND_CLOSEST_ULL(combined, BILLION);
} | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c | static inline u64 scaled_div_min(struct bcm_clk_div *div) {
if (divider_is_fixed(div))
return (u64)div->u.fixed;
return scaled_div_value(div, 0);
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c |
static inline unsigned long ccu_lock(struct ccu_data *ccu) {
unsigned long flags;
spin_lock_irqsave(&ccu->lock, flags);
return flags;
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c | static inline void ccu_unlock(struct ccu_data *ccu, unsigned long flags) {
spin_unlock_irqrestore(&ccu->lock, flags);
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c | static inline void __ccu_write_enable(struct ccu_data *ccu) {
if (ccu->write_enabled) {
pr_err("%s: access already enabled for %s\n", __func__, ccu->name);
return;
}
ccu->write_enabled = true;
__ccu_write(ccu, 0, CCU_ACCESS_PASSWORD | 1);
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c | static bool __ccu_policy_engine_stop(struct ccu_data *ccu) {
struct bcm_lvm_en *enable = &ccu->policy.enable;
u32 offset;
u32 enable_bit;
bool ret;
if (!policy_lvm_en_exists(enable))
return true;
/* Ensure we're not busy before we start */
offset = enable->offset;
enable_bit = enable->bit;
ret =... | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c | static bool __gate_commit(struct ccu_data *ccu, struct bcm_clk_gate *gate) {
u32 reg_val;
u32 mask;
bool enabled = false;
BUG_ON(!gate_exists(gate));
if (!gate_is_sw_controllable(gate))
return true;
reg_val = __ccu_read(ccu, gate->offset);
/* For a hardware/software gate, set which is in control */... | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c | static bool hyst_init(struct ccu_data *ccu, struct bcm_clk_hyst *hyst) {
u32 offset;
u32 reg_val;
u32 mask;
if (!hyst_exists(hyst))
return true;
offset = hyst->offset;
mask = (u32)1 << hyst->en_bit;
mask |= (u32)1 << hyst->val_bit;
reg_val = __ccu_read(ccu, offset);
reg_val |= mask;
__ccu_wri... | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c | static u64 divider_read_scaled(struct ccu_data *ccu, struct bcm_clk_div *div) {
unsigned long flags;
u32 reg_val;
u32 reg_div;
if (divider_is_fixed(div))
return (u64)div->u.fixed;
flags = ccu_lock(ccu);
reg_val = __ccu_read(ccu, div->u.s.offset);
ccu_unlock(ccu, flags);
reg_div = bitfield_extract... | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c | static unsigned long clk_recalc_rate(struct ccu_data *ccu,
struct bcm_clk_div *div,
struct bcm_clk_div *pre_div,
unsigned long parent_rate) {
u64 scaled_parent_rate;
u64 scaled_div;
u64 result;
if (!d... | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c | static long round_rate(struct ccu_data *ccu, struct bcm_clk_div *div,
struct bcm_clk_div *pre_div, unsigned long rate,
unsigned long parent_rate, u64 *scaled_div) {
u64 scaled_parent_rate;
u64 min_scaled_div;
u64 max_scaled_div;
u64 best_scaled_div;
u64 result;
... | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c | static u8 parent_index(struct bcm_clk_sel *sel, u8 parent_sel) {
u8 i;
BUG_ON(sel->parent_count > (u32)U8_MAX);
for (i = 0; i < sel->parent_count; i++)
if (sel->parent_sel[i] == parent_sel)
return i;
return BAD_CLK_INDEX;
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c | static int __sel_commit(struct ccu_data *ccu, struct bcm_clk_gate *gate,
struct bcm_clk_sel *sel, struct bcm_clk_trig *trig) {
u32 parent_sel;
u32 reg_val;
bool enabled;
int ret = 0;
BUG_ON(!selector_exists(sel));
if (sel->clk_index == BAD_CLK_INDEX) {
u8 index;
reg_val = ... | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c |
static void kona_peri_clk_disable(struct clk_hw *hw) {
struct kona_clk *bcm_clk = to_kona_clk(hw);
struct bcm_clk_gate *gate = &bcm_clk->u.peri->gate;
(void)clk_gate(bcm_clk->ccu, bcm_clk->init_data.name, gate, false);
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c |
static int kona_peri_clk_is_enabled(struct clk_hw *hw) {
struct kona_clk *bcm_clk = to_kona_clk(hw);
struct bcm_clk_gate *gate = &bcm_clk->u.peri->gate;
return is_clk_gate_enabled(bcm_clk->ccu, gate) ? 1 : 0;
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-kona.c | static bool __peri_clk_init(struct kona_clk *bcm_clk) {
struct ccu_data *ccu = bcm_clk->ccu;
struct peri_clk_data *peri = bcm_clk->u.peri;
const char *name = bcm_clk->init_data.name;
struct bcm_clk_trig *trig;
BUG_ON(bcm_clk->type != bcm_clk_peri);
if (!policy_init(ccu, &peri->policy)) {
pr_err("%s: e... | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-ns2.c |
static void __init ns2_genpll_sw_clk_init(struct device_node *node) {
iproc_pll_clk_setup(node, &genpll_sw, NULL, 0, genpll_sw_clk,
ARRAY_SIZE(genpll_sw_clk));
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-nsp.c |
static void __init nsp_lcpll0_clk_init(struct device_node *node) {
iproc_pll_clk_setup(node, &lcpll0, NULL, 0, lcpll0_clk,
ARRAY_SIZE(lcpll0_clk));
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-raspberrypi.c |
static unsigned long raspberrypi_fw_get_rate(struct clk_hw *hw,
unsigned long parent_rate) {
struct raspberrypi_clk_data *data =
container_of(hw, struct raspberrypi_clk_data, hw);
struct raspberrypi_clk *rpi = data->rpi;
u32 val = 0;
int ret;
ret = raspber... | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-raspberrypi.c | static int raspberrypi_clk_probe(struct platform_device *pdev) {
struct clk_hw_onecell_data *clk_data;
struct device_node *firmware_node;
struct device *dev = &pdev->dev;
struct rpi_firmware *firmware;
struct raspberrypi_clk *rpi;
int ret;
if (dev->of_node)
firmware_node = of_get_parent(dev->of_node)... | [
1,
0
] |
Linux Kernel | drivers/clk/bcm/clk-raspberrypi.c |
static int raspberrypi_clk_remove(struct platform_device *pdev) {
struct raspberrypi_clk *rpi = platform_get_drvdata(pdev);
platform_device_unregister(rpi->cpufreq);
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-sr.c |
static int sr_genpll0_clk_init(struct platform_device *pdev) {
iproc_pll_clk_setup(pdev->dev.of_node, &sr_genpll0, NULL, 0, sr_genpll0_clk,
ARRAY_SIZE(sr_genpll0_clk));
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/clk/bcm/clk-sr.c |
static int sr_genpll2_clk_init(struct platform_device *pdev) {
iproc_pll_clk_setup(pdev->dev.of_node, &sr_genpll2, NULL, 0, sr_genpll2_clk,
ARRAY_SIZE(sr_genpll2_clk));
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/clk/berlin/berlin2-avpll.c |
static int berlin2_avpll_vco_enable(struct clk_hw *hw) {
struct berlin2_avpll_vco *vco = to_avpll_vco(hw);
u32 reg;
reg = readl_relaxed(vco->base + VCO_CTRL0);
if (vco->flags & BERLIN2_AVPLL_BIT_QUIRK)
reg |= VCO_POWERUP << 4;
else
reg |= VCO_POWERUP;
writel_relaxed(reg, vco->base + VCO_CTRL0);
... | [
0,
0
] |
Linux Kernel | drivers/clk/berlin/berlin2-avpll.c | static unsigned long berlin2_avpll_vco_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) {
struct berlin2_avpll_vco *vco = to_avpll_vco(hw);
u32 reg, refdiv, fbdiv;
u64 freq = parent_rate;
reg = readl_relaxed(vco->base + VCO_CTRL1);
refdiv = (reg & V... | [
0,
0
] |
Linux Kernel | drivers/clk/berlin/berlin2-avpll.c |
static void berlin2_avpll_channel_disable(struct clk_hw *hw) {
struct berlin2_avpll_channel *ch = to_avpll_channel(hw);
u32 reg;
reg = readl_relaxed(ch->base + VCO_CTRL10);
reg &= ~(VCO_POWERUP_CH1 << ch->index);
writel_relaxed(reg, ch->base + VCO_CTRL10);
} | [
0,
0
] |
Linux Kernel | drivers/clk/berlin/berlin2-div.c |
static int berlin2_div_is_enabled(struct clk_hw *hw) {
struct berlin2_div *div = to_berlin2_div(hw);
struct berlin2_div_map *map = &div->map;
u32 reg;
if (div->lock)
spin_lock(div->lock);
reg = readl_relaxed(div->base + map->gate_offs);
reg >>= map->gate_shift;
if (div->lock)
spin_unlock(div->... | [
1,
0
] |
Linux Kernel | drivers/clk/berlin/berlin2-div.c |
static void berlin2_div_disable(struct clk_hw *hw) {
struct berlin2_div *div = to_berlin2_div(hw);
struct berlin2_div_map *map = &div->map;
u32 reg;
if (div->lock)
spin_lock(div->lock);
reg = readl_relaxed(div->base + map->gate_offs);
reg &= ~BIT(map->gate_shift);
writel_relaxed(reg, div->base + ma... | [
0,
0
] |
Linux Kernel | drivers/clk/berlin/berlin2-div.c | static int berlin2_div_set_parent(struct clk_hw *hw, u8 index) {
struct berlin2_div *div = to_berlin2_div(hw);
struct berlin2_div_map *map = &div->map;
u32 reg;
if (div->lock)
spin_lock(div->lock);
reg = readl_relaxed(div->base + map->pll_switch_offs);
if (index == 0)
reg &= ~BIT(map->pll_switch_s... | [
1,
0
] |
Linux Kernel | drivers/clk/clk-apple-nco.c |
static void applnco_enable_nolock(struct clk_hw *hw) {
struct applnco_channel *chan = to_applnco_channel(hw);
u32 val;
val = readl_relaxed(chan->base + REG_CTRL);
writel_relaxed(val | CTRL_ENABLE, chan->base + REG_CTRL);
} | [
0,
0
] |
Linux Kernel | drivers/clk/clk-apple-nco.c | static void applnco_compute_tables(struct applnco_tables *tbl) {
int i;
u32 state = LFSR_INIT;
for (i = LFSR_PERIOD; i > 0; i--) {
if (state & 1)
state = (state >> 1) ^ (LFSR_POLY >> 1);
else
state = (state >> 1);
tbl->fwd[i] = state;
tbl->inv[state] = i;
}
/* Zero value is speci... | [
0,
0
] |
Linux Kernel | drivers/clk/clk-apple-nco.c |
static bool applnco_div_out_of_range(unsigned int div) {
unsigned int coarse = div / 4;
return coarse < COARSE_DIV_OFFSET ||
coarse >= COARSE_DIV_OFFSET + LFSR_TBLSIZE;
} | [
1,
0
] |
Linux Kernel | drivers/clk/clk-apple-nco.c |
static void applnco_disable(struct clk_hw *hw) {
struct applnco_channel *chan = to_applnco_channel(hw);
unsigned long flags;
spin_lock_irqsave(&chan->lock, flags);
applnco_disable_nolock(hw);
spin_unlock_irqrestore(&chan->lock, flags);
} | [
0,
0
] |
Linux Kernel | drivers/clk/clk-aspeed.c | static struct clk_hw *aspeed_ast2400_calc_pll(const char *name, u32 val) {
unsigned int mult, div;
if (val & AST2400_HPLL_BYPASS_EN) {
mult = div = 1;
} else {
/* F = 24Mhz * (2-OD) * [(N + 2) / (D + 1)] */
u32 n = (val >> 5) & 0x3f;
u32 od = (val >> 4) & 0x1;
u32 d = val & 0xf;
mult = ... | [
1,
0
] |
Linux Kernel | drivers/clk/clk-aspeed.c | static struct clk_hw *aspeed_ast2500_calc_pll(const char *name, u32 val) {
unsigned int mult, div;
if (val & AST2500_HPLL_BYPASS_EN) {
mult = div = 1;
} else {
/* F = clkin * [(M+1) / (N+1)] / (P + 1) */
u32 p = (val >> 13) & 0x3f;
u32 m = (val >> 5) & 0xff;
u32 n = val & 0x1f;
mult = (... | [
1,
0
] |
Linux Kernel | drivers/clk/clk-aspeed.c | static int aspeed_clk_is_enabled(struct clk_hw *hw) {
struct aspeed_clk_gate *gate = to_aspeed_clk_gate(hw);
u32 clk = BIT(gate->clock_idx);
u32 rst = BIT(gate->reset_idx);
u32 enval = (gate->flags & CLK_GATE_SET_TO_DISABLE) ? 0 : clk;
u32 reg;
if (gate->reset_idx >= 0) {
regmap_read(gate->map, ASPEED_... | [
0,
0
] |
Linux Kernel | drivers/clk/clk-aspeed.c |
static int aspeed_reset_status(struct reset_controller_dev *rcdev,
unsigned long id) {
struct aspeed_reset *ar = to_aspeed_reset(rcdev);
u32 reg = ASPEED_RESET_CTRL;
u32 bit = aspeed_resets[id];
int ret, val;
if (bit >= ASPEED_RESET2_OFFSET) {
bit -= ASPEED_RESET2_OFFSET;
... | [
0,
0
] |
Linux Kernel | drivers/clk/clk-aspeed.c |
static struct clk_hw *
aspeed_clk_hw_register_gate(struct device *dev, const char *name,
const char *parent_name, unsigned long flags,
struct regmap *map, u8 clock_idx, u8 reset_idx,
u8 clk_gate_flags, spinlock_t *lock) {
struct aspe... | [
0,
0
] |
Linux Kernel | drivers/clk/clk-aspeed.c | static void __init aspeed_ast2500_cc(struct regmap *map) {
struct clk_hw *hw;
u32 val, freq, div;
regmap_read(map, ASPEED_STRAP, &val);
if (val & CLKIN_25MHZ_EN)
freq = 25000000;
else
freq = 24000000;
hw = clk_hw_register_fixed_rate(NULL, "clkin", NULL, 0, freq);
pr_debug("clkin @%u MHz\n", freq ... | [
1,
0
] |
Linux Kernel | drivers/clk/clk-aspeed.c | static void __init aspeed_cc_init(struct device_node *np) {
struct regmap *map;
u32 val;
int ret;
int i;
scu_base = of_iomap(np, 0);
if (!scu_base)
return;
aspeed_clk_data =
kzalloc(struct_size(aspeed_clk_data, hws, ASPEED_NUM_CLKS), GFP_KERNEL);
if (!aspeed_clk_data)
return;
for (i =... | [
0,
0
] |
Linux Kernel | drivers/clk/clk-ast2600.c |
static u32 get_bit(u8 idx) { return BIT(idx % 32); } | [
0,
0
] |
Linux Kernel | drivers/clk/clk-ast2600.c | static int aspeed_g6_reset_deassert(struct reset_controller_dev *rcdev,
unsigned long id) {
struct aspeed_reset *ar = to_aspeed_reset(rcdev);
u32 rst = get_bit(id);
u32 reg = id >= 32 ? ASPEED_G6_RESET_CTRL2 : ASPEED_G6_RESET_CTRL;
return regmap_write(ar->map, reg + 0x04, rs... | [
0,
0
] |
Linux Kernel | drivers/clk/clk-ast2600.c |
static int aspeed_g6_reset_status(struct reset_controller_dev *rcdev,
unsigned long id) {
struct aspeed_reset *ar = to_aspeed_reset(rcdev);
int ret;
u32 val;
u32 rst = get_bit(id);
u32 reg = id >= 32 ? ASPEED_G6_RESET_CTRL2 : ASPEED_G6_RESET_CTRL;
ret = regmap_read(ar->ma... | [
0,
0
] |
Linux Kernel | drivers/clk/clk-axi-clkgen.c |
static void axi_clkgen_calc_clk_params(unsigned int divider,
unsigned int frac_divider,
struct axi_clkgen_div_params *params) {
memset(params, 0x0, sizeof(*params));
if (divider == 1) {
params->nocount = 1;
return;
}
if (f... | [
1,
0
] |
Linux Kernel | drivers/clk/clk-axi-clkgen.c |
static int axi_clkgen_wait_non_busy(struct axi_clkgen *axi_clkgen) {
unsigned int timeout = 10000;
unsigned int val;
do {
axi_clkgen_read(axi_clkgen, AXI_CLKGEN_V2_REG_DRP_STATUS, &val);
} while ((val & AXI_CLKGEN_V2_DRP_STATUS_BUSY) && --timeout);
if (val & AXI_CLKGEN_V2_DRP_STATUS_BUSY)
return -E... | [
1,
0
] |
Linux Kernel | drivers/clk/clk-axi-clkgen.c |
static void axi_clkgen_disable(struct clk_hw *clk_hw) {
struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(clk_hw);
axi_clkgen_mmcm_enable(axi_clkgen, false);
} | [
0,
0
] |
Linux Kernel | drivers/clk/clk-axi-clkgen.c |
static int axi_clkgen_remove(struct platform_device *pdev) {
of_clk_del_provider(pdev->dev.of_node);
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/clk/clk-axm5516.c |
static struct clk_hw *of_clk_axmclk_get(struct of_phandle_args *clkspec,
void *unused) {
unsigned int idx = clkspec->args[0];
if (idx >= ARRAY_SIZE(axmclk_clocks)) {
pr_err("%s: invalid index %u\n", __func__, idx);
return ERR_PTR(-EINVAL);
}
return &axmclk_cloc... | [
1,
0
] |
Linux Kernel | drivers/clk/clk-bm1880.c |
static int bm1880_clk_register_mux(const struct bm1880_mux_clock *clks,
int num_clks,
struct bm1880_clock_data *data) {
struct clk_hw *hw;
void __iomem *sys_base = data->sys_base;
int i;
for (i = 0; i < num_clks; i++) {
hw = clk_hw_regi... | [
0,
0
] |
Linux Kernel | drivers/clk/clk-bm1880.c |
static unsigned long bm1880_clk_div_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) {
struct bm1880_div_hw_clock *div_hw = to_bm1880_div_clk(hw);
struct bm1880_div_clock *div = &div_hw->div;
void __iomem *reg_addr = div_hw->base + div->reg;
unsigned int... | [
1,
0
] |
Linux Kernel | drivers/clk/clk-bm1880.c |
static int bm1880_clk_register_composites(struct bm1880_composite_clock *clks,
int num_clks,
struct bm1880_clock_data *data) {
struct clk_hw *hw;
void __iomem *sys_base = data->sys_base;
int i;
for (i = 0; i < num_clks; i++) {... | [
0,
0
] |
Linux Kernel | drivers/clk/clk-bulk.c |
static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
struct clk_bulk_data *clks) {
int ret;
int i;
for (i = 0; i < num_clks; i++) {
clks[i].id = NULL;
clks[i].clk = NULL;
}
for (i = 0; i < num_clks; i++) {
of_property_read_string_... | [
0,
0
] |
Linux Kernel | drivers/clk/clk-bulk.c |
static int __must_check of_clk_bulk_get_all(struct device_node *np,
struct clk_bulk_data **clks) {
struct clk_bulk_data *clk_bulk;
int num_clks;
int ret;
num_clks = of_clk_get_parent_count(np);
if (!num_clks)
return 0;
clk_bulk = kmalloc_array(num_clks, siz... | [
1,
0
] |
Linux Kernel | drivers/clk/clk-bulk.c | void clk_bulk_unprepare(int num_clks, const struct clk_bulk_data *clks) {
while (--num_clks >= 0)
clk_unprepare(clks[num_clks].clk);
} | [
0,
0
] |
Linux Kernel | drivers/clk/clk-bulk.c | int __must_check clk_bulk_prepare(int num_clks,
const struct clk_bulk_data *clks) {
int ret;
int i;
for (i = 0; i < num_clks; i++) {
ret = clk_prepare(clks[i].clk);
if (ret) {
pr_err("Failed to prepare clk '%s': %d\n", clks[i].id, ret);
goto err;
}
}
... | [
0,
0
] |
Linux Kernel | drivers/clk/clk-bulk.c | void clk_bulk_disable(int num_clks, const struct clk_bulk_data *clks) {
while (--num_clks >= 0)
clk_disable(clks[num_clks].clk);
} | [
0,
0
] |
Linux Kernel | drivers/clk/clk-cdce706.c |
static int cdce706_reg_read(struct cdce706_dev_data *dev_data, unsigned reg,
unsigned *val) {
int rc = regmap_read(dev_data->regmap, reg | 0x80, val);
if (rc < 0)
dev_err(&dev_data->client->dev, "error reading reg %u", reg);
return rc;
} | [
0,
0
] |
Linux Kernel | drivers/clk/clk-cdce706.c |
static void cdce706_clkout_unprepare(struct clk_hw *hw) {
struct cdce706_hw_data *hwd = to_hw_data(hw);
cdce706_reg_update(hwd->dev_data, CDCE706_CLKOUT(hwd->idx),
CDCE706_CLKOUT_ENABLE_MASK, 0);
} | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.