summaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk-u300.c
diff options
context:
space:
mode:
authorStephen Boyd <stephen.boyd@linaro.org>2016-06-01 16:15:31 -0700
committerStephen Boyd <sboyd@codeaurora.org>2016-06-30 12:26:18 -0700
commitfb2cd7d07ae0146db95b68c4c31b2d96cd0e9575 (patch)
tree18ec4e14ca6c34e3e65e9841dbef170838cc7222 /drivers/clk/clk-u300.c
parent7b38d1b222b42cfed197290332a8e426fb77e8fe (diff)
downloadlinux-fb2cd7d07ae0146db95b68c4c31b2d96cd0e9575.tar.bz2
clk: u300: Migrate to clk_hw based registration APIs
Now that we have clk_hw based provider APIs to register clks, we can get rid of struct clk pointers while registering clks in these drivers, allowing us to move closer to a clear split of consumer and provider clk APIs. Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/clk-u300.c')
-rw-r--r--drivers/clk/clk-u300.c59
1 files changed, 33 insertions, 26 deletions
diff --git a/drivers/clk/clk-u300.c b/drivers/clk/clk-u300.c
index 95d1742dac30..ec8aafda6e24 100644
--- a/drivers/clk/clk-u300.c
+++ b/drivers/clk/clk-u300.c
@@ -689,7 +689,7 @@ static const struct clk_ops syscon_clk_ops = {
.set_rate = syscon_clk_set_rate,
};
-static struct clk * __init
+static struct clk_hw * __init
syscon_clk_register(struct device *dev, const char *name,
const char *parent_name, unsigned long flags,
bool hw_ctrld,
@@ -697,9 +697,10 @@ syscon_clk_register(struct device *dev, const char *name,
void __iomem *en_reg, u8 en_bit,
u16 clk_val)
{
- struct clk *clk;
+ struct clk_hw *hw;
struct clk_syscon *sclk;
struct clk_init_data init;
+ int ret;
sclk = kzalloc(sizeof(struct clk_syscon), GFP_KERNEL);
if (!sclk) {
@@ -722,11 +723,14 @@ syscon_clk_register(struct device *dev, const char *name,
sclk->en_bit = en_bit;
sclk->clk_val = clk_val;
- clk = clk_register(dev, &sclk->hw);
- if (IS_ERR(clk))
+ hw = &sclk->hw;
+ ret = clk_hw_register(dev, hw);
+ if (ret) {
kfree(sclk);
+ hw = ERR_PTR(ret);
+ }
- return clk;
+ return hw;
}
#define U300_CLK_TYPE_SLOW 0
@@ -868,7 +872,7 @@ static struct u300_clock const u300_clk_lookup[] __initconst = {
static void __init of_u300_syscon_clk_init(struct device_node *np)
{
- struct clk *clk = ERR_PTR(-EINVAL);
+ struct clk_hw *hw = ERR_PTR(-EINVAL);
const char *clk_name = np->name;
const char *parent_name;
void __iomem *res_reg;
@@ -911,16 +915,15 @@ static void __init of_u300_syscon_clk_init(struct device_node *np)
const struct u300_clock *u3clk = &u300_clk_lookup[i];
if (u3clk->type == clk_type && u3clk->id == clk_id)
- clk = syscon_clk_register(NULL,
- clk_name, parent_name,
- 0, u3clk->hw_ctrld,
- res_reg, u3clk->id,
- en_reg, u3clk->id,
- u3clk->clk_val);
+ hw = syscon_clk_register(NULL, clk_name, parent_name,
+ 0, u3clk->hw_ctrld,
+ res_reg, u3clk->id,
+ en_reg, u3clk->id,
+ u3clk->clk_val);
}
- if (!IS_ERR(clk)) {
- of_clk_add_provider(np, of_clk_src_simple_get, clk);
+ if (!IS_ERR(hw)) {
+ of_clk_add_hw_provider(np, of_clk_hw_simple_get, hw);
/*
* Some few system clocks - device tree does not
@@ -928,11 +931,11 @@ static void __init of_u300_syscon_clk_init(struct device_node *np)
* for now we add these three clocks here.
*/
if (clk_type == U300_CLK_TYPE_REST && clk_id == 5)
- clk_register_clkdev(clk, NULL, "pl172");
+ clk_hw_register_clkdev(hw, NULL, "pl172");
if (clk_type == U300_CLK_TYPE_REST && clk_id == 9)
- clk_register_clkdev(clk, NULL, "semi");
+ clk_hw_register_clkdev(hw, NULL, "semi");
if (clk_type == U300_CLK_TYPE_REST && clk_id == 12)
- clk_register_clkdev(clk, NULL, "intcon");
+ clk_hw_register_clkdev(hw, NULL, "intcon");
}
}
@@ -1111,13 +1114,14 @@ static const struct clk_ops mclk_ops = {
.set_rate = mclk_clk_set_rate,
};
-static struct clk * __init
+static struct clk_hw * __init
mclk_clk_register(struct device *dev, const char *name,
const char *parent_name, bool is_mspro)
{
- struct clk *clk;
+ struct clk_hw *hw;
struct clk_mclk *mclk;
struct clk_init_data init;
+ int ret;
mclk = kzalloc(sizeof(struct clk_mclk), GFP_KERNEL);
if (!mclk) {
@@ -1133,23 +1137,26 @@ mclk_clk_register(struct device *dev, const char *name,
mclk->hw.init = &init;
mclk->is_mspro = is_mspro;
- clk = clk_register(dev, &mclk->hw);
- if (IS_ERR(clk))
+ hw = &mclk->hw;
+ ret = clk_hw_register(dev, hw);
+ if (ret) {
kfree(mclk);
+ hw = ERR_PTR(ret);
+ }
- return clk;
+ return hw;
}
static void __init of_u300_syscon_mclk_init(struct device_node *np)
{
- struct clk *clk = ERR_PTR(-EINVAL);
+ struct clk_hw *hw;
const char *clk_name = np->name;
const char *parent_name;
parent_name = of_clk_get_parent_name(np, 0);
- clk = mclk_clk_register(NULL, clk_name, parent_name, false);
- if (!IS_ERR(clk))
- of_clk_add_provider(np, of_clk_src_simple_get, clk);
+ hw = mclk_clk_register(NULL, clk_name, parent_name, false);
+ if (!IS_ERR(hw))
+ of_clk_add_hw_provider(np, of_clk_hw_simple_get, hw);
}
static const struct of_device_id u300_clk_match[] __initconst = {