blob: 01b5ba4e0773ddc5a8e46ca01e790276ab4a85a2 [file] [log] [blame]
Stephen Warren135aa952016-06-17 09:44:00 -06001/*
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
12struct 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 */
20enum 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 */
33enum 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 */
48ulong 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 */
56int 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 */
65int sandbox_clk_test_get(struct udevice *dev);
66/**
Neil Armstrong65388d02018-04-03 11:44:19 +020067 * 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 */
73int sandbox_clk_test_get_bulk(struct udevice *dev);
74/**
Stephen Warren135aa952016-06-17 09:44:00 -060075 * 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 */
82ulong 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 */
91ulong 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 */
100int sandbox_clk_test_enable(struct udevice *dev, int id);
101/**
Neil Armstrong65388d02018-04-03 11:44:19 +0200102 * 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 */
108int sandbox_clk_test_enable_bulk(struct udevice *dev);
109/**
Stephen Warren135aa952016-06-17 09:44:00 -0600110 * 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 */
117int sandbox_clk_test_disable(struct udevice *dev, int id);
118/**
Neil Armstrong65388d02018-04-03 11:44:19 +0200119 * 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 */
125int sandbox_clk_test_disable_bulk(struct udevice *dev);
126/**
Stephen Warren135aa952016-06-17 09:44:00 -0600127 * 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 */
133int sandbox_clk_test_free(struct udevice *dev);
Neil Armstrong65388d02018-04-03 11:44:19 +0200134/**
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 */
141int sandbox_clk_test_release_bulk(struct udevice *dev);
Stephen Warren135aa952016-06-17 09:44:00 -0600142
143#endif