summaryrefslogtreecommitdiff
path: root/arch/sandbox/include/asm/clk.h
blob: d85cbadf6ec5d974ded6727486e278257b004346 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) 2016, NVIDIA CORPORATION.
 */

#ifndef __SANDBOX_CLK_H
#define __SANDBOX_CLK_H

#include <common.h>

struct udevice;

/**
 * enum sandbox_clk_id - Identity of clocks implemented by the sandbox clock
 * provider.
 *
 * These IDs are within/relative-to the clock provider.
 */
enum sandbox_clk_id {
	SANDBOX_CLK_ID_SPI,
	SANDBOX_CLK_ID_I2C,

	SANDBOX_CLK_ID_COUNT,
};

/**
 * enum sandbox_clk_test_id - Identity of the clocks consumed by the sandbox
 * clock test device.
 *
 * These are the IDs the clock consumer knows the clocks as.
 */
enum sandbox_clk_test_id {
	SANDBOX_CLK_TEST_ID_FIXED,
	SANDBOX_CLK_TEST_ID_SPI,
	SANDBOX_CLK_TEST_ID_I2C,

	SANDBOX_CLK_TEST_ID_COUNT,
};

/**
 * sandbox_clk_query_rate - Query the current rate of a sandbox clock.
 *
 * @dev:	The sandbox clock provider device.
 * @id:		The clock to query.
 * @return:	The rate of the clock.
 */
ulong sandbox_clk_query_rate(struct udevice *dev, int id);
/**
 * sandbox_clk_query_enable - Query the enable state of a sandbox clock.
 *
 * @dev:	The sandbox clock provider device.
 * @id:		The clock to query.
 * @return:	The rate of the clock.
 */
int sandbox_clk_query_enable(struct udevice *dev, int id);

/**
 * sandbox_clk_test_get - Ask the sandbox clock test device to request its
 * clocks.
 *
 * @dev:	The sandbox clock test (client) devivce.
 * @return:	0 if OK, or a negative error code.
 */
int sandbox_clk_test_get(struct udevice *dev);
/**
 * sandbox_clk_test_get_bulk - Ask the sandbox clock test device to request its
 * clocks with the bulk clk API.
 *
 * @dev:	The sandbox clock test (client) devivce.
 * @return:	0 if OK, or a negative error code.
 */
int sandbox_clk_test_get_bulk(struct udevice *dev);
/**
 * sandbox_clk_test_get_rate - Ask the sandbox clock test device to query a
 * clock's rate.
 *
 * @dev:	The sandbox clock test (client) devivce.
 * @id:		The test device's clock ID to query.
 * @return:	The rate of the clock.
 */
ulong sandbox_clk_test_get_rate(struct udevice *dev, int id);
/**
 * sandbox_clk_test_set_rate - Ask the sandbox clock test device to set a
 * clock's rate.
 *
 * @dev:	The sandbox clock test (client) devivce.
 * @id:		The test device's clock ID to configure.
 * @return:	The new rate of the clock.
 */
ulong sandbox_clk_test_set_rate(struct udevice *dev, int id, ulong rate);
/**
 * sandbox_clk_test_enable - Ask the sandbox clock test device to enable a
 * clock.
 *
 * @dev:	The sandbox clock test (client) devivce.
 * @id:		The test device's clock ID to configure.
 * @return:	0 if OK, or a negative error code.
 */
int sandbox_clk_test_enable(struct udevice *dev, int id);
/**
 * sandbox_clk_test_enable_bulk - Ask the sandbox clock test device to enable
 * all clocks in it's clock bulk struct.
 *
 * @dev:	The sandbox clock test (client) devivce.
 * @return:	0 if OK, or a negative error code.
 */
int sandbox_clk_test_enable_bulk(struct udevice *dev);
/**
 * sandbox_clk_test_disable - Ask the sandbox clock test device to disable a
 * clock.
 *
 * @dev:	The sandbox clock test (client) devivce.
 * @id:		The test device's clock ID to configure.
 * @return:	0 if OK, or a negative error code.
 */
int sandbox_clk_test_disable(struct udevice *dev, int id);
/**
 * sandbox_clk_test_disable_bulk - Ask the sandbox clock test device to disable
 * all clocks in it's clock bulk struct.
 *
 * @dev:	The sandbox clock test (client) devivce.
 * @return:	0 if OK, or a negative error code.
 */
int sandbox_clk_test_disable_bulk(struct udevice *dev);
/**
 * sandbox_clk_test_free - Ask the sandbox clock test device to free its
 * clocks.
 *
 * @dev:	The sandbox clock test (client) devivce.
 * @return:	0 if OK, or a negative error code.
 */
int sandbox_clk_test_free(struct udevice *dev);
/**
 * sandbox_clk_test_release_bulk - Ask the sandbox clock test device to release
 * all clocks in it's clock bulk struct.
 *
 * @dev:	The sandbox clock test (client) devivce.
 * @return:	0 if OK, or a negative error code.
 */
int sandbox_clk_test_release_bulk(struct udevice *dev);

#endif