]> git.ipfire.org Git - people/ms/u-boot.git/blame - drivers/clk/clk-uclass.c
clk: move Kconfig options into sub-menu
[people/ms/u-boot.git] / drivers / clk / clk-uclass.c
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
8#include <common.h>
9#include <clk.h>
10#include <dm.h>
11#include <errno.h>
12#include <dm/lists.h>
13#include <dm/root.h>
14
15ulong clk_get_rate(struct udevice *dev)
16{
17 struct clk_ops *ops = clk_get_ops(dev);
18
19 if (!ops->get_rate)
20 return -ENOSYS;
21
22 return ops->get_rate(dev);
23}
24
25ulong clk_set_rate(struct udevice *dev, ulong rate)
26{
27 struct clk_ops *ops = clk_get_ops(dev);
28
29 if (!ops->set_rate)
30 return -ENOSYS;
31
32 return ops->set_rate(dev, rate);
33}
34
35ulong clk_get_periph_rate(struct udevice *dev, int periph)
36{
37 struct clk_ops *ops = clk_get_ops(dev);
38
39 if (!ops->get_periph_rate)
40 return -ENOSYS;
41
42 return ops->get_periph_rate(dev, periph);
43}
44
45ulong clk_set_periph_rate(struct udevice *dev, int periph, ulong rate)
46{
47 struct clk_ops *ops = clk_get_ops(dev);
48
49 if (!ops->set_periph_rate)
50 return -ENOSYS;
51
52 return ops->set_periph_rate(dev, periph, rate);
53}
54
55UCLASS_DRIVER(clk) = {
56 .id = UCLASS_CLK,
57 .name = "clk",
58};