Masahiro Yamada | e4dfb05 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 1 | /* |
Masahiro Yamada | fa1f73f | 2016-07-19 21:56:13 +0900 | [diff] [blame] | 2 | * Copyright (C) 2016 Socionext Inc. |
| 3 | * Author: Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | e4dfb05 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
| 8 | #ifndef __CLK_UNIPHIER_H__ |
| 9 | #define __CLK_UNIPHIER_H__ |
| 10 | |
| 11 | #include <linux/kernel.h> |
| 12 | |
Masahiro Yamada | 8bdfe0a | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 13 | #define UNIPHIER_CLK_MAX_NR_MUXS 8 |
| 14 | |
Masahiro Yamada | e4dfb05 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 15 | struct uniphier_clk_gate_data { |
Masahiro Yamada | 8bdfe0a | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 16 | unsigned int id; |
Masahiro Yamada | e4dfb05 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 17 | unsigned int reg; |
Masahiro Yamada | 8bdfe0a | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 18 | unsigned int bit; |
Masahiro Yamada | e4dfb05 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 19 | }; |
| 20 | |
Masahiro Yamada | 8bdfe0a | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 21 | struct uniphier_clk_mux_data { |
| 22 | unsigned int id; |
| 23 | unsigned int nr_muxs; |
Masahiro Yamada | e4dfb05 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 24 | unsigned int reg; |
Masahiro Yamada | 8bdfe0a | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 25 | unsigned int masks[UNIPHIER_CLK_MAX_NR_MUXS]; |
| 26 | unsigned int vals[UNIPHIER_CLK_MAX_NR_MUXS]; |
| 27 | unsigned long rates[UNIPHIER_CLK_MAX_NR_MUXS]; |
Masahiro Yamada | e4dfb05 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 28 | }; |
| 29 | |
Masahiro Yamada | 8bdfe0a | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 30 | struct uniphier_clk_data { |
Masahiro Yamada | 630c99f | 2016-09-22 07:42:20 +0900 | [diff] [blame] | 31 | const struct uniphier_clk_gate_data *gate; |
Masahiro Yamada | 8bdfe0a | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 32 | const struct uniphier_clk_mux_data *mux; |
Masahiro Yamada | e4dfb05 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 33 | }; |
| 34 | |
Masahiro Yamada | 8bdfe0a | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 35 | #define UNIPHIER_CLK_ID_END (unsigned int)(-1) |
| 36 | |
| 37 | #define UNIPHIER_CLK_END \ |
| 38 | { .id = UNIPHIER_CLK_ID_END } |
| 39 | |
| 40 | #define UNIPHIER_CLK_GATE(_id, _reg, _bit) \ |
Masahiro Yamada | e4dfb05 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 41 | { \ |
Masahiro Yamada | 8bdfe0a | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 42 | .id = (_id), \ |
| 43 | .reg = (_reg), \ |
| 44 | .bit = (_bit), \ |
Masahiro Yamada | e4dfb05 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 45 | } |
| 46 | |
Masahiro Yamada | 8bdfe0a | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 47 | #define UNIPHIER_CLK_FIXED_RATE(_id, _rate) \ |
| 48 | { \ |
| 49 | .id = (_id), \ |
| 50 | .rates = {(_reg),}, \ |
| 51 | } |
| 52 | |
Masahiro Yamada | 644f5bf | 2017-08-29 01:06:15 +0900 | [diff] [blame] | 53 | extern const struct uniphier_clk_data uniphier_pxs2_sys_clk_data; |
| 54 | extern const struct uniphier_clk_data uniphier_ld20_sys_clk_data; |
Masahiro Yamada | 8bdfe0a | 2016-10-17 22:18:01 +0900 | [diff] [blame] | 55 | extern const struct uniphier_clk_data uniphier_mio_clk_data; |
Masahiro Yamada | e4dfb05 | 2016-02-02 21:11:32 +0900 | [diff] [blame] | 56 | |
| 57 | #endif /* __CLK_UNIPHIER_H__ */ |