diff options
author | Haojian Zhuang <haojian.zhuang@linaro.org> | 2013-12-24 04:33:54 -0500 |
---|---|---|
committer | Haojian Zhuang <haojian.zhuang@gmail.com> | 2014-03-19 03:23:53 -0400 |
commit | d3e6573c48f4472147b37e92cb345271e04d34d9 (patch) | |
tree | 6c99ed07c18a9c70df35521222fc1fe384495378 | |
parent | 16d1c8991cd6f25083ec43c15bed7ae30fbbe41e (diff) |
clk: hip04: add clock driver
Now only fixed rate clocks are appended into the clock driver.
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
-rw-r--r-- | drivers/clk/Makefile | 1 | ||||
-rw-r--r-- | drivers/clk/hisilicon/Makefile | 5 | ||||
-rw-r--r-- | drivers/clk/hisilicon/clk-hip04.c | 54 | ||||
-rw-r--r-- | include/dt-bindings/clock/hip04-clock.h | 35 |
4 files changed, 94 insertions, 1 deletions
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index a367a9831717..5134a79be320 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile | |||
@@ -30,6 +30,7 @@ obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o | |||
30 | obj-$(CONFIG_COMMON_CLK_XGENE) += clk-xgene.o | 30 | obj-$(CONFIG_COMMON_CLK_XGENE) += clk-xgene.o |
31 | obj-$(CONFIG_COMMON_CLK_AT91) += at91/ | 31 | obj-$(CONFIG_COMMON_CLK_AT91) += at91/ |
32 | obj-$(CONFIG_ARCH_HI3xxx) += hisilicon/ | 32 | obj-$(CONFIG_ARCH_HI3xxx) += hisilicon/ |
33 | obj-$(CONFIG_ARCH_HIP04) += hisilicon/ | ||
33 | obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/ | 34 | obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/ |
34 | ifeq ($(CONFIG_COMMON_CLK), y) | 35 | ifeq ($(CONFIG_COMMON_CLK), y) |
35 | obj-$(CONFIG_ARCH_MMP) += mmp/ | 36 | obj-$(CONFIG_ARCH_MMP) += mmp/ |
diff --git a/drivers/clk/hisilicon/Makefile b/drivers/clk/hisilicon/Makefile index a049108341fc..40b33c6a8257 100644 --- a/drivers/clk/hisilicon/Makefile +++ b/drivers/clk/hisilicon/Makefile | |||
@@ -2,4 +2,7 @@ | |||
2 | # Hisilicon Clock specific Makefile | 2 | # Hisilicon Clock specific Makefile |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += clk.o clkgate-separated.o clk-hi3620.o | 5 | obj-y += clk.o clkgate-separated.o |
6 | |||
7 | obj-$(CONFIG_ARCH_HI3xxx) += clk-hi3620.o | ||
8 | obj-$(CONFIG_ARCH_HIP04) += clk-hip04.o | ||
diff --git a/drivers/clk/hisilicon/clk-hip04.c b/drivers/clk/hisilicon/clk-hip04.c new file mode 100644 index 000000000000..bdc6cd05f4ca --- /dev/null +++ b/drivers/clk/hisilicon/clk-hip04.c | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * Hisilicon HiP04 clock driver | ||
3 | * | ||
4 | * Copyright (c) 2013-2014 Hisilicon Limited. | ||
5 | * Copyright (c) 2013-2014 Linaro Limited. | ||
6 | * | ||
7 | * Author: Haojian Zhuang <haojian.zhuang@linaro.org> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License along | ||
20 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
21 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/clk-provider.h> | ||
27 | #include <linux/clkdev.h> | ||
28 | #include <linux/io.h> | ||
29 | #include <linux/of.h> | ||
30 | #include <linux/of_address.h> | ||
31 | #include <linux/of_device.h> | ||
32 | #include <linux/slab.h> | ||
33 | #include <linux/clk.h> | ||
34 | |||
35 | #include <dt-bindings/clock/hip04-clock.h> | ||
36 | |||
37 | #include "clk.h" | ||
38 | |||
39 | /* fixed rate clocks */ | ||
40 | static struct hisi_fixed_rate_clock hip04_fixed_rate_clks[] __initdata = { | ||
41 | { HIP04_OSC50M, "osc50m", NULL, CLK_IS_ROOT, 50000000, }, | ||
42 | { HIP04_CLK_50M, "clk50m", NULL, CLK_IS_ROOT, 50000000, }, | ||
43 | { HIP04_CLK_168M, "clk168m", NULL, CLK_IS_ROOT, 168750000, }, | ||
44 | }; | ||
45 | |||
46 | static void __init hip04_clk_init(struct device_node *np) | ||
47 | { | ||
48 | hisi_clk_init(np, HIP04_NR_CLKS); | ||
49 | |||
50 | hisi_clk_register_fixed_rate(hip04_fixed_rate_clks, | ||
51 | ARRAY_SIZE(hip04_fixed_rate_clks), | ||
52 | NULL); | ||
53 | } | ||
54 | CLK_OF_DECLARE(hip04_clk, "hisilicon,hip04-clock", hip04_clk_init); | ||
diff --git a/include/dt-bindings/clock/hip04-clock.h b/include/dt-bindings/clock/hip04-clock.h new file mode 100644 index 000000000000..695e61cd1523 --- /dev/null +++ b/include/dt-bindings/clock/hip04-clock.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013-2014 Hisilicon Limited. | ||
3 | * Copyright (c) 2013-2014 Linaro Limited. | ||
4 | * | ||
5 | * Author: Haojian Zhuang <haojian.zhuang@linaro.org> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along | ||
18 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef __DTS_HIP04_CLOCK_H | ||
24 | #define __DTS_HIP04_CLOCK_H | ||
25 | |||
26 | #define HIP04_NONE_CLOCK 0 | ||
27 | |||
28 | /* fixed rate & fixed factor clocks */ | ||
29 | #define HIP04_OSC50M 1 | ||
30 | #define HIP04_CLK_50M 2 | ||
31 | #define HIP04_CLK_168M 3 | ||
32 | |||
33 | #define HIP04_NR_CLKS 64 | ||
34 | |||
35 | #endif /* __DTS_HIP04_CLOCK_H */ | ||