summaryrefslogtreecommitdiff
path: root/include/soc/qcom/clock-alpha-pll.h
blob: b5a34b4cecb504c13700198ad5995b253e6a76d6 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
 * Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef __ARCH_ARM_MACH_MSM_CLOCK_ALPHA_PLL_H
#define __ARCH_ARM_MACH_MSM_CLOCK_ALPHA_PLL_H

#include <linux/spinlock.h>
#include <linux/clk/msm-clk-provider.h>

struct alpha_pll_masks {
	u32 lock_mask;		/* lock_det bit */
	u32 active_mask;	/* active_flag in FSM mode */
	u32 update_mask;	/* update bit for dynamic update */
	u32 vco_mask;		/* vco_sel bits */
	u32 vco_shift;
	u32 alpha_en_mask;	/* alpha_en bit */
	u32 output_mask;	/* pllout_* bits */
	u32 post_div_mask;

	u32 test_ctl_lo_mask;
	u32 test_ctl_hi_mask;
};

struct alpha_pll_vco_tbl {
	u32 vco_val;
	unsigned long min_freq;
	unsigned long max_freq;
};

#define VCO(a, b, c) { \
	.vco_val = a,\
	.min_freq = b,\
	.max_freq = c,\
}

struct alpha_pll_clk {
	struct alpha_pll_masks *masks;
	void *const __iomem *base;
	u32 offset;

	/* if fsm_en_mask is set, config PLL to FSM mode */
	u32 fsm_reg_offset;
	u32 fsm_en_mask;

	u32 enable_config;	/* bitmask of outputs to be enabled */
	u32 post_div_config;	/* masked post divider setting */
	u32 config_ctl_val;	/* config register init value */
	u32 test_ctl_lo_val;	/* test control settings */
	u32 test_ctl_hi_val;

	struct alpha_pll_vco_tbl *vco_tbl;
	u32 num_vco;
	u32 current_vco_val;
	bool inited;
	bool slew;
	bool no_prepared_reconfig;

	/*
	 * Some chipsets need the offline request bit to be
	 * cleared on a second write to the register, even though
	 * SW wants the bit to be set. Set this flag to indicate
	 * that the workaround is required.
	 */
	bool offline_bit_workaround;
	bool is_fabia;
	unsigned long min_supported_freq;
	struct clk c;
};

static inline struct alpha_pll_clk *to_alpha_pll_clk(struct clk *c)
{
	return container_of(c, struct alpha_pll_clk, c);
}


#endif
extern void __init_alpha_pll(struct clk *c);
extern struct clk_ops clk_ops_alpha_pll;
extern struct clk_ops clk_ops_alpha_pll_hwfsm;
extern struct clk_ops clk_ops_fixed_alpha_pll;
extern struct clk_ops clk_ops_dyna_alpha_pll;
extern struct clk_ops clk_ops_fixed_fabia_alpha_pll;
extern struct clk_ops clk_ops_fabia_alpha_pll;