Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | drivers/clk/sunxi/clk-sunxi.c | static void sun5i_a13_get_ahb_factors(struct factors_request *req) {
u32 div;
if (req->parent_rate < req->rate)
req->rate = req->parent_rate;
/*
* user manual says valid speed is 8k ~ 276M, but tests show it
* can work at speeds up to 300M, just after reparenting to pll6
*/
if (req->rate < 8000)
... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi/clk-sunxi.c | static void sun7i_a20_get_out_factors(struct factors_request *req) {
u8 div, calcm, calcp;
if (req->rate > req->parent_rate)
req->rate = req->parent_rate;
div = DIV_ROUND_UP(req->parent_rate, req->rate);
if (div < 32)
calcp = 0;
else if (div / 2 < 32)
calcp = 1;
else if (div / 4 < 32)
cal... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi/clk-sunxi.c |
static void __init sun5i_ahb_clk_setup(struct device_node *node) {
sunxi_factors_clk_setup(node, &sun5i_a13_ahb_data);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi/clk-sunxi.c |
static void __init sun7i_out_clk_setup(struct device_node *node) {
sunxi_factors_clk_setup(node, &sun7i_a20_out_data);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi/clk-sunxi.c |
static struct clk *__init sunxi_mux_clk_setup(struct device_node *node,
const struct mux_data *data,
unsigned long flags) {
struct clk *clk;
const char *clk_name = node->name;
const char *parents[SUNXI_MAX_PARENTS];
voi... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi/clk-sunxi.c | static void __init sun4i_cpu_clk_setup(struct device_node *node) {
sunxi_mux_clk_setup(node, &sun4i_cpu_mux_data, CLK_IS_CRITICAL);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi/clk-usb.c |
static void __init sun4i_a10_usb_setup(struct device_node *node) {
sunxi_usb_clk_setup(node, &sun4i_a10_usb_clk_data, &sun4i_a10_usb_lock);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi/clk-usb.c |
static void __init sun6i_a31_usb_setup(struct device_node *node) {
sunxi_usb_clk_setup(node, &sun6i_a31_usb_clk_data, &sun4i_a10_usb_lock);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu-sun4i-a10.c | static int sun4i_a10_ccu_probe(struct platform_device *pdev) {
const struct sunxi_ccu_desc *desc;
void __iomem *reg;
u32 val;
desc = of_device_get_match_data(&pdev->dev);
if (!desc)
return -EINVAL;
reg = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(reg))
return PTR_ERR(reg);
val = read... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu-sun6i-rtc.c |
static int ccu_iosc_32k_prepare(struct clk_hw *hw) {
struct ccu_common *cm = hw_to_ccu_common(hw);
u32 val;
if (!have_iosc_calibration)
return 0;
val = readl(cm->base + IOSC_CLK_CALI_REG);
writel(val | IOSC_CLK_CALI_EN | IOSC_CLK_CALI_SRC_SEL,
cm->base + IOSC_CLK_CALI_REG);
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu-sun6i-rtc.c | static unsigned long
ccu_iosc_32k_recalc_accuracy(struct clk_hw *hw, unsigned long parent_accuracy) {
struct ccu_common *cm = hw_to_ccu_common(hw);
u32 val;
if (have_iosc_calibration) {
val = readl(cm->base + IOSC_CLK_CALI_REG);
if (val & IOSC_CLK_CALI_SRC_SEL)
return 0;
}
return parent_accur... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu-sun8i-a33.c | static int sun8i_a33_ccu_probe(struct platform_device *pdev) {
void __iomem *reg;
int ret;
u32 val;
reg = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(reg))
return PTR_ERR(reg);
val = readl(reg + SUN8I_A33_PLL_AUDIO_REG);
val &= ~GENMASK(19, 16);
writel(val | (0 << 16), reg + SUN8I_A33_PLL_... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu-sun8i-a83t.c | static void sun8i_a83t_cpu_pll_fixup(void __iomem *reg) {
u32 val = readl(reg);
/* bail out if P divider is not used */
if (!(val & BIT(SUN8I_A83T_PLL_P_SHIFT)))
return;
/*
* If P is used, output should be less than 288 MHz. When we
* set P to 1, we should also decrease the multiplier so the
* ou... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu-sun8i-de2.c | static int sunxi_de2_clk_probe(struct platform_device *pdev) {
struct clk *bus_clk, *mod_clk;
struct reset_control *rstc;
void __iomem *reg;
const struct sunxi_ccu_desc *ccu_desc;
int ret;
ccu_desc = of_device_get_match_data(&pdev->dev);
if (!ccu_desc)
return -EINVAL;
reg = devm_platform_ioremap_r... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c | static int sun9i_a80_de_clk_probe(struct platform_device *pdev) {
struct clk *bus_clk;
struct reset_control *rstc;
void __iomem *reg;
int ret;
reg = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(reg))
return PTR_ERR(reg);
bus_clk = devm_clk_get(&pdev->dev, "bus");
if (IS_ERR(bus_clk))
re... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c | static int sun9i_a80_usb_clk_probe(struct platform_device *pdev) {
struct clk *bus_clk;
void __iomem *reg;
int ret;
reg = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(reg))
return PTR_ERR(reg);
bus_clk = devm_clk_get(&pdev->dev, "bus");
if (IS_ERR(bus_clk))
return dev_err_probe(&pdev->dev... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c | static int suniv_f1c100s_ccu_probe(struct platform_device *pdev) {
void __iomem *reg;
int ret;
u32 val;
reg = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(reg))
return PTR_ERR(reg);
val = readl(reg + SUNIV_PLL_AUDIO_REG);
val &= ~GENMASK(19, 16);
writel(val | (3 << 16), reg + SUNIV_PLL_AUDI... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_common.c |
void ccu_helper_wait_for_lock(struct ccu_common *common, u32 lock) {
void __iomem *addr;
u32 reg;
if (!lock)
return;
if (common->features & CCU_FEATURE_LOCK_REG)
addr = common->base + common->lock_reg;
else
addr = common->base + common->reg;
WARN_ON(readl_relaxed_poll_timeout(addr, reg, reg ... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_common.c |
static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev,
struct device_node *node, void __iomem *reg,
const struct sunxi_ccu_desc *desc) {
struct ccu_reset *reset;
int i, ret;
ccu->desc = desc;
spin_lock_init(&ccu->lock);
for (i = 0; i < d... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_div.c |
static unsigned long ccu_div_round_rate(struct ccu_mux_internal *mux,
struct clk_hw *parent,
unsigned long *parent_rate,
unsigned long rate, void *data) {
struct ccu_div *cd = data;
if (cd->comm... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_div.c |
static unsigned long ccu_div_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) {
struct ccu_div *cd = hw_to_ccu_div(hw);
unsigned long val;
u32 reg;
reg = readl(cd->common.base + cd->common.reg);
val = reg >> cd->div.shift;
val &= (1 << cd->div.width) - 1;
... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_div.c |
static int ccu_div_set_parent(struct clk_hw *hw, u8 index) {
struct ccu_div *cd = hw_to_ccu_div(hw);
return ccu_mux_helper_set_parent(&cd->common, &cd->mux, index);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_frac.c |
void ccu_frac_helper_enable(struct ccu_common *common,
struct ccu_frac_internal *cf) {
unsigned long flags;
u32 reg;
if (!(common->features & CCU_FEATURE_FRACTIONAL))
return;
spin_lock_irqsave(common->lock, flags);
reg = readl(common->base + common->reg);
writel(reg & ~cf-... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_gate.c |
static unsigned long ccu_gate_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) {
struct ccu_gate *cg = hw_to_ccu_gate(hw);
unsigned long rate = parent_rate;
if (cg->common.features & CCU_FEATURE_ALL_PREDIV)
rate /= cg->common.prediv;
return rate;
} | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_gate.c |
static long ccu_gate_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *prate) {
struct ccu_gate *cg = hw_to_ccu_gate(hw);
int div = 1;
if (cg->common.features & CCU_FEATURE_ALL_PREDIV)
div = cg->common.prediv;
if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) ... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_mp.c | static unsigned long ccu_mp_find_best_with_parent_adj(struct clk_hw *hw,
unsigned long *parent,
unsigned long rate,
unsigned int max_m,
... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_mp.c |
static int ccu_mp_is_enabled(struct clk_hw *hw) {
struct ccu_mp *cmp = hw_to_ccu_mp(hw);
return ccu_gate_helper_is_enabled(&cmp->common, cmp->enable);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_mp.c |
static int ccu_mp_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req) {
struct ccu_mp *cmp = hw_to_ccu_mp(hw);
return ccu_mux_helper_determine_rate(&cmp->common, &cmp->mux, req,
ccu_mp_round_rate, cmp);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_mp.c | static int ccu_mp_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate) {
struct ccu_mp *cmp = hw_to_ccu_mp(hw);
unsigned long flags;
unsigned int max_m, max_p;
unsigned int m, p;
u32 reg;
parent_rate =
ccu_mux_helper_apply_prediv(&cmp->common, &cmp->mu... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_mp.c |
static int ccu_mp_set_parent(struct clk_hw *hw, u8 index) {
struct ccu_mp *cmp = hw_to_ccu_mp(hw);
return ccu_mux_helper_set_parent(&cmp->common, &cmp->mux, index);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_mp.c | static int ccu_mp_mmc_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req) {
struct ccu_common *cm = hw_to_ccu_common(hw);
u32 val = readl(cm->base + cm->reg);
int ret;
if (val & CCU_MMC_NEW_TIMING_MODE) {
req->rate *= 2;
req->min_rate *= 2;
req->max_... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_mult.c |
static void ccu_mult_disable(struct clk_hw *hw) {
struct ccu_mult *cm = hw_to_ccu_mult(hw);
return ccu_gate_helper_disable(&cm->common, cm->enable);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_mult.c |
static int ccu_mult_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req) {
struct ccu_mult *cm = hw_to_ccu_mult(hw);
return ccu_mux_helper_determine_rate(&cm->common, &cm->mux, req,
ccu_mult_round_rate, cm);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_mult.c |
static int ccu_mult_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate) {
struct ccu_mult *cm = hw_to_ccu_mult(hw);
struct _ccu_mult _cm;
unsigned long flags;
u32 reg;
if (ccu_frac_helper_has_rate(&cm->common, &cm->frac, rate)) {
ccu_frac_helper_enable... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_mux.c |
static u8 ccu_mux_get_parent(struct clk_hw *hw) {
struct ccu_mux *cm = hw_to_ccu_mux(hw);
return ccu_mux_helper_get_parent(&cm->common, &cm->mux);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_mux.c |
static unsigned long ccu_mux_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) {
struct ccu_mux *cm = hw_to_ccu_mux(hw);
return ccu_mux_helper_apply_prediv(&cm->common, &cm->mux, -1, parent_rate);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_nk.c |
static void ccu_nk_find_best(unsigned long parent, unsigned long rate,
struct _ccu_nk *nk) {
unsigned long best_rate = 0;
unsigned int best_k = 0, best_n = 0;
unsigned int _k, _n;
for (_k = nk->min_k; _k <= nk->max_k; _k++) {
for (_n = nk->min_n; _n <= nk->max_n; _n++) {
... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_nk.c |
static long ccu_nk_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate) {
struct ccu_nk *nk = hw_to_ccu_nk(hw);
struct _ccu_nk _nk;
if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV)
rate *= nk->fixed_post_div;
_nk.min_n = nk->n.min ?: 1;
_nk.max... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_nkm.c |
static int ccu_nkm_is_enabled(struct clk_hw *hw) {
struct ccu_nkm *nkm = hw_to_ccu_nkm(hw);
return ccu_gate_helper_is_enabled(&nkm->common, nkm->enable);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_nkmp.c |
static unsigned long ccu_nkmp_calc_rate(unsigned long parent, unsigned long n,
unsigned long k, unsigned long m,
unsigned long p) {
u64 rate = parent;
rate *= n * k;
do_div(rate, m * p);
return rate;
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_nkmp.c |
static void ccu_nkmp_find_best(unsigned long parent, unsigned long rate,
struct _ccu_nkmp *nkmp) {
unsigned long best_rate = 0;
unsigned long best_n = 0, best_k = 0, best_m = 0, best_p = 0;
unsigned long _n, _k, _m, _p;
for (_k = nkmp->min_k; _k <= nkmp->max_k; _k++) {
for (... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_nkmp.c |
static void ccu_nkmp_disable(struct clk_hw *hw) {
struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw);
return ccu_gate_helper_disable(&nkmp->common, nkmp->enable);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_nkmp.c |
static unsigned long ccu_nkmp_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) {
struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw);
unsigned long n, m, k, p, rate;
u32 reg;
reg = readl(nkmp->common.base + nkmp->common.reg);
n = reg >> nkmp->n.shift;
n &= (1 << ... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_nkmp.c |
static long ccu_nkmp_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate) {
struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw);
struct _ccu_nkmp _nkmp;
if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV)
rate *= nkmp->fixed_post_div;
if (nkmp->max_rate ... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_nm.c |
static void ccu_nm_find_best(unsigned long parent, unsigned long rate,
struct _ccu_nm *nm) {
unsigned long best_rate = 0;
unsigned long best_n = 0, best_m = 0;
unsigned long _n, _m;
for (_n = nm->min_n; _n <= nm->max_n; _n++) {
for (_m = nm->min_m; _m <= nm->max_m; _m++) {
... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_nm.c |
static int ccu_nm_is_enabled(struct clk_hw *hw) {
struct ccu_nm *nm = hw_to_ccu_nm(hw);
return ccu_gate_helper_is_enabled(&nm->common, nm->enable);
} | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_nm.c |
static long ccu_nm_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate) {
struct ccu_nm *nm = hw_to_ccu_nm(hw);
struct _ccu_nm _nm;
if (nm->common.features & CCU_FEATURE_FIXED_POSTDIV)
rate *= nm->fixed_post_div;
if (rate < nm->min_rate) {
rate =... | [
0,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_phase.c | static int ccu_phase_set_phase(struct clk_hw *hw, int degrees) {
struct ccu_phase *phase = hw_to_ccu_phase(hw);
struct clk_hw *parent, *grandparent;
unsigned int parent_rate, grandparent_rate;
unsigned long flags;
u32 reg;
u8 delay;
parent = clk_hw_get_parent(hw);
if (!parent)
return -EINVAL;
/*... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_sdm.c | void ccu_sdm_helper_enable(struct ccu_common *common,
struct ccu_sdm_internal *sdm, unsigned long rate) {
unsigned long flags;
unsigned int i;
u32 reg;
if (!(common->features & CCU_FEATURE_SIGMA_DELTA_MOD))
return;
for (i = 0; i < sdm->table_size; i++)
if (sdm->table[i].ra... | [
1,
0
] |
Linux Kernel | drivers/clk/sunxi-ng/ccu_sdm.c | bool ccu_sdm_helper_has_rate(struct ccu_common *common,
struct ccu_sdm_internal *sdm, unsigned long rate) {
unsigned int i;
if (!(common->features & CCU_FEATURE_SIGMA_DELTA_MOD))
return false;
for (i = 0; i < sdm->table_size; i++)
if (sdm->table[i].rate == rate)
return... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-bpmp.c | static int tegra_bpmp_clk_set_parent(struct clk_hw *hw, u8 index) {
struct tegra_bpmp_clk *clk = to_tegra_bpmp_clk(hw);
struct cmd_clk_set_parent_response response;
struct cmd_clk_set_parent_request request;
struct tegra_bpmp_clk_message msg;
int err;
memset(&request, 0, sizeof(request));
request.parent_... | [
1,
1
] |
Linux Kernel | drivers/clk/tegra/clk-bpmp.c |
static int tegra_bpmp_clk_get_info(struct tegra_bpmp *bpmp, unsigned int id,
struct tegra_bpmp_clk_info *info) {
struct cmd_clk_get_all_info_response response;
struct tegra_bpmp_clk_message msg;
unsigned int i;
int err;
memset(&msg, 0, sizeof(msg));
msg.cmd = CMD_CLK_GET... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-bpmp.c |
static void tegra_bpmp_clk_info_dump(struct tegra_bpmp *bpmp, const char *level,
const struct tegra_bpmp_clk_info *info) {
const char *prefix = "";
struct seq_buf buf;
unsigned int i;
char flags[64];
seq_buf_init(&buf, flags, sizeof(flags));
if (info->flags)
seq_b... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-bpmp.c |
static unsigned int
tegra_bpmp_clk_id_to_index(const struct tegra_bpmp_clk_info *clocks,
unsigned int num_clocks, unsigned int id) {
unsigned int i;
for (i = 0; i < num_clocks; i++)
if (clocks[i].id == id)
return i;
return UINT_MAX;
} | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-bpmp.c |
static const struct tegra_bpmp_clk_info *
tegra_bpmp_clk_find(const struct tegra_bpmp_clk_info *clocks,
unsigned int num_clocks, unsigned int id) {
unsigned int i;
i = tegra_bpmp_clk_id_to_index(clocks, num_clocks, id);
if (i < num_clocks)
return &clocks[i];
return NULL;
} | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-bpmp.c |
static int tegra_bpmp_register_clocks(struct tegra_bpmp *bpmp,
struct tegra_bpmp_clk_info *infos,
unsigned int count) {
unsigned int i;
bpmp->num_clocks = count;
bpmp->clocks =
devm_kcalloc(bpmp->dev, count, sizeof(struct tegra_b... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-bpmp.c |
static struct clk_hw *tegra_bpmp_clk_of_xlate(struct of_phandle_args *clkspec,
void *data) {
unsigned int id = clkspec->args[0], i;
struct tegra_bpmp *bpmp = data;
for (i = 0; i < bpmp->num_clocks; i++) {
struct tegra_bpmp_clk *clk = bpmp->clocks[i];
if (!c... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c | static inline u32 dfll_readl(struct tegra_dfll *td, u32 offs) {
return __raw_readl(td->base + offs);
} | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c |
static inline void dfll_wmb(struct tegra_dfll *td) {
dfll_readl(td, DFLL_CTRL);
} | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c |
static inline void dfll_i2c_wmb(struct tegra_dfll *td) {
dfll_i2c_readl(td, DFLL_I2C_CFG);
} | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c | static unsigned long dfll_scale_dvco_rate(int scale_bits,
unsigned long dvco_rate) {
return (u64)dvco_rate * (scale_bits + 1) / DFLL_FREQ_REQ_SCALE_MAX;
} | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c | static int dfll_pwm_set_output_enabled(struct tegra_dfll *td, bool enable) {
int ret;
u32 val, div;
if (enable) {
ret = pinctrl_select_state(td->pwm_pin, td->pwm_enable_state);
if (ret < 0) {
dev_err(td->dev, "setting enable state failed\n");
return -EINVAL;
}
val = dfll_readl(td, DFL... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c | static void dfll_load_i2c_lut(struct tegra_dfll *td) {
int i, lut_index;
u32 val;
for (i = 0; i < MAX_DFLL_VOLTAGES; i++) {
if (i < td->lut_min)
lut_index = td->lut_min;
else if (i > td->lut_max)
lut_index = td->lut_max;
else
lut_index = i;
val = regulator_list_hardware_vsel(td... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c | static void dfll_init_out_if(struct tegra_dfll *td) {
u32 val;
td->lut_min = td->lut_bottom;
td->lut_max = td->lut_size - 1;
td->lut_safe = td->lut_min + (td->lut_min < td->lut_max ? 1 : 0);
dfll_writel(td, 0, DFLL_OUTPUT_CFG);
dfll_wmb(td);
val = (td->lut_safe << DFLL_OUTPUT_CFG_SAFE_SHIFT) |
... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c | static int dfll_calculate_rate_request(struct tegra_dfll *td,
struct dfll_rate_req *req,
unsigned long rate) {
u32 val;
req->scale_bits = DFLL_FREQ_REQ_SCALE_MAX - 1;
if (rate < td->dvco_rate_min) {
int scale;
scale = DIV_ROUN... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c | /**
* dfll_set_frequency_request - start the frequency change operation
* @td: DFLL instance
* @req: rate request structure
*
* Tell the DFLL to try to change its output frequency to the
* frequency represented by @req. DFLL must be in closed-loop mode.
*/
static void dfll_set_frequency_request(struct tegra_dfll... | [
0,
1
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c | static int dfll_request_rate(struct tegra_dfll *td, unsigned long rate) {
int ret;
struct dfll_rate_req req;
if (td->mode == DFLL_UNINITIALIZED) {
dev_err(td->dev, "%s: Cannot set DFLL rate in %s mode\n", __func__,
mode_name[td->mode]);
return -EPERM;
}
ret = dfll_calculate_rate_request(... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c | static int dfll_lock(struct tegra_dfll *td) {
struct dfll_rate_req *req = &td->last_req;
switch (td->mode) {
case DFLL_CLOSED_LOOP:
return 0;
case DFLL_OPEN_LOOP:
if (req->rate == 0) {
dev_err(td->dev, "%s: Cannot lock DFLL at rate 0\n", __func__);
return -EINVAL;
}
if (td->pmu_if... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c |
static int dfll_clk_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate) {
struct tegra_dfll *td = clk_hw_to_dfll(hw);
return dfll_request_rate(td, rate);
} | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c |
static int attr_enable_get(void *data, u64 *val) {
struct tegra_dfll *td = data;
*val = dfll_is_running(td);
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c |
static int attr_lock_get(void *data, u64 *val) {
struct tegra_dfll *td = data;
*val = (td->mode == DFLL_CLOSED_LOOP);
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c | static int dfll_init_clks(struct tegra_dfll *td) {
td->ref_clk = devm_clk_get(td->dev, "ref");
if (IS_ERR(td->ref_clk)) {
dev_err(td->dev, "missing ref clock\n");
return PTR_ERR(td->ref_clk);
}
td->soc_clk = devm_clk_get(td->dev, "soc");
if (IS_ERR(td->soc_clk)) {
dev_err(td->dev, "missing soc cl... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c | static int find_vdd_map_entry_min(struct tegra_dfll *td, int uV) {
int i, n_voltages, reg_uV, reg_volt_id, align_step;
if (WARN_ON(td->pmu_if == TEGRA_DFLL_PMU_PWM))
return -EINVAL;
align_step = uV / td->soc->alignment.step_uv;
n_voltages = regulator_count_voltages(td->vdd_reg);
for (i = 0; i < n_voltag... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c |
static int dfll_build_lut(struct tegra_dfll *td) {
unsigned long rate, v_max;
struct dev_pm_opp *opp;
rate = ULONG_MAX;
opp = dev_pm_opp_find_freq_floor(td->soc->dev, &rate);
if (IS_ERR(opp)) {
dev_err(td->dev, "couldn't get vmax opp, empty opp table?\n");
return -EINVAL;
}
v_max = dev_pm_opp_ge... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c | static bool read_dt_param(struct tegra_dfll *td, const char *param, u32 *dest) {
int err = of_property_read_u32(td->dev->of_node, param, dest);
if (err < 0) {
dev_err(td->dev, "failed to read DT parameter %s: %d\n", param, err);
return false;
}
return true;
} | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-dfll.c |
static int dfll_fetch_pwm_params(struct tegra_dfll *td) {
int ret, i;
u32 pwm_period;
if (!td->soc->alignment.step_uv || !td->soc->alignment.offset_uv) {
dev_err(td->dev, "Missing step or alignment info for PWM regulator");
return -EINVAL;
}
for (i = 0; i < MAX_DFLL_VOLTAGES; i++)
td->lut_uv[i] ... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-divider.c |
static unsigned long clk_frac_div_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) {
struct tegra_clk_frac_div *divider = to_clk_frac_div(hw);
u32 reg;
int div, mul;
u64 rate = parent_rate;
reg = readl_relaxed(divider->reg);
if ((divider->flags & TEG... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-periph-fixed.c |
static void tegra_clk_periph_fixed_disable(struct clk_hw *hw) {
struct tegra_clk_periph_fixed *fixed = to_tegra_clk_periph_fixed(hw);
u32 mask = 1 << (fixed->num % 32);
writel(mask, fixed->base + fixed->regs->enb_clr_reg);
} | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-periph-gate.c | static int clk_periph_is_enabled(struct clk_hw *hw) {
struct tegra_clk_periph_gate *gate = to_clk_periph_gate(hw);
int state = 1;
if (!(read_enb(gate) & periph_clk_to_bit(gate)))
state = 0;
if (!(gate->flags & TEGRA_PERIPH_NO_RESET))
if (read_rst(gate) & periph_clk_to_bit(gate))
state = 0;
re... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-periph-gate.c | static void clk_periph_disable_locked(struct clk_hw *hw) {
struct tegra_clk_periph_gate *gate = to_clk_periph_gate(hw);
if (gate->flags & TEGRA_PERIPH_ON_APB)
tegra_read_chipid();
write_enb_clr(periph_clk_to_bit(gate), gate);
} | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-periph-gate.c |
static void clk_periph_disable(struct clk_hw *hw) {
struct tegra_clk_periph_gate *gate = to_clk_periph_gate(hw);
unsigned long flags = 0;
spin_lock_irqsave(&periph_ref_lock, flags);
WARN_ON(!gate->enable_refcnt[gate->clk_num]);
if (--gate->enable_refcnt[gate->clk_num] == 0)
clk_periph_disable_locked(h... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-periph.c |
static unsigned long clk_periph_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) {
struct tegra_clk_periph *periph = to_clk_periph(hw);
const struct clk_ops *div_ops = periph->div_ops;
struct clk_hw *div_hw = &periph->divider.hw;
__clk_hw_set_clk(div_hw, hw... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-periph.c |
static long clk_periph_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *prate) {
struct tegra_clk_periph *periph = to_clk_periph(hw);
const struct clk_ops *div_ops = periph->div_ops;
struct clk_hw *div_hw = &periph->divider.hw;
__clk_hw_set_clk(div_hw, hw);
... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-periph.c |
static int clk_periph_is_enabled(struct clk_hw *hw) {
struct tegra_clk_periph *periph = to_clk_periph(hw);
const struct clk_ops *gate_ops = periph->gate_ops;
struct clk_hw *gate_hw = &periph->gate.hw;
__clk_hw_set_clk(gate_hw, hw);
return gate_ops->is_enabled(gate_hw);
} | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll-out.c | struct clk *tegra_clk_register_pll_out(const char *name,
const char *parent_name,
void __iomem *reg, u8 enb_bit_idx,
u8 rst_bit_idx, unsigned long flags,
u8 pll_out... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c |
static void _clk_pll_enable(struct clk_hw *hw) {
struct tegra_clk_pll *pll = to_clk_pll(hw);
u32 val;
if (pll->params->iddq_reg) {
val = pll_readl(pll->params->iddq_reg, pll);
val &= ~BIT(pll->params->iddq_bit_idx);
pll_writel(val, pll->params->iddq_reg, pll);
udelay(5);
}
if (pll->params->... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c |
static void pll_clk_stop_ss(struct tegra_clk_pll *pll) {
if (pll->params->defaults_set && pll->params->ssc_ctrl_reg) {
u32 val = pll_readl(pll->params->ssc_ctrl_reg, pll);
val &= ~pll->params->ssc_ctrl_en_mask;
pll_writel(val, pll->params->ssc_ctrl_reg, pll);
}
} | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c |
static int _p_div_to_hw(struct clk_hw *hw, u8 p_div) {
struct tegra_clk_pll *pll = to_clk_pll(hw);
const struct pdiv_map *p_tohw = pll->params->pdiv_tohw;
if (p_tohw) {
while (p_tohw->pdiv) {
if (p_div <= p_tohw->pdiv)
return p_tohw->hw_val;
p_tohw++;
}
return -EINVAL;
}
retu... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c |
int tegra_pll_p_div_to_hw(struct tegra_clk_pll *pll, u8 p_div) {
return _p_div_to_hw(&pll->hw, p_div);
} | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c |
static int _program_pll(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,
unsigned long rate) {
struct tegra_clk_pll *pll = to_clk_pll(hw);
struct tegra_clk_pll_freq_table old_cfg;
int state, ret = 0;
state = clk_pll_is_enabled(hw);
if (state && pll->params->pre_rate_change) ... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c | static int clk_plle_training(struct tegra_clk_pll *pll) {
u32 val;
unsigned long timeout;
if (!pll->pmc)
return -ENOSYS;
val = readl(pll->pmc + PMC_SATA_PWRGT);
val |= PMC_SATA_PWRGT_PLLE_IDDQ_VALUE;
writel(val, pll->pmc + PMC_SATA_PWRGT);
val = readl(pll->pmc + PMC_SATA_PWRGT);
val |= PMC_SATA_P... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c |
static unsigned long clk_plle_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) {
struct tegra_clk_pll *pll = to_clk_pll(hw);
u32 val = pll_readl_base(pll);
u32 divn = 0, divm = 0, divp = 0;
u64 rate = parent_rate;
divp = (val >> pll->params->div_nmp->divp_s... | [
0,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c |
static void tegra_clk_pll_restore_context(struct clk_hw *hw) {
struct tegra_clk_pll *pll = to_clk_pll(hw);
struct clk_hw *parent = clk_hw_get_parent(hw);
unsigned long parent_rate = clk_hw_get_rate(parent);
unsigned long rate = clk_hw_get_rate(hw);
if (clk_pll_is_enabled(hw))
return;
if (pll->params-... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c |
static int _pll_ramp_calc_pll(struct clk_hw *hw,
struct tegra_clk_pll_freq_table *cfg,
unsigned long rate, unsigned long parent_rate) {
struct tegra_clk_pll *pll = to_clk_pll(hw);
int err = 0;
err = _get_table_rate(hw, cfg, rate, parent_rate);
if (er... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c |
static int clk_pllc_enable(struct clk_hw *hw) {
struct tegra_clk_pll *pll = to_clk_pll(hw);
u32 val;
int ret;
unsigned long flags = 0;
if (clk_pll_is_enabled(hw))
return 0;
if (pll->lock)
spin_lock_irqsave(pll->lock, flags);
_clk_pll_enable(hw);
udelay(2);
val = pll_readl_misc(pll);
val... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c |
static void clk_pllc_disable(struct clk_hw *hw) {
struct tegra_clk_pll *pll = to_clk_pll(hw);
unsigned long flags = 0;
if (pll->lock)
spin_lock_irqsave(pll->lock, flags);
_clk_pllc_disable(hw);
if (pll->lock)
spin_unlock_irqrestore(pll->lock, flags);
} | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c |
static int clk_pllc_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate) {
struct tegra_clk_pll_freq_table cfg, old_cfg;
struct tegra_clk_pll *pll = to_clk_pll(hw);
unsigned long flags = 0;
int state, ret = 0;
if (pll->lock)
spin_lock_irqsave(pll->lock,... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c |
static void clk_plle_tegra114_disable(struct clk_hw *hw) {
struct tegra_clk_pll *pll = to_clk_pll(hw);
unsigned long flags = 0;
u32 val;
if (pll->lock)
spin_lock_irqsave(pll->lock, flags);
_clk_pll_disable(hw);
val = pll_readl_misc(pll);
val |= PLLE_MISC_IDDQ_SW_CTRL | PLLE_MISC_IDDQ_SW_VALUE;
p... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c | static struct clk *_tegra_clk_register_pll(struct tegra_clk_pll *pll,
const char *name,
const char *parent_name,
unsigned long flags,
const struct c... | [
1,
0
] |
Linux Kernel | drivers/clk/tegra/clk-pll.c |
struct clk *
tegra_clk_register_plle_tegra114(const char *name, const char *parent_name,
void __iomem *clk_base, unsigned long flags,
struct tegra_clk_pll_params *pll_params,
spinlock_t *lock) {
struct tegra_clk_pll *p... | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.