Merge branches 'clk-spreadtrum', 'clk-mvebu-dvfs', 'clk-qoriq', 'clk-imx' and 'clk-qcom-ipq8074' into clk-next
* clk-spreadtrum: clk: sprd: add clocks support for SC9860 clk: sprd: Add dt-bindings include file for SC9860 dt-bindings: Add Spreadtrum clock binding documentation clk: sprd: add adjustable pll support clk: sprd: add composite clock support clk: sprd: add divider clock support clk: sprd: add mux clock support clk: sprd: add gate clock support clk: sprd: Add common infrastructure clk: move clock common macros out from vendor directories * clk-mvebu-dvfs: clk: mvebu: armada-37xx-periph: add DVFS support for cpu clocks clk: mvebu: armada-37xx-periph: prepare cpu clk to be used with DVFS clk: mvebu: armada-37xx-periph: cosmetic changes * clk-qoriq: clk: qoriq: add more divider clocks support * clk-imx: clk: imx51: uart4, uart5 gates only exist on imx50, imx53 * clk-qcom-ipq8074: clk: qcom: ipq8074: add misc resets for PCIE and NSS dt-bindings: clock: qcom: add misc resets for PCIE and NSS clk: qcom: ipq8074: add GP and Crypto clocks clk: qcom: ipq8074: add NSS ethernet port clocks clk: qcom: ipq8074: add NSS clocks clk: qcom: ipq8074: add PCIE, USB and SDCC clocks clk: qcom: ipq8074: add remaining PLL’s dt-bindings: clock: qcom: add remaining clocks for IPQ8074 clk: qcom: ipq8074: fix missing GPLL0 divider width clk: qcom: add parent map for regmap mux clk: qcom: add read-only divider operations
This commit is contained in:
@@ -25,16 +25,6 @@ struct freq_tbl {
|
||||
u16 n;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct parent_map - map table for PLL source select configuration values
|
||||
* @src: source PLL
|
||||
* @cfg: configuration value
|
||||
*/
|
||||
struct parent_map {
|
||||
u8 src;
|
||||
u8 cfg;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct mn - M/N:D counter
|
||||
* @mnctr_en_bit: bit to enable mn counter
|
||||
|
@@ -23,6 +23,29 @@ static inline struct clk_regmap_div *to_clk_regmap_div(struct clk_hw *hw)
|
||||
return container_of(to_clk_regmap(hw), struct clk_regmap_div, clkr);
|
||||
}
|
||||
|
||||
static long div_round_ro_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *prate)
|
||||
{
|
||||
struct clk_regmap_div *divider = to_clk_regmap_div(hw);
|
||||
struct clk_regmap *clkr = ÷r->clkr;
|
||||
u32 div;
|
||||
struct clk_hw *hw_parent = clk_hw_get_parent(hw);
|
||||
|
||||
regmap_read(clkr->regmap, divider->reg, &div);
|
||||
div >>= divider->shift;
|
||||
div &= BIT(divider->width) - 1;
|
||||
div += 1;
|
||||
|
||||
if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
|
||||
if (!hw_parent)
|
||||
return -EINVAL;
|
||||
|
||||
*prate = clk_hw_round_rate(hw_parent, rate * div);
|
||||
}
|
||||
|
||||
return DIV_ROUND_UP_ULL((u64)*prate, div);
|
||||
}
|
||||
|
||||
static long div_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *prate)
|
||||
{
|
||||
@@ -68,3 +91,9 @@ const struct clk_ops clk_regmap_div_ops = {
|
||||
.recalc_rate = div_recalc_rate,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(clk_regmap_div_ops);
|
||||
|
||||
const struct clk_ops clk_regmap_div_ro_ops = {
|
||||
.round_rate = div_round_ro_rate,
|
||||
.recalc_rate = div_recalc_rate,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(clk_regmap_div_ro_ops);
|
||||
|
@@ -25,5 +25,6 @@ struct clk_regmap_div {
|
||||
};
|
||||
|
||||
extern const struct clk_ops clk_regmap_div_ops;
|
||||
extern const struct clk_ops clk_regmap_div_ro_ops;
|
||||
|
||||
#endif
|
||||
|
@@ -35,6 +35,9 @@ static u8 mux_get_parent(struct clk_hw *hw)
|
||||
val >>= mux->shift;
|
||||
val &= mask;
|
||||
|
||||
if (mux->parent_map)
|
||||
return qcom_find_src_index(hw, mux->parent_map, val);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
@@ -45,6 +48,9 @@ static int mux_set_parent(struct clk_hw *hw, u8 index)
|
||||
unsigned int mask = GENMASK(mux->width + mux->shift - 1, mux->shift);
|
||||
unsigned int val;
|
||||
|
||||
if (mux->parent_map)
|
||||
index = mux->parent_map[index].cfg;
|
||||
|
||||
val = index;
|
||||
val <<= mux->shift;
|
||||
|
||||
|
@@ -16,11 +16,13 @@
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include "clk-regmap.h"
|
||||
#include "common.h"
|
||||
|
||||
struct clk_regmap_mux {
|
||||
u32 reg;
|
||||
u32 shift;
|
||||
u32 width;
|
||||
const struct parent_map *parent_map;
|
||||
struct clk_regmap clkr;
|
||||
};
|
||||
|
||||
|
@@ -20,7 +20,6 @@ struct qcom_reset_map;
|
||||
struct regmap;
|
||||
struct freq_tbl;
|
||||
struct clk_hw;
|
||||
struct parent_map;
|
||||
|
||||
#define PLL_LOCK_COUNT_SHIFT 8
|
||||
#define PLL_LOCK_COUNT_MASK 0x3f
|
||||
@@ -39,6 +38,16 @@ struct qcom_cc_desc {
|
||||
size_t num_gdscs;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct parent_map - map table for source select configuration values
|
||||
* @src: source
|
||||
* @cfg: configuration value
|
||||
*/
|
||||
struct parent_map {
|
||||
u8 src;
|
||||
u8 cfg;
|
||||
};
|
||||
|
||||
extern const struct freq_tbl *qcom_find_freq(const struct freq_tbl *f,
|
||||
unsigned long rate);
|
||||
extern const struct freq_tbl *qcom_find_freq_floor(const struct freq_tbl *f,
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user