blob: 2b1c49f78309798fbd2885f3753c3f8808952011 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0 */
Stephen Warrena9622432016-06-17 09:44:00 -06002/*
3 * Copyright (c) 2016, NVIDIA CORPORATION.
Stephen Warrena9622432016-06-17 09:44:00 -06004 */
5
6#ifndef __SANDBOX_CLK_H
7#define __SANDBOX_CLK_H
8
9#include <common.h>
10
11struct 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 */
19enum 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 */
32enum 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 */
47ulong 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 */
55int 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 */
64int sandbox_clk_test_get(struct udevice *dev);
65/**
Neil Armstrong567a38b2018-04-03 11:44:19 +020066 * 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 */
72int sandbox_clk_test_get_bulk(struct udevice *dev);
73/**
Stephen Warrena9622432016-06-17 09:44:00 -060074 * 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 */
81ulong 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 */
90ulong 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 */
99int sandbox_clk_test_enable(struct udevice *dev, int id);
100/**
Neil Armstrong567a38b2018-04-03 11:44:19 +0200101 * 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 */
107int sandbox_clk_test_enable_bulk(struct udevice *dev);
108/**
Stephen Warrena9622432016-06-17 09:44:00 -0600109 * 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 */
116int sandbox_clk_test_disable(struct udevice *dev, int id);
117/**
Neil Armstrong567a38b2018-04-03 11:44:19 +0200118 * 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 */
124int sandbox_clk_test_disable_bulk(struct udevice *dev);
125/**
Stephen Warrena9622432016-06-17 09:44:00 -0600126 * 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 */
132int sandbox_clk_test_free(struct udevice *dev);
Neil Armstrong567a38b2018-04-03 11:44:19 +0200133/**
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 */
140int sandbox_clk_test_release_bulk(struct udevice *dev);
Fabrice Gasnier11192712018-07-24 16:31:28 +0200141/**
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 */
148int sandbox_clk_test_valid(struct udevice *dev);
Stephen Warrena9622432016-06-17 09:44:00 -0600149
150#endif