File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Documentation/devicetree/bindings/serio Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,14 @@ Required properties:
4
4
- compatible : "olpc,ap-sp"
5
5
- reg : base address and length of SoC's WTM registers
6
6
- interrupts : SP-AP interrupt
7
+ - clocks : phandle + clock-specifier for the clock that drives the WTM
8
+ - clock-names: should be "sp"
7
9
8
10
Example:
9
11
ap-sp@d4290000 {
10
12
compatible = "olpc,ap-sp";
11
13
reg = <0xd4290000 0x1000>;
12
14
interrupts = <40>;
15
+ clocks = <&soc_clocks MMP2_CLK_SP>;
16
+ clock-names = "sp";
13
17
}
Original file line number Diff line number Diff line change 23
23
#include <linux/of.h>
24
24
#include <linux/slab.h>
25
25
#include <linux/delay.h>
26
+ #include <linux/clk.h>
26
27
27
28
/*
28
29
* The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller.
@@ -74,6 +75,7 @@ struct olpc_apsp {
74
75
struct serio * kbio ;
75
76
struct serio * padio ;
76
77
void __iomem * base ;
78
+ struct clk * clk ;
77
79
int open_count ;
78
80
int irq ;
79
81
};
@@ -146,11 +148,17 @@ static int olpc_apsp_open(struct serio *port)
146
148
struct olpc_apsp * priv = port -> port_data ;
147
149
unsigned int tmp ;
148
150
unsigned long l ;
151
+ int error ;
149
152
150
153
if (priv -> open_count ++ == 0 ) {
154
+ error = clk_prepare_enable (priv -> clk );
155
+ if (error )
156
+ return error ;
157
+
151
158
l = readl (priv -> base + COMMAND_FIFO_STATUS );
152
159
if (!(l & CMD_STS_MASK )) {
153
160
dev_err (priv -> dev , "SP cannot accept commands.\n" );
161
+ clk_disable_unprepare (priv -> clk );
154
162
return - EIO ;
155
163
}
156
164
@@ -171,6 +179,8 @@ static void olpc_apsp_close(struct serio *port)
171
179
/* Disable interrupt 0 */
172
180
tmp = readl (priv -> base + PJ_INTERRUPT_MASK );
173
181
writel (tmp | INT_0 , priv -> base + PJ_INTERRUPT_MASK );
182
+
183
+ clk_disable_unprepare (priv -> clk );
174
184
}
175
185
}
176
186
@@ -198,6 +208,10 @@ static int olpc_apsp_probe(struct platform_device *pdev)
198
208
if (priv -> irq < 0 )
199
209
return priv -> irq ;
200
210
211
+ priv -> clk = devm_clk_get (& pdev -> dev , "sp" );
212
+ if (IS_ERR (priv -> clk ))
213
+ return PTR_ERR (priv -> clk );
214
+
201
215
/* KEYBOARD */
202
216
kb_serio = kzalloc (sizeof (struct serio ), GFP_KERNEL );
203
217
if (!kb_serio )
You can’t perform that action at this time.
0 commit comments