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