Vikas Manocha | 1b51c93 | 2016-02-11 15:47:20 -0800 | [diff] [blame] | 1 | /* |
Patrice Chotard | 789ee0e | 2017-10-23 09:53:58 +0200 | [diff] [blame] | 2 | * Copyright (C) 2017, STMicroelectronics - All Rights Reserved |
| 3 | * Author(s): Vikas Manocha, <vikas.manocha@st.com> for STMicroelectronics. |
Vikas Manocha | 1b51c93 | 2016-02-11 15:47:20 -0800 | [diff] [blame] | 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
Patrice Chotard | 789ee0e | 2017-10-23 09:53:58 +0200 | [diff] [blame] | 7 | |
Vikas Manocha | 1b51c93 | 2016-02-11 15:47:20 -0800 | [diff] [blame] | 8 | #include <common.h> |
Vikas Manocha | daaeaab | 2017-02-12 10:25:45 -0800 | [diff] [blame] | 9 | #include <clk-uclass.h> |
| 10 | #include <dm.h> |
Patrice Chotard | 03f10a1 | 2017-11-15 13:14:51 +0100 | [diff] [blame] | 11 | #include <stm32_rcc.h> |
Patrice Chotard | 22768d5 | 2017-11-15 13:14:44 +0100 | [diff] [blame] | 12 | |
Vikas Manocha | 1b51c93 | 2016-02-11 15:47:20 -0800 | [diff] [blame] | 13 | #include <asm/io.h> |
Vikas Manocha | 1b51c93 | 2016-02-11 15:47:20 -0800 | [diff] [blame] | 14 | #include <asm/arch/stm32.h> |
Patrice Chotard | 22768d5 | 2017-11-15 13:14:44 +0100 | [diff] [blame] | 15 | #include <asm/arch/stm32_pwr.h> |
Vikas Manocha | 1b51c93 | 2016-02-11 15:47:20 -0800 | [diff] [blame] | 16 | |
Patrice Chotard | 7bdf971 | 2017-07-18 09:29:05 +0200 | [diff] [blame] | 17 | #include <dt-bindings/mfd/stm32f7-rcc.h> |
| 18 | |
Michael Kurz | c204fb7 | 2017-01-22 16:04:24 +0100 | [diff] [blame] | 19 | #define RCC_CR_HSION BIT(0) |
| 20 | #define RCC_CR_HSEON BIT(16) |
| 21 | #define RCC_CR_HSERDY BIT(17) |
| 22 | #define RCC_CR_HSEBYP BIT(18) |
| 23 | #define RCC_CR_CSSON BIT(19) |
| 24 | #define RCC_CR_PLLON BIT(24) |
| 25 | #define RCC_CR_PLLRDY BIT(25) |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 26 | #define RCC_CR_PLLSAION BIT(28) |
| 27 | #define RCC_CR_PLLSAIRDY BIT(29) |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 28 | |
Michael Kurz | c204fb7 | 2017-01-22 16:04:24 +0100 | [diff] [blame] | 29 | #define RCC_PLLCFGR_PLLM_MASK GENMASK(5, 0) |
| 30 | #define RCC_PLLCFGR_PLLN_MASK GENMASK(14, 6) |
| 31 | #define RCC_PLLCFGR_PLLP_MASK GENMASK(17, 16) |
| 32 | #define RCC_PLLCFGR_PLLQ_MASK GENMASK(27, 24) |
| 33 | #define RCC_PLLCFGR_PLLSRC BIT(22) |
| 34 | #define RCC_PLLCFGR_PLLM_SHIFT 0 |
| 35 | #define RCC_PLLCFGR_PLLN_SHIFT 6 |
| 36 | #define RCC_PLLCFGR_PLLP_SHIFT 16 |
| 37 | #define RCC_PLLCFGR_PLLQ_SHIFT 24 |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 38 | |
Michael Kurz | c204fb7 | 2017-01-22 16:04:24 +0100 | [diff] [blame] | 39 | #define RCC_CFGR_AHB_PSC_MASK GENMASK(7, 4) |
| 40 | #define RCC_CFGR_APB1_PSC_MASK GENMASK(12, 10) |
| 41 | #define RCC_CFGR_APB2_PSC_MASK GENMASK(15, 13) |
| 42 | #define RCC_CFGR_SW0 BIT(0) |
| 43 | #define RCC_CFGR_SW1 BIT(1) |
| 44 | #define RCC_CFGR_SW_MASK GENMASK(1, 0) |
| 45 | #define RCC_CFGR_SW_HSI 0 |
| 46 | #define RCC_CFGR_SW_HSE RCC_CFGR_SW0 |
| 47 | #define RCC_CFGR_SW_PLL RCC_CFGR_SW1 |
| 48 | #define RCC_CFGR_SWS0 BIT(2) |
| 49 | #define RCC_CFGR_SWS1 BIT(3) |
| 50 | #define RCC_CFGR_SWS_MASK GENMASK(3, 2) |
| 51 | #define RCC_CFGR_SWS_HSI 0 |
| 52 | #define RCC_CFGR_SWS_HSE RCC_CFGR_SWS0 |
| 53 | #define RCC_CFGR_SWS_PLL RCC_CFGR_SWS1 |
| 54 | #define RCC_CFGR_HPRE_SHIFT 4 |
| 55 | #define RCC_CFGR_PPRE1_SHIFT 10 |
| 56 | #define RCC_CFGR_PPRE2_SHIFT 13 |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 57 | |
Patrice Chotard | 9490aca | 2018-02-08 17:20:46 +0100 | [diff] [blame] | 58 | #define RCC_PLLSAICFGR_PLLSAIN_MASK GENMASK(14, 6) |
| 59 | #define RCC_PLLSAICFGR_PLLSAIP_MASK GENMASK(17, 16) |
Patrice Chotard | 8aca2d1 | 2018-02-08 17:20:48 +0100 | [diff] [blame^] | 60 | #define RCC_PLLSAICFGR_PLLSAIQ_MASK GENMASK(27, 24) |
| 61 | #define RCC_PLLSAICFGR_PLLSAIR_MASK GENMASK(30, 28) |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 62 | #define RCC_PLLSAICFGR_PLLSAIN_SHIFT 6 |
| 63 | #define RCC_PLLSAICFGR_PLLSAIP_SHIFT 16 |
Patrice Chotard | 8aca2d1 | 2018-02-08 17:20:48 +0100 | [diff] [blame^] | 64 | #define RCC_PLLSAICFGR_PLLSAIQ_SHIFT 24 |
| 65 | #define RCC_PLLSAICFGR_PLLSAIR_SHIFT 28 |
Patrice Chotard | d5d3655 | 2018-01-19 18:02:40 +0100 | [diff] [blame] | 66 | #define RCC_PLLSAICFGR_PLLSAIP_4 BIT(16) |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 67 | #define RCC_PLLSAICFGR_PLLSAIQ_4 BIT(26) |
| 68 | #define RCC_PLLSAICFGR_PLLSAIR_2 BIT(29) |
| 69 | |
Patrice Chotard | ef77287 | 2018-02-07 10:44:46 +0100 | [diff] [blame] | 70 | #define RCC_DCKCFGRX_TIMPRE BIT(24) |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 71 | #define RCC_DCKCFGRX_CK48MSEL BIT(27) |
| 72 | #define RCC_DCKCFGRX_SDMMC1SEL BIT(28) |
| 73 | #define RCC_DCKCFGR2_SDMMC2SEL BIT(29) |
| 74 | |
Patrice Chotard | 06fc648 | 2017-11-15 13:14:49 +0100 | [diff] [blame] | 75 | /* |
| 76 | * RCC AHB1ENR specific definitions |
| 77 | */ |
| 78 | #define RCC_AHB1ENR_ETHMAC_EN BIT(25) |
| 79 | #define RCC_AHB1ENR_ETHMAC_TX_EN BIT(26) |
| 80 | #define RCC_AHB1ENR_ETHMAC_RX_EN BIT(27) |
| 81 | |
| 82 | /* |
| 83 | * RCC APB1ENR specific definitions |
| 84 | */ |
| 85 | #define RCC_APB1ENR_TIM2EN BIT(0) |
| 86 | #define RCC_APB1ENR_PWREN BIT(28) |
| 87 | |
| 88 | /* |
| 89 | * RCC APB2ENR specific definitions |
| 90 | */ |
| 91 | #define RCC_APB2ENR_SYSCFGEN BIT(14) |
Patrice Chotard | e2d564e | 2018-01-18 14:10:05 +0100 | [diff] [blame] | 92 | #define RCC_APB2ENR_SAI1EN BIT(22) |
Patrice Chotard | 06fc648 | 2017-11-15 13:14:49 +0100 | [diff] [blame] | 93 | |
Patrice Chotard | 8aca2d1 | 2018-02-08 17:20:48 +0100 | [diff] [blame^] | 94 | enum pllsai_div { |
| 95 | PLLSAIP, |
| 96 | PLLSAIQ, |
| 97 | PLLSAIR, |
| 98 | }; |
| 99 | |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 100 | static const struct stm32_clk_info stm32f4_clk_info = { |
Patrice Chotard | 1509d66 | 2017-11-15 13:14:47 +0100 | [diff] [blame] | 101 | /* 180 MHz */ |
| 102 | .sys_pll_psc = { |
Patrice Chotard | 1509d66 | 2017-11-15 13:14:47 +0100 | [diff] [blame] | 103 | .pll_n = 360, |
| 104 | .pll_p = 2, |
| 105 | .pll_q = 8, |
| 106 | .ahb_psc = AHB_PSC_1, |
| 107 | .apb1_psc = APB_PSC_4, |
| 108 | .apb2_psc = APB_PSC_2, |
| 109 | }, |
| 110 | .has_overdrive = false, |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 111 | .v2 = false, |
Patrice Chotard | 1509d66 | 2017-11-15 13:14:47 +0100 | [diff] [blame] | 112 | }; |
| 113 | |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 114 | static const struct stm32_clk_info stm32f7_clk_info = { |
Patrice Chotard | 1509d66 | 2017-11-15 13:14:47 +0100 | [diff] [blame] | 115 | /* 200 MHz */ |
| 116 | .sys_pll_psc = { |
Patrice Chotard | 1509d66 | 2017-11-15 13:14:47 +0100 | [diff] [blame] | 117 | .pll_n = 400, |
| 118 | .pll_p = 2, |
| 119 | .pll_q = 8, |
| 120 | .ahb_psc = AHB_PSC_1, |
| 121 | .apb1_psc = APB_PSC_4, |
| 122 | .apb2_psc = APB_PSC_2, |
| 123 | }, |
| 124 | .has_overdrive = true, |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 125 | .v2 = true, |
Patrice Chotard | 1509d66 | 2017-11-15 13:14:47 +0100 | [diff] [blame] | 126 | }; |
| 127 | |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 128 | struct stm32_clk { |
| 129 | struct stm32_rcc_regs *base; |
Patrice Chotard | 22768d5 | 2017-11-15 13:14:44 +0100 | [diff] [blame] | 130 | struct stm32_pwr_regs *pwr_regs; |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 131 | struct stm32_clk_info info; |
| 132 | unsigned long hse_rate; |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 133 | }; |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 134 | |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 135 | static int configure_clocks(struct udevice *dev) |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 136 | { |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 137 | struct stm32_clk *priv = dev_get_priv(dev); |
| 138 | struct stm32_rcc_regs *regs = priv->base; |
Patrice Chotard | 22768d5 | 2017-11-15 13:14:44 +0100 | [diff] [blame] | 139 | struct stm32_pwr_regs *pwr = priv->pwr_regs; |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 140 | struct pll_psc *sys_pll_psc = &priv->info.sys_pll_psc; |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 141 | |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 142 | /* Reset RCC configuration */ |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 143 | setbits_le32(®s->cr, RCC_CR_HSION); |
| 144 | writel(0, ®s->cfgr); /* Reset CFGR */ |
| 145 | clrbits_le32(®s->cr, (RCC_CR_HSEON | RCC_CR_CSSON |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 146 | | RCC_CR_PLLON | RCC_CR_PLLSAION)); |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 147 | writel(0x24003010, ®s->pllcfgr); /* Reset value from RM */ |
| 148 | clrbits_le32(®s->cr, RCC_CR_HSEBYP); |
| 149 | writel(0, ®s->cir); /* Disable all interrupts */ |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 150 | |
| 151 | /* Configure for HSE+PLL operation */ |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 152 | setbits_le32(®s->cr, RCC_CR_HSEON); |
| 153 | while (!(readl(®s->cr) & RCC_CR_HSERDY)) |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 154 | ; |
| 155 | |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 156 | setbits_le32(®s->cfgr, (( |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 157 | sys_pll_psc->ahb_psc << RCC_CFGR_HPRE_SHIFT) |
| 158 | | (sys_pll_psc->apb1_psc << RCC_CFGR_PPRE1_SHIFT) |
| 159 | | (sys_pll_psc->apb2_psc << RCC_CFGR_PPRE2_SHIFT))); |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 160 | |
| 161 | /* Configure the main PLL */ |
Patrice Chotard | b6653f6 | 2017-10-26 13:23:19 +0200 | [diff] [blame] | 162 | setbits_le32(®s->pllcfgr, RCC_PLLCFGR_PLLSRC); /* pll source HSE */ |
| 163 | clrsetbits_le32(®s->pllcfgr, RCC_PLLCFGR_PLLM_MASK, |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 164 | sys_pll_psc->pll_m << RCC_PLLCFGR_PLLM_SHIFT); |
Patrice Chotard | b6653f6 | 2017-10-26 13:23:19 +0200 | [diff] [blame] | 165 | clrsetbits_le32(®s->pllcfgr, RCC_PLLCFGR_PLLN_MASK, |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 166 | sys_pll_psc->pll_n << RCC_PLLCFGR_PLLN_SHIFT); |
Patrice Chotard | b6653f6 | 2017-10-26 13:23:19 +0200 | [diff] [blame] | 167 | clrsetbits_le32(®s->pllcfgr, RCC_PLLCFGR_PLLP_MASK, |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 168 | ((sys_pll_psc->pll_p >> 1) - 1) << RCC_PLLCFGR_PLLP_SHIFT); |
Patrice Chotard | b6653f6 | 2017-10-26 13:23:19 +0200 | [diff] [blame] | 169 | clrsetbits_le32(®s->pllcfgr, RCC_PLLCFGR_PLLQ_MASK, |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 170 | sys_pll_psc->pll_q << RCC_PLLCFGR_PLLQ_SHIFT); |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 171 | |
Patrice Chotard | cb15d28 | 2018-02-08 17:20:47 +0100 | [diff] [blame] | 172 | /* configure SDMMC clock */ |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 173 | if (priv->info.v2) { /*stm32f7 case */ |
Patrice Chotard | cb15d28 | 2018-02-08 17:20:47 +0100 | [diff] [blame] | 174 | /* select PLLQ as 48MHz clock source */ |
| 175 | clrbits_le32(®s->dckcfgr2, RCC_DCKCFGRX_CK48MSEL); |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 176 | |
| 177 | /* select 48MHz as SDMMC1 clock source */ |
| 178 | clrbits_le32(®s->dckcfgr2, RCC_DCKCFGRX_SDMMC1SEL); |
| 179 | |
| 180 | /* select 48MHz as SDMMC2 clock source */ |
| 181 | clrbits_le32(®s->dckcfgr2, RCC_DCKCFGR2_SDMMC2SEL); |
| 182 | } else { /* stm32f4 case */ |
Patrice Chotard | cb15d28 | 2018-02-08 17:20:47 +0100 | [diff] [blame] | 183 | /* select PLLQ as 48MHz clock source */ |
| 184 | clrbits_le32(®s->dckcfgr, RCC_DCKCFGRX_CK48MSEL); |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 185 | |
| 186 | /* select 48MHz as SDMMC1 clock source */ |
| 187 | clrbits_le32(®s->dckcfgr, RCC_DCKCFGRX_SDMMC1SEL); |
| 188 | } |
| 189 | |
Patrice Chotard | cb15d28 | 2018-02-08 17:20:47 +0100 | [diff] [blame] | 190 | /* Enable the main PLL */ |
| 191 | setbits_le32(®s->cr, RCC_CR_PLLON); |
| 192 | while (!(readl(®s->cr) & RCC_CR_PLLRDY)) |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 193 | ; |
| 194 | |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 195 | setbits_le32(®s->apb1enr, RCC_APB1ENR_PWREN); |
Patrice Chotard | 1509d66 | 2017-11-15 13:14:47 +0100 | [diff] [blame] | 196 | |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 197 | if (priv->info.has_overdrive) { |
Patrice Chotard | 1509d66 | 2017-11-15 13:14:47 +0100 | [diff] [blame] | 198 | /* |
| 199 | * Enable high performance mode |
| 200 | * System frequency up to 200 MHz |
| 201 | */ |
| 202 | setbits_le32(&pwr->cr1, PWR_CR1_ODEN); |
| 203 | /* Infinite wait! */ |
| 204 | while (!(readl(&pwr->csr1) & PWR_CSR1_ODRDY)) |
| 205 | ; |
| 206 | /* Enable the Over-drive switch */ |
| 207 | setbits_le32(&pwr->cr1, PWR_CR1_ODSWEN); |
| 208 | /* Infinite wait! */ |
| 209 | while (!(readl(&pwr->csr1) & PWR_CSR1_ODSWRDY)) |
| 210 | ; |
| 211 | } |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 212 | |
| 213 | stm32_flash_latency_cfg(5); |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 214 | clrbits_le32(®s->cfgr, (RCC_CFGR_SW0 | RCC_CFGR_SW1)); |
| 215 | setbits_le32(®s->cfgr, RCC_CFGR_SW_PLL); |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 216 | |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 217 | while ((readl(®s->cfgr) & RCC_CFGR_SWS_MASK) != |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 218 | RCC_CFGR_SWS_PLL) |
| 219 | ; |
| 220 | |
Patrice Chotard | e2d564e | 2018-01-18 14:10:05 +0100 | [diff] [blame] | 221 | #ifdef CONFIG_ETH_DESIGNWARE |
| 222 | /* gate the SYSCFG clock, needed to set RMII ethernet interface */ |
| 223 | setbits_le32(®s->apb2enr, RCC_APB2ENR_SYSCFGEN); |
| 224 | #endif |
| 225 | |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 226 | return 0; |
| 227 | } |
| 228 | |
Patrice Chotard | 8aca2d1 | 2018-02-08 17:20:48 +0100 | [diff] [blame^] | 229 | static bool stm32_clk_get_ck48msel(struct stm32_clk *priv) |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 230 | { |
| 231 | struct stm32_rcc_regs *regs = priv->base; |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 232 | |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 233 | if (priv->info.v2) /*stm32f7 case */ |
Patrice Chotard | 8aca2d1 | 2018-02-08 17:20:48 +0100 | [diff] [blame^] | 234 | return readl(®s->dckcfgr2) & RCC_DCKCFGRX_CK48MSEL; |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 235 | else |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 236 | |
Patrice Chotard | 8aca2d1 | 2018-02-08 17:20:48 +0100 | [diff] [blame^] | 237 | return readl(®s->dckcfgr) & RCC_DCKCFGRX_CK48MSEL; |
| 238 | } |
| 239 | |
| 240 | static unsigned long stm32_clk_get_pllsai_vco_rate(struct stm32_clk *priv) |
| 241 | { |
| 242 | struct stm32_rcc_regs *regs = priv->base; |
| 243 | u16 pllm, pllsain; |
| 244 | |
| 245 | pllm = (readl(®s->pllcfgr) & RCC_PLLCFGR_PLLM_MASK); |
| 246 | pllsain = ((readl(®s->pllsaicfgr) & RCC_PLLSAICFGR_PLLSAIN_MASK) |
| 247 | >> RCC_PLLSAICFGR_PLLSAIN_SHIFT); |
| 248 | |
| 249 | return ((priv->hse_rate / pllm) * pllsain); |
| 250 | } |
| 251 | |
| 252 | static unsigned long stm32_clk_get_pllsai_rate(struct stm32_clk *priv, |
| 253 | enum pllsai_div output) |
| 254 | { |
| 255 | struct stm32_rcc_regs *regs = priv->base; |
| 256 | u16 pll_div_output; |
| 257 | |
| 258 | switch (output) { |
| 259 | case PLLSAIP: |
| 260 | pll_div_output = ((((readl(®s->pllsaicfgr) |
| 261 | & RCC_PLLSAICFGR_PLLSAIP_MASK) |
| 262 | >> RCC_PLLSAICFGR_PLLSAIP_SHIFT) + 1) << 1); |
| 263 | break; |
| 264 | case PLLSAIQ: |
| 265 | pll_div_output = (readl(®s->pllsaicfgr) |
| 266 | & RCC_PLLSAICFGR_PLLSAIQ_MASK) |
| 267 | >> RCC_PLLSAICFGR_PLLSAIQ_SHIFT; |
| 268 | break; |
| 269 | case PLLSAIR: |
| 270 | pll_div_output = (readl(®s->pllsaicfgr) |
| 271 | & RCC_PLLSAICFGR_PLLSAIR_MASK) |
| 272 | >> RCC_PLLSAICFGR_PLLSAIR_SHIFT; |
| 273 | break; |
| 274 | default: |
| 275 | pr_err("incorrect PLLSAI output %d\n", output); |
| 276 | return -EINVAL; |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 277 | } |
Patrice Chotard | 8aca2d1 | 2018-02-08 17:20:48 +0100 | [diff] [blame^] | 278 | |
| 279 | return (stm32_clk_get_pllsai_vco_rate(priv) / pll_div_output); |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 280 | } |
| 281 | |
Patrice Chotard | ef77287 | 2018-02-07 10:44:46 +0100 | [diff] [blame] | 282 | static bool stm32_get_timpre(struct stm32_clk *priv) |
Patrice Chotard | 7bdf971 | 2017-07-18 09:29:05 +0200 | [diff] [blame] | 283 | { |
Patrice Chotard | 7bdf971 | 2017-07-18 09:29:05 +0200 | [diff] [blame] | 284 | struct stm32_rcc_regs *regs = priv->base; |
Patrice Chotard | ef77287 | 2018-02-07 10:44:46 +0100 | [diff] [blame] | 285 | u32 val; |
| 286 | |
| 287 | if (priv->info.v2) /*stm32f7 case */ |
| 288 | val = readl(®s->dckcfgr2); |
| 289 | else |
| 290 | val = readl(®s->dckcfgr); |
| 291 | /* get timer prescaler */ |
| 292 | return !!(val & RCC_DCKCFGRX_TIMPRE); |
| 293 | } |
| 294 | |
| 295 | static u32 stm32_get_hclk_rate(struct stm32_rcc_regs *regs, u32 sysclk) |
| 296 | { |
| 297 | u8 shift; |
Patrice Chotard | 7bdf971 | 2017-07-18 09:29:05 +0200 | [diff] [blame] | 298 | /* Prescaler table lookups for clock computation */ |
| 299 | u8 ahb_psc_table[16] = { |
| 300 | 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9 |
| 301 | }; |
Patrice Chotard | ef77287 | 2018-02-07 10:44:46 +0100 | [diff] [blame] | 302 | |
| 303 | shift = ahb_psc_table[( |
| 304 | (readl(®s->cfgr) & RCC_CFGR_AHB_PSC_MASK) |
| 305 | >> RCC_CFGR_HPRE_SHIFT)]; |
| 306 | |
| 307 | return sysclk >> shift; |
| 308 | }; |
| 309 | |
| 310 | static u8 stm32_get_apb_shift(struct stm32_rcc_regs *regs, enum apb apb) |
| 311 | { |
| 312 | /* Prescaler table lookups for clock computation */ |
Patrice Chotard | 7bdf971 | 2017-07-18 09:29:05 +0200 | [diff] [blame] | 313 | u8 apb_psc_table[8] = { |
| 314 | 0, 0, 0, 0, 1, 2, 3, 4 |
| 315 | }; |
| 316 | |
Patrice Chotard | ef77287 | 2018-02-07 10:44:46 +0100 | [diff] [blame] | 317 | if (apb == APB1) |
| 318 | return apb_psc_table[( |
| 319 | (readl(®s->cfgr) & RCC_CFGR_APB1_PSC_MASK) |
| 320 | >> RCC_CFGR_PPRE1_SHIFT)]; |
| 321 | else /* APB2 */ |
| 322 | return apb_psc_table[( |
| 323 | (readl(®s->cfgr) & RCC_CFGR_APB2_PSC_MASK) |
| 324 | >> RCC_CFGR_PPRE2_SHIFT)]; |
| 325 | }; |
| 326 | |
| 327 | static u32 stm32_get_timer_rate(struct stm32_clk *priv, u32 sysclk, |
| 328 | enum apb apb) |
| 329 | { |
| 330 | struct stm32_rcc_regs *regs = priv->base; |
| 331 | u8 shift = stm32_get_apb_shift(regs, apb); |
| 332 | |
| 333 | if (stm32_get_timpre(priv)) |
| 334 | /* |
| 335 | * if APB prescaler is configured to a |
| 336 | * division factor of 1, 2 or 4 |
| 337 | */ |
| 338 | switch (shift) { |
| 339 | case 0: |
| 340 | case 1: |
| 341 | case 2: |
| 342 | return stm32_get_hclk_rate(regs, sysclk); |
| 343 | default: |
| 344 | return (sysclk >> shift) * 4; |
| 345 | } |
| 346 | else |
| 347 | /* |
| 348 | * if APB prescaler is configured to a |
| 349 | * division factor of 1 |
| 350 | */ |
| 351 | if (shift == 0) |
| 352 | return sysclk; |
| 353 | else |
| 354 | return (sysclk >> shift) * 2; |
| 355 | }; |
| 356 | |
| 357 | static ulong stm32_clk_get_rate(struct clk *clk) |
| 358 | { |
| 359 | struct stm32_clk *priv = dev_get_priv(clk->dev); |
| 360 | struct stm32_rcc_regs *regs = priv->base; |
| 361 | u32 sysclk = 0; |
Patrice Chotard | 81d7765 | 2018-02-08 17:20:45 +0100 | [diff] [blame] | 362 | u32 vco; |
Patrice Chotard | 8aca2d1 | 2018-02-08 17:20:48 +0100 | [diff] [blame^] | 363 | u32 sdmmcxsel_bit; |
| 364 | u16 pllm, plln, pllp, pllq; |
Patrice Chotard | ef77287 | 2018-02-07 10:44:46 +0100 | [diff] [blame] | 365 | |
Patrice Chotard | 7bdf971 | 2017-07-18 09:29:05 +0200 | [diff] [blame] | 366 | if ((readl(®s->cfgr) & RCC_CFGR_SWS_MASK) == |
| 367 | RCC_CFGR_SWS_PLL) { |
Patrice Chotard | 7bdf971 | 2017-07-18 09:29:05 +0200 | [diff] [blame] | 368 | pllm = (readl(®s->pllcfgr) & RCC_PLLCFGR_PLLM_MASK); |
| 369 | plln = ((readl(®s->pllcfgr) & RCC_PLLCFGR_PLLN_MASK) |
| 370 | >> RCC_PLLCFGR_PLLN_SHIFT); |
| 371 | pllp = ((((readl(®s->pllcfgr) & RCC_PLLCFGR_PLLP_MASK) |
| 372 | >> RCC_PLLCFGR_PLLP_SHIFT) + 1) << 1); |
Patrice Chotard | 8aca2d1 | 2018-02-08 17:20:48 +0100 | [diff] [blame^] | 373 | pllq = ((readl(®s->pllcfgr) & RCC_PLLCFGR_PLLQ_MASK) |
| 374 | >> RCC_PLLCFGR_PLLQ_SHIFT); |
Patrice Chotard | 81d7765 | 2018-02-08 17:20:45 +0100 | [diff] [blame] | 375 | vco = (priv->hse_rate / pllm) * plln; |
| 376 | sysclk = vco / pllp; |
Patrice Chotard | 7bdf971 | 2017-07-18 09:29:05 +0200 | [diff] [blame] | 377 | } else { |
| 378 | return -EINVAL; |
| 379 | } |
| 380 | |
| 381 | switch (clk->id) { |
| 382 | /* |
| 383 | * AHB CLOCK: 3 x 32 bits consecutive registers are used : |
| 384 | * AHB1, AHB2 and AHB3 |
| 385 | */ |
| 386 | case STM32F7_AHB1_CLOCK(GPIOA) ... STM32F7_AHB3_CLOCK(QSPI): |
Patrice Chotard | ef77287 | 2018-02-07 10:44:46 +0100 | [diff] [blame] | 387 | return stm32_get_hclk_rate(regs, sysclk); |
Patrice Chotard | 7bdf971 | 2017-07-18 09:29:05 +0200 | [diff] [blame] | 388 | /* APB1 CLOCK */ |
| 389 | case STM32F7_APB1_CLOCK(TIM2) ... STM32F7_APB1_CLOCK(UART8): |
Patrice Chotard | ef77287 | 2018-02-07 10:44:46 +0100 | [diff] [blame] | 390 | /* For timer clock, an additionnal prescaler is used*/ |
| 391 | switch (clk->id) { |
| 392 | case STM32F7_APB1_CLOCK(TIM2): |
| 393 | case STM32F7_APB1_CLOCK(TIM3): |
| 394 | case STM32F7_APB1_CLOCK(TIM4): |
| 395 | case STM32F7_APB1_CLOCK(TIM5): |
| 396 | case STM32F7_APB1_CLOCK(TIM6): |
| 397 | case STM32F7_APB1_CLOCK(TIM7): |
| 398 | case STM32F7_APB1_CLOCK(TIM12): |
| 399 | case STM32F7_APB1_CLOCK(TIM13): |
| 400 | case STM32F7_APB1_CLOCK(TIM14): |
| 401 | return stm32_get_timer_rate(priv, sysclk, APB1); |
| 402 | } |
| 403 | return (sysclk >> stm32_get_apb_shift(regs, APB1)); |
| 404 | |
Patrice Chotard | 7bdf971 | 2017-07-18 09:29:05 +0200 | [diff] [blame] | 405 | /* APB2 CLOCK */ |
| 406 | case STM32F7_APB2_CLOCK(TIM1) ... STM32F7_APB2_CLOCK(LTDC): |
Patrice Chotard | 8aca2d1 | 2018-02-08 17:20:48 +0100 | [diff] [blame^] | 407 | switch (clk->id) { |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 408 | /* |
| 409 | * particular case for SDMMC1 and SDMMC2 : |
| 410 | * 48Mhz source clock can be from main PLL or from |
Patrice Chotard | 8aca2d1 | 2018-02-08 17:20:48 +0100 | [diff] [blame^] | 411 | * PLLSAIP |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 412 | */ |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 413 | case STM32F7_APB2_CLOCK(SDMMC1): |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 414 | case STM32F7_APB2_CLOCK(SDMMC2): |
Patrice Chotard | 8aca2d1 | 2018-02-08 17:20:48 +0100 | [diff] [blame^] | 415 | if (clk->id == STM32F7_APB2_CLOCK(SDMMC1)) |
| 416 | sdmmcxsel_bit = RCC_DCKCFGRX_SDMMC1SEL; |
| 417 | else |
| 418 | sdmmcxsel_bit = RCC_DCKCFGR2_SDMMC2SEL; |
| 419 | |
| 420 | if (readl(®s->dckcfgr2) & sdmmcxsel_bit) |
| 421 | /* System clock is selected as SDMMC1 clock */ |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 422 | return sysclk; |
Patrice Chotard | 8aca2d1 | 2018-02-08 17:20:48 +0100 | [diff] [blame^] | 423 | /* |
| 424 | * 48 MHz can be generated by either PLLSAIP |
| 425 | * or by PLLQ depending of CK48MSEL bit of RCC_DCKCFGR |
| 426 | */ |
| 427 | if (stm32_clk_get_ck48msel(priv)) |
| 428 | return stm32_clk_get_pllsai_rate(priv, PLLSAIP); |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 429 | else |
Patrice Chotard | 8aca2d1 | 2018-02-08 17:20:48 +0100 | [diff] [blame^] | 430 | return (vco / pllq); |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 431 | break; |
Patrice Chotard | ef77287 | 2018-02-07 10:44:46 +0100 | [diff] [blame] | 432 | |
| 433 | /* For timer clock, an additionnal prescaler is used*/ |
| 434 | case STM32F7_APB2_CLOCK(TIM1): |
| 435 | case STM32F7_APB2_CLOCK(TIM8): |
| 436 | case STM32F7_APB2_CLOCK(TIM9): |
| 437 | case STM32F7_APB2_CLOCK(TIM10): |
| 438 | case STM32F7_APB2_CLOCK(TIM11): |
| 439 | return stm32_get_timer_rate(priv, sysclk, APB2); |
| 440 | break; |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 441 | } |
Patrice Chotard | ef77287 | 2018-02-07 10:44:46 +0100 | [diff] [blame] | 442 | return (sysclk >> stm32_get_apb_shift(regs, APB2)); |
Patrice Chotard | 369d483 | 2017-11-15 13:14:52 +0100 | [diff] [blame] | 443 | |
Patrice Chotard | 7bdf971 | 2017-07-18 09:29:05 +0200 | [diff] [blame] | 444 | default: |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 445 | pr_err("clock index %ld out of range\n", clk->id); |
Patrice Chotard | 7bdf971 | 2017-07-18 09:29:05 +0200 | [diff] [blame] | 446 | return -EINVAL; |
Patrice Chotard | 7bdf971 | 2017-07-18 09:29:05 +0200 | [diff] [blame] | 447 | } |
| 448 | } |
| 449 | |
Patrice Chotard | 24e8578 | 2018-01-29 18:14:14 +0100 | [diff] [blame] | 450 | static ulong stm32_set_rate(struct clk *clk, ulong rate) |
| 451 | { |
| 452 | return 0; |
| 453 | } |
| 454 | |
Vikas Manocha | daaeaab | 2017-02-12 10:25:45 -0800 | [diff] [blame] | 455 | static int stm32_clk_enable(struct clk *clk) |
| 456 | { |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 457 | struct stm32_clk *priv = dev_get_priv(clk->dev); |
| 458 | struct stm32_rcc_regs *regs = priv->base; |
Vikas Manocha | daaeaab | 2017-02-12 10:25:45 -0800 | [diff] [blame] | 459 | u32 offset = clk->id / 32; |
| 460 | u32 bit_index = clk->id % 32; |
| 461 | |
| 462 | debug("%s: clkid = %ld, offset from AHB1ENR is %d, bit_index = %d\n", |
| 463 | __func__, clk->id, offset, bit_index); |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 464 | setbits_le32(®s->ahb1enr + offset, BIT(bit_index)); |
Vikas Manocha | daaeaab | 2017-02-12 10:25:45 -0800 | [diff] [blame] | 465 | |
| 466 | return 0; |
| 467 | } |
Toshifumi NISHINAGA | 65bfb9c | 2016-07-08 01:02:24 +0900 | [diff] [blame] | 468 | |
Vikas Manocha | daaeaab | 2017-02-12 10:25:45 -0800 | [diff] [blame] | 469 | static int stm32_clk_probe(struct udevice *dev) |
| 470 | { |
Patrice Chotard | 22768d5 | 2017-11-15 13:14:44 +0100 | [diff] [blame] | 471 | struct ofnode_phandle_args args; |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 472 | struct udevice *fixed_clock_dev = NULL; |
| 473 | struct clk clk; |
Patrice Chotard | 22768d5 | 2017-11-15 13:14:44 +0100 | [diff] [blame] | 474 | int err; |
| 475 | |
Patrice Chotard | d4f2d20 | 2017-11-15 13:14:48 +0100 | [diff] [blame] | 476 | debug("%s\n", __func__); |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 477 | |
| 478 | struct stm32_clk *priv = dev_get_priv(dev); |
| 479 | fdt_addr_t addr; |
| 480 | |
Patrice Chotard | 1509d66 | 2017-11-15 13:14:47 +0100 | [diff] [blame] | 481 | addr = dev_read_addr(dev); |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 482 | if (addr == FDT_ADDR_T_NONE) |
| 483 | return -EINVAL; |
| 484 | |
| 485 | priv->base = (struct stm32_rcc_regs *)addr; |
Patrice Chotard | 03f10a1 | 2017-11-15 13:14:51 +0100 | [diff] [blame] | 486 | |
| 487 | switch (dev_get_driver_data(dev)) { |
| 488 | case STM32F4: |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 489 | memcpy(&priv->info, &stm32f4_clk_info, |
| 490 | sizeof(struct stm32_clk_info)); |
Patrice Chotard | 03f10a1 | 2017-11-15 13:14:51 +0100 | [diff] [blame] | 491 | break; |
| 492 | case STM32F7: |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 493 | memcpy(&priv->info, &stm32f7_clk_info, |
| 494 | sizeof(struct stm32_clk_info)); |
Patrice Chotard | 03f10a1 | 2017-11-15 13:14:51 +0100 | [diff] [blame] | 495 | break; |
| 496 | default: |
| 497 | return -EINVAL; |
| 498 | } |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 499 | |
Patrice Chotard | acd97ca | 2018-01-18 13:39:30 +0100 | [diff] [blame] | 500 | /* retrieve HSE frequency (external oscillator) */ |
| 501 | err = uclass_get_device_by_name(UCLASS_CLK, "clk-hse", |
| 502 | &fixed_clock_dev); |
| 503 | |
| 504 | if (err) { |
| 505 | pr_err("Can't find fixed clock (%d)", err); |
| 506 | return err; |
| 507 | } |
| 508 | |
| 509 | err = clk_request(fixed_clock_dev, &clk); |
| 510 | if (err) { |
| 511 | pr_err("Can't request %s clk (%d)", fixed_clock_dev->name, |
| 512 | err); |
| 513 | return err; |
| 514 | } |
| 515 | |
| 516 | /* |
| 517 | * set pllm factor accordingly to the external oscillator |
| 518 | * frequency (HSE). For STM32F4 and STM32F7, we want VCO |
| 519 | * freq at 1MHz |
| 520 | * if input PLL frequency is 25Mhz, divide it by 25 |
| 521 | */ |
| 522 | clk.id = 0; |
| 523 | priv->hse_rate = clk_get_rate(&clk); |
| 524 | |
| 525 | if (priv->hse_rate < 1000000) { |
| 526 | pr_err("%s: unexpected HSE clock rate = %ld \"n", __func__, |
| 527 | priv->hse_rate); |
| 528 | return -EINVAL; |
| 529 | } |
| 530 | |
| 531 | priv->info.sys_pll_psc.pll_m = priv->hse_rate / 1000000; |
| 532 | |
| 533 | if (priv->info.has_overdrive) { |
Patrice Chotard | 1509d66 | 2017-11-15 13:14:47 +0100 | [diff] [blame] | 534 | err = dev_read_phandle_with_args(dev, "st,syscfg", NULL, 0, 0, |
| 535 | &args); |
| 536 | if (err) { |
| 537 | debug("%s: can't find syscon device (%d)\n", __func__, |
| 538 | err); |
| 539 | return err; |
| 540 | } |
Patrice Chotard | 22768d5 | 2017-11-15 13:14:44 +0100 | [diff] [blame] | 541 | |
Patrice Chotard | 1509d66 | 2017-11-15 13:14:47 +0100 | [diff] [blame] | 542 | priv->pwr_regs = (struct stm32_pwr_regs *)ofnode_get_addr(args.node); |
| 543 | } |
Patrice Chotard | 22768d5 | 2017-11-15 13:14:44 +0100 | [diff] [blame] | 544 | |
Patrice Chotard | d93fc2c | 2017-07-18 09:29:04 +0200 | [diff] [blame] | 545 | configure_clocks(dev); |
Vikas Manocha | daaeaab | 2017-02-12 10:25:45 -0800 | [diff] [blame] | 546 | |
| 547 | return 0; |
| 548 | } |
| 549 | |
Simon Glass | b7ae277 | 2017-05-18 20:09:40 -0600 | [diff] [blame] | 550 | static int stm32_clk_of_xlate(struct clk *clk, struct ofnode_phandle_args *args) |
Vikas Manocha | daaeaab | 2017-02-12 10:25:45 -0800 | [diff] [blame] | 551 | { |
| 552 | debug("%s(clk=%p)\n", __func__, clk); |
| 553 | |
| 554 | if (args->args_count != 2) { |
| 555 | debug("Invaild args_count: %d\n", args->args_count); |
| 556 | return -EINVAL; |
| 557 | } |
| 558 | |
| 559 | if (args->args_count) |
| 560 | clk->id = args->args[1]; |
| 561 | else |
| 562 | clk->id = 0; |
| 563 | |
| 564 | return 0; |
| 565 | } |
| 566 | |
| 567 | static struct clk_ops stm32_clk_ops = { |
| 568 | .of_xlate = stm32_clk_of_xlate, |
| 569 | .enable = stm32_clk_enable, |
Patrice Chotard | 7bdf971 | 2017-07-18 09:29:05 +0200 | [diff] [blame] | 570 | .get_rate = stm32_clk_get_rate, |
Patrice Chotard | 24e8578 | 2018-01-29 18:14:14 +0100 | [diff] [blame] | 571 | .set_rate = stm32_set_rate, |
Vikas Manocha | daaeaab | 2017-02-12 10:25:45 -0800 | [diff] [blame] | 572 | }; |
| 573 | |
Patrice Chotard | d4f2d20 | 2017-11-15 13:14:48 +0100 | [diff] [blame] | 574 | U_BOOT_DRIVER(stm32fx_clk) = { |
Patrice Chotard | 03f10a1 | 2017-11-15 13:14:51 +0100 | [diff] [blame] | 575 | .name = "stm32fx_rcc_clock", |
Patrice Chotard | b323de5 | 2017-09-21 10:08:09 +0200 | [diff] [blame] | 576 | .id = UCLASS_CLK, |
Patrice Chotard | b323de5 | 2017-09-21 10:08:09 +0200 | [diff] [blame] | 577 | .ops = &stm32_clk_ops, |
| 578 | .probe = stm32_clk_probe, |
| 579 | .priv_auto_alloc_size = sizeof(struct stm32_clk), |
| 580 | .flags = DM_FLAG_PRE_RELOC, |
Vikas Manocha | daaeaab | 2017-02-12 10:25:45 -0800 | [diff] [blame] | 581 | }; |