mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08:00
Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
Pull more clk updates from Stephen Boyd: "This is the final part of the clk patches for this merge window. The clk rate range series needed another week to fully bake. Maxime fixed the bug that broke clk notifiers and prevented this from being included in the first pull request. He also added a unit test on top to make sure it doesn't break so easily again. The majority of the series fixes up how the clk_set_rate_*() APIs work, particularly around when the rate constraints are dropped and how they move around when reparenting clks. Overall it's a much needed improvement to the clk rate range APIs that used to be pretty broken if you looked sideways. Beyond the core changes there are a few driver fixes for a compilation issue or improper data causing clks to fail to register or have the wrong parents. These are good to get in before the first -rc so that the system actually boots on the affected devices" * tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (31 commits) clk: tegra: Fix Tegra PWM parent clock clk: at91: fix the build with binutils 2.27 clk: qcom: gcc-msm8660: Drop hardcoded fixed board clocks clk: mediatek: clk-mux: Add .determine_rate() callback clk: tests: Add tests for notifiers clk: Update req_rate on __clk_recalc_rates() clk: tests: Add missing test case for ranges clk: qcom: clk-rcg2: Take clock boundaries into consideration for gfx3d clk: Introduce the clk_hw_get_rate_range function clk: Zero the clk_rate_request structure clk: Stop forwarding clk_rate_requests to the parent clk: Constify clk_has_parent() clk: Introduce clk_core_has_parent() clk: Switch from __clk_determine_rate to clk_core_round_rate_nolock clk: Add our request boundaries in clk_core_init_rate_req clk: Introduce clk_hw_init_rate_request() clk: Move clk_core_init_rate_req() from clk_core_round_rate_nolock() to its caller clk: Change clk_core_init_rate_req prototype clk: Set req_rate on reparenting clk: Take into account uncached clocks in clk_set_rate_range() ...
This commit is contained in:
@@ -136,7 +136,6 @@ static int clk_generated_determine_rate(struct clk_hw *hw,
|
||||
{
|
||||
struct clk_generated *gck = to_clk_generated(hw);
|
||||
struct clk_hw *parent = NULL;
|
||||
struct clk_rate_request req_parent = *req;
|
||||
long best_rate = -EINVAL;
|
||||
unsigned long min_rate, parent_rate;
|
||||
int best_diff = -1;
|
||||
@@ -192,7 +191,9 @@ static int clk_generated_determine_rate(struct clk_hw *hw,
|
||||
goto end;
|
||||
|
||||
for (div = 1; div < GENERATED_MAX_DIV + 2; div++) {
|
||||
req_parent.rate = req->rate * div;
|
||||
struct clk_rate_request req_parent;
|
||||
|
||||
clk_hw_forward_rate_request(hw, req, parent, &req_parent, req->rate * div);
|
||||
if (__clk_determine_rate(parent, &req_parent))
|
||||
continue;
|
||||
clk_generated_best_diff(req, parent, req_parent.rate, div,
|
||||
|
||||
@@ -581,7 +581,6 @@ static int clk_sama7g5_master_determine_rate(struct clk_hw *hw,
|
||||
struct clk_rate_request *req)
|
||||
{
|
||||
struct clk_master *master = to_clk_master(hw);
|
||||
struct clk_rate_request req_parent = *req;
|
||||
struct clk_hw *parent;
|
||||
long best_rate = LONG_MIN, best_diff = LONG_MIN;
|
||||
unsigned long parent_rate;
|
||||
@@ -618,11 +617,15 @@ static int clk_sama7g5_master_determine_rate(struct clk_hw *hw,
|
||||
goto end;
|
||||
|
||||
for (div = 0; div < MASTER_PRES_MAX + 1; div++) {
|
||||
if (div == MASTER_PRES_MAX)
|
||||
req_parent.rate = req->rate * 3;
|
||||
else
|
||||
req_parent.rate = req->rate << div;
|
||||
struct clk_rate_request req_parent;
|
||||
unsigned long req_rate;
|
||||
|
||||
if (div == MASTER_PRES_MAX)
|
||||
req_rate = req->rate * 3;
|
||||
else
|
||||
req_rate = req->rate << div;
|
||||
|
||||
clk_hw_forward_rate_request(hw, req, parent, &req_parent, req_rate);
|
||||
if (__clk_determine_rate(parent, &req_parent))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -269,7 +269,6 @@ static int clk_sam9x5_peripheral_determine_rate(struct clk_hw *hw,
|
||||
{
|
||||
struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
|
||||
struct clk_hw *parent = clk_hw_get_parent(hw);
|
||||
struct clk_rate_request req_parent = *req;
|
||||
unsigned long parent_rate = clk_hw_get_rate(parent);
|
||||
unsigned long tmp_rate;
|
||||
long best_rate = LONG_MIN;
|
||||
@@ -302,8 +301,9 @@ static int clk_sam9x5_peripheral_determine_rate(struct clk_hw *hw,
|
||||
goto end;
|
||||
|
||||
for (shift = 0; shift <= PERIPHERAL_MAX_SHIFT; shift++) {
|
||||
req_parent.rate = req->rate << shift;
|
||||
struct clk_rate_request req_parent;
|
||||
|
||||
clk_hw_forward_rate_request(hw, req, parent, &req_parent, req->rate << shift);
|
||||
if (__clk_determine_rate(parent, &req_parent))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -85,10 +85,11 @@ static int clk_composite_determine_rate(struct clk_hw *hw,
|
||||
req->best_parent_hw = NULL;
|
||||
|
||||
if (clk_hw_get_flags(hw) & CLK_SET_RATE_NO_REPARENT) {
|
||||
struct clk_rate_request tmp_req = *req;
|
||||
struct clk_rate_request tmp_req;
|
||||
|
||||
parent = clk_hw_get_parent(mux_hw);
|
||||
|
||||
clk_hw_forward_rate_request(hw, req, parent, &tmp_req, req->rate);
|
||||
ret = clk_composite_determine_rate_for_parent(rate_hw,
|
||||
&tmp_req,
|
||||
parent,
|
||||
@@ -104,12 +105,13 @@ static int clk_composite_determine_rate(struct clk_hw *hw,
|
||||
}
|
||||
|
||||
for (i = 0; i < clk_hw_get_num_parents(mux_hw); i++) {
|
||||
struct clk_rate_request tmp_req = *req;
|
||||
struct clk_rate_request tmp_req;
|
||||
|
||||
parent = clk_hw_get_parent_by_index(mux_hw, i);
|
||||
if (!parent)
|
||||
continue;
|
||||
|
||||
clk_hw_forward_rate_request(hw, req, parent, &tmp_req, req->rate);
|
||||
ret = clk_composite_determine_rate_for_parent(rate_hw,
|
||||
&tmp_req,
|
||||
parent,
|
||||
|
||||
@@ -386,13 +386,13 @@ long divider_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
|
||||
const struct clk_div_table *table,
|
||||
u8 width, unsigned long flags)
|
||||
{
|
||||
struct clk_rate_request req = {
|
||||
.rate = rate,
|
||||
.best_parent_rate = *prate,
|
||||
.best_parent_hw = parent,
|
||||
};
|
||||
struct clk_rate_request req;
|
||||
int ret;
|
||||
|
||||
clk_hw_init_rate_request(hw, &req, rate);
|
||||
req.best_parent_rate = *prate;
|
||||
req.best_parent_hw = parent;
|
||||
|
||||
ret = divider_determine_rate(hw, &req, table, width, flags);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -408,13 +408,13 @@ long divider_ro_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
|
||||
const struct clk_div_table *table, u8 width,
|
||||
unsigned long flags, unsigned int val)
|
||||
{
|
||||
struct clk_rate_request req = {
|
||||
.rate = rate,
|
||||
.best_parent_rate = *prate,
|
||||
.best_parent_hw = parent,
|
||||
};
|
||||
struct clk_rate_request req;
|
||||
int ret;
|
||||
|
||||
clk_hw_init_rate_request(hw, &req, rate);
|
||||
req.best_parent_rate = *prate;
|
||||
req.best_parent_hw = parent;
|
||||
|
||||
ret = divider_ro_determine_rate(hw, &req, table, width, flags, val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -129,9 +129,18 @@ static int mtk_clk_mux_set_parent_setclr_lock(struct clk_hw *hw, u8 index)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mtk_clk_mux_determine_rate(struct clk_hw *hw,
|
||||
struct clk_rate_request *req)
|
||||
{
|
||||
struct mtk_clk_mux *mux = to_mtk_clk_mux(hw);
|
||||
|
||||
return clk_mux_determine_rate_flags(hw, req, mux->data->flags);
|
||||
}
|
||||
|
||||
const struct clk_ops mtk_mux_clr_set_upd_ops = {
|
||||
.get_parent = mtk_clk_mux_get_parent,
|
||||
.set_parent = mtk_clk_mux_set_parent_setclr_lock,
|
||||
.determine_rate = mtk_clk_mux_determine_rate,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(mtk_mux_clr_set_upd_ops);
|
||||
|
||||
@@ -141,6 +150,7 @@ const struct clk_ops mtk_mux_gate_clr_set_upd_ops = {
|
||||
.is_enabled = mtk_clk_mux_is_enabled,
|
||||
.get_parent = mtk_clk_mux_get_parent,
|
||||
.set_parent = mtk_clk_mux_set_parent_setclr_lock,
|
||||
.determine_rate = mtk_clk_mux_determine_rate,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(mtk_mux_gate_clr_set_upd_ops);
|
||||
|
||||
|
||||
@@ -915,6 +915,15 @@ static int clk_gfx3d_determine_rate(struct clk_hw *hw,
|
||||
req->best_parent_hw = p2;
|
||||
}
|
||||
|
||||
clk_hw_get_rate_range(req->best_parent_hw,
|
||||
&parent_req.min_rate, &parent_req.max_rate);
|
||||
|
||||
if (req->min_rate > parent_req.min_rate)
|
||||
parent_req.min_rate = req->min_rate;
|
||||
|
||||
if (req->max_rate < parent_req.max_rate)
|
||||
parent_req.max_rate = req->max_rate;
|
||||
|
||||
ret = __clk_determine_rate(req->best_parent_hw, &parent_req);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -2767,17 +2767,6 @@ MODULE_DEVICE_TABLE(of, gcc_msm8660_match_table);
|
||||
|
||||
static int gcc_msm8660_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret;
|
||||
struct device *dev = &pdev->dev;
|
||||
|
||||
ret = qcom_cc_register_board_clk(dev, "cxo_board", "cxo", 19200000);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = qcom_cc_register_board_clk(dev, "pxo_board", "pxo", 27000000);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return qcom_cc_probe(pdev, &gcc_msm8660_desc);
|
||||
}
|
||||
|
||||
|
||||
@@ -1166,6 +1166,7 @@ static struct tegra_clk_init_table init_table[] __initdata = {
|
||||
{ TEGRA114_CLK_I2S3_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 },
|
||||
{ TEGRA114_CLK_I2S4_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 },
|
||||
{ TEGRA114_CLK_VIMCLK_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 },
|
||||
{ TEGRA114_CLK_PWM, TEGRA114_CLK_PLL_P, 408000000, 0 },
|
||||
/* must be the last entry */
|
||||
{ TEGRA114_CLK_CLK_MAX, TEGRA114_CLK_CLK_MAX, 0, 0 },
|
||||
};
|
||||
|
||||
@@ -1330,6 +1330,7 @@ static struct tegra_clk_init_table common_init_table[] __initdata = {
|
||||
{ TEGRA124_CLK_I2S3_SYNC, TEGRA124_CLK_CLK_MAX, 24576000, 0 },
|
||||
{ TEGRA124_CLK_I2S4_SYNC, TEGRA124_CLK_CLK_MAX, 24576000, 0 },
|
||||
{ TEGRA124_CLK_VIMCLK_SYNC, TEGRA124_CLK_CLK_MAX, 24576000, 0 },
|
||||
{ TEGRA124_CLK_PWM, TEGRA124_CLK_PLL_P, 408000000, 0 },
|
||||
/* must be the last entry */
|
||||
{ TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0 },
|
||||
};
|
||||
|
||||
@@ -1044,6 +1044,7 @@ static struct tegra_clk_init_table init_table[] = {
|
||||
{ TEGRA20_CLK_GR2D, TEGRA20_CLK_PLL_C, 300000000, 0 },
|
||||
{ TEGRA20_CLK_GR3D, TEGRA20_CLK_PLL_C, 300000000, 0 },
|
||||
{ TEGRA20_CLK_VDE, TEGRA20_CLK_PLL_C, 300000000, 0 },
|
||||
{ TEGRA20_CLK_PWM, TEGRA20_CLK_PLL_P, 48000000, 0 },
|
||||
/* must be the last entry */
|
||||
{ TEGRA20_CLK_CLK_MAX, TEGRA20_CLK_CLK_MAX, 0, 0 },
|
||||
};
|
||||
|
||||
@@ -3597,6 +3597,7 @@ static struct tegra_clk_init_table init_table[] __initdata = {
|
||||
{ TEGRA210_CLK_VIMCLK_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 },
|
||||
{ TEGRA210_CLK_HDA, TEGRA210_CLK_PLL_P, 51000000, 0 },
|
||||
{ TEGRA210_CLK_HDA2CODEC_2X, TEGRA210_CLK_PLL_P, 48000000, 0 },
|
||||
{ TEGRA210_CLK_PWM, TEGRA210_CLK_PLL_P, 48000000, 0 },
|
||||
/* This MUST be the last entry. */
|
||||
{ TEGRA210_CLK_CLK_MAX, TEGRA210_CLK_CLK_MAX, 0, 0 },
|
||||
};
|
||||
|
||||
@@ -1237,6 +1237,7 @@ static struct tegra_clk_init_table init_table[] = {
|
||||
{ TEGRA30_CLK_VIMCLK_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 },
|
||||
{ TEGRA30_CLK_HDA, TEGRA30_CLK_PLL_P, 102000000, 0 },
|
||||
{ TEGRA30_CLK_HDA2CODEC_2X, TEGRA30_CLK_PLL_P, 48000000, 0 },
|
||||
{ TEGRA30_CLK_PWM, TEGRA30_CLK_PLL_P, 48000000, 0 },
|
||||
/* must be the last entry */
|
||||
{ TEGRA30_CLK_CLK_MAX, TEGRA30_CLK_CLK_MAX, 0, 0 },
|
||||
};
|
||||
|
||||
@@ -42,6 +42,8 @@ struct dentry;
|
||||
* struct clk_rate_request - Structure encoding the clk constraints that
|
||||
* a clock user might require.
|
||||
*
|
||||
* Should be initialized by calling clk_hw_init_rate_request().
|
||||
*
|
||||
* @rate: Requested clock rate. This field will be adjusted by
|
||||
* clock drivers according to hardware capabilities.
|
||||
* @min_rate: Minimum rate imposed by clk users.
|
||||
@@ -60,6 +62,15 @@ struct clk_rate_request {
|
||||
struct clk_hw *best_parent_hw;
|
||||
};
|
||||
|
||||
void clk_hw_init_rate_request(const struct clk_hw *hw,
|
||||
struct clk_rate_request *req,
|
||||
unsigned long rate);
|
||||
void clk_hw_forward_rate_request(const struct clk_hw *core,
|
||||
const struct clk_rate_request *old_req,
|
||||
const struct clk_hw *parent,
|
||||
struct clk_rate_request *req,
|
||||
unsigned long parent_rate);
|
||||
|
||||
/**
|
||||
* struct clk_duty - Struture encoding the duty cycle ratio of a clock
|
||||
*
|
||||
@@ -118,8 +129,9 @@ struct clk_duty {
|
||||
*
|
||||
* @recalc_rate Recalculate the rate of this clock, by querying hardware. The
|
||||
* parent rate is an input parameter. It is up to the caller to
|
||||
* ensure that the prepare_mutex is held across this call.
|
||||
* Returns the calculated rate. Optional, but recommended - if
|
||||
* ensure that the prepare_mutex is held across this call. If the
|
||||
* driver cannot figure out a rate for this clock, it must return
|
||||
* 0. Returns the calculated rate. Optional, but recommended - if
|
||||
* this op is not set then clock rate will be initialized to 0.
|
||||
*
|
||||
* @round_rate: Given a target rate as input, returns the closest rate actually
|
||||
@@ -1303,6 +1315,8 @@ int clk_mux_determine_rate_flags(struct clk_hw *hw,
|
||||
struct clk_rate_request *req,
|
||||
unsigned long flags);
|
||||
void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent);
|
||||
void clk_hw_get_rate_range(struct clk_hw *hw, unsigned long *min_rate,
|
||||
unsigned long *max_rate);
|
||||
void clk_hw_set_rate_range(struct clk_hw *hw, unsigned long min_rate,
|
||||
unsigned long max_rate);
|
||||
|
||||
|
||||
@@ -799,7 +799,7 @@ int clk_set_rate_exclusive(struct clk *clk, unsigned long rate);
|
||||
*
|
||||
* Returns true if @parent is a possible parent for @clk, false otherwise.
|
||||
*/
|
||||
bool clk_has_parent(struct clk *clk, struct clk *parent);
|
||||
bool clk_has_parent(const struct clk *clk, const struct clk *parent);
|
||||
|
||||
/**
|
||||
* clk_set_rate_range - set a rate range for a clock source
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#ifndef AT91_PMC_H
|
||||
#define AT91_PMC_H
|
||||
|
||||
#include <linux/bits.h>
|
||||
|
||||
#define AT91_PMC_V1 (1) /* PMC version 1 */
|
||||
#define AT91_PMC_V2 (2) /* PMC version 2 [SAM9X60] */
|
||||
|
||||
@@ -45,8 +47,8 @@
|
||||
#define AT91_PMC_PCSR 0x18 /* Peripheral Clock Status Register */
|
||||
|
||||
#define AT91_PMC_PLL_ACR 0x18 /* PLL Analog Control Register [for SAM9X60] */
|
||||
#define AT91_PMC_PLL_ACR_DEFAULT_UPLL 0x12020010UL /* Default PLL ACR value for UPLL */
|
||||
#define AT91_PMC_PLL_ACR_DEFAULT_PLLA 0x00020010UL /* Default PLL ACR value for PLLA */
|
||||
#define AT91_PMC_PLL_ACR_DEFAULT_UPLL UL(0x12020010) /* Default PLL ACR value for UPLL */
|
||||
#define AT91_PMC_PLL_ACR_DEFAULT_PLLA UL(0x00020010) /* Default PLL ACR value for PLLA */
|
||||
#define AT91_PMC_PLL_ACR_UTMIVR (1 << 12) /* UPLL Voltage regulator Control */
|
||||
#define AT91_PMC_PLL_ACR_UTMIBG (1 << 13) /* UPLL Bandgap Control */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user