Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6475e29 authored by Stephen Boyd's avatar Stephen Boyd Committed by Stephen Boyd
Browse files

clk: berlin: Migrate to clk_hw based registration and OF 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. We also remove some __init
markings in header files as they're useless and we're in the
area.

Tested-by: default avatarJisheng Zhang <jszhang@marvell.com>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: default avatarSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: default avatarStephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 57c4a2ac
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -188,7 +188,7 @@ static const struct clk_ops berlin2_avpll_vco_ops = {
	.recalc_rate	= berlin2_avpll_vco_recalc_rate,
	.recalc_rate	= berlin2_avpll_vco_recalc_rate,
};
};


struct clk * __init berlin2_avpll_vco_register(void __iomem *base,
int __init berlin2_avpll_vco_register(void __iomem *base,
			       const char *name, const char *parent_name,
			       const char *name, const char *parent_name,
			       u8 vco_flags, unsigned long flags)
			       u8 vco_flags, unsigned long flags)
{
{
@@ -197,7 +197,7 @@ struct clk * __init berlin2_avpll_vco_register(void __iomem *base,


	vco = kzalloc(sizeof(*vco), GFP_KERNEL);
	vco = kzalloc(sizeof(*vco), GFP_KERNEL);
	if (!vco)
	if (!vco)
		return ERR_PTR(-ENOMEM);
		return -ENOMEM;


	vco->base = base;
	vco->base = base;
	vco->flags = vco_flags;
	vco->flags = vco_flags;
@@ -208,7 +208,7 @@ struct clk * __init berlin2_avpll_vco_register(void __iomem *base,
	init.num_parents = 1;
	init.num_parents = 1;
	init.flags = flags;
	init.flags = flags;


	return clk_register(NULL, &vco->hw);
	return clk_hw_register(NULL, &vco->hw);
}
}


struct berlin2_avpll_channel {
struct berlin2_avpll_channel {
@@ -364,7 +364,7 @@ static const struct clk_ops berlin2_avpll_channel_ops = {
 */
 */
static const u8 quirk_index[] __initconst = { 0, 6, 5, 4, 3, 2, 1, 7 };
static const u8 quirk_index[] __initconst = { 0, 6, 5, 4, 3, 2, 1, 7 };


struct clk * __init berlin2_avpll_channel_register(void __iomem *base,
int __init berlin2_avpll_channel_register(void __iomem *base,
			   const char *name, u8 index, const char *parent_name,
			   const char *name, u8 index, const char *parent_name,
			   u8 ch_flags, unsigned long flags)
			   u8 ch_flags, unsigned long flags)
{
{
@@ -373,7 +373,7 @@ struct clk * __init berlin2_avpll_channel_register(void __iomem *base,


	ch = kzalloc(sizeof(*ch), GFP_KERNEL);
	ch = kzalloc(sizeof(*ch), GFP_KERNEL);
	if (!ch)
	if (!ch)
		return ERR_PTR(-ENOMEM);
		return -ENOMEM;


	ch->base = base;
	ch->base = base;
	if (ch_flags & BERLIN2_AVPLL_SCRAMBLE_QUIRK)
	if (ch_flags & BERLIN2_AVPLL_SCRAMBLE_QUIRK)
@@ -389,5 +389,5 @@ struct clk * __init berlin2_avpll_channel_register(void __iomem *base,
	init.num_parents = 1;
	init.num_parents = 1;
	init.flags = flags;
	init.flags = flags;


	return clk_register(NULL, &ch->hw);
	return clk_hw_register(NULL, &ch->hw);
}
}
+2 −6
Original line number Original line Diff line number Diff line
@@ -19,17 +19,13 @@
#ifndef __BERLIN2_AVPLL_H
#ifndef __BERLIN2_AVPLL_H
#define __BERLIN2_AVPLL_H
#define __BERLIN2_AVPLL_H


struct clk;

#define BERLIN2_AVPLL_BIT_QUIRK		BIT(0)
#define BERLIN2_AVPLL_BIT_QUIRK		BIT(0)
#define BERLIN2_AVPLL_SCRAMBLE_QUIRK	BIT(1)
#define BERLIN2_AVPLL_SCRAMBLE_QUIRK	BIT(1)


struct clk * __init
int berlin2_avpll_vco_register(void __iomem *base, const char *name,
berlin2_avpll_vco_register(void __iomem *base, const char *name,
	   const char *parent_name, u8 vco_flags, unsigned long flags);
	   const char *parent_name, u8 vco_flags, unsigned long flags);


struct clk * __init
int berlin2_avpll_channel_register(void __iomem *base, const char *name,
berlin2_avpll_channel_register(void __iomem *base, const char *name,
		       u8 index, const char *parent_name, u8 ch_flags,
		       u8 index, const char *parent_name, u8 ch_flags,
		       unsigned long flags);
		       unsigned long flags);


+2 −2
Original line number Original line Diff line number Diff line
@@ -234,7 +234,7 @@ static const struct clk_ops berlin2_div_mux_ops = {
	.get_parent	= berlin2_div_get_parent,
	.get_parent	= berlin2_div_get_parent,
};
};


struct clk * __init
struct clk_hw * __init
berlin2_div_register(const struct berlin2_div_map *map,
berlin2_div_register(const struct berlin2_div_map *map,
		     void __iomem *base, const char *name, u8 div_flags,
		     void __iomem *base, const char *name, u8 div_flags,
		     const char **parent_names, int num_parents,
		     const char **parent_names, int num_parents,
@@ -259,7 +259,7 @@ berlin2_div_register(const struct berlin2_div_map *map,
	if ((div_flags & BERLIN2_DIV_HAS_MUX) == 0)
	if ((div_flags & BERLIN2_DIV_HAS_MUX) == 0)
		mux_ops = NULL;
		mux_ops = NULL;


	return clk_register_composite(NULL, name, parent_names, num_parents,
	return clk_hw_register_composite(NULL, name, parent_names, num_parents,
				      &div->hw, mux_ops, &div->hw, rate_ops,
				      &div->hw, mux_ops, &div->hw, rate_ops,
				      &div->hw, gate_ops, flags);
				      &div->hw, gate_ops, flags);
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -19,7 +19,7 @@
#ifndef __BERLIN2_DIV_H
#ifndef __BERLIN2_DIV_H
#define __BERLIN2_DIV_H
#define __BERLIN2_DIV_H


struct clk;
struct clk_hw;


#define BERLIN2_DIV_HAS_GATE		BIT(0)
#define BERLIN2_DIV_HAS_GATE		BIT(0)
#define BERLIN2_DIV_HAS_MUX		BIT(1)
#define BERLIN2_DIV_HAS_MUX		BIT(1)
@@ -80,7 +80,7 @@ struct berlin2_div_data {
	u8 div_flags;
	u8 div_flags;
};
};


struct clk * __init
struct clk_hw *
berlin2_div_register(const struct berlin2_div_map *map,
berlin2_div_register(const struct berlin2_div_map *map,
	     void __iomem *base,  const char *name, u8 div_flags,
	     void __iomem *base,  const char *name, u8 div_flags,
	     const char **parent_names, int num_parents,
	     const char **parent_names, int num_parents,
+3 −3
Original line number Original line Diff line number Diff line
@@ -84,7 +84,7 @@ static const struct clk_ops berlin2_pll_ops = {
	.recalc_rate	= berlin2_pll_recalc_rate,
	.recalc_rate	= berlin2_pll_recalc_rate,
};
};


struct clk * __init
int __init
berlin2_pll_register(const struct berlin2_pll_map *map,
berlin2_pll_register(const struct berlin2_pll_map *map,
		     void __iomem *base, const char *name,
		     void __iomem *base, const char *name,
		     const char *parent_name, unsigned long flags)
		     const char *parent_name, unsigned long flags)
@@ -94,7 +94,7 @@ berlin2_pll_register(const struct berlin2_pll_map *map,


	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
	if (!pll)
	if (!pll)
		return ERR_PTR(-ENOMEM);
		return -ENOMEM;


	/* copy pll_map to allow __initconst */
	/* copy pll_map to allow __initconst */
	memcpy(&pll->map, map, sizeof(*map));
	memcpy(&pll->map, map, sizeof(*map));
@@ -106,5 +106,5 @@ berlin2_pll_register(const struct berlin2_pll_map *map,
	init.num_parents = 1;
	init.num_parents = 1;
	init.flags = flags;
	init.flags = flags;


	return clk_register(NULL, &pll->hw);
	return clk_hw_register(NULL, &pll->hw);
}
}
Loading