blob: ab85bbcbfca8e9e2f31a8fe4363e5499e31b953a [file] [log] [blame]
Sean Anderson65cd44e2020-06-24 06:41:10 -04001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright (C) 2020 Sean Anderson <seanga2@gmail.com>
4 */
5#ifndef K210_BYPASS_H
6#define K210_BYPASS_H
7
Simon Glass43033962020-07-19 10:15:56 -06008struct clk;
Sean Anderson65cd44e2020-06-24 06:41:10 -04009
10struct k210_bypass {
11 struct clk clk;
12 struct clk **children; /* Clocks to reparent */
13 struct clk **saved_parents; /* Parents saved over en-/dis-able */
14 struct clk *bypassee; /* Clock to bypass */
15 const struct clk_ops *bypassee_ops; /* Ops of the bypass clock */
16 struct clk *alt; /* Clock to set children to when bypassing */
17 size_t child_count;
18};
19
20#define to_k210_bypass(_clk) container_of(_clk, struct k210_bypass, clk)
21
22int k210_bypass_set_children(struct clk *clk, struct clk **children,
23 size_t child_count);
24struct clk *k210_register_bypass_struct(const char *name,
25 const char *parent_name,
26 struct k210_bypass *bypass);
27struct clk *k210_register_bypass(const char *name, const char *parent_name,
28 struct clk *bypassee,
29 const struct clk_ops *bypassee_ops,
30 struct clk *alt);
31#endif /* K210_BYPASS_H */