12 #include <linux/kernel.h>
17 #include <linux/slab.h>
22 #define APBC_APBCLK (1 << 0)
23 #define APBC_FNCLK (1 << 1)
24 #define APBC_RST (1 << 2)
25 #define APBC_POWER (1 << 7)
27 #define to_clk_apbc(hw) container_of(hw, struct clk_apbc, hw)
36 static int clk_apbc_prepare(
struct clk_hw *
hw)
40 unsigned long flags = 0;
53 writel_relaxed(data, apbc->
base);
56 spin_unlock_irqrestore(apbc->
lock, flags);
65 writel_relaxed(data, apbc->
base);
68 spin_unlock_irqrestore(apbc->
lock, flags);
78 writel_relaxed(data, apbc->
base);
81 spin_unlock_irqrestore(apbc->
lock, flags);
87 static void clk_apbc_unprepare(
struct clk_hw *
hw)
91 unsigned long flags = 0;
100 writel_relaxed(data, apbc->
base);
103 spin_unlock_irqrestore(apbc->
lock, flags);
112 writel_relaxed(data, apbc->
base);
115 spin_unlock_irqrestore(apbc->
lock, flags);
119 .prepare = clk_apbc_prepare,
120 .unprepare = clk_apbc_unprepare,
129 struct clk_init_data init;
137 init.flags = CLK_SET_RATE_PARENT;
138 init.parent_names = (parent_name ? &parent_name :
NULL);
139 init.num_parents = (parent_name ? 1 : 0);
143 apbc->flags = apbc_flags;
145 apbc->hw.init = &
init;