summaryrefslogtreecommitdiff
path: root/drivers/clk/uniphier/clk-uniphier.h
blob: f9a560ee73d355cb38bdb0cb0d6faf92bb3f8c7f (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
/*
 * Copyright (C) 2016 Socionext Inc.
 *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

#ifndef __CLK_UNIPHIER_H__
#define __CLK_UNIPHIER_H__

#include <linux/kernel.h>

#define UNIPHIER_CLK_MAX_NR_MUXS	8

struct uniphier_clk_gate_data {
	unsigned int id;
	unsigned int reg;
	unsigned int bit;
};

struct uniphier_clk_mux_data {
	unsigned int id;
	unsigned int nr_muxs;
	unsigned int reg;
	unsigned int masks[UNIPHIER_CLK_MAX_NR_MUXS];
	unsigned int vals[UNIPHIER_CLK_MAX_NR_MUXS];
	unsigned long rates[UNIPHIER_CLK_MAX_NR_MUXS];
};

struct uniphier_clk_data {
	const struct uniphier_clk_gate_data *gate;
	const struct uniphier_clk_mux_data *mux;
};

#define UNIPHIER_CLK_ID_END		(unsigned int)(-1)

#define UNIPHIER_CLK_END				\
	{ .id = UNIPHIER_CLK_ID_END }

#define UNIPHIER_CLK_GATE(_id, _reg, _bit)		\
	{						\
		.id = (_id),				\
		.reg = (_reg),				\
		.bit = (_bit),				\
	}

#define UNIPHIER_CLK_FIXED_RATE(_id, _rate)		\
	{						\
		.id = (_id),				\
		.rates = {(_reg),},			\
	}

extern const struct uniphier_clk_data uniphier_mio_clk_data;

#endif /* __CLK_UNIPHIER_H__ */