xref: /openbmc/u-boot/arch/sandbox/include/asm/clk.h (revision fc82e768)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2016, NVIDIA CORPORATION.
4  */
5 
6 #ifndef __SANDBOX_CLK_H
7 #define __SANDBOX_CLK_H
8 
9 #include <common.h>
10 
11 struct udevice;
12 
13 /**
14  * enum sandbox_clk_id - Identity of clocks implemented by the sandbox clock
15  * provider.
16  *
17  * These IDs are within/relative-to the clock provider.
18  */
19 enum sandbox_clk_id {
20 	SANDBOX_CLK_ID_SPI,
21 	SANDBOX_CLK_ID_I2C,
22 
23 	SANDBOX_CLK_ID_COUNT,
24 };
25 
26 /**
27  * enum sandbox_clk_test_id - Identity of the clocks consumed by the sandbox
28  * clock test device.
29  *
30  * These are the IDs the clock consumer knows the clocks as.
31  */
32 enum sandbox_clk_test_id {
33 	SANDBOX_CLK_TEST_ID_FIXED,
34 	SANDBOX_CLK_TEST_ID_SPI,
35 	SANDBOX_CLK_TEST_ID_I2C,
36 
37 	SANDBOX_CLK_TEST_ID_COUNT,
38 };
39 
40 /**
41  * sandbox_clk_query_rate - Query the current rate of a sandbox clock.
42  *
43  * @dev:	The sandbox clock provider device.
44  * @id:		The clock to query.
45  * @return:	The rate of the clock.
46  */
47 ulong sandbox_clk_query_rate(struct udevice *dev, int id);
48 /**
49  * sandbox_clk_query_enable - Query the enable state of a sandbox clock.
50  *
51  * @dev:	The sandbox clock provider device.
52  * @id:		The clock to query.
53  * @return:	The rate of the clock.
54  */
55 int sandbox_clk_query_enable(struct udevice *dev, int id);
56 
57 /**
58  * sandbox_clk_test_get - Ask the sandbox clock test device to request its
59  * clocks.
60  *
61  * @dev:	The sandbox clock test (client) devivce.
62  * @return:	0 if OK, or a negative error code.
63  */
64 int sandbox_clk_test_get(struct udevice *dev);
65 /**
66  * sandbox_clk_test_get_bulk - Ask the sandbox clock test device to request its
67  * clocks with the bulk clk API.
68  *
69  * @dev:	The sandbox clock test (client) devivce.
70  * @return:	0 if OK, or a negative error code.
71  */
72 int sandbox_clk_test_get_bulk(struct udevice *dev);
73 /**
74  * sandbox_clk_test_get_rate - Ask the sandbox clock test device to query a
75  * clock's rate.
76  *
77  * @dev:	The sandbox clock test (client) devivce.
78  * @id:		The test device's clock ID to query.
79  * @return:	The rate of the clock.
80  */
81 ulong sandbox_clk_test_get_rate(struct udevice *dev, int id);
82 /**
83  * sandbox_clk_test_set_rate - Ask the sandbox clock test device to set a
84  * clock's rate.
85  *
86  * @dev:	The sandbox clock test (client) devivce.
87  * @id:		The test device's clock ID to configure.
88  * @return:	The new rate of the clock.
89  */
90 ulong sandbox_clk_test_set_rate(struct udevice *dev, int id, ulong rate);
91 /**
92  * sandbox_clk_test_enable - Ask the sandbox clock test device to enable a
93  * clock.
94  *
95  * @dev:	The sandbox clock test (client) devivce.
96  * @id:		The test device's clock ID to configure.
97  * @return:	0 if OK, or a negative error code.
98  */
99 int sandbox_clk_test_enable(struct udevice *dev, int id);
100 /**
101  * sandbox_clk_test_enable_bulk - Ask the sandbox clock test device to enable
102  * all clocks in it's clock bulk struct.
103  *
104  * @dev:	The sandbox clock test (client) devivce.
105  * @return:	0 if OK, or a negative error code.
106  */
107 int sandbox_clk_test_enable_bulk(struct udevice *dev);
108 /**
109  * sandbox_clk_test_disable - Ask the sandbox clock test device to disable a
110  * clock.
111  *
112  * @dev:	The sandbox clock test (client) devivce.
113  * @id:		The test device's clock ID to configure.
114  * @return:	0 if OK, or a negative error code.
115  */
116 int sandbox_clk_test_disable(struct udevice *dev, int id);
117 /**
118  * sandbox_clk_test_disable_bulk - Ask the sandbox clock test device to disable
119  * all clocks in it's clock bulk struct.
120  *
121  * @dev:	The sandbox clock test (client) devivce.
122  * @return:	0 if OK, or a negative error code.
123  */
124 int sandbox_clk_test_disable_bulk(struct udevice *dev);
125 /**
126  * sandbox_clk_test_free - Ask the sandbox clock test device to free its
127  * clocks.
128  *
129  * @dev:	The sandbox clock test (client) devivce.
130  * @return:	0 if OK, or a negative error code.
131  */
132 int sandbox_clk_test_free(struct udevice *dev);
133 /**
134  * sandbox_clk_test_release_bulk - Ask the sandbox clock test device to release
135  * all clocks in it's clock bulk struct.
136  *
137  * @dev:	The sandbox clock test (client) devivce.
138  * @return:	0 if OK, or a negative error code.
139  */
140 int sandbox_clk_test_release_bulk(struct udevice *dev);
141 /**
142  * sandbox_clk_test_valid - Ask the sandbox clock test device to check its
143  * clocks are valid.
144  *
145  * @dev:	The sandbox clock test (client) devivce.
146  * @return:	0 if OK, or a negative error code.
147  */
148 int sandbox_clk_test_valid(struct udevice *dev);
149 
150 #endif
151