]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/clk/qcom/clk-rpm.h
clk: qcom: Add support for RPM Clocks
[karo-tx-linux.git] / drivers / clk / qcom / clk-rpm.h
1 /*
2  * Copyright (c) 2015, Linaro Limited
3  * Copyright (c) 2014, The Linux Foundation. All rights reserved.
4  *
5  * This software is licensed under the terms of the GNU General Public
6  * License version 2, as published by the Free Software Foundation, and
7  * may be copied, distributed, and modified under those terms.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  */
14
15 #ifndef __QCOM_CLK_RPM_H__
16 #define __QCOM_CLK_RPM_H__
17
18 #include <linux/clk-provider.h>
19
20 struct qcom_rpm;
21
22 struct clk_rpm {
23         const int rpm_clk_id;
24         unsigned long rate;
25         bool enabled;
26         bool branch;
27         struct clk_hw hw;
28         struct qcom_rpm *rpm;
29 };
30
31 extern const struct clk_ops clk_rpm_ops;
32 extern const struct clk_ops clk_rpm_branch_ops;
33
34 #define DEFINE_CLK_RPM(_platform, _name, r_id)                               \
35         static struct clk_rpm _platform##_##_name = {                        \
36                 .rpm_clk_id = (r_id),                                        \
37                 .rate = INT_MAX,                                             \
38                 .hw.init = &(struct clk_init_data){                          \
39                         .name = #_name,                                      \
40                         .parent_names = (const char *[]){ "pxo_board" },     \
41                         .num_parents = 1,                                    \
42                         .ops = &clk_rpm_ops,                                 \
43                 },                                                           \
44         }
45
46 #define DEFINE_CLK_RPM_PXO_BRANCH(_platform, _name, r_id, r)                 \
47         static struct clk_rpm _platform##_##_name = {                        \
48                 .rpm_clk_id = (r_id),                                        \
49                 .branch = true,                                              \
50                 .rate = (r),                                                 \
51                 .hw.init = &(struct clk_init_data){                          \
52                         .name = #_name,                                      \
53                         .parent_names = (const char *[]){ "pxo_board" },     \
54                         .num_parents = 1,                                    \
55                         .ops = &clk_rpm_branch_ops,                          \
56                 },                                                           \
57         }
58
59 #define DEFINE_CLK_RPM_CXO_BRANCH(_platform, _name, r_id, r)                 \
60         static struct clk_rpm _platform##_##_name = {                        \
61                 .rpm_clk_id = (r_id),                                        \
62                 .branch = true,                                              \
63                 .rate = (r),                                                 \
64                 .hw.init = &(struct clk_init_data){                          \
65                         .name = #_name,                                      \
66                         .parent_names = (const char *[]){ "cxo_board" },     \
67                         .num_parents = 1,                                    \
68                         .ops = &clk_rpm_branch_ops,                          \
69                 },                                                           \
70         }
71 #endif