2 * Copyright (c) 2015 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
4 * Copyright (c) 2016, NVIDIA CORPORATION.
6 * SPDX-License-Identifier: GPL-2.0+
12 /* See clk.h for background documentation. */
18 * struct clk_ops - The functions that a clock driver must implement.
22 * of_xlate - Translate a client's device-tree (OF) clock specifier.
24 * The clock core calls this function as the first step in implementing
25 * a client's clk_get_by_*() call.
27 * If this function pointer is set to NULL, the clock core will use a
28 * default implementation, which assumes #clock-cells = <1>, and that
29 * the DT cell contains a simple integer clock ID.
31 * At present, the clock API solely supports device-tree. If this
32 * changes, other xxx_xlate() functions may be added to support those
35 * @clock: The clock struct to hold the translation result.
36 * @args: The clock specifier values from device tree.
37 * @return 0 if OK, or a negative error code.
39 int (*of_xlate)(struct clk *clock,
40 struct fdtdec_phandle_args *args);
42 * request - Request a translated clock.
44 * The clock core calls this function as the second step in
45 * implementing a client's clk_get_by_*() call, following a successful
46 * xxx_xlate() call, or as the only step in implementing a client's
49 * @clock: The clock struct to request; this has been fille in by
50 * a previoux xxx_xlate() function call, or by the caller
52 * @return 0 if OK, or a negative error code.
54 int (*request)(struct clk *clock);
56 * free - Free a previously requested clock.
58 * This is the implementation of the client clk_free() API.
60 * @clock: The clock to free.
61 * @return 0 if OK, or a negative error code.
63 int (*free)(struct clk *clock);
65 * get_rate() - Get current clock rate.
67 * @clk: The clock to query.
68 * @return clock rate in Hz, or -ve error code
70 ulong (*get_rate)(struct clk *clk);
72 * set_rate() - Set current clock rate.
74 * @clk: The clock to manipulate.
75 * @rate: New clock rate in Hz.
76 * @return new rate, or -ve error code.
78 ulong (*set_rate)(struct clk *clk, ulong rate);
80 * enable() - Enable a clock.
82 * @clk: The clock to manipulate.
83 * @return zero on success, or -ve error code.
85 int (*enable)(struct clk *clk);
87 * disable() - Disable a clock.
89 * @clk: The clock to manipulate.
90 * @return zero on success, or -ve error code.
92 int (*disable)(struct clk *clk);