.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Ingenic SoC CGU driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2013-2015 Imagination Technologies |
---|
5 | 6 | * Author: Paul Burton <paul.burton@mips.com> |
---|
6 | | - * |
---|
7 | | - * This program is free software; you can redistribute it and/or |
---|
8 | | - * modify it under the terms of the GNU General Public License as |
---|
9 | | - * published by the Free Software Foundation; either version 2 of |
---|
10 | | - * the License, or (at your option) any later version. |
---|
11 | | - * |
---|
12 | | - * This program is distributed in the hope that it will be useful, |
---|
13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | | - * GNU General Public License for more details. |
---|
16 | 7 | */ |
---|
17 | 8 | |
---|
18 | 9 | #ifndef __DRIVERS_CLK_INGENIC_CGU_H__ |
---|
19 | 10 | #define __DRIVERS_CLK_INGENIC_CGU_H__ |
---|
20 | 11 | |
---|
21 | 12 | #include <linux/bitops.h> |
---|
| 13 | +#include <linux/clk-provider.h> |
---|
22 | 14 | #include <linux/of.h> |
---|
23 | 15 | #include <linux/spinlock.h> |
---|
24 | 16 | |
---|
25 | 17 | /** |
---|
26 | 18 | * struct ingenic_cgu_pll_info - information about a PLL |
---|
27 | 19 | * @reg: the offset of the PLL's control register within the CGU |
---|
| 20 | + * @rate_multiplier: the multiplier needed by pll rate calculation |
---|
28 | 21 | * @m_shift: the number of bits to shift the multiplier value by (ie. the |
---|
29 | 22 | * index of the lowest bit of the multiplier value in the PLL's |
---|
30 | 23 | * control register) |
---|
.. | .. |
---|
45 | 38 | * @od_encoding: a pointer to an array mapping post-VCO divider values to |
---|
46 | 39 | * their encoded values in the PLL control register, or -1 for |
---|
47 | 40 | * unsupported values |
---|
| 41 | + * @bypass_reg: the offset of the bypass control register within the CGU |
---|
48 | 42 | * @bypass_bit: the index of the bypass bit in the PLL control register |
---|
49 | 43 | * @enable_bit: the index of the enable bit in the PLL control register |
---|
50 | 44 | * @stable_bit: the index of the stable bit in the PLL control register |
---|
.. | .. |
---|
52 | 46 | */ |
---|
53 | 47 | struct ingenic_cgu_pll_info { |
---|
54 | 48 | unsigned reg; |
---|
| 49 | + unsigned rate_multiplier; |
---|
55 | 50 | const s8 *od_encoding; |
---|
56 | 51 | u8 m_shift, m_bits, m_offset; |
---|
57 | 52 | u8 n_shift, n_bits, n_offset; |
---|
58 | 53 | u8 od_shift, od_bits, od_max; |
---|
| 54 | + unsigned bypass_reg; |
---|
59 | 55 | u8 bypass_bit; |
---|
60 | 56 | u8 enable_bit; |
---|
61 | 57 | u8 stable_bit; |
---|
.. | .. |
---|
88 | 84 | * isn't one |
---|
89 | 85 | * @busy_bit: the index of the busy bit within reg, or -1 if there isn't one |
---|
90 | 86 | * @stop_bit: the index of the stop bit within reg, or -1 if there isn't one |
---|
| 87 | + * @div_table: optional table to map the value read from the register to the |
---|
| 88 | + * actual divider value |
---|
91 | 89 | */ |
---|
92 | 90 | struct ingenic_cgu_div_info { |
---|
93 | 91 | unsigned reg; |
---|
.. | .. |
---|
97 | 95 | s8 ce_bit; |
---|
98 | 96 | s8 busy_bit; |
---|
99 | 97 | s8 stop_bit; |
---|
| 98 | + const u8 *div_table; |
---|
100 | 99 | }; |
---|
101 | 100 | |
---|
102 | 101 | /** |
---|