OSDN Git Service

0a3a0e7011889794b2a7bd8f843595b1481198f4
[uclinux-h8/linux.git] / arch / h8300 / kernel / clk.c
1 /*
2  * linux/arch/h8300/kernel/clk.c
3  *
4  * Copyright 2015 Yoshinori Sato <ysato@users.sourceforge.jp>
5  */
6
7 #include <linux/clk.h>
8 #include <linux/module.h>
9 #include <linux/compiler.h>
10 #include <linux/clkdev.h>
11 #include <asm/clk.h>
12
13 unsigned long clk_get_rate(struct clk *clk)
14 {
15         return clk->parent->rate;
16 }
17 EXPORT_SYMBOL(clk_get_rate)
18
19 int clk_enable(struct clk *clk)
20 {
21         return 0;
22 }
23 EXPORT_SYMBOL(clk_enable)
24
25 void clk_disable(struct clk *clk)
26 {
27 }
28 EXPORT_SYMBOL(clk_disable)
29
30 static struct clk master_clk;
31
32 static struct clk peripheral_clk = {
33         .parent = &master_clk,
34 };
35
36 static struct clk_lookup lookups[] = {
37         {
38                 .con_id = "master_clk",
39                 .clk = &master_clk,
40         },
41         {
42                 .con_id = "peripheral_clk",
43                 .clk = &peripheral_clk,
44         },
45 };
46
47 int __init h8300_clk_init(unsigned long hz)
48 {
49         master_clk.rate = hz;
50         clkdev_add_table(lookups, ARRAY_SIZE(lookups));
51         return 0;
52 }