Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Jorge Ramirez-Ortiz | 7c75f7f | 2018-01-10 11:33:49 +0100 | [diff] [blame] | 2 | /* |
Jorge Ramirez-Ortiz | 7c75f7f | 2018-01-10 11:33:49 +0100 | [diff] [blame] | 3 | * (C) Copyright 2017 Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org> |
Jorge Ramirez-Ortiz | 7c75f7f | 2018-01-10 11:33:49 +0100 | [diff] [blame] | 4 | */ |
Konrad Dybcio | d993573 | 2023-11-07 12:41:01 +0000 | [diff] [blame^] | 5 | #ifndef _CLOCK_QCOM_H |
| 6 | #define _CLOCK_QCOM_H |
Jorge Ramirez-Ortiz | 7c75f7f | 2018-01-10 11:33:49 +0100 | [diff] [blame] | 7 | |
| 8 | #define CFG_CLK_SRC_CXO (0 << 8) |
| 9 | #define CFG_CLK_SRC_GPLL0 (1 << 8) |
Dzmitry Sankouski | 90496af | 2021-10-17 13:44:30 +0300 | [diff] [blame] | 10 | #define CFG_CLK_SRC_GPLL0_EVEN (6 << 8) |
Jorge Ramirez-Ortiz | 7c75f7f | 2018-01-10 11:33:49 +0100 | [diff] [blame] | 11 | #define CFG_CLK_SRC_MASK (7 << 8) |
| 12 | |
Ramon Fried | 640dc34 | 2018-05-16 12:13:39 +0300 | [diff] [blame] | 13 | struct pll_vote_clk { |
Jorge Ramirez-Ortiz | 7c75f7f | 2018-01-10 11:33:49 +0100 | [diff] [blame] | 14 | uintptr_t status; |
| 15 | int status_bit; |
| 16 | uintptr_t ena_vote; |
| 17 | int vote_bit; |
| 18 | }; |
| 19 | |
Ramon Fried | 640dc34 | 2018-05-16 12:13:39 +0300 | [diff] [blame] | 20 | struct vote_clk { |
| 21 | uintptr_t cbcr_reg; |
| 22 | uintptr_t ena_vote; |
| 23 | int vote_bit; |
| 24 | }; |
Jorge Ramirez-Ortiz | 7c75f7f | 2018-01-10 11:33:49 +0100 | [diff] [blame] | 25 | struct 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 Dybcio | d993573 | 2023-11-07 12:41:01 +0000 | [diff] [blame^] | 33 | struct qcom_reset_map { |
| 34 | unsigned int reg; |
| 35 | u8 bit; |
Jorge Ramirez-Ortiz | 7c75f7f | 2018-01-10 11:33:49 +0100 | [diff] [blame] | 36 | }; |
| 37 | |
Konrad Dybcio | d993573 | 2023-11-07 12:41:01 +0000 | [diff] [blame^] | 38 | struct msm_clk_data { |
| 39 | const struct qcom_reset_map *resets; |
| 40 | unsigned long num_resets; |
| 41 | }; |
| 42 | |
| 43 | struct msm_clk_priv { |
| 44 | phys_addr_t base; |
| 45 | struct msm_clk_data *data; |
| 46 | }; |
| 47 | |
| 48 | int qcom_cc_bind(struct udevice *parent); |
Ramon Fried | 640dc34 | 2018-05-16 12:13:39 +0300 | [diff] [blame] | 49 | void clk_enable_gpll0(phys_addr_t base, const struct pll_vote_clk *gpll0); |
Jorge Ramirez-Ortiz | 7c75f7f | 2018-01-10 11:33:49 +0100 | [diff] [blame] | 50 | void clk_bcr_update(phys_addr_t apps_cmd_rgcr); |
| 51 | void clk_enable_cbc(phys_addr_t cbcr); |
Ramon Fried | 640dc34 | 2018-05-16 12:13:39 +0300 | [diff] [blame] | 52 | void clk_enable_vote_clk(phys_addr_t base, const struct vote_clk *vclk); |
Jorge Ramirez-Ortiz | 7c75f7f | 2018-01-10 11:33:49 +0100 | [diff] [blame] | 53 | void clk_rcg_set_rate_mnd(phys_addr_t base, const struct bcr_regs *regs, |
| 54 | int div, int m, int n, int source); |
Sumit Garg | 22d3fcd | 2023-02-01 19:28:57 +0530 | [diff] [blame] | 55 | void clk_rcg_set_rate(phys_addr_t base, const struct bcr_regs *regs, int div, |
| 56 | int source); |
Jorge Ramirez-Ortiz | 7c75f7f | 2018-01-10 11:33:49 +0100 | [diff] [blame] | 57 | |
| 58 | #endif |