1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2016, NVIDIA CORPORATION.
6 #ifndef __SANDBOX_CLK_H
7 #define __SANDBOX_CLK_H
14 * enum sandbox_clk_id - Identity of clocks implemented by the sandbox clock
17 * These IDs are within/relative-to the clock provider.
29 * enum sandbox_clk_test_id - Identity of the clocks consumed by the sandbox
32 * These are the IDs the clock consumer knows the clocks as.
34 enum sandbox_clk_test_id {
35 SANDBOX_CLK_TEST_ID_FIXED,
36 SANDBOX_CLK_TEST_ID_SPI,
37 SANDBOX_CLK_TEST_ID_I2C,
38 SANDBOX_CLK_TEST_ID_DEVM1,
39 SANDBOX_CLK_TEST_ID_DEVM2,
40 SANDBOX_CLK_TEST_ID_DEVM_NULL,
42 SANDBOX_CLK_TEST_ID_COUNT,
45 #define SANDBOX_CLK_TEST_NON_DEVM_COUNT SANDBOX_CLK_TEST_ID_DEVM1
48 * sandbox_clk_query_rate - Query the current rate of a sandbox clock.
50 * @dev: The sandbox clock provider device.
51 * @id: The clock to query.
52 * @return: The rate of the clock.
54 ulong sandbox_clk_query_rate(struct udevice *dev, int id);
56 * sandbox_clk_query_enable - Query the enable state of a sandbox clock.
58 * @dev: The sandbox clock provider device.
59 * @id: The clock to query.
60 * @return: The rate of the clock.
62 int sandbox_clk_query_enable(struct udevice *dev, int id);
64 * sandbox_clk_query_requested - Query the requested state of a sandbox clock.
66 * @dev: The sandbox clock provider device.
67 * @id: The clock to query.
68 * @return: The rate of the clock.
70 int sandbox_clk_query_requested(struct udevice *dev, int id);
73 * sandbox_clk_test_get - Ask the sandbox clock test device to request its
76 * @dev: The sandbox clock test (client) devivce.
77 * @return: 0 if OK, or a negative error code.
79 int sandbox_clk_test_get(struct udevice *dev);
82 * sandbox_clk_test_devm_get - Ask the sandbox clock test device to request its
83 * clocks using the managed API.
85 * @dev: The sandbox clock test (client) devivce.
86 * @return: 0 if OK, or a negative error code.
88 int sandbox_clk_test_devm_get(struct udevice *dev);
91 * sandbox_clk_test_get_bulk - Ask the sandbox clock test device to request its
92 * clocks with the bulk clk API.
94 * @dev: The sandbox clock test (client) devivce.
95 * @return: 0 if OK, or a negative error code.
97 int sandbox_clk_test_get_bulk(struct udevice *dev);
99 * sandbox_clk_test_get_rate - Ask the sandbox clock test device to query a
102 * @dev: The sandbox clock test (client) devivce.
103 * @id: The test device's clock ID to query.
104 * @return: The rate of the clock.
106 ulong sandbox_clk_test_get_rate(struct udevice *dev, int id);
108 * sandbox_clk_test_set_rate - Ask the sandbox clock test device to set a
111 * @dev: The sandbox clock test (client) devivce.
112 * @id: The test device's clock ID to configure.
113 * @return: The new rate of the clock.
115 ulong sandbox_clk_test_set_rate(struct udevice *dev, int id, ulong rate);
117 * sandbox_clk_test_enable - Ask the sandbox clock test device to enable a
120 * @dev: The sandbox clock test (client) devivce.
121 * @id: The test device's clock ID to configure.
122 * @return: 0 if OK, or a negative error code.
124 int sandbox_clk_test_enable(struct udevice *dev, int id);
126 * sandbox_clk_test_enable_bulk - Ask the sandbox clock test device to enable
127 * all clocks in it's clock bulk struct.
129 * @dev: The sandbox clock test (client) devivce.
130 * @return: 0 if OK, or a negative error code.
132 int sandbox_clk_test_enable_bulk(struct udevice *dev);
134 * sandbox_clk_test_disable - Ask the sandbox clock test device to disable a
137 * @dev: The sandbox clock test (client) devivce.
138 * @id: The test device's clock ID to configure.
139 * @return: 0 if OK, or a negative error code.
141 int sandbox_clk_test_disable(struct udevice *dev, int id);
143 * sandbox_clk_test_disable_bulk - Ask the sandbox clock test device to disable
144 * all clocks in it's clock bulk struct.
146 * @dev: The sandbox clock test (client) devivce.
147 * @return: 0 if OK, or a negative error code.
149 int sandbox_clk_test_disable_bulk(struct udevice *dev);
151 * sandbox_clk_test_free - Ask the sandbox clock test device to free its
154 * @dev: The sandbox clock test (client) devivce.
155 * @return: 0 if OK, or a negative error code.
157 int sandbox_clk_test_free(struct udevice *dev);
159 * sandbox_clk_test_release_bulk - Ask the sandbox clock test device to release
160 * all clocks in it's clock bulk struct.
162 * @dev: The sandbox clock test (client) devivce.
163 * @return: 0 if OK, or a negative error code.
165 int sandbox_clk_test_release_bulk(struct udevice *dev);
167 * sandbox_clk_test_valid - Ask the sandbox clock test device to check its
170 * @dev: The sandbox clock test (client) devivce.
171 * @return: 0 if OK, or a negative error code.
173 int sandbox_clk_test_valid(struct udevice *dev);
175 * sandbox_clk_test_valid - Ask the sandbox clock test device to check its
178 * @dev: The sandbox clock test (client) devivce.
179 * @return: 0 if OK, or a negative error code.
181 struct clk *sandbox_clk_test_get_devm_clk(struct udevice *dev, int id);