diff options
author | Emilio López <emilio@elopez.com.ar> | 2014-07-18 14:49:37 -0400 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2015-10-21 15:51:28 -0400 |
commit | e2771545f49fbfec874642533058a3423fa29e16 (patch) | |
tree | 13d88512ab374afa387804554ca87de90ff6c1be | |
parent | eb662f854710e6a438789a4b0d1d0cce8c12379d (diff) |
clk: sunxi: codec clock support
The codec clock on sun4i, sun5i and sun7i is a simple gate with PLL2 as
parent. Add a driver for such a clock.
Signed-off-by: Emilio López <emilio@elopez.com.ar>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
-rw-r--r-- | drivers/clk/sunxi/Makefile | 1 | ||||
-rw-r--r-- | drivers/clk/sunxi/clk-a10-codec.c | 44 |
2 files changed, 45 insertions, 0 deletions
diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile index c658a18ba7cb..70a449a419e6 100644 --- a/drivers/clk/sunxi/Makefile +++ b/drivers/clk/sunxi/Makefile | |||
@@ -3,6 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += clk-sunxi.o clk-factors.o | 5 | obj-y += clk-sunxi.o clk-factors.o |
6 | obj-y += clk-a10-codec.o | ||
6 | obj-y += clk-a10-hosc.o | 7 | obj-y += clk-a10-hosc.o |
7 | obj-y += clk-a10-pll2.o | 8 | obj-y += clk-a10-pll2.o |
8 | obj-y += clk-a20-gmac.o | 9 | obj-y += clk-a20-gmac.o |
diff --git a/drivers/clk/sunxi/clk-a10-codec.c b/drivers/clk/sunxi/clk-a10-codec.c new file mode 100644 index 000000000000..ac321d6a0df5 --- /dev/null +++ b/drivers/clk/sunxi/clk-a10-codec.c | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Copyright 2013 Emilio López | ||
3 | * | ||
4 | * Emilio López <emilio@elopez.com.ar> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | */ | ||
16 | |||
17 | #include <linux/clk-provider.h> | ||
18 | #include <linux/of.h> | ||
19 | #include <linux/of_address.h> | ||
20 | |||
21 | #define SUN4I_CODEC_GATE 31 | ||
22 | |||
23 | static void __init sun4i_codec_clk_setup(struct device_node *node) | ||
24 | { | ||
25 | struct clk *clk; | ||
26 | const char *clk_name = node->name, *parent_name; | ||
27 | void __iomem *reg; | ||
28 | |||
29 | reg = of_io_request_and_map(node, 0, of_node_full_name(node)); | ||
30 | if (IS_ERR(reg)) | ||
31 | return; | ||
32 | |||
33 | of_property_read_string(node, "clock-output-names", &clk_name); | ||
34 | parent_name = of_clk_get_parent_name(node, 0); | ||
35 | |||
36 | clk = clk_register_gate(NULL, clk_name, parent_name, | ||
37 | CLK_SET_RATE_PARENT, reg, | ||
38 | SUN4I_CODEC_GATE, 0, NULL); | ||
39 | |||
40 | if (!IS_ERR(clk)) | ||
41 | of_clk_add_provider(node, of_clk_src_simple_get, clk); | ||
42 | } | ||
43 | CLK_OF_DECLARE(sun4i_codec, "allwinner,sun4i-a10-codec-clk", | ||
44 | sun4i_codec_clk_setup); | ||