Sumit Garg | e6a488b | 2022-07-12 12:42:11 +0530 | [diff] [blame] | 1 | // SPDX-License-Identifier: BSD-3-Clause |
| 2 | /* |
| 3 | * Clock drivers for Qualcomm QCS404 |
| 4 | * |
| 5 | * (C) Copyright 2022 Sumit Garg <sumit.garg@linaro.org> |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <clk-uclass.h> |
| 10 | #include <dm.h> |
| 11 | #include <errno.h> |
| 12 | #include <asm/io.h> |
| 13 | #include <linux/bitops.h> |
Konrad Dybcio | 6c0b844 | 2023-11-07 12:41:01 +0000 | [diff] [blame] | 14 | #include <dt-bindings/clock/qcom,gcc-qcs404.h> |
| 15 | |
Caleb Connolly | 878b26a | 2023-11-07 12:40:59 +0000 | [diff] [blame] | 16 | #include "clock-qcom.h" |
Sumit Garg | e6a488b | 2022-07-12 12:42:11 +0530 | [diff] [blame] | 17 | |
Caleb Connolly | 10a0abb | 2023-11-07 12:41:03 +0000 | [diff] [blame] | 18 | /* Clocks: (from CLK_CTL_BASE) */ |
| 19 | #define GPLL0_STATUS (0x21000) |
| 20 | #define GPLL1_STATUS (0x20000) |
| 21 | #define APCS_GPLL_ENA_VOTE (0x45000) |
| 22 | #define APCS_CLOCK_BRANCH_ENA_VOTE (0x45004) |
| 23 | |
| 24 | /* BLSP1 AHB clock (root clock for BLSP) */ |
| 25 | #define BLSP1_AHB_CBCR 0x1008 |
| 26 | |
| 27 | /* Uart clock control registers */ |
| 28 | #define BLSP1_UART2_BCR (0x3028) |
| 29 | #define BLSP1_UART2_APPS_CBCR (0x302C) |
| 30 | #define BLSP1_UART2_APPS_CMD_RCGR (0x3034) |
| 31 | #define BLSP1_UART2_APPS_CFG_RCGR (0x3038) |
| 32 | #define BLSP1_UART2_APPS_M (0x303C) |
| 33 | #define BLSP1_UART2_APPS_N (0x3040) |
| 34 | #define BLSP1_UART2_APPS_D (0x3044) |
| 35 | |
| 36 | /* I2C controller clock control registerss */ |
| 37 | #define BLSP1_QUP0_I2C_APPS_CBCR (0x6028) |
| 38 | #define BLSP1_QUP0_I2C_APPS_CMD_RCGR (0x602C) |
| 39 | #define BLSP1_QUP0_I2C_APPS_CFG_RCGR (0x6030) |
| 40 | #define BLSP1_QUP1_I2C_APPS_CBCR (0x2008) |
| 41 | #define BLSP1_QUP1_I2C_APPS_CMD_RCGR (0x200C) |
| 42 | #define BLSP1_QUP1_I2C_APPS_CFG_RCGR (0x2010) |
| 43 | #define BLSP1_QUP2_I2C_APPS_CBCR (0x3010) |
| 44 | #define BLSP1_QUP2_I2C_APPS_CMD_RCGR (0x3000) |
| 45 | #define BLSP1_QUP2_I2C_APPS_CFG_RCGR (0x3004) |
| 46 | #define BLSP1_QUP3_I2C_APPS_CBCR (0x4020) |
| 47 | #define BLSP1_QUP3_I2C_APPS_CMD_RCGR (0x4000) |
| 48 | #define BLSP1_QUP3_I2C_APPS_CFG_RCGR (0x4004) |
| 49 | #define BLSP1_QUP4_I2C_APPS_CBCR (0x5020) |
| 50 | #define BLSP1_QUP4_I2C_APPS_CMD_RCGR (0x5000) |
| 51 | #define BLSP1_QUP4_I2C_APPS_CFG_RCGR (0x5004) |
| 52 | |
| 53 | /* SD controller clock control registers */ |
| 54 | #define SDCC_BCR(n) (((n) * 0x1000) + 0x41000) |
| 55 | #define SDCC_CMD_RCGR(n) (((n) * 0x1000) + 0x41004) |
| 56 | #define SDCC_CFG_RCGR(n) (((n) * 0x1000) + 0x41008) |
| 57 | #define SDCC_M(n) (((n) * 0x1000) + 0x4100C) |
| 58 | #define SDCC_N(n) (((n) * 0x1000) + 0x41010) |
| 59 | #define SDCC_D(n) (((n) * 0x1000) + 0x41014) |
| 60 | #define SDCC_APPS_CBCR(n) (((n) * 0x1000) + 0x41018) |
| 61 | #define SDCC_AHB_CBCR(n) (((n) * 0x1000) + 0x4101C) |
| 62 | |
| 63 | /* USB-3.0 controller clock control registers */ |
| 64 | #define SYS_NOC_USB3_CBCR (0x26014) |
| 65 | #define USB30_BCR (0x39000) |
| 66 | #define USB3PHY_BCR (0x39008) |
| 67 | #define USB30_MASTER_CBCR (0x3900C) |
| 68 | #define USB30_SLEEP_CBCR (0x39010) |
| 69 | #define USB30_MOCK_UTMI_CBCR (0x39014) |
| 70 | #define USB30_MOCK_UTMI_CMD_RCGR (0x3901C) |
| 71 | #define USB30_MOCK_UTMI_CFG_RCGR (0x39020) |
| 72 | #define USB30_MASTER_CMD_RCGR (0x39028) |
| 73 | #define USB30_MASTER_CFG_RCGR (0x3902C) |
| 74 | #define USB30_MASTER_M (0x39030) |
| 75 | #define USB30_MASTER_N (0x39034) |
| 76 | #define USB30_MASTER_D (0x39038) |
| 77 | #define USB2A_PHY_SLEEP_CBCR (0x4102C) |
| 78 | #define USB_HS_PHY_CFG_AHB_CBCR (0x41030) |
| 79 | |
| 80 | /* ETH controller clock control registers */ |
| 81 | #define ETH_PTP_CBCR (0x4e004) |
| 82 | #define ETH_RGMII_CBCR (0x4e008) |
| 83 | #define ETH_SLAVE_AHB_CBCR (0x4e00c) |
| 84 | #define ETH_AXI_CBCR (0x4e010) |
| 85 | #define EMAC_PTP_CMD_RCGR (0x4e014) |
| 86 | #define EMAC_PTP_CFG_RCGR (0x4e018) |
| 87 | #define EMAC_CMD_RCGR (0x4e01c) |
| 88 | #define EMAC_CFG_RCGR (0x4e020) |
| 89 | #define EMAC_M (0x4e024) |
| 90 | #define EMAC_N (0x4e028) |
| 91 | #define EMAC_D (0x4e02c) |
| 92 | |
Sumit Garg | e6a488b | 2022-07-12 12:42:11 +0530 | [diff] [blame] | 93 | |
| 94 | /* GPLL0 clock control registers */ |
| 95 | #define GPLL0_STATUS_ACTIVE BIT(31) |
| 96 | |
Sumit Garg | e9e6234 | 2023-02-01 19:28:50 +0530 | [diff] [blame] | 97 | #define CFG_CLK_SRC_GPLL1 BIT(8) |
| 98 | #define GPLL1_STATUS_ACTIVE BIT(31) |
| 99 | |
Sumit Garg | e6a488b | 2022-07-12 12:42:11 +0530 | [diff] [blame] | 100 | static struct vote_clk gcc_blsp1_ahb_clk = { |
| 101 | .cbcr_reg = BLSP1_AHB_CBCR, |
| 102 | .ena_vote = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 103 | .vote_bit = BIT(10) | BIT(5) | BIT(4), |
| 104 | }; |
| 105 | |
| 106 | static const struct bcr_regs uart2_regs = { |
| 107 | .cfg_rcgr = BLSP1_UART2_APPS_CFG_RCGR, |
| 108 | .cmd_rcgr = BLSP1_UART2_APPS_CMD_RCGR, |
| 109 | .M = BLSP1_UART2_APPS_M, |
| 110 | .N = BLSP1_UART2_APPS_N, |
| 111 | .D = BLSP1_UART2_APPS_D, |
| 112 | }; |
| 113 | |
| 114 | static const struct bcr_regs sdc_regs = { |
| 115 | .cfg_rcgr = SDCC_CFG_RCGR(1), |
| 116 | .cmd_rcgr = SDCC_CMD_RCGR(1), |
| 117 | .M = SDCC_M(1), |
| 118 | .N = SDCC_N(1), |
| 119 | .D = SDCC_D(1), |
| 120 | }; |
| 121 | |
| 122 | static struct pll_vote_clk gpll0_vote_clk = { |
| 123 | .status = GPLL0_STATUS, |
| 124 | .status_bit = GPLL0_STATUS_ACTIVE, |
| 125 | .ena_vote = APCS_GPLL_ENA_VOTE, |
| 126 | .vote_bit = BIT(0), |
| 127 | }; |
| 128 | |
Sumit Garg | e9e6234 | 2023-02-01 19:28:50 +0530 | [diff] [blame] | 129 | static struct pll_vote_clk gpll1_vote_clk = { |
| 130 | .status = GPLL1_STATUS, |
| 131 | .status_bit = GPLL1_STATUS_ACTIVE, |
| 132 | .ena_vote = APCS_GPLL_ENA_VOTE, |
| 133 | .vote_bit = BIT(1), |
| 134 | }; |
| 135 | |
Sumit Garg | 3018e52 | 2022-08-04 19:57:15 +0530 | [diff] [blame] | 136 | static const struct bcr_regs usb30_master_regs = { |
| 137 | .cfg_rcgr = USB30_MASTER_CFG_RCGR, |
| 138 | .cmd_rcgr = USB30_MASTER_CMD_RCGR, |
| 139 | .M = USB30_MASTER_M, |
| 140 | .N = USB30_MASTER_N, |
| 141 | .D = USB30_MASTER_D, |
| 142 | }; |
| 143 | |
Sumit Garg | e9e6234 | 2023-02-01 19:28:50 +0530 | [diff] [blame] | 144 | static const struct bcr_regs emac_regs = { |
| 145 | .cfg_rcgr = EMAC_CFG_RCGR, |
| 146 | .cmd_rcgr = EMAC_CMD_RCGR, |
| 147 | .M = EMAC_M, |
| 148 | .N = EMAC_N, |
| 149 | .D = EMAC_D, |
| 150 | }; |
| 151 | |
| 152 | static const struct bcr_regs emac_ptp_regs = { |
| 153 | .cfg_rcgr = EMAC_PTP_CFG_RCGR, |
| 154 | .cmd_rcgr = EMAC_PTP_CMD_RCGR, |
| 155 | .M = EMAC_M, |
| 156 | .N = EMAC_N, |
| 157 | .D = EMAC_D, |
| 158 | }; |
| 159 | |
Sumit Garg | 89e0dff | 2023-02-13 10:19:09 +0530 | [diff] [blame] | 160 | static const struct bcr_regs blsp1_qup0_i2c_apps_regs = { |
| 161 | .cmd_rcgr = BLSP1_QUP0_I2C_APPS_CMD_RCGR, |
| 162 | .cfg_rcgr = BLSP1_QUP0_I2C_APPS_CFG_RCGR, |
| 163 | /* mnd_width = 0 */ |
| 164 | }; |
| 165 | |
| 166 | static const struct bcr_regs blsp1_qup1_i2c_apps_regs = { |
| 167 | .cmd_rcgr = BLSP1_QUP1_I2C_APPS_CMD_RCGR, |
| 168 | .cfg_rcgr = BLSP1_QUP1_I2C_APPS_CFG_RCGR, |
| 169 | /* mnd_width = 0 */ |
| 170 | }; |
| 171 | |
| 172 | static const struct bcr_regs blsp1_qup2_i2c_apps_regs = { |
| 173 | .cmd_rcgr = BLSP1_QUP2_I2C_APPS_CMD_RCGR, |
| 174 | .cfg_rcgr = BLSP1_QUP2_I2C_APPS_CFG_RCGR, |
| 175 | /* mnd_width = 0 */ |
| 176 | }; |
| 177 | |
| 178 | static const struct bcr_regs blsp1_qup3_i2c_apps_regs = { |
| 179 | .cmd_rcgr = BLSP1_QUP3_I2C_APPS_CMD_RCGR, |
| 180 | .cfg_rcgr = BLSP1_QUP3_I2C_APPS_CFG_RCGR, |
| 181 | /* mnd_width = 0 */ |
| 182 | }; |
| 183 | |
| 184 | static const struct bcr_regs blsp1_qup4_i2c_apps_regs = { |
| 185 | .cmd_rcgr = BLSP1_QUP4_I2C_APPS_CMD_RCGR, |
| 186 | .cfg_rcgr = BLSP1_QUP4_I2C_APPS_CFG_RCGR, |
| 187 | /* mnd_width = 0 */ |
| 188 | }; |
| 189 | |
Caleb Connolly | 10a0abb | 2023-11-07 12:41:03 +0000 | [diff] [blame] | 190 | static ulong qcs404_clk_set_rate(struct clk *clk, ulong rate) |
Sumit Garg | e6a488b | 2022-07-12 12:42:11 +0530 | [diff] [blame] | 191 | { |
| 192 | struct msm_clk_priv *priv = dev_get_priv(clk->dev); |
| 193 | |
| 194 | switch (clk->id) { |
| 195 | case GCC_BLSP1_UART2_APPS_CLK: |
Caleb Connolly | d718e3e | 2024-02-26 17:26:10 +0000 | [diff] [blame] | 196 | /* UART: 1843200Hz for a fixed 115200 baudrate (19200000 * (12/125)) */ |
Sumit Garg | e6a488b | 2022-07-12 12:42:11 +0530 | [diff] [blame] | 197 | clk_rcg_set_rate_mnd(priv->base, &uart2_regs, 0, 12, 125, |
Caleb Connolly | fbacc67 | 2023-11-07 12:41:04 +0000 | [diff] [blame] | 198 | CFG_CLK_SRC_CXO, 16); |
Sumit Garg | e6a488b | 2022-07-12 12:42:11 +0530 | [diff] [blame] | 199 | clk_enable_cbc(priv->base + BLSP1_UART2_APPS_CBCR); |
Caleb Connolly | d718e3e | 2024-02-26 17:26:10 +0000 | [diff] [blame] | 200 | return 1843200; |
Sumit Garg | e6a488b | 2022-07-12 12:42:11 +0530 | [diff] [blame] | 201 | case GCC_SDCC1_APPS_CLK: |
| 202 | /* SDCC1: 200MHz */ |
Caleb Connolly | 397c84f | 2023-11-07 12:41:05 +0000 | [diff] [blame] | 203 | clk_rcg_set_rate_mnd(priv->base, &sdc_regs, 7, 0, 0, |
Caleb Connolly | fbacc67 | 2023-11-07 12:41:04 +0000 | [diff] [blame] | 204 | CFG_CLK_SRC_GPLL0, 8); |
Sumit Garg | e6a488b | 2022-07-12 12:42:11 +0530 | [diff] [blame] | 205 | clk_enable_gpll0(priv->base, &gpll0_vote_clk); |
| 206 | clk_enable_cbc(priv->base + SDCC_APPS_CBCR(1)); |
Caleb Connolly | d718e3e | 2024-02-26 17:26:10 +0000 | [diff] [blame] | 207 | return rate; |
Sumit Garg | e9e6234 | 2023-02-01 19:28:50 +0530 | [diff] [blame] | 208 | case GCC_ETH_RGMII_CLK: |
| 209 | if (rate == 250000000) |
Caleb Connolly | 397c84f | 2023-11-07 12:41:05 +0000 | [diff] [blame] | 210 | clk_rcg_set_rate_mnd(priv->base, &emac_regs, 3, 0, 0, |
Caleb Connolly | fbacc67 | 2023-11-07 12:41:04 +0000 | [diff] [blame] | 211 | CFG_CLK_SRC_GPLL1, 8); |
Sumit Garg | e9e6234 | 2023-02-01 19:28:50 +0530 | [diff] [blame] | 212 | else if (rate == 125000000) |
Caleb Connolly | 397c84f | 2023-11-07 12:41:05 +0000 | [diff] [blame] | 213 | clk_rcg_set_rate_mnd(priv->base, &emac_regs, 7, 0, 0, |
Caleb Connolly | fbacc67 | 2023-11-07 12:41:04 +0000 | [diff] [blame] | 214 | CFG_CLK_SRC_GPLL1, 8); |
Sumit Garg | e9e6234 | 2023-02-01 19:28:50 +0530 | [diff] [blame] | 215 | else if (rate == 50000000) |
Caleb Connolly | 397c84f | 2023-11-07 12:41:05 +0000 | [diff] [blame] | 216 | clk_rcg_set_rate_mnd(priv->base, &emac_regs, 19, 0, 0, |
Caleb Connolly | fbacc67 | 2023-11-07 12:41:04 +0000 | [diff] [blame] | 217 | CFG_CLK_SRC_GPLL1, 8); |
Sumit Garg | e9e6234 | 2023-02-01 19:28:50 +0530 | [diff] [blame] | 218 | else if (rate == 5000000) |
Caleb Connolly | 397c84f | 2023-11-07 12:41:05 +0000 | [diff] [blame] | 219 | clk_rcg_set_rate_mnd(priv->base, &emac_regs, 3, 1, 50, |
Caleb Connolly | fbacc67 | 2023-11-07 12:41:04 +0000 | [diff] [blame] | 220 | CFG_CLK_SRC_GPLL1, 8); |
Caleb Connolly | d718e3e | 2024-02-26 17:26:10 +0000 | [diff] [blame] | 221 | return rate; |
Sumit Garg | e6a488b | 2022-07-12 12:42:11 +0530 | [diff] [blame] | 222 | } |
| 223 | |
Caleb Connolly | d718e3e | 2024-02-26 17:26:10 +0000 | [diff] [blame] | 224 | /* There is a bug only seeming to affect this board where the MMC driver somehow calls |
| 225 | * clk_set_rate() on a clock with id 0 which is associated with the qcom_clk device. |
| 226 | * The only clock with ID 0 is the xo_board clock which should not be associated with |
| 227 | * this device... |
| 228 | */ |
| 229 | log_debug("Unknown clock id %ld\n", clk->id); |
Sumit Garg | e6a488b | 2022-07-12 12:42:11 +0530 | [diff] [blame] | 230 | return 0; |
| 231 | } |
Sumit Garg | 1d1ca6e | 2022-08-04 19:57:14 +0530 | [diff] [blame] | 232 | |
Caleb Connolly | 10a0abb | 2023-11-07 12:41:03 +0000 | [diff] [blame] | 233 | static int qcs404_clk_enable(struct clk *clk) |
Sumit Garg | 1d1ca6e | 2022-08-04 19:57:14 +0530 | [diff] [blame] | 234 | { |
Sumit Garg | 3018e52 | 2022-08-04 19:57:15 +0530 | [diff] [blame] | 235 | struct msm_clk_priv *priv = dev_get_priv(clk->dev); |
| 236 | |
| 237 | switch (clk->id) { |
| 238 | case GCC_USB30_MASTER_CLK: |
| 239 | clk_enable_cbc(priv->base + USB30_MASTER_CBCR); |
Caleb Connolly | 397c84f | 2023-11-07 12:41:05 +0000 | [diff] [blame] | 240 | clk_rcg_set_rate_mnd(priv->base, &usb30_master_regs, 7, 0, 0, |
Caleb Connolly | fbacc67 | 2023-11-07 12:41:04 +0000 | [diff] [blame] | 241 | CFG_CLK_SRC_GPLL0, 8); |
Sumit Garg | 3018e52 | 2022-08-04 19:57:15 +0530 | [diff] [blame] | 242 | break; |
| 243 | case GCC_SYS_NOC_USB3_CLK: |
| 244 | clk_enable_cbc(priv->base + SYS_NOC_USB3_CBCR); |
| 245 | break; |
| 246 | case GCC_USB30_SLEEP_CLK: |
| 247 | clk_enable_cbc(priv->base + USB30_SLEEP_CBCR); |
| 248 | break; |
| 249 | case GCC_USB30_MOCK_UTMI_CLK: |
| 250 | clk_enable_cbc(priv->base + USB30_MOCK_UTMI_CBCR); |
| 251 | break; |
| 252 | case GCC_USB_HS_PHY_CFG_AHB_CLK: |
| 253 | clk_enable_cbc(priv->base + USB_HS_PHY_CFG_AHB_CBCR); |
| 254 | break; |
| 255 | case GCC_USB2A_PHY_SLEEP_CLK: |
| 256 | clk_enable_cbc(priv->base + USB_HS_PHY_CFG_AHB_CBCR); |
| 257 | break; |
Sumit Garg | e9e6234 | 2023-02-01 19:28:50 +0530 | [diff] [blame] | 258 | case GCC_ETH_PTP_CLK: |
| 259 | /* SPEED_1000: freq -> 250MHz */ |
| 260 | clk_enable_cbc(priv->base + ETH_PTP_CBCR); |
| 261 | clk_enable_gpll0(priv->base, &gpll1_vote_clk); |
Caleb Connolly | 397c84f | 2023-11-07 12:41:05 +0000 | [diff] [blame] | 262 | clk_rcg_set_rate_mnd(priv->base, &emac_ptp_regs, 3, 0, 0, |
Caleb Connolly | fbacc67 | 2023-11-07 12:41:04 +0000 | [diff] [blame] | 263 | CFG_CLK_SRC_GPLL1, 8); |
Sumit Garg | e9e6234 | 2023-02-01 19:28:50 +0530 | [diff] [blame] | 264 | break; |
| 265 | case GCC_ETH_RGMII_CLK: |
| 266 | /* SPEED_1000: freq -> 250MHz */ |
| 267 | clk_enable_cbc(priv->base + ETH_RGMII_CBCR); |
| 268 | clk_enable_gpll0(priv->base, &gpll1_vote_clk); |
Caleb Connolly | 397c84f | 2023-11-07 12:41:05 +0000 | [diff] [blame] | 269 | clk_rcg_set_rate_mnd(priv->base, &emac_regs, 3, 0, 0, |
Caleb Connolly | fbacc67 | 2023-11-07 12:41:04 +0000 | [diff] [blame] | 270 | CFG_CLK_SRC_GPLL1, 8); |
Sumit Garg | e9e6234 | 2023-02-01 19:28:50 +0530 | [diff] [blame] | 271 | break; |
| 272 | case GCC_ETH_SLAVE_AHB_CLK: |
| 273 | clk_enable_cbc(priv->base + ETH_SLAVE_AHB_CBCR); |
| 274 | break; |
| 275 | case GCC_ETH_AXI_CLK: |
| 276 | clk_enable_cbc(priv->base + ETH_AXI_CBCR); |
| 277 | break; |
Sumit Garg | 89e0dff | 2023-02-13 10:19:09 +0530 | [diff] [blame] | 278 | case GCC_BLSP1_AHB_CLK: |
| 279 | clk_enable_vote_clk(priv->base, &gcc_blsp1_ahb_clk); |
| 280 | break; |
| 281 | case GCC_BLSP1_QUP0_I2C_APPS_CLK: |
| 282 | clk_enable_cbc(priv->base + BLSP1_QUP0_I2C_APPS_CBCR); |
| 283 | clk_rcg_set_rate(priv->base, &blsp1_qup0_i2c_apps_regs, 0, |
| 284 | CFG_CLK_SRC_CXO); |
| 285 | break; |
| 286 | case GCC_BLSP1_QUP1_I2C_APPS_CLK: |
| 287 | clk_enable_cbc(priv->base + BLSP1_QUP1_I2C_APPS_CBCR); |
| 288 | clk_rcg_set_rate(priv->base, &blsp1_qup1_i2c_apps_regs, 0, |
| 289 | CFG_CLK_SRC_CXO); |
| 290 | break; |
| 291 | case GCC_BLSP1_QUP2_I2C_APPS_CLK: |
| 292 | clk_enable_cbc(priv->base + BLSP1_QUP2_I2C_APPS_CBCR); |
| 293 | clk_rcg_set_rate(priv->base, &blsp1_qup2_i2c_apps_regs, 0, |
| 294 | CFG_CLK_SRC_CXO); |
| 295 | break; |
| 296 | case GCC_BLSP1_QUP3_I2C_APPS_CLK: |
| 297 | clk_enable_cbc(priv->base + BLSP1_QUP3_I2C_APPS_CBCR); |
| 298 | clk_rcg_set_rate(priv->base, &blsp1_qup3_i2c_apps_regs, 0, |
| 299 | CFG_CLK_SRC_CXO); |
| 300 | break; |
| 301 | case GCC_BLSP1_QUP4_I2C_APPS_CLK: |
| 302 | clk_enable_cbc(priv->base + BLSP1_QUP4_I2C_APPS_CBCR); |
| 303 | clk_rcg_set_rate(priv->base, &blsp1_qup4_i2c_apps_regs, 0, |
| 304 | CFG_CLK_SRC_CXO); |
| 305 | break; |
Caleb Connolly | d718e3e | 2024-02-26 17:26:10 +0000 | [diff] [blame] | 306 | case GCC_SDCC1_AHB_CLK: |
| 307 | clk_enable_cbc(priv->base + SDCC_AHB_CBCR(1)); |
| 308 | break; |
Sumit Garg | 3018e52 | 2022-08-04 19:57:15 +0530 | [diff] [blame] | 309 | default: |
| 310 | return 0; |
| 311 | } |
| 312 | |
Sumit Garg | 1d1ca6e | 2022-08-04 19:57:14 +0530 | [diff] [blame] | 313 | return 0; |
| 314 | } |
Konrad Dybcio | 6c0b844 | 2023-11-07 12:41:01 +0000 | [diff] [blame] | 315 | |
| 316 | static const struct qcom_reset_map qcs404_gcc_resets[] = { |
| 317 | [GCC_GENI_IR_BCR] = { 0x0F000 }, |
| 318 | [GCC_CDSP_RESTART] = { 0x18000 }, |
| 319 | [GCC_USB_HS_BCR] = { 0x41000 }, |
| 320 | [GCC_USB2_HS_PHY_ONLY_BCR] = { 0x41034 }, |
| 321 | [GCC_QUSB2_PHY_BCR] = { 0x4103c }, |
| 322 | [GCC_USB_HS_PHY_CFG_AHB_BCR] = { 0x0000c, 1 }, |
| 323 | [GCC_USB2A_PHY_BCR] = { 0x0000c, 0 }, |
| 324 | [GCC_USB3_PHY_BCR] = { 0x39004 }, |
| 325 | [GCC_USB_30_BCR] = { 0x39000 }, |
| 326 | [GCC_USB3PHY_PHY_BCR] = { 0x39008 }, |
| 327 | [GCC_PCIE_0_BCR] = { 0x3e000 }, |
| 328 | [GCC_PCIE_0_PHY_BCR] = { 0x3e004 }, |
| 329 | [GCC_PCIE_0_LINK_DOWN_BCR] = { 0x3e038 }, |
| 330 | [GCC_PCIEPHY_0_PHY_BCR] = { 0x3e03c }, |
| 331 | [GCC_PCIE_0_AXI_MASTER_STICKY_ARES] = { 0x3e040, 6}, |
| 332 | [GCC_PCIE_0_AHB_ARES] = { 0x3e040, 5 }, |
| 333 | [GCC_PCIE_0_AXI_SLAVE_ARES] = { 0x3e040, 4 }, |
| 334 | [GCC_PCIE_0_AXI_MASTER_ARES] = { 0x3e040, 3 }, |
| 335 | [GCC_PCIE_0_CORE_STICKY_ARES] = { 0x3e040, 2 }, |
| 336 | [GCC_PCIE_0_SLEEP_ARES] = { 0x3e040, 1 }, |
| 337 | [GCC_PCIE_0_PIPE_ARES] = { 0x3e040, 0 }, |
| 338 | [GCC_EMAC_BCR] = { 0x4e000 }, |
| 339 | [GCC_WDSP_RESTART] = {0x19000}, |
| 340 | }; |
| 341 | |
Caleb Connolly | 10a0abb | 2023-11-07 12:41:03 +0000 | [diff] [blame] | 342 | static const struct msm_clk_data qcs404_clk_gcc_data = { |
Konrad Dybcio | 6c0b844 | 2023-11-07 12:41:01 +0000 | [diff] [blame] | 343 | .resets = qcs404_gcc_resets, |
| 344 | .num_resets = ARRAY_SIZE(qcs404_gcc_resets), |
Caleb Connolly | 10a0abb | 2023-11-07 12:41:03 +0000 | [diff] [blame] | 345 | .enable = qcs404_clk_enable, |
| 346 | .set_rate = qcs404_clk_set_rate, |
Konrad Dybcio | 6c0b844 | 2023-11-07 12:41:01 +0000 | [diff] [blame] | 347 | }; |
| 348 | |
| 349 | static const struct udevice_id gcc_qcs404_of_match[] = { |
| 350 | { |
| 351 | .compatible = "qcom,gcc-qcs404", |
Caleb Connolly | 10a0abb | 2023-11-07 12:41:03 +0000 | [diff] [blame] | 352 | .data = (ulong)&qcs404_clk_gcc_data |
Konrad Dybcio | 6c0b844 | 2023-11-07 12:41:01 +0000 | [diff] [blame] | 353 | }, |
| 354 | { } |
| 355 | }; |
| 356 | |
| 357 | U_BOOT_DRIVER(gcc_qcs404) = { |
| 358 | .name = "gcc_qcs404", |
| 359 | .id = UCLASS_NOP, |
| 360 | .of_match = gcc_qcs404_of_match, |
| 361 | .bind = qcom_cc_bind, |
| 362 | .flags = DM_FLAG_PRE_RELOC, |
| 363 | }; |