Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 365309
b: refs/heads/master
c: 38e4aa0
h: refs/heads/master
i:
  365307: cc6af80
v: v3
  • Loading branch information
Emilio López authored and Mike Turquette committed Apr 12, 2013
1 parent a4c580a commit 8466f00
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f363e215931ecc8077b6f6ee6d39d9ffaf1c3bd0
refs/heads/master: 38e4aa00975cf37afd63d7cd1cefd754dcf66e07
33 changes: 26 additions & 7 deletions trunk/drivers/clk/sunxi/clk-sunxi.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,36 @@ static DEFINE_SPINLOCK(clk_lock);
static void __init sunxi_osc_clk_setup(struct device_node *node)
{
struct clk *clk;
struct clk_fixed_rate *fixed;
struct clk_gate *gate;
const char *clk_name = node->name;
const char *parent;
void *reg;
u32 rate;

reg = of_iomap(node, 0);
/* allocate fixed-rate and gate clock structs */
fixed = kzalloc(sizeof(struct clk_fixed_rate), GFP_KERNEL);
if (!fixed)
return;
gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL);
if (!gate) {
kfree(fixed);
return;
}

parent = of_clk_get_parent_name(node, 0);
if (of_property_read_u32(node, "clock-frequency", &rate))
return;

/* set up gate and fixed rate properties */
gate->reg = of_iomap(node, 0);
gate->bit_idx = SUNXI_OSC24M_GATE;
gate->lock = &clk_lock;
fixed->fixed_rate = rate;

clk = clk_register_gate(NULL, clk_name, parent, 0, reg,
SUNXI_OSC24M_GATE, 0, &clk_lock);
clk = clk_register_composite(NULL, clk_name,
NULL, 0,
NULL, NULL,
&fixed->hw, &clk_fixed_rate_ops,
&gate->hw, &clk_gate_ops,
CLK_IS_ROOT);

if (clk) {
of_clk_add_provider(node, of_clk_src_simple_get, clk);
Expand Down Expand Up @@ -380,7 +400,6 @@ static void __init sunxi_gates_clk_setup(struct device_node *node,

/* Matches for of_clk_init */
static const __initconst struct of_device_id clk_match[] = {
{.compatible = "fixed-clock", .data = of_fixed_clk_setup,},
{.compatible = "allwinner,sun4i-osc-clk", .data = sunxi_osc_clk_setup,},
{}
};
Expand Down

0 comments on commit 8466f00

Please sign in to comment.