0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __BERLIN2_DIV_H
0009 #define __BERLIN2_DIV_H
0010
0011 struct clk_hw;
0012
0013 #define BERLIN2_DIV_HAS_GATE BIT(0)
0014 #define BERLIN2_DIV_HAS_MUX BIT(1)
0015
0016 #define BERLIN2_PLL_SELECT(_off, _sh) \
0017 .pll_select_offs = _off, \
0018 .pll_select_shift = _sh
0019
0020 #define BERLIN2_PLL_SWITCH(_off, _sh) \
0021 .pll_switch_offs = _off, \
0022 .pll_switch_shift = _sh
0023
0024 #define BERLIN2_DIV_SELECT(_off, _sh) \
0025 .div_select_offs = _off, \
0026 .div_select_shift = _sh
0027
0028 #define BERLIN2_DIV_SWITCH(_off, _sh) \
0029 .div_switch_offs = _off, \
0030 .div_switch_shift = _sh
0031
0032 #define BERLIN2_DIV_D3SWITCH(_off, _sh) \
0033 .div3_switch_offs = _off, \
0034 .div3_switch_shift = _sh
0035
0036 #define BERLIN2_DIV_GATE(_off, _sh) \
0037 .gate_offs = _off, \
0038 .gate_shift = _sh
0039
0040 #define BERLIN2_SINGLE_DIV(_off) \
0041 BERLIN2_DIV_GATE(_off, 0), \
0042 BERLIN2_PLL_SELECT(_off, 1), \
0043 BERLIN2_PLL_SWITCH(_off, 4), \
0044 BERLIN2_DIV_SWITCH(_off, 5), \
0045 BERLIN2_DIV_D3SWITCH(_off, 6), \
0046 BERLIN2_DIV_SELECT(_off, 7)
0047
0048 struct berlin2_div_map {
0049 u16 pll_select_offs;
0050 u16 pll_switch_offs;
0051 u16 div_select_offs;
0052 u16 div_switch_offs;
0053 u16 div3_switch_offs;
0054 u16 gate_offs;
0055 u8 pll_select_shift;
0056 u8 pll_switch_shift;
0057 u8 div_select_shift;
0058 u8 div_switch_shift;
0059 u8 div3_switch_shift;
0060 u8 gate_shift;
0061 };
0062
0063 struct berlin2_div_data {
0064 const char *name;
0065 const u8 *parent_ids;
0066 int num_parents;
0067 unsigned long flags;
0068 struct berlin2_div_map map;
0069 u8 div_flags;
0070 };
0071
0072 struct clk_hw *
0073 berlin2_div_register(const struct berlin2_div_map *map,
0074 void __iomem *base, const char *name, u8 div_flags,
0075 const char **parent_names, int num_parents,
0076 unsigned long flags, spinlock_t *lock);
0077
0078 #endif