Commit 14dd5b01 authored by Robert Jarzmik's avatar Robert Jarzmik Committed by Michael Turquette

clk: pxa: declare init function and data __init

As the clock descriptions are constant and only usefull at init time,
mark them as such by :
 - spliting clock description (desc) and clock private data (dynamic)
 - mark __initdata clock descriptions

This makes all the register and descriptions of the clocks to go after
kernel init phase.
Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: default avatarMichael Turquette <mturquette@linaro.org>
parent fe7710fa
...@@ -26,12 +26,20 @@ static struct clk_onecell_data onecell_data = { ...@@ -26,12 +26,20 @@ static struct clk_onecell_data onecell_data = {
.clk_num = CLK_MAX, .clk_num = CLK_MAX,
}; };
#define to_pxa_clk(_hw) container_of(_hw, struct pxa_clk_cken, hw) struct pxa_clk {
struct clk_hw hw;
struct clk_fixed_factor lp;
struct clk_fixed_factor hp;
struct clk_gate gate;
bool (*is_in_low_power)(void);
};
#define to_pxa_clk(_hw) container_of(_hw, struct pxa_clk, hw)
static unsigned long cken_recalc_rate(struct clk_hw *hw, static unsigned long cken_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) unsigned long parent_rate)
{ {
struct pxa_clk_cken *pclk = to_pxa_clk(hw); struct pxa_clk *pclk = to_pxa_clk(hw);
struct clk_fixed_factor *fix; struct clk_fixed_factor *fix;
if (!pclk->is_in_low_power || pclk->is_in_low_power()) if (!pclk->is_in_low_power || pclk->is_in_low_power())
...@@ -48,7 +56,7 @@ static struct clk_ops cken_rate_ops = { ...@@ -48,7 +56,7 @@ static struct clk_ops cken_rate_ops = {
static u8 cken_get_parent(struct clk_hw *hw) static u8 cken_get_parent(struct clk_hw *hw)
{ {
struct pxa_clk_cken *pclk = to_pxa_clk(hw); struct pxa_clk *pclk = to_pxa_clk(hw);
if (!pclk->is_in_low_power) if (!pclk->is_in_low_power)
return 0; return 0;
...@@ -69,23 +77,27 @@ void __init clkdev_pxa_register(int ckid, const char *con_id, ...@@ -69,23 +77,27 @@ void __init clkdev_pxa_register(int ckid, const char *con_id,
clk_register_clkdev(clk, con_id, dev_id); clk_register_clkdev(clk, con_id, dev_id);
} }
int __init clk_pxa_cken_init(struct pxa_clk_cken *clks, int nb_clks) int __init clk_pxa_cken_init(const struct desc_clk_cken *clks, int nb_clks)
{ {
int i; int i;
struct pxa_clk_cken *pclk; struct pxa_clk *pxa_clk;
struct clk *clk; struct clk *clk;
for (i = 0; i < nb_clks; i++) { for (i = 0; i < nb_clks; i++) {
pclk = clks + i; pxa_clk = kzalloc(sizeof(*pxa_clk), GFP_KERNEL);
pclk->gate.lock = &lock; pxa_clk->is_in_low_power = clks[i].is_in_low_power;
clk = clk_register_composite(NULL, pclk->name, pxa_clk->lp = clks[i].lp;
pclk->parent_names, 2, pxa_clk->hp = clks[i].hp;
&pclk->hw, &cken_mux_ops, pxa_clk->gate = clks[i].gate;
&pclk->hw, &cken_rate_ops, pxa_clk->gate.lock = &lock;
&pclk->gate.hw, &clk_gate_ops, clk = clk_register_composite(NULL, clks[i].name,
pclk->flags); clks[i].parent_names, 2,
clkdev_pxa_register(pclk->ckid, pclk->con_id, pclk->dev_id, &pxa_clk->hw, &cken_mux_ops,
clk); &pxa_clk->hw, &cken_rate_ops,
&pxa_clk->gate.hw, &clk_gate_ops,
clks[i].flags);
clkdev_pxa_register(clks[i].ckid, clks[i].con_id,
clks[i].dev_id, clk);
} }
return 0; return 0;
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
static struct clk_ops name ## _rate_ops = { \ static struct clk_ops name ## _rate_ops = { \
.recalc_rate = name ## _get_rate, \ .recalc_rate = name ## _get_rate, \
}; \ }; \
static struct clk *clk_register_ ## name(void) \ static struct clk * __init clk_register_ ## name(void) \
{ \ { \
return clk_register_composite(NULL, clk_name, \ return clk_register_composite(NULL, clk_name, \
name ## _parents, \ name ## _parents, \
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
static struct clk_ops name ## _rate_ops = { \ static struct clk_ops name ## _rate_ops = { \
.recalc_rate = name ## _get_rate, \ .recalc_rate = name ## _get_rate, \
}; \ }; \
static struct clk *clk_register_ ## name(void) \ static struct clk * __init clk_register_ ## name(void) \
{ \ { \
return clk_register_composite(NULL, clk_name, \ return clk_register_composite(NULL, clk_name, \
name ## _parents, \ name ## _parents, \
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
* | Clock | --- | / div_hp | * | Clock | --- | / div_hp |
* +------------+ +-----------+ * +------------+ +-----------+
*/ */
struct pxa_clk_cken { struct desc_clk_cken {
struct clk_hw hw; struct clk_hw hw;
int ckid; int ckid;
const char *name; const char *name;
...@@ -102,6 +102,6 @@ static int dummy_clk_set_parent(struct clk_hw *hw, u8 index) ...@@ -102,6 +102,6 @@ static int dummy_clk_set_parent(struct clk_hw *hw, u8 index)
extern void clkdev_pxa_register(int ckid, const char *con_id, extern void clkdev_pxa_register(int ckid, const char *con_id,
const char *dev_id, struct clk *clk); const char *dev_id, struct clk *clk);
extern int clk_pxa_cken_init(struct pxa_clk_cken *clks, int nb_clks); extern int clk_pxa_cken_init(const struct desc_clk_cken *clks, int nb_clks);
#endif #endif
...@@ -111,7 +111,7 @@ PARENTS(pxa27x_membus) = { "lcd_base", "lcd_base" }; ...@@ -111,7 +111,7 @@ PARENTS(pxa27x_membus) = { "lcd_base", "lcd_base" };
PXA_CKEN_1RATE(dev_id, con_id, bit, parents, \ PXA_CKEN_1RATE(dev_id, con_id, bit, parents, \
&CKEN, CKEN_ ## bit, CLK_IGNORE_UNUSED) &CKEN, CKEN_ ## bit, CLK_IGNORE_UNUSED)
static struct pxa_clk_cken pxa27x_clocks[] = { static struct desc_clk_cken pxa27x_clocks[] __initdata = {
PXA27X_PBUS_CKEN("pxa2xx-uart.0", NULL, FFUART, 2, 42, 1), PXA27X_PBUS_CKEN("pxa2xx-uart.0", NULL, FFUART, 2, 42, 1),
PXA27X_PBUS_CKEN("pxa2xx-uart.1", NULL, BTUART, 2, 42, 1), PXA27X_PBUS_CKEN("pxa2xx-uart.1", NULL, BTUART, 2, 42, 1),
PXA27X_PBUS_CKEN("pxa2xx-uart.2", NULL, STUART, 2, 42, 1), PXA27X_PBUS_CKEN("pxa2xx-uart.2", NULL, STUART, 2, 42, 1),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment