4 #ifndef __IPQ40XX_CLOCK_H_
5 #define __IPQ40XX_CLOCK_H_
11 #define UART_DM_CLK_RX_TX_BIT_RATE 0xFF
15 #define Uart_ns_val NS(BIT_POS_31, BIT_POS_16, N_VALUE, M_VALUE, \
17 #define Uart_clk_ns_mask (BM(BIT_POS_31, BIT_POS_16) | \
18 BM(BIT_POS_6, BIT_POS_0))
19 #define Uart_mnd_en_mask (BIT(8) * !!(625))
20 #define Uart_en_mask BIT(11)
21 #define MD16(m, n) (BVAL(BIT_POS_31, BIT_POS_16, m) | \
22 BVAL(BIT_POS_15, BIT_POS_0, ~(n)))
23 #define Uart_ns_val_rumi NS(BIT_POS_31, BIT_POS_16, N_VALUE, M_VALUE, \
25 #define GSBIn_UART_APPS_MD_REG(n) REG(0x29D0+(0x20*((n)-1)))
26 #define GSBIn_UART_APPS_NS_REG(n) REG(0x29D4+(0x20*((n)-1)))
27 #define GSBIn_HCLK_CTL_REG(n) REG(0x29C0+(0x20*((n)-1)))
28 #define BB_PLL_ENA_SC0_REG REG(0x34C0)
29 #define BB_PLL8_STATUS_REG REG(0x3158)
30 #define REG(off) ((void *)(MSM_CLK_CTL_BASE + (off)))
31 #define PLL8_STATUS_BIT 16
33 #define PLL_LOCK_DET_STATUS_REG REG(0x03420)
34 #define SFAB_AHB_S3_FCLK_CTL_REG REG(0x0216C)
35 #define CFPB_CLK_NS_REG REG(0x0264C)
36 #define CFPB0_HCLK_CTL_REG REG(0x02650)
37 #define SFAB_CFPB_S_HCLK_CTL_REG REG(0x026C0)
38 #define CFPB_SPLITTER_HCLK_CTL_REG REG(0x026E0)
39 #define EBI2_CLK_CTL_REG REG(0x03B00)
41 #define USB30_MASTER_CLK_CTL_REG REG(0x3b24)
42 #define USB30_MASTER_CLK_MD REG(0x3b28)
43 #define USB30_MASTER_CLK_NS REG(0x3b2c)
44 #define USB30_1_MASTER_CLK_CTL_REG REG(0x3b34)
45 #define USB30_MOC_UTMI_CLK_MD REG(0x3b40)
46 #define USB30_MOC_UTMI_CLK_NS REG(0x3b44)
47 #define USB30_MOC_UTMI_CLK_CTL REG(0x3b48)
48 #define USB30_1_MOC_UTMI_CLK_CTL REG(0x3b4c)
49 #define USB30_RESET REG(0x3b50)
51 #define ALWAYS_ON_CLK_BRANCH_ENA(i) ((i) << 8)
53 #define CLK_BRANCH_ENA_MASK 0x00000010
54 #define CLK_BRANCH_ENA_ENABLE 0x00000010
55 #define CLK_BRANCH_ENA_DISABLE 0x00000000
56 #define CLK_BRANCH_ENA(i) ((i) << 4)
59 #define CLK_DIV_MASK 0x00000003
60 #define CLK_DIV_DIV_1 0x00000000
61 #define CLK_DIV_DIV_2 0x00000001
62 #define CLK_DIV_DIV_3 0x00000002
63 #define CLK_DIV_DIV_4 0x00000003
64 #define CLK_DIV(i) ((i) << 0)
66 #define MN_MODE_DUAL_EDGE 0x2
73 #define BM(m, l) (((((unsigned int)-1) << (31-m)) >> (31-m+l)) << l)
74 #define BVAL(m, l, val) (((val) << l) & BM(m, l))
77 #define MD4(m_lsb, m, n_lsb, n) \
78 (BVAL((m_lsb+3), m_lsb, m) | BVAL((n_lsb+3), n_lsb, ~(n)))
80 #define MD8(m_lsb, m, n_lsb, n) \
81 (BVAL((m_lsb+7), m_lsb, m) | BVAL((n_lsb+7), n_lsb, ~(n)))
84 #define NS(n_msb, n_lsb, n, m, mde_lsb, d_msb, d_lsb, d, s_msb, s_lsb, s) \
85 (BVAL(n_msb, n_lsb, ~(n-m)) \
86 | (BVAL((mde_lsb+1), mde_lsb, MN_MODE_DUAL_EDGE) * !!(n)) \
87 | BVAL(d_msb, d_lsb, (d-1)) | BVAL(s_msb, s_lsb, s))
89 #define NS_MM(n_msb, n_lsb, n, m, d_msb, d_lsb, d, s_msb, s_lsb, s) \
90 (BVAL(n_msb, n_lsb, ~(n-m)) | BVAL(d_msb, d_lsb, (d-1)) \
91 | BVAL(s_msb, s_lsb, s))
93 #define NS_DIVSRC(d_msb , d_lsb, d, s_msb, s_lsb, s) \
94 (BVAL(d_msb, d_lsb, (d-1)) | BVAL(s_msb, s_lsb, s))
96 #define NS_DIV(d_msb , d_lsb, d) \
97 BVAL(d_msb, d_lsb, (d-1))
99 #define NS_SRC_SEL(s_msb, s_lsb, s) \
100 BVAL(s_msb, s_lsb, s)
102 #define GMAC_AHB_RESET 0x903E24
104 #define SRC_SEL_PLL0 (0x2 << 0)
105 #define MNCNTR_MODE_DUAL_EDGE (0x2 << 5)
106 #define MNCNTR_ENABLE (0x1 << 8)
107 #define MNCNTR_RST_ACTIVE (0x1 << 7)
110 #define GMAC_CORE_RESET(n) \
111 ((void *)(0x903CBC + ((n) * 0x20)))
113 #define GMACSEC_CORE_RESET(n) \
114 ((void *)(0x903E28 + ((n - 1) * 4)))
116 #define GMAC_COREn_CLCK_SRC_CTL(N) \
117 (0x00900000 + (0x3CA0 + (32*(N-1))))
119 #define GMAC_COREn_CLCK_SRC0_MD(N) \
120 (0x00900000 + (0x3CA4 + (32*(N-1))))
122 #define GMAC_COREn_CLCK_SRC1_MD(N) \
123 (0x00900000 + (0x3CA8 + (32*(N-1))))
125 #define GMAC_COREn_CLCK_SRC0_NS(N) \
126 (0x00900000 + (0x3CAC + (32*(N-1))))
128 #define GMAC_COREn_CLCK_SRC1_NS(N) \
129 (0x00900000 + (0x3CB0 + (32*(N-1))))
131 #define DISABLE_DUAL_MN8_SEL (0)
132 #define DISABLE_CLK_LOW_PWR (0 << 2)
133 #define GMAC_CORE_CLCK_ROOT_ENABLE (1 << 1)
136 #define GMAC_CORE_CLCK_M 0x32
137 #define GMAC_CORE_CLCK_D 0
138 #define GMAC_CORE_CLCK_M_SHIFT 16
139 #define GMAC_CORE_CLCK_D_SHIFT 0
140 #define GMAC_CORE_CLCK_M_VAL \
141 (GMAC_CORE_CLCK_M << GMAC_CORE_CLCK_M_SHIFT)
142 #define GMAC_CORE_CLCK_D_VAL \
143 (GMAC_CORE_CLCK_D << GMAC_CORE_CLCK_D_SHIFT)
146 #define GMAC_CORE_CLCK_N 0x4
147 #define GMAC_CORE_CLCK_N_SHIFT 16
148 #define GMAC_CORE_CLCK_N_VAL \
149 (GMAC_CORE_CLCK_N << GMAC_CORE_CLCK_N_SHIFT)
151 #define GMAC_CORE_CLCK_MNCNTR_EN 0x00000100
153 #define GMAC_CORE_CLCK_MNCNTR_RST 0x00000080
155 #define GMAC_CORE_CLCK_MNCNTR_MODE_MASK 0x00000060
156 #define GMAC_CORE_CLCK_MNCNTR_MODE_SHIFT 5
158 #define GMAC_CORE_CLCK_MNCNTR_MODE_DUAL \
159 (2 << GMAC_CORE_CLCK_MNCNTR_MODE_SHIFT)
161 #define GMAC_CORE_CLCK_PRE_DIV_SEL_MASK 0x00000018
162 #define GMAC_CORE_CLCK_PRE_DIV_SEL_SHIFT 3
164 #define GMAC_CORE_CLCK_PRE_DIV_SEL_BYP \
165 (0 << GMAC_CORE_CLCK_PRE_DIV_SEL_SHIFT)
167 #define GMAC_CORE_CLCK_SRC_SEL_MASK 0x00000007
168 #define GMAC_CORE_CLCK_SRC_SEL_SHIFT 0
170 #define GMAC_CORE_CLCK_SRC_SEL_PLL0 \
171 (2 << GMAC_CORE_CLCK_SRC_SEL_SHIFT)
172 #define GMAC_COREn_CLCK_CTL(N) \
173 (0x00900000 + (0x3CB4 + (32*(N-1))))
175 #define GMAC_COREn_CLCK_INV_DISABLE (0 << 5)
176 #define GMAC_COREn_CLCK_BRANCH_ENA (1 << 4)
int blsp_i2c_clock_config(blsp_qup_id_t id)
void nand_clock_config(void)
nand_clock_config - configure NAND controller clocks
int audio_clock_config(unsigned int frequency)
void uart_clock_config(unsigned int blsp_uart, unsigned int m, unsigned int n, unsigned int d)
uart_clock_config - configures UART clocks
void uart_pll_vote_clk_enable(unsigned int)
uart_pll_vote_clk_enable - enables PLL8
void usb_clock_config(void)
usb_clock_config - configure USB controller clocks and reset the controller
#define m(clkreg, src_bits, pmcreg, dst_bits)