Add Broadcom's code for bcm63xx support
[project/bcm63xx/atf.git] / plat / bcm / include / clk_rst.h
1 /*
2 <:copyright-BRCM:2013:DUAL/GPL:standard
3
4 Copyright (c) 2013 Broadcom
5 All Rights Reserved
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License, version 2, as published by
9 the Free Software Foundation (the "GPL").
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16
17 A copy of the GPL is available at http://www.broadcom.com/licenses/GPLv2.php, or by
18 writing to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
20
21 :>
22 */
23
24 #ifndef CLK_RST_H
25 #define CLK_RST_H
26
27 #ifndef IS_BCMCHIP
28 #define IS_BCMCHIP(num) (defined(_BCM9##num##_)||defined(CONFIG_BCM9##num)||\
29 defined(CONFIG_BCM##num))
30 #endif
31
32 /* pll dividers */
33 struct PLL_DIVIDERS {
34 unsigned int pdiv;
35 unsigned int ndiv_int;
36 unsigned int ndiv_frac;
37 unsigned int ka;
38 unsigned int ki;
39 unsigned int kp;
40 };
41
42 int pll_vco_freq_set(unsigned int pll_addr, struct PLL_DIVIDERS *divs);
43 int pll_ch_freq_set(unsigned int pll_addr, unsigned int ch, unsigned int mdiv);
44 int pll_ch_freq_get(unsigned int pll_addr, unsigned int ch, unsigned int *freq);
45 int ddr_freq_set(unsigned long freq);
46 int viper_freq_set(unsigned long freq);
47 int rdp_freq_set(unsigned long freq);
48 unsigned long get_rdp_freq(unsigned int *rdp_freq);
49 #if IS_BCMCHIP(6858) || IS_BCMCHIP(6856) || IS_BCMCHIP(6878) || IS_BCMCHIP(6855)
50 int pll_vco_freq_get(unsigned int pll_addr, unsigned int *fvco);
51 int pll_ch_freq_vco_set(unsigned int pll_addr, unsigned int ch,
52 unsigned int mdiv, unsigned int use_vco);
53 #endif
54
55 #if IS_BCMCHIP(6855)
56 int pll_vco_config(unsigned int pll_addr, unsigned int ndivider, unsigned int pdivider);
57 #endif
58
59 void set_vreg_clk(void);
60
61 #if IS_BCMCHIP(6858)
62
63 typedef enum {
64 BCM_CPU_CLK_HIGH,
65 BCM_CPU_CLK_LOW
66 } BCM_CPU_CLK;
67
68 int bcm_change_cpu_clk(BCM_CPU_CLK clock);
69
70 #endif
71
72 #if IS_BCMCHIP(6858) || IS_BCMCHIP(6855)
73 #define XRDPPLL_RUNNER_CHANNEL 0
74 #endif
75 #if IS_BCMCHIP(6856) || IS_BCMCHIP(6846)
76 #define XRDPPLL_RUNNER_CHANNEL 1
77 #endif
78 #if IS_BCMCHIP(6878)
79 #define SYSPLL_RUNNER_CHANNEL 0
80 #endif
81 #if IS_BCMCHIP(63158)
82 /* TBD. Verify value. */
83 #define XRDPPLL_RUNNER_CHANNEL 1
84 #endif
85 #endif /* #ifndef CLK_RST_H */