blob: a9f895c2422e90f6fad820e383716e45be2dfe11 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Jorge Ramirez-Ortiz7c75f7f2018-01-10 11:33:49 +01002/*
Jorge Ramirez-Ortiz7c75f7f2018-01-10 11:33:49 +01003 * (C) Copyright 2017 Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Jorge Ramirez-Ortiz7c75f7f2018-01-10 11:33:49 +01004 */
Konrad Dybciod9935732023-11-07 12:41:01 +00005#ifndef _CLOCK_QCOM_H
6#define _CLOCK_QCOM_H
Jorge Ramirez-Ortiz7c75f7f2018-01-10 11:33:49 +01007
8#define CFG_CLK_SRC_CXO (0 << 8)
9#define CFG_CLK_SRC_GPLL0 (1 << 8)
Dzmitry Sankouski90496af2021-10-17 13:44:30 +030010#define CFG_CLK_SRC_GPLL0_EVEN (6 << 8)
Jorge Ramirez-Ortiz7c75f7f2018-01-10 11:33:49 +010011#define CFG_CLK_SRC_MASK (7 << 8)
12
Ramon Fried640dc342018-05-16 12:13:39 +030013struct pll_vote_clk {
Jorge Ramirez-Ortiz7c75f7f2018-01-10 11:33:49 +010014 uintptr_t status;
15 int status_bit;
16 uintptr_t ena_vote;
17 int vote_bit;
18};
19
Ramon Fried640dc342018-05-16 12:13:39 +030020struct vote_clk {
21 uintptr_t cbcr_reg;
22 uintptr_t ena_vote;
23 int vote_bit;
24};
Jorge Ramirez-Ortiz7c75f7f2018-01-10 11:33:49 +010025struct bcr_regs {
26 uintptr_t cfg_rcgr;
27 uintptr_t cmd_rcgr;
28 uintptr_t M;
29 uintptr_t N;
30 uintptr_t D;
31};
32
Konrad Dybciod9935732023-11-07 12:41:01 +000033struct qcom_reset_map {
34 unsigned int reg;
35 u8 bit;
Jorge Ramirez-Ortiz7c75f7f2018-01-10 11:33:49 +010036};
37
Konrad Dybciod9935732023-11-07 12:41:01 +000038struct msm_clk_data {
39 const struct qcom_reset_map *resets;
40 unsigned long num_resets;
41};
42
43struct msm_clk_priv {
44 phys_addr_t base;
45 struct msm_clk_data *data;
46};
47
48int qcom_cc_bind(struct udevice *parent);
Ramon Fried640dc342018-05-16 12:13:39 +030049void clk_enable_gpll0(phys_addr_t base, const struct pll_vote_clk *gpll0);
Jorge Ramirez-Ortiz7c75f7f2018-01-10 11:33:49 +010050void clk_bcr_update(phys_addr_t apps_cmd_rgcr);
51void clk_enable_cbc(phys_addr_t cbcr);
Ramon Fried640dc342018-05-16 12:13:39 +030052void clk_enable_vote_clk(phys_addr_t base, const struct vote_clk *vclk);
Jorge Ramirez-Ortiz7c75f7f2018-01-10 11:33:49 +010053void clk_rcg_set_rate_mnd(phys_addr_t base, const struct bcr_regs *regs,
54 int div, int m, int n, int source);
Sumit Garg22d3fcd2023-02-01 19:28:57 +053055void clk_rcg_set_rate(phys_addr_t base, const struct bcr_regs *regs, int div,
56 int source);
Jorge Ramirez-Ortiz7c75f7f2018-01-10 11:33:49 +010057
58#endif