]> git.ipfire.org Git - people/ms/u-boot.git/blame - include/clk.h
arm: mvebu: Move CONFIG_SYS_TEXT_BASE to an address < 16 MiB
[people/ms/u-boot.git] / include / clk.h
CommitLineData
f26c8a8e
SG
1/*
2 * Copyright (c) 2015 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
08d0d6f3
MS
8#ifndef _CLK_H_
9#define _CLK_H_
10
11int soc_clk_dump(void);
12
f26c8a8e
SG
13struct clk_ops {
14 /**
15 * get_rate() - Get current clock rate
16 *
17 * @dev: Device to check (UCLASS_CLK)
18 * @return clock rate in Hz, or -ve error code
19 */
20 ulong (*get_rate)(struct udevice *dev);
21
22 /**
23 * set_rate() - Set current clock rate
24 *
25 * @dev: Device to adjust
26 * @rate: New clock rate in Hz
27 * @return new rate, or -ve error code
28 */
29 ulong (*set_rate)(struct udevice *dev, ulong rate);
30
31 /**
32 * clk_set_periph_rate() - Set clock rate for a peripheral
33 *
34 * @dev: Device to adjust (UCLASS_CLK)
35 * @rate: New clock rate in Hz
36 * @return new clock rate in Hz, or -ve error code
37 */
38 ulong (*get_periph_rate)(struct udevice *dev, int periph);
39
40 /**
41 * clk_set_periph_rate() - Set current clock rate for a peripheral
42 *
43 * @dev: Device to update (UCLASS_CLK)
44 * @periph: Peripheral ID to cupdate
45 * @return new clock rate in Hz, or -ve error code
46 */
47 ulong (*set_periph_rate)(struct udevice *dev, int periph, ulong rate);
48};
49
50#define clk_get_ops(dev) ((struct clk_ops *)(dev)->driver->ops)
51
52/**
53 * clk_get_rate() - Get current clock rate
54 *
55 * @dev: Device to check (UCLASS_CLK)
56 * @return clock rate in Hz, or -ve error code
57 */
58ulong clk_get_rate(struct udevice *dev);
59
60/**
61 * set_rate() - Set current clock rate
62 *
63 * @dev: Device to adjust
64 * @rate: New clock rate in Hz
65 * @return new rate, or -ve error code
66 */
67ulong clk_set_rate(struct udevice *dev, ulong rate);
68
69/**
70 * clk_get_periph_rate() - Get current clock rate for a peripheral
71 *
72 * @dev: Device to check (UCLASS_CLK)
73 * @return clock rate in Hz, -ve error code
74 */
75ulong clk_get_periph_rate(struct udevice *dev, int periph);
76
77/**
78 * clk_set_periph_rate() - Set current clock rate for a peripheral
79 *
80 * @dev: Device to update (UCLASS_CLK)
81 * @periph: Peripheral ID to cupdate
82 * @return new clock rate in Hz, or -ve error code
83 */
84ulong clk_set_periph_rate(struct udevice *dev, int periph, ulong rate);
85
08d0d6f3 86#endif /* _CLK_H_ */