xref: /openbmc/u-boot/arch/sandbox/include/asm/clk.h (revision a7da6f8c)
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_rate - Ask the sandbox clock test device to query a
68  * clock's rate.
69  *
70  * @dev:	The sandbox clock test (client) devivce.
71  * @id:		The test device's clock ID to query.
72  * @return:	The rate of the clock.
73  */
74 ulong sandbox_clk_test_get_rate(struct udevice *dev, int id);
75 /**
76  * sandbox_clk_test_set_rate - Ask the sandbox clock test device to set a
77  * clock's rate.
78  *
79  * @dev:	The sandbox clock test (client) devivce.
80  * @id:		The test device's clock ID to configure.
81  * @return:	The new rate of the clock.
82  */
83 ulong sandbox_clk_test_set_rate(struct udevice *dev, int id, ulong rate);
84 /**
85  * sandbox_clk_test_enable - Ask the sandbox clock test device to enable a
86  * clock.
87  *
88  * @dev:	The sandbox clock test (client) devivce.
89  * @id:		The test device's clock ID to configure.
90  * @return:	0 if OK, or a negative error code.
91  */
92 int sandbox_clk_test_enable(struct udevice *dev, int id);
93 /**
94  * sandbox_clk_test_disable - Ask the sandbox clock test device to disable a
95  * clock.
96  *
97  * @dev:	The sandbox clock test (client) devivce.
98  * @id:		The test device's clock ID to configure.
99  * @return:	0 if OK, or a negative error code.
100  */
101 int sandbox_clk_test_disable(struct udevice *dev, int id);
102 /**
103  * sandbox_clk_test_free - Ask the sandbox clock test device to free its
104  * clocks.
105  *
106  * @dev:	The sandbox clock test (client) devivce.
107  * @return:	0 if OK, or a negative error code.
108  */
109 int sandbox_clk_test_free(struct udevice *dev);
110 
111 #endif
112