paul@160 | 1 | /* |
paul@160 | 2 | * Clock and power management. This exposes the combined functionality |
paul@160 | 3 | * provided by the X1600 and related SoCs. The power management |
paul@160 | 4 | * functionality could be exposed using a separate driver. |
paul@160 | 5 | * |
paul@160 | 6 | * Copyright (C) 2017, 2018, 2020, 2021, 2023 Paul Boddie <paul@boddie.org.uk> |
paul@160 | 7 | * |
paul@160 | 8 | * This program is free software; you can redistribute it and/or |
paul@160 | 9 | * modify it under the terms of the GNU General Public License as |
paul@160 | 10 | * published by the Free Software Foundation; either version 2 of |
paul@160 | 11 | * the License, or (at your option) any later version. |
paul@160 | 12 | * |
paul@160 | 13 | * This program is distributed in the hope that it will be useful, |
paul@160 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@160 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@160 | 16 | * GNU General Public License for more details. |
paul@160 | 17 | * |
paul@160 | 18 | * You should have received a copy of the GNU General Public License |
paul@160 | 19 | * along with this program; if not, write to the Free Software |
paul@160 | 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@160 | 21 | * Boston, MA 02110-1301, USA |
paul@160 | 22 | */ |
paul@160 | 23 | |
paul@160 | 24 | #include <l4/devices/hw_mmio_register_block.h> |
paul@160 | 25 | #include "cpm-x1600.h" |
paul@160 | 26 | #include <math.h> |
paul@161 | 27 | #include <stdio.h> |
paul@160 | 28 | |
paul@160 | 29 | |
paul@160 | 30 | |
paul@161 | 31 | // Register locations. |
paul@161 | 32 | |
paul@160 | 33 | enum Regs : unsigned |
paul@160 | 34 | { |
paul@160 | 35 | Clock_control = 0x000, // CPCCR |
paul@160 | 36 | Low_power_control = 0x004, // LCR |
paul@160 | 37 | Clock_gate0 = 0x020, // CLKGR0 |
paul@160 | 38 | Clock_gate1 = 0x028, // CLKGR1 |
paul@160 | 39 | Sleep_control = 0x024, // OPCR (oscillator and power control) |
paul@160 | 40 | Clock_status = 0x0d4, // CPCSR |
paul@167 | 41 | Divider_ddr = 0x02c, // DDRCDR |
paul@167 | 42 | Divider_mac = 0x054, // MACCDR |
paul@167 | 43 | Divider0_i2s0 = 0x060, // I2SCDR |
paul@167 | 44 | Divider1_i2s0 = 0x070, // I2S1CDR |
paul@167 | 45 | Divider_lcd = 0x064, // LPCDR |
paul@167 | 46 | Divider_msc0 = 0x068, // MSC0CDR |
paul@167 | 47 | Divider_msc1 = 0x0a4, // MSC1CDR |
paul@167 | 48 | Divider_sfc = 0x074, // SFCCDR |
paul@167 | 49 | Divider_ssi = 0x05c, // SSICDR |
paul@167 | 50 | Divider_cim = 0x078, // CIMCDR |
paul@167 | 51 | Divider_pwm = 0x06c, // PWMCDR |
paul@167 | 52 | Divider_can0 = 0x0a0, // CAN0CDR |
paul@167 | 53 | Divider_can1 = 0x0a8, // CAN1CDR |
paul@167 | 54 | Divider_cdbus = 0x0ac, // CDBUSCDR |
paul@167 | 55 | Divider_macphy0 = 0x0e4, // MPHY0C |
paul@160 | 56 | Cpm_interrupt = 0x0b0, // CPM_INTR |
paul@160 | 57 | Cpm_interrupt_en = 0x0b4, // CPM_INTRE |
paul@160 | 58 | Cpm_swi = 0x0bc, // CPM_SFTINT |
paul@160 | 59 | Ddr_gate = 0x0d0, // DRCG |
paul@160 | 60 | Cpm_scratch_prot = 0x038, // CPSPPR |
paul@160 | 61 | Cpm_scratch = 0x034, // CPSPR |
paul@160 | 62 | Usb_param_control0 = 0x03c, // USBPCR |
paul@160 | 63 | Usb_reset_detect = 0x040, // USBRDT |
paul@160 | 64 | Usb_vbus_jitter = 0x044, // USBVBFIL |
paul@160 | 65 | Usb_param_control1 = 0x048, // USBPCR1 |
paul@160 | 66 | Pll_control = 0x00c, // CPPCR |
paul@160 | 67 | Pll_control_A = 0x010, // CPAPCR |
paul@160 | 68 | Pll_control_M = 0x014, // CPMPCR |
paul@160 | 69 | Pll_control_E = 0x018, // CPEPCR |
paul@160 | 70 | Pll_fraction_A = 0x084, // CPAPACR |
paul@160 | 71 | Pll_fraction_M = 0x088, // CPMPACR |
paul@160 | 72 | Pll_fraction_E = 0x08c, // CPEPACR |
paul@160 | 73 | }; |
paul@160 | 74 | |
paul@161 | 75 | enum Clock_source_values : unsigned |
paul@160 | 76 | { |
paul@161 | 77 | Source_mME_main = 0, |
paul@161 | 78 | Source_mME_pll_M = 1, |
paul@161 | 79 | Source_mME_pll_E = 2, |
paul@160 | 80 | |
paul@161 | 81 | // Special value |
paul@160 | 82 | |
paul@161 | 83 | Source_mask = 0x3, |
paul@160 | 84 | }; |
paul@160 | 85 | |
paul@160 | 86 | |
paul@160 | 87 | |
paul@166 | 88 | // Register field abstraction. |
paul@166 | 89 | |
paul@166 | 90 | class Field |
paul@166 | 91 | { |
paul@166 | 92 | uint32_t reg; |
paul@166 | 93 | uint32_t mask; |
paul@166 | 94 | uint8_t bit; |
paul@166 | 95 | bool defined; |
paul@166 | 96 | |
paul@166 | 97 | public: |
paul@166 | 98 | explicit Field() |
paul@166 | 99 | : defined(false) |
paul@166 | 100 | { |
paul@166 | 101 | } |
paul@166 | 102 | |
paul@166 | 103 | explicit Field(uint32_t reg, uint32_t mask, uint32_t bit) |
paul@166 | 104 | : reg(reg), mask(mask), bit(bit), defined(true) |
paul@166 | 105 | { |
paul@166 | 106 | } |
paul@166 | 107 | |
paul@166 | 108 | uint32_t get_field(Cpm_regs ®s); |
paul@166 | 109 | void set_field(Cpm_regs ®s, uint32_t value); |
paul@166 | 110 | bool is_defined() { return defined; } |
paul@166 | 111 | }; |
paul@166 | 112 | |
paul@166 | 113 | // Undefined fields. |
paul@166 | 114 | |
paul@171 | 115 | Field Gate_undefined, Change_enable_undefined, Busy_undefined, Divider_undefined; |
paul@166 | 116 | |
paul@166 | 117 | |
paul@166 | 118 | |
paul@169 | 119 | // Clock sources. |
paul@169 | 120 | |
paul@169 | 121 | class Mux |
paul@169 | 122 | { |
paul@169 | 123 | int _num_inputs; |
paul@171 | 124 | enum Clock_identifiers *_inputs, _input; |
paul@169 | 125 | |
paul@169 | 126 | public: |
paul@171 | 127 | explicit Mux(int num_inputs, enum Clock_identifiers inputs[]) |
paul@169 | 128 | : _num_inputs(num_inputs), _inputs(inputs) |
paul@169 | 129 | { |
paul@169 | 130 | } |
paul@169 | 131 | |
paul@171 | 132 | explicit Mux(enum Clock_identifiers input) |
paul@171 | 133 | : _num_inputs(1), _inputs(&_input) |
paul@171 | 134 | { |
paul@171 | 135 | _input = input; |
paul@171 | 136 | } |
paul@171 | 137 | |
paul@171 | 138 | explicit Mux() |
paul@171 | 139 | : _num_inputs(0), _inputs(NULL) |
paul@171 | 140 | { |
paul@171 | 141 | } |
paul@171 | 142 | |
paul@169 | 143 | int get_number() { return _num_inputs; } |
paul@169 | 144 | enum Clock_identifiers get_input(int num); |
paul@169 | 145 | }; |
paul@169 | 146 | |
paul@171 | 147 | class Source |
paul@171 | 148 | { |
paul@171 | 149 | Mux _inputs; |
paul@171 | 150 | Field _source; |
paul@171 | 151 | |
paul@171 | 152 | public: |
paul@171 | 153 | explicit Source(Mux inputs, Field source) |
paul@171 | 154 | : _inputs(inputs), _source(source) |
paul@171 | 155 | { |
paul@171 | 156 | } |
paul@171 | 157 | |
paul@171 | 158 | explicit Source(Mux inputs) |
paul@171 | 159 | : _inputs(inputs) |
paul@171 | 160 | { |
paul@171 | 161 | } |
paul@171 | 162 | |
paul@171 | 163 | explicit Source() |
paul@171 | 164 | { |
paul@171 | 165 | } |
paul@171 | 166 | |
paul@171 | 167 | int get_number() { return _inputs.get_number(); } |
paul@171 | 168 | enum Clock_identifiers get_input(int num) { return _inputs.get_input(num); } |
paul@171 | 169 | |
paul@171 | 170 | // Clock source. |
paul@171 | 171 | |
paul@171 | 172 | uint8_t get_source(Cpm_regs ®s); |
paul@171 | 173 | void set_source(Cpm_regs ®s, uint8_t source); |
paul@172 | 174 | |
paul@172 | 175 | // Clock source frequency. |
paul@172 | 176 | |
paul@172 | 177 | uint32_t get_frequency(Cpm_regs ®s); |
paul@171 | 178 | }; |
paul@171 | 179 | |
paul@169 | 180 | // Undefined sources. |
paul@169 | 181 | |
paul@171 | 182 | Source Source_undefined; |
paul@169 | 183 | |
paul@169 | 184 | |
paul@169 | 185 | |
paul@165 | 186 | // Common clock abstraction. |
paul@165 | 187 | |
paul@165 | 188 | class Clock_base |
paul@165 | 189 | { |
paul@171 | 190 | Source _source; |
paul@165 | 191 | |
paul@165 | 192 | public: |
paul@171 | 193 | explicit Clock_base(Source source) |
paul@171 | 194 | : _source(source) |
paul@165 | 195 | { |
paul@165 | 196 | } |
paul@165 | 197 | |
paul@165 | 198 | // Clock control. |
paul@165 | 199 | |
paul@165 | 200 | virtual int have_clock(Cpm_regs ®s); |
paul@165 | 201 | virtual void start_clock(Cpm_regs ®s); |
paul@165 | 202 | virtual void stop_clock(Cpm_regs ®s); |
paul@165 | 203 | |
paul@165 | 204 | // Clock divider. |
paul@165 | 205 | |
paul@165 | 206 | virtual uint32_t get_divider(Cpm_regs ®s); |
paul@165 | 207 | virtual void set_divider(Cpm_regs ®s, uint32_t division); |
paul@165 | 208 | |
paul@165 | 209 | // Clock source. |
paul@165 | 210 | |
paul@165 | 211 | virtual uint8_t get_source(Cpm_regs ®s); |
paul@165 | 212 | virtual void set_source(Cpm_regs ®s, uint8_t source); |
paul@165 | 213 | |
paul@165 | 214 | // Clock source frequency. |
paul@165 | 215 | |
paul@165 | 216 | virtual uint32_t get_source_frequency(Cpm_regs ®s); |
paul@165 | 217 | |
paul@165 | 218 | // Output frequency. |
paul@165 | 219 | |
paul@165 | 220 | virtual uint32_t get_frequency(Cpm_regs ®s); |
paul@165 | 221 | }; |
paul@165 | 222 | |
paul@165 | 223 | |
paul@165 | 224 | |
paul@165 | 225 | // PLL descriptions. |
paul@165 | 226 | |
paul@165 | 227 | class Pll : public Clock_base |
paul@165 | 228 | { |
paul@168 | 229 | Field _enable, _stable, _bypass; |
paul@168 | 230 | Field _multiplier, _input_division, _output_division0, _output_division1; |
paul@165 | 231 | |
paul@165 | 232 | public: |
paul@171 | 233 | explicit Pll(Source source, |
paul@168 | 234 | Field enable, Field stable, Field bypass, |
paul@168 | 235 | Field multiplier, Field input_division, |
paul@168 | 236 | Field output_division0, Field output_division1) |
paul@171 | 237 | : Clock_base(source), |
paul@168 | 238 | _enable(enable), _stable(stable), _bypass(bypass), |
paul@168 | 239 | _multiplier(multiplier), _input_division(input_division), |
paul@168 | 240 | _output_division0(output_division0), _output_division1(output_division1) |
paul@165 | 241 | { |
paul@165 | 242 | } |
paul@165 | 243 | |
paul@165 | 244 | // PLL_specific control. |
paul@165 | 245 | |
paul@165 | 246 | int have_pll(Cpm_regs ®s); |
paul@165 | 247 | int pll_enabled(Cpm_regs ®s); |
paul@165 | 248 | int pll_bypassed(Cpm_regs ®s); |
paul@165 | 249 | |
paul@165 | 250 | // Clock control. |
paul@165 | 251 | |
paul@165 | 252 | int have_clock(Cpm_regs ®s); |
paul@165 | 253 | void start_clock(Cpm_regs ®s); |
paul@165 | 254 | void stop_clock(Cpm_regs ®s); |
paul@165 | 255 | |
paul@165 | 256 | // General frequency modifiers. |
paul@165 | 257 | |
paul@165 | 258 | uint16_t get_multiplier(Cpm_regs ®s); |
paul@165 | 259 | void set_multiplier(Cpm_regs ®s, uint16_t multiplier); |
paul@165 | 260 | uint8_t get_input_division(Cpm_regs ®s); |
paul@165 | 261 | void set_input_division(Cpm_regs ®s, uint8_t divider); |
paul@165 | 262 | uint8_t get_output_division(Cpm_regs ®s); |
paul@165 | 263 | void set_output_division(Cpm_regs ®s, uint8_t divider); |
paul@165 | 264 | |
paul@165 | 265 | // PLL output frequency. |
paul@165 | 266 | |
paul@165 | 267 | uint32_t get_frequency(Cpm_regs ®s); |
paul@165 | 268 | |
paul@165 | 269 | // Other operations. |
paul@165 | 270 | |
paul@165 | 271 | void set_pll_parameters(Cpm_regs ®s, uint16_t multiplier, |
paul@165 | 272 | uint8_t in_divider, uint8_t out_divider); |
paul@165 | 273 | }; |
paul@165 | 274 | |
paul@165 | 275 | |
paul@165 | 276 | |
paul@161 | 277 | // Clock descriptions. |
paul@161 | 278 | |
paul@165 | 279 | class Clock : public Clock_base |
paul@161 | 280 | { |
paul@166 | 281 | Field _gate, _change_enable, _busy, _divider; |
paul@161 | 282 | |
paul@165 | 283 | // Clock control. |
paul@161 | 284 | |
paul@165 | 285 | void change_disable(Cpm_regs ®s); |
paul@165 | 286 | void change_enable(Cpm_regs ®s); |
paul@165 | 287 | void wait_busy(Cpm_regs ®s); |
paul@161 | 288 | |
paul@165 | 289 | public: |
paul@171 | 290 | explicit Clock(Source source = Source_undefined, |
paul@166 | 291 | Field gate = Gate_undefined, |
paul@166 | 292 | Field change_enable = Change_enable_undefined, |
paul@166 | 293 | Field busy = Busy_undefined, |
paul@166 | 294 | Field divider = Divider_undefined) |
paul@171 | 295 | : Clock_base(source), |
paul@166 | 296 | _gate(gate), _change_enable(change_enable), _busy(busy), _divider(divider) |
paul@165 | 297 | { |
paul@165 | 298 | } |
paul@161 | 299 | |
paul@165 | 300 | // Clock control. |
paul@161 | 301 | |
paul@165 | 302 | int have_clock(Cpm_regs ®s); |
paul@165 | 303 | void start_clock(Cpm_regs ®s); |
paul@165 | 304 | void stop_clock(Cpm_regs ®s); |
paul@161 | 305 | |
paul@165 | 306 | // Clock divider. |
paul@161 | 307 | |
paul@165 | 308 | uint32_t get_divider(Cpm_regs ®s); |
paul@165 | 309 | void set_divider(Cpm_regs ®s, uint32_t division); |
paul@161 | 310 | |
paul@165 | 311 | // Clock source. |
paul@161 | 312 | |
paul@165 | 313 | void set_source(Cpm_regs ®s, uint8_t source); |
paul@161 | 314 | }; |
paul@161 | 315 | |
paul@161 | 316 | |
paul@161 | 317 | |
paul@167 | 318 | // Register field definitions. |
paul@167 | 319 | |
paul@168 | 320 | Field Clock_source_main (Clock_control, 3, 30); // SEL_SRC (output to SCLK_A) |
paul@168 | 321 | Field Clock_source_cpu (Clock_control, 3, 28); // SEL_CPLL (output to CCLK) |
paul@168 | 322 | Field Clock_source_hclock0 (Clock_control, 3, 26); // SEL_H0PLL (output to AHB0) |
paul@168 | 323 | Field Clock_source_hclock2 (Clock_control, 3, 24); // SEL_H2PLL (output to AHB2) |
paul@168 | 324 | Field Clock_source_can0 (Divider_can0, 3, 30); // CA0CS |
paul@168 | 325 | Field Clock_source_can1 (Divider_can1, 3, 30); // CA1CS |
paul@168 | 326 | Field Clock_source_cdbus (Divider_cdbus, 3, 30); // CDCS |
paul@168 | 327 | Field Clock_source_cim (Divider_cim, 3, 30); // CIMPCS |
paul@168 | 328 | Field Clock_source_ddr (Divider_ddr, 3, 30); // DCS |
paul@168 | 329 | Field Clock_source_i2s (Divider0_i2s0, 1, 31); // I2PCS |
paul@168 | 330 | Field Clock_source_lcd (Divider_lcd, 3, 30); // LPCS |
paul@168 | 331 | Field Clock_source_mac (Divider_mac, 3, 30); // MACPCS |
paul@168 | 332 | Field Clock_source_msc0 (Divider_msc0, 3, 30); // MPCS |
paul@168 | 333 | Field Clock_source_msc1 (Divider_msc1, 3, 30); // MPCS |
paul@168 | 334 | Field Clock_source_pwm (Divider_pwm, 3, 30); // PWMPCS |
paul@168 | 335 | Field Clock_source_sfc (Divider_sfc, 3, 30); // SFCS |
paul@168 | 336 | Field Clock_source_ssi (Divider_ssi, 3, 30); // SPCS |
paul@167 | 337 | |
paul@167 | 338 | Field Clock_busy_cpu (Clock_status, 1, 0); |
paul@167 | 339 | Field Clock_busy_ddr (Divider_ddr, 1, 28); |
paul@167 | 340 | Field Clock_busy_mac (Divider_mac, 1, 28); |
paul@167 | 341 | Field Clock_busy_lcd (Divider_lcd, 1, 28); |
paul@167 | 342 | Field Clock_busy_msc0 (Divider_msc0, 1, 28); |
paul@167 | 343 | Field Clock_busy_msc1 (Divider_msc1, 1, 28); |
paul@167 | 344 | Field Clock_busy_sfc (Divider_sfc, 1, 28); |
paul@167 | 345 | Field Clock_busy_ssi (Divider_ssi, 1, 28); |
paul@167 | 346 | Field Clock_busy_cim (Divider_cim, 1, 28); |
paul@167 | 347 | Field Clock_busy_pwm (Divider_pwm, 1, 28); |
paul@167 | 348 | Field Clock_busy_can0 (Divider_can0, 1, 28); |
paul@167 | 349 | Field Clock_busy_can1 (Divider_can1, 1, 28); |
paul@167 | 350 | Field Clock_busy_cdbus (Divider_cdbus, 1, 28); |
paul@167 | 351 | |
paul@167 | 352 | Field Clock_change_enable_cpu (Clock_control, 1, 22); |
paul@167 | 353 | Field Clock_change_enable_ahb0 (Clock_control, 1, 21); |
paul@167 | 354 | Field Clock_change_enable_ahb2 (Clock_control, 1, 20); |
paul@167 | 355 | Field Clock_change_enable_ddr (Divider_ddr, 1, 29); |
paul@167 | 356 | Field Clock_change_enable_mac (Divider_mac, 1, 29); |
paul@167 | 357 | Field Clock_change_enable_i2s (Divider0_i2s0, 1, 29); |
paul@167 | 358 | Field Clock_change_enable_lcd (Divider_lcd, 1, 29); |
paul@167 | 359 | Field Clock_change_enable_msc0 (Divider_msc0, 1, 29); |
paul@167 | 360 | Field Clock_change_enable_msc1 (Divider_msc1, 1, 29); |
paul@167 | 361 | Field Clock_change_enable_sfc (Divider_sfc, 1, 29); |
paul@167 | 362 | Field Clock_change_enable_ssi (Divider_ssi, 1, 29); |
paul@167 | 363 | Field Clock_change_enable_cim (Divider_cim, 1, 29); |
paul@167 | 364 | Field Clock_change_enable_pwm (Divider_pwm, 1, 29); |
paul@167 | 365 | Field Clock_change_enable_can0 (Divider_can0, 1, 29); |
paul@167 | 366 | Field Clock_change_enable_can1 (Divider_can1, 1, 29); |
paul@167 | 367 | Field Clock_change_enable_cdbus (Divider_cdbus, 1, 29); |
paul@167 | 368 | |
paul@168 | 369 | Field Clock_divider_can0 (Divider_can0, 0xff, 0); // CAN0CDR |
paul@168 | 370 | Field Clock_divider_can1 (Divider_can1, 0xff, 0); // CAN1CDR |
paul@168 | 371 | Field Clock_divider_cdbus (Divider_cdbus, 0xff, 0); // CDBUSCDR |
paul@168 | 372 | Field Clock_divider_cim (Divider_cim, 0xff, 0); // CIMCDR |
paul@168 | 373 | Field Clock_divider_cpu (Clock_control, 0x0f, 0); // CDIV |
paul@168 | 374 | Field Clock_divider_ddr (Divider_ddr, 0x0f, 0); // DDRCDR |
paul@168 | 375 | Field Clock_divider_hclock0 (Clock_control, 0x0f, 8); // H0DIV (fast AHB peripherals) |
paul@168 | 376 | Field Clock_divider_hclock2 (Clock_control, 0x0f, 12); // H2DIV (fast AHB peripherals) |
paul@168 | 377 | Field Clock_divider_l2cache (Clock_control, 0x0f, 4); // L2CDIV |
paul@168 | 378 | Field Clock_divider_lcd (Divider_lcd, 0xff, 0); // LPCDR |
paul@168 | 379 | Field Clock_divider_mac (Divider_mac, 0xff, 0); // MACCDR |
paul@168 | 380 | Field Clock_divider_msc0 (Divider_msc0, 0xff, 0); // MSC0CDR |
paul@168 | 381 | Field Clock_divider_msc1 (Divider_msc1, 0xff, 0); // MSC1CDR |
paul@168 | 382 | Field Clock_divider_pclock (Clock_control, 0x0f, 16); // PDIV (slow APB peripherals) |
paul@168 | 383 | Field Clock_divider_pwm (Divider_pwm, 0x0f, 0); // PWMCDR |
paul@168 | 384 | Field Clock_divider_sfc (Divider_sfc, 0xff, 0); // SFCCDR |
paul@168 | 385 | Field Clock_divider_ssi (Divider_ssi, 0xff, 0); // SSICDR |
paul@167 | 386 | |
paul@168 | 387 | Field Clock_gate_main (Clock_control, 1, 23); // GATE_SCLKA |
paul@168 | 388 | Field Clock_gate_ddr (Clock_gate0, 1, 31); // DDR |
paul@168 | 389 | Field Clock_gate_ahb0 (Clock_gate0, 1, 29); // AHB0 |
paul@168 | 390 | Field Clock_gate_apb0 (Clock_gate0, 1, 28); // APB0 |
paul@168 | 391 | Field Clock_gate_rtc (Clock_gate0, 1, 27); // RTC |
paul@168 | 392 | Field Clock_gate_aes (Clock_gate0, 1, 24); // AES |
paul@168 | 393 | Field Clock_gate_lcd_pixel (Clock_gate0, 1, 23); // LCD |
paul@168 | 394 | Field Clock_gate_cim (Clock_gate0, 1, 22); // CIM |
paul@168 | 395 | Field Clock_gate_dma (Clock_gate0, 1, 21); // PDMA |
paul@168 | 396 | Field Clock_gate_ost (Clock_gate0, 1, 20); // OST |
paul@168 | 397 | Field Clock_gate_ssi0 (Clock_gate0, 1, 19); // SSI0 |
paul@168 | 398 | Field Clock_gate_timer (Clock_gate0, 1, 18); // TCU |
paul@168 | 399 | Field Clock_gate_dtrng (Clock_gate0, 1, 17); // DTRNG |
paul@168 | 400 | Field Clock_gate_uart2 (Clock_gate0, 1, 16); // UART2 |
paul@168 | 401 | Field Clock_gate_uart1 (Clock_gate0, 1, 15); // UART1 |
paul@168 | 402 | Field Clock_gate_uart0 (Clock_gate0, 1, 14); // UART0 |
paul@168 | 403 | Field Clock_gate_sadc (Clock_gate0, 1, 13); // SADC |
paul@168 | 404 | Field Clock_gate_audio (Clock_gate0, 1, 11); // AUDIO |
paul@168 | 405 | Field Clock_gate_ssi_slv (Clock_gate0, 1, 10); // SSI_SLV |
paul@168 | 406 | Field Clock_gate_i2c1 (Clock_gate0, 1, 8); // I2C1 |
paul@168 | 407 | Field Clock_gate_i2c0 (Clock_gate0, 1, 7); // I2C0 |
paul@168 | 408 | Field Clock_gate_msc1 (Clock_gate0, 1, 5); // MSC1 |
paul@168 | 409 | Field Clock_gate_msc0 (Clock_gate0, 1, 4); // MSC0 |
paul@168 | 410 | Field Clock_gate_otg (Clock_gate0, 1, 3); // OTG |
paul@168 | 411 | Field Clock_gate_sfc (Clock_gate0, 1, 2); // SFC |
paul@168 | 412 | Field Clock_gate_efuse (Clock_gate0, 1, 1); // EFUSE |
paul@168 | 413 | Field Clock_gate_nemc (Clock_gate0, 1, 0); // NEMC |
paul@168 | 414 | Field Clock_gate_arb (Clock_gate1, 1, 30); // ARB |
paul@168 | 415 | Field Clock_gate_mipi_csi (Clock_gate1, 1, 28); // MIPI_CSI |
paul@168 | 416 | Field Clock_gate_intc (Clock_gate1, 1, 26); // INTC |
paul@168 | 417 | Field Clock_gate_gmac0 (Clock_gate1, 1, 23); // GMAC0 |
paul@168 | 418 | Field Clock_gate_uart3 (Clock_gate1, 1, 16); // UART3 |
paul@168 | 419 | Field Clock_gate_i2s0_tx (Clock_gate1, 1, 9); // I2S0_dev_tclk |
paul@168 | 420 | Field Clock_gate_i2s0_rx (Clock_gate1, 1, 8); // I2S0_dev_rclk |
paul@168 | 421 | Field Clock_gate_hash (Clock_gate1, 1, 6); // HASH |
paul@168 | 422 | Field Clock_gate_pwm (Clock_gate1, 1, 5); // PWM |
paul@168 | 423 | Field Clock_gate_cdbus (Clock_gate1, 1, 2); // CDBUS |
paul@168 | 424 | Field Clock_gate_can1 (Clock_gate1, 1, 1); // CAN1 |
paul@168 | 425 | Field Clock_gate_can0 (Clock_gate1, 1, 0); // CAN0 |
paul@168 | 426 | |
paul@168 | 427 | Field Pll_enable_A (Pll_control_A, 1, 0); // APLLEN |
paul@168 | 428 | Field Pll_enable_E (Pll_control_E, 1, 0); // EPLLEN |
paul@168 | 429 | Field Pll_enable_M (Pll_control_M, 1, 0); // MPLLEN |
paul@168 | 430 | |
paul@168 | 431 | Field Pll_stable_A (Pll_control_A, 1, 3); // APLL_ON |
paul@168 | 432 | Field Pll_stable_E (Pll_control_E, 1, 3); // EPLL_ON |
paul@168 | 433 | Field Pll_stable_M (Pll_control_M, 1, 3); // MPLL_ON |
paul@168 | 434 | |
paul@168 | 435 | Field Pll_bypass_A (Pll_control_A, 1, 30); // APLL_BP |
paul@168 | 436 | Field Pll_bypass_E (Pll_control_E, 1, 26); // EPLL_BP |
paul@168 | 437 | Field Pll_bypass_M (Pll_control_M, 1, 28); // MPLL_BP |
paul@168 | 438 | |
paul@168 | 439 | Field Pll_multiplier_A (Pll_control_A, 0x1fff, 20); // APLLM |
paul@168 | 440 | Field Pll_multiplier_E (Pll_control_E, 0x1fff, 20); // EPLLM |
paul@168 | 441 | Field Pll_multiplier_M (Pll_control_M, 0x1fff, 20); // MPLLM |
paul@168 | 442 | |
paul@168 | 443 | Field Pll_input_division_A (Pll_control_A, 0x3f, 14); // APLLN |
paul@168 | 444 | Field Pll_input_division_E (Pll_control_E, 0x3f, 14); // EPLLN |
paul@168 | 445 | Field Pll_input_division_M (Pll_control_M, 0x3f, 14); // MPLLN |
paul@168 | 446 | |
paul@168 | 447 | Field Pll_output_division1_A (Pll_control_A, 0x07, 11); // APLLOD1 |
paul@168 | 448 | Field Pll_output_division1_E (Pll_control_E, 0x07, 11); // EPLLOD1 |
paul@168 | 449 | Field Pll_output_division1_M (Pll_control_M, 0x07, 11); // MPLLOD1 |
paul@168 | 450 | |
paul@168 | 451 | Field Pll_output_division0_A (Pll_control_A, 0x07, 8); // APLLOD0 |
paul@168 | 452 | Field Pll_output_division0_E (Pll_control_E, 0x07, 8); // EPLLOD0 |
paul@168 | 453 | Field Pll_output_division0_M (Pll_control_M, 0x07, 8); // MPLLOD0 |
paul@167 | 454 | |
paul@167 | 455 | |
paul@167 | 456 | |
paul@169 | 457 | // Multiplexer instances. |
paul@169 | 458 | |
paul@169 | 459 | #define Clocks(...) ((enum Clock_identifiers []) {__VA_ARGS__}) |
paul@169 | 460 | |
paul@171 | 461 | Mux mux_external(Clock_external); |
paul@171 | 462 | |
paul@171 | 463 | Mux mux_pclock(Clock_pclock); |
paul@171 | 464 | |
paul@171 | 465 | Mux mux_ahb2_apb(Clock_ahb2_apb); |
paul@169 | 466 | |
paul@169 | 467 | Mux mux_core(3, Clocks(Clock_none, Clock_main, Clock_pll_M)); |
paul@169 | 468 | |
paul@169 | 469 | Mux mux_bus(4, Clocks(Clock_main, Clock_pll_M, Clock_pll_E, Clock_external)); |
paul@169 | 470 | |
paul@169 | 471 | Mux mux_dev(3, Clocks(Clock_main, Clock_pll_M, Clock_pll_E)); |
paul@169 | 472 | |
paul@169 | 473 | Mux mux_i2s(2, Clocks(Clock_main, Clock_pll_E)); |
paul@169 | 474 | |
paul@169 | 475 | |
paul@169 | 476 | |
paul@165 | 477 | // Clock instances. |
paul@165 | 478 | |
paul@171 | 479 | Clock clock_ahb2_apb(Source(mux_core, Clock_source_hclock2)); |
paul@165 | 480 | |
paul@165 | 481 | Clock clock_aic_bitclk; |
paul@165 | 482 | |
paul@165 | 483 | Clock clock_aic_pclk; |
paul@165 | 484 | |
paul@171 | 485 | Clock clock_can0(Source(mux_bus, Clock_source_can0), |
paul@167 | 486 | Clock_gate_can0, |
paul@167 | 487 | Clock_change_enable_can0, |
paul@167 | 488 | Clock_busy_can0, |
paul@167 | 489 | Clock_divider_can0); |
paul@165 | 490 | |
paul@171 | 491 | Clock clock_can1(Source(mux_bus, Clock_source_can1), |
paul@167 | 492 | Clock_gate_can1, |
paul@167 | 493 | Clock_change_enable_can1, |
paul@167 | 494 | Clock_busy_can1, |
paul@167 | 495 | Clock_divider_can1); |
paul@165 | 496 | |
paul@171 | 497 | Clock clock_cdbus(Source(mux_dev, Clock_source_cdbus), |
paul@167 | 498 | Clock_gate_cdbus, |
paul@167 | 499 | Clock_change_enable_cdbus, |
paul@167 | 500 | Clock_busy_cdbus, |
paul@167 | 501 | Clock_divider_cdbus); |
paul@165 | 502 | |
paul@171 | 503 | Clock clock_cim(Source(mux_dev, Clock_source_cim), |
paul@167 | 504 | Clock_gate_cim, |
paul@167 | 505 | Clock_change_enable_cim, |
paul@167 | 506 | Clock_busy_cim, |
paul@167 | 507 | Clock_divider_cim); |
paul@165 | 508 | |
paul@171 | 509 | Clock clock_cpu(Source(mux_core, Clock_source_cpu), |
paul@166 | 510 | Gate_undefined, |
paul@167 | 511 | Clock_change_enable_cpu, |
paul@167 | 512 | Clock_busy_cpu, |
paul@167 | 513 | Clock_divider_cpu); |
paul@165 | 514 | |
paul@171 | 515 | Clock clock_ddr(Source(mux_core, Clock_source_ddr), |
paul@167 | 516 | Clock_gate_ddr, |
paul@167 | 517 | Clock_change_enable_ddr, |
paul@167 | 518 | Clock_busy_ddr, |
paul@167 | 519 | Clock_divider_ddr); |
paul@165 | 520 | |
paul@171 | 521 | Clock clock_dma(Source(mux_pclock), Clock_gate_dma); |
paul@165 | 522 | |
paul@165 | 523 | Clock clock_emac; |
paul@165 | 524 | |
paul@165 | 525 | Clock clock_external; |
paul@165 | 526 | |
paul@171 | 527 | Clock clock_hclock0(Source(mux_core, Clock_source_hclock0), |
paul@167 | 528 | Clock_gate_ahb0, |
paul@167 | 529 | Clock_change_enable_ahb0, |
paul@166 | 530 | Busy_undefined, |
paul@167 | 531 | Clock_divider_hclock0); |
paul@165 | 532 | |
paul@171 | 533 | Clock clock_hclock2(Source(mux_ahb2_apb), |
paul@167 | 534 | Clock_gate_apb0, |
paul@167 | 535 | Clock_change_enable_ahb2, |
paul@166 | 536 | Busy_undefined, |
paul@167 | 537 | Clock_divider_hclock2); |
paul@165 | 538 | |
paul@165 | 539 | Clock clock_hdmi; |
paul@165 | 540 | |
paul@171 | 541 | Clock clock_i2c(Source(mux_pclock), Clock_gate_i2c0); |
paul@165 | 542 | |
paul@171 | 543 | Clock clock_i2c0(Source(mux_pclock), Clock_gate_i2c0); |
paul@165 | 544 | |
paul@171 | 545 | Clock clock_i2c1(Source(mux_pclock), Clock_gate_i2c1); |
paul@165 | 546 | |
paul@165 | 547 | Clock clock_i2s; |
paul@165 | 548 | |
paul@171 | 549 | Clock clock_i2s0_rx(Source(mux_i2s, Clock_source_i2s), |
paul@167 | 550 | Clock_gate_i2s0_rx, |
paul@167 | 551 | Clock_change_enable_i2s); |
paul@165 | 552 | |
paul@171 | 553 | Clock clock_i2s0_tx(Source(mux_i2s, Clock_source_i2s), |
paul@167 | 554 | Clock_gate_i2s0_tx, |
paul@167 | 555 | Clock_change_enable_i2s); |
paul@165 | 556 | |
paul@165 | 557 | Clock clock_kbc; |
paul@165 | 558 | |
paul@165 | 559 | Clock clock_lcd; |
paul@165 | 560 | |
paul@171 | 561 | Clock clock_lcd_pixel(Source(mux_dev, Clock_source_lcd), |
paul@167 | 562 | Clock_gate_lcd_pixel, |
paul@167 | 563 | Clock_change_enable_lcd, |
paul@167 | 564 | Clock_busy_lcd, |
paul@167 | 565 | Clock_divider_lcd); |
paul@165 | 566 | |
paul@171 | 567 | Clock clock_mac(Source(mux_dev, Clock_source_mac), |
paul@167 | 568 | Clock_gate_gmac0, |
paul@167 | 569 | Clock_change_enable_mac, |
paul@167 | 570 | Clock_busy_mac, |
paul@167 | 571 | Clock_divider_mac); |
paul@165 | 572 | |
paul@171 | 573 | Clock clock_main(Source(mux_core, Clock_source_main), |
paul@167 | 574 | Clock_gate_main); |
paul@165 | 575 | |
paul@171 | 576 | Clock clock_msc(Source(mux_dev, Clock_source_msc0), |
paul@167 | 577 | Clock_gate_msc0, |
paul@167 | 578 | Clock_change_enable_msc0, |
paul@167 | 579 | Clock_busy_msc0, |
paul@167 | 580 | Clock_divider_msc0); |
paul@165 | 581 | |
paul@171 | 582 | Clock clock_msc0(Source(mux_dev, Clock_source_msc0), |
paul@167 | 583 | Clock_gate_msc0, |
paul@167 | 584 | Clock_change_enable_msc0, |
paul@167 | 585 | Clock_busy_msc0, |
paul@167 | 586 | Clock_divider_msc0); |
paul@165 | 587 | |
paul@171 | 588 | Clock clock_msc1(Source(mux_dev, Clock_source_msc1), |
paul@167 | 589 | Clock_gate_msc1, |
paul@167 | 590 | Clock_change_enable_msc1, |
paul@167 | 591 | Clock_busy_msc1, |
paul@167 | 592 | Clock_divider_msc1); |
paul@165 | 593 | |
paul@165 | 594 | Clock clock_none; |
paul@161 | 595 | |
paul@171 | 596 | Clock clock_pclock(Source(mux_ahb2_apb), |
paul@167 | 597 | Clock_gate_apb0, |
paul@166 | 598 | Change_enable_undefined, |
paul@166 | 599 | Busy_undefined, |
paul@167 | 600 | Clock_divider_pclock); |
paul@165 | 601 | |
paul@171 | 602 | Pll clock_pll_A(Source(mux_external), |
paul@168 | 603 | Pll_enable_A, Pll_stable_A, Pll_bypass_A, |
paul@168 | 604 | Pll_multiplier_A, Pll_input_division_A, |
paul@168 | 605 | Pll_output_division0_A, Pll_output_division1_A); |
paul@165 | 606 | |
paul@171 | 607 | Pll clock_pll_E(Source(mux_external), |
paul@168 | 608 | Pll_enable_E, Pll_stable_E, Pll_bypass_E, |
paul@168 | 609 | Pll_multiplier_E, Pll_input_division_E, |
paul@168 | 610 | Pll_output_division0_E, Pll_output_division1_E); |
paul@165 | 611 | |
paul@171 | 612 | Pll clock_pll_M(Source(mux_external), |
paul@168 | 613 | Pll_enable_M, Pll_stable_M, Pll_bypass_M, |
paul@168 | 614 | Pll_multiplier_M, Pll_input_division_M, |
paul@168 | 615 | Pll_output_division0_M, Pll_output_division1_M); |
paul@165 | 616 | |
paul@171 | 617 | Clock clock_pwm(Source(mux_dev, Clock_source_pwm), |
paul@167 | 618 | Clock_gate_pwm, |
paul@167 | 619 | Clock_change_enable_pwm, |
paul@167 | 620 | Clock_busy_pwm, |
paul@167 | 621 | Clock_divider_pwm); |
paul@165 | 622 | |
paul@171 | 623 | Clock clock_pwm0(Source(mux_dev, Clock_source_pwm), |
paul@167 | 624 | Clock_gate_pwm, |
paul@167 | 625 | Clock_change_enable_pwm, |
paul@167 | 626 | Clock_busy_pwm, |
paul@167 | 627 | Clock_divider_pwm); |
paul@165 | 628 | |
paul@165 | 629 | Clock clock_pwm1; |
paul@165 | 630 | |
paul@165 | 631 | Clock clock_scc; |
paul@165 | 632 | |
paul@171 | 633 | Clock clock_sfc(Source(mux_dev, Clock_source_sfc), |
paul@167 | 634 | Clock_gate_sfc, |
paul@167 | 635 | Clock_change_enable_sfc, |
paul@167 | 636 | Clock_busy_sfc, |
paul@167 | 637 | Clock_divider_sfc); |
paul@165 | 638 | |
paul@165 | 639 | Clock clock_smb0; |
paul@165 | 640 | |
paul@165 | 641 | Clock clock_smb1; |
paul@165 | 642 | |
paul@165 | 643 | Clock clock_smb2; |
paul@165 | 644 | |
paul@165 | 645 | Clock clock_smb3; |
paul@165 | 646 | |
paul@165 | 647 | Clock clock_smb4; |
paul@165 | 648 | |
paul@171 | 649 | Clock clock_ssi(Source(mux_dev, Clock_source_ssi), |
paul@167 | 650 | Clock_gate_ssi0, |
paul@167 | 651 | Clock_change_enable_ssi, |
paul@167 | 652 | Clock_busy_ssi, |
paul@167 | 653 | Clock_divider_ssi); |
paul@165 | 654 | |
paul@171 | 655 | Clock clock_timer(Source(mux_pclock), Clock_gate_timer); |
paul@165 | 656 | |
paul@171 | 657 | Clock clock_uart0(Source(mux_external), Clock_gate_uart0); |
paul@165 | 658 | |
paul@171 | 659 | Clock clock_uart1(Source(mux_external), Clock_gate_uart1); |
paul@165 | 660 | |
paul@171 | 661 | Clock clock_uart2(Source(mux_external), Clock_gate_uart2); |
paul@165 | 662 | |
paul@171 | 663 | Clock clock_uart3(Source(mux_external), Clock_gate_uart3); |
paul@165 | 664 | |
paul@165 | 665 | Clock clock_udc; |
paul@165 | 666 | |
paul@165 | 667 | Clock clock_uhc; |
paul@165 | 668 | |
paul@165 | 669 | Clock clock_uprt; |
paul@165 | 670 | |
paul@165 | 671 | |
paul@165 | 672 | |
paul@165 | 673 | // Clock register. |
paul@165 | 674 | |
paul@165 | 675 | static Clock_base *clocks[Clock_identifier_count] = { |
paul@165 | 676 | &clock_ahb2_apb, |
paul@165 | 677 | &clock_aic_bitclk, |
paul@165 | 678 | &clock_aic_pclk, |
paul@165 | 679 | &clock_can0, |
paul@165 | 680 | &clock_can1, |
paul@165 | 681 | &clock_cdbus, |
paul@165 | 682 | &clock_cim, |
paul@165 | 683 | &clock_cpu, |
paul@165 | 684 | &clock_ddr, |
paul@165 | 685 | &clock_dma, |
paul@165 | 686 | &clock_emac, |
paul@165 | 687 | &clock_external, |
paul@165 | 688 | &clock_hclock0, |
paul@165 | 689 | &clock_hclock2, |
paul@165 | 690 | &clock_hdmi, |
paul@165 | 691 | &clock_i2c, |
paul@165 | 692 | &clock_i2c0, |
paul@165 | 693 | &clock_i2c1, |
paul@165 | 694 | &clock_i2s, |
paul@165 | 695 | &clock_i2s0_rx, |
paul@165 | 696 | &clock_i2s0_tx, |
paul@165 | 697 | &clock_kbc, |
paul@165 | 698 | &clock_lcd, |
paul@165 | 699 | &clock_lcd_pixel, |
paul@165 | 700 | &clock_mac, |
paul@165 | 701 | &clock_main, |
paul@165 | 702 | &clock_msc, |
paul@165 | 703 | &clock_msc0, |
paul@165 | 704 | &clock_msc1, |
paul@165 | 705 | &clock_none, |
paul@165 | 706 | &clock_pclock, |
paul@165 | 707 | &clock_pll_A, |
paul@165 | 708 | &clock_pll_E, |
paul@165 | 709 | &clock_pll_M, |
paul@165 | 710 | &clock_pwm, |
paul@165 | 711 | &clock_pwm0, |
paul@165 | 712 | &clock_pwm1, |
paul@165 | 713 | &clock_scc, |
paul@165 | 714 | &clock_sfc, |
paul@165 | 715 | &clock_smb0, |
paul@165 | 716 | &clock_smb1, |
paul@165 | 717 | &clock_smb2, |
paul@165 | 718 | &clock_smb3, |
paul@165 | 719 | &clock_smb4, |
paul@165 | 720 | &clock_ssi, |
paul@165 | 721 | &clock_timer, |
paul@165 | 722 | &clock_uart0, |
paul@165 | 723 | &clock_uart1, |
paul@165 | 724 | &clock_uart2, |
paul@165 | 725 | &clock_uart3, |
paul@165 | 726 | &clock_udc, |
paul@165 | 727 | &clock_uhc, |
paul@165 | 728 | &clock_uprt, |
paul@165 | 729 | }; |
paul@165 | 730 | |
paul@165 | 731 | |
paul@165 | 732 | |
paul@165 | 733 | // Register access. |
paul@165 | 734 | |
paul@165 | 735 | Cpm_regs::Cpm_regs(l4_addr_t addr, uint32_t exclk_freq) |
paul@165 | 736 | : exclk_freq(exclk_freq) |
paul@161 | 737 | { |
paul@165 | 738 | _regs = new Hw::Mmio_register_block<32>(addr); |
paul@161 | 739 | } |
paul@161 | 740 | |
paul@165 | 741 | // Utility methods. |
paul@165 | 742 | |
paul@165 | 743 | uint32_t |
paul@165 | 744 | Cpm_regs::get_field(uint32_t reg, uint32_t mask, uint8_t shift) |
paul@165 | 745 | { |
paul@165 | 746 | return (_regs[reg] & (mask << shift)) >> shift; |
paul@165 | 747 | } |
paul@165 | 748 | |
paul@165 | 749 | void |
paul@165 | 750 | Cpm_regs::set_field(uint32_t reg, uint32_t mask, uint8_t shift, uint32_t value) |
paul@165 | 751 | { |
paul@165 | 752 | _regs[reg] = (_regs[reg] & (~(mask << shift))) | ((mask & value) << shift); |
paul@165 | 753 | } |
paul@165 | 754 | |
paul@165 | 755 | |
paul@165 | 756 | |
paul@166 | 757 | // Field methods. |
paul@166 | 758 | |
paul@166 | 759 | uint32_t |
paul@166 | 760 | Field::get_field(Cpm_regs ®s) |
paul@166 | 761 | { |
paul@166 | 762 | if (defined) |
paul@166 | 763 | return regs.get_field(reg, mask, bit); |
paul@166 | 764 | else |
paul@166 | 765 | return 0; |
paul@166 | 766 | } |
paul@166 | 767 | |
paul@166 | 768 | void |
paul@166 | 769 | Field::set_field(Cpm_regs ®s, uint32_t value) |
paul@166 | 770 | { |
paul@166 | 771 | if (defined) |
paul@166 | 772 | regs.set_field(reg, mask, bit, value); |
paul@166 | 773 | } |
paul@166 | 774 | |
paul@166 | 775 | |
paul@166 | 776 | |
paul@169 | 777 | // Clock sources. |
paul@169 | 778 | |
paul@169 | 779 | enum Clock_identifiers |
paul@169 | 780 | Mux::get_input(int num) |
paul@169 | 781 | { |
paul@169 | 782 | if (num < _num_inputs) |
paul@169 | 783 | return _inputs[num]; |
paul@169 | 784 | else |
paul@169 | 785 | return Clock_undefined; |
paul@169 | 786 | } |
paul@169 | 787 | |
paul@171 | 788 | // Clock sources. |
paul@171 | 789 | |
paul@171 | 790 | uint8_t |
paul@171 | 791 | Source::get_source(Cpm_regs ®s) |
paul@171 | 792 | { |
paul@171 | 793 | if (_source.is_defined()) |
paul@171 | 794 | return _source.get_field(regs); |
paul@171 | 795 | else |
paul@171 | 796 | return 0; |
paul@171 | 797 | } |
paul@171 | 798 | |
paul@171 | 799 | void |
paul@171 | 800 | Source::set_source(Cpm_regs ®s, uint8_t source) |
paul@171 | 801 | { |
paul@171 | 802 | if (!_source.is_defined()) |
paul@171 | 803 | return; |
paul@171 | 804 | |
paul@171 | 805 | _source.set_field(regs, source); |
paul@171 | 806 | } |
paul@171 | 807 | |
paul@172 | 808 | // Clock source frequencies. |
paul@172 | 809 | |
paul@172 | 810 | uint32_t |
paul@172 | 811 | Source::get_frequency(Cpm_regs ®s) |
paul@172 | 812 | { |
paul@172 | 813 | // Return the external clock frequency without any input clock. |
paul@172 | 814 | |
paul@172 | 815 | if (get_number() == 0) |
paul@172 | 816 | return regs.exclk_freq; |
paul@172 | 817 | |
paul@172 | 818 | // Clocks with one source yield that input frequency. |
paul@172 | 819 | |
paul@172 | 820 | else if (get_number() == 1) |
paul@172 | 821 | return clocks[get_input(0)]->get_frequency(regs); |
paul@172 | 822 | |
paul@172 | 823 | // With multiple sources, obtain the selected source for the clock. |
paul@172 | 824 | |
paul@172 | 825 | uint8_t source = get_source(regs); |
paul@172 | 826 | enum Clock_identifiers input = get_input(source); |
paul@172 | 827 | |
paul@172 | 828 | // Return the frequency of the source. |
paul@172 | 829 | |
paul@172 | 830 | if (input != Clock_undefined) |
paul@172 | 831 | return clocks[input]->get_frequency(regs); |
paul@172 | 832 | else |
paul@172 | 833 | return 0; |
paul@172 | 834 | } |
paul@172 | 835 | |
paul@169 | 836 | |
paul@169 | 837 | |
paul@165 | 838 | // Clock control. |
paul@165 | 839 | |
paul@165 | 840 | int |
paul@165 | 841 | Clock_base::have_clock(Cpm_regs ®s) |
paul@165 | 842 | { |
paul@165 | 843 | (void) regs; |
paul@165 | 844 | return true; |
paul@165 | 845 | } |
paul@165 | 846 | |
paul@165 | 847 | void |
paul@165 | 848 | Clock_base::start_clock(Cpm_regs ®s) |
paul@165 | 849 | { |
paul@165 | 850 | (void) regs; |
paul@165 | 851 | } |
paul@165 | 852 | |
paul@165 | 853 | void |
paul@165 | 854 | Clock_base::stop_clock(Cpm_regs ®s) |
paul@165 | 855 | { |
paul@165 | 856 | (void) regs; |
paul@165 | 857 | } |
paul@165 | 858 | |
paul@165 | 859 | // Default divider. |
paul@165 | 860 | |
paul@165 | 861 | uint32_t |
paul@165 | 862 | Clock_base::get_divider(Cpm_regs ®s) |
paul@165 | 863 | { |
paul@165 | 864 | (void) regs; |
paul@165 | 865 | return 1; |
paul@165 | 866 | } |
paul@165 | 867 | |
paul@165 | 868 | void |
paul@165 | 869 | Clock_base::set_divider(Cpm_regs ®s, uint32_t division) |
paul@165 | 870 | { |
paul@165 | 871 | (void) regs; |
paul@165 | 872 | (void) division; |
paul@165 | 873 | } |
paul@165 | 874 | |
paul@165 | 875 | // Clock sources. |
paul@165 | 876 | |
paul@165 | 877 | uint8_t |
paul@165 | 878 | Clock_base::get_source(Cpm_regs ®s) |
paul@165 | 879 | { |
paul@171 | 880 | return _source.get_source(regs); |
paul@165 | 881 | } |
paul@165 | 882 | |
paul@165 | 883 | void |
paul@165 | 884 | Clock_base::set_source(Cpm_regs ®s, uint8_t source) |
paul@165 | 885 | { |
paul@171 | 886 | _source.set_source(regs, source); |
paul@165 | 887 | } |
paul@165 | 888 | |
paul@165 | 889 | // Clock source frequencies. |
paul@165 | 890 | |
paul@165 | 891 | uint32_t |
paul@165 | 892 | Clock_base::get_source_frequency(Cpm_regs ®s) |
paul@165 | 893 | { |
paul@172 | 894 | return _source.get_frequency(regs); |
paul@165 | 895 | } |
paul@165 | 896 | |
paul@165 | 897 | // Output clock frequencies. |
paul@165 | 898 | |
paul@165 | 899 | uint32_t |
paul@165 | 900 | Clock_base::get_frequency(Cpm_regs ®s) |
paul@165 | 901 | { |
paul@165 | 902 | return get_source_frequency(regs) / get_divider(regs); |
paul@165 | 903 | } |
paul@165 | 904 | |
paul@165 | 905 | |
paul@165 | 906 | |
paul@165 | 907 | // PLL-specific control. |
paul@165 | 908 | |
paul@165 | 909 | int |
paul@165 | 910 | Pll::have_pll(Cpm_regs ®s) |
paul@165 | 911 | { |
paul@168 | 912 | return _stable.get_field(regs); |
paul@165 | 913 | } |
paul@165 | 914 | |
paul@165 | 915 | int |
paul@165 | 916 | Pll::pll_enabled(Cpm_regs ®s) |
paul@165 | 917 | { |
paul@168 | 918 | return _enable.get_field(regs); |
paul@165 | 919 | } |
paul@165 | 920 | |
paul@165 | 921 | int |
paul@165 | 922 | Pll::pll_bypassed(Cpm_regs ®s) |
paul@165 | 923 | { |
paul@168 | 924 | return _bypass.get_field(regs); |
paul@165 | 925 | } |
paul@165 | 926 | |
paul@165 | 927 | // Clock control. |
paul@165 | 928 | |
paul@165 | 929 | int |
paul@165 | 930 | Pll::have_clock(Cpm_regs ®s) |
paul@165 | 931 | { |
paul@165 | 932 | return have_pll(regs) && pll_enabled(regs); |
paul@165 | 933 | } |
paul@165 | 934 | |
paul@165 | 935 | void |
paul@165 | 936 | Pll::start_clock(Cpm_regs ®s) |
paul@165 | 937 | { |
paul@168 | 938 | _enable.set_field(regs, 1); |
paul@165 | 939 | while (!have_pll(regs)); |
paul@165 | 940 | } |
paul@165 | 941 | |
paul@165 | 942 | void |
paul@165 | 943 | Pll::stop_clock(Cpm_regs ®s) |
paul@161 | 944 | { |
paul@168 | 945 | _enable.set_field(regs, 0); |
paul@165 | 946 | while (have_pll(regs)); |
paul@165 | 947 | } |
paul@165 | 948 | |
paul@165 | 949 | // Feedback (13-bit) multiplier. |
paul@165 | 950 | |
paul@165 | 951 | uint16_t |
paul@165 | 952 | Pll::get_multiplier(Cpm_regs ®s) |
paul@165 | 953 | { |
paul@168 | 954 | return _multiplier.get_field(regs) + 1; |
paul@165 | 955 | } |
paul@165 | 956 | |
paul@165 | 957 | void |
paul@165 | 958 | Pll::set_multiplier(Cpm_regs ®s, uint16_t multiplier) |
paul@165 | 959 | { |
paul@168 | 960 | _multiplier.set_field(regs, multiplier - 1); |
paul@165 | 961 | } |
paul@165 | 962 | |
paul@165 | 963 | // Input (6-bit) divider. |
paul@165 | 964 | |
paul@165 | 965 | uint8_t |
paul@165 | 966 | Pll::get_input_division(Cpm_regs ®s) |
paul@165 | 967 | { |
paul@168 | 968 | return _input_division.get_field(regs) + 1; |
paul@165 | 969 | } |
paul@165 | 970 | |
paul@165 | 971 | void |
paul@165 | 972 | Pll::set_input_division(Cpm_regs ®s, uint8_t divider) |
paul@165 | 973 | { |
paul@168 | 974 | _input_division.set_field(regs, divider - 1); |
paul@165 | 975 | } |
paul@165 | 976 | |
paul@165 | 977 | // Output (dual 3-bit) dividers. |
paul@165 | 978 | |
paul@165 | 979 | uint8_t |
paul@165 | 980 | Pll::get_output_division(Cpm_regs ®s) |
paul@165 | 981 | { |
paul@168 | 982 | uint8_t d0 = _output_division0.get_field(regs); |
paul@168 | 983 | uint8_t d1 = _output_division1.get_field(regs); |
paul@165 | 984 | |
paul@165 | 985 | return d0 * d1; |
paul@165 | 986 | } |
paul@165 | 987 | |
paul@165 | 988 | void |
paul@165 | 989 | Pll::set_output_division(Cpm_regs ®s, uint8_t divider) |
paul@165 | 990 | { |
paul@165 | 991 | // Assert 1 as a minimum. |
paul@165 | 992 | // Divider 0 must be less than or equal to divider 1. |
paul@165 | 993 | |
paul@165 | 994 | uint8_t d0 = (uint8_t) floor(sqrt(divider ? divider : 1)); |
paul@165 | 995 | uint8_t d1 = divider / d0; |
paul@165 | 996 | |
paul@168 | 997 | _output_division0.set_field(regs, d0); |
paul@168 | 998 | _output_division1.set_field(regs, d1); |
paul@165 | 999 | } |
paul@165 | 1000 | |
paul@165 | 1001 | uint32_t |
paul@165 | 1002 | Pll::get_frequency(Cpm_regs ®s) |
paul@165 | 1003 | { |
paul@165 | 1004 | // Test for PLL enable and not PLL bypass. |
paul@165 | 1005 | |
paul@165 | 1006 | if (pll_enabled(regs)) |
paul@165 | 1007 | { |
paul@165 | 1008 | if (!pll_bypassed(regs)) |
paul@165 | 1009 | return (get_source_frequency(regs) * get_multiplier(regs)) / |
paul@165 | 1010 | (get_input_division(regs) * get_output_division(regs)); |
paul@165 | 1011 | else |
paul@165 | 1012 | return get_source_frequency(regs); |
paul@165 | 1013 | } |
paul@165 | 1014 | else |
paul@165 | 1015 | return 0; |
paul@165 | 1016 | } |
paul@165 | 1017 | |
paul@165 | 1018 | void |
paul@165 | 1019 | Pll::set_pll_parameters(Cpm_regs ®s, uint16_t multiplier, uint8_t in_divider, uint8_t out_divider) |
paul@165 | 1020 | { |
paul@165 | 1021 | set_multiplier(regs, multiplier); |
paul@165 | 1022 | set_input_division(regs, in_divider); |
paul@165 | 1023 | set_output_division(regs, out_divider); |
paul@161 | 1024 | |
paul@165 | 1025 | if (pll_enabled(regs) && !pll_bypassed(regs)) |
paul@165 | 1026 | while (!have_pll(regs)); |
paul@165 | 1027 | } |
paul@165 | 1028 | |
paul@165 | 1029 | |
paul@165 | 1030 | |
paul@165 | 1031 | // Clock control. |
paul@165 | 1032 | |
paul@165 | 1033 | void |
paul@165 | 1034 | Clock::change_disable(Cpm_regs ®s) |
paul@165 | 1035 | { |
paul@166 | 1036 | if (_change_enable.is_defined()) |
paul@166 | 1037 | _change_enable.set_field(regs, 0); |
paul@165 | 1038 | } |
paul@165 | 1039 | |
paul@165 | 1040 | void |
paul@165 | 1041 | Clock::change_enable(Cpm_regs ®s) |
paul@165 | 1042 | { |
paul@166 | 1043 | if (_change_enable.is_defined()) |
paul@166 | 1044 | _change_enable.set_field(regs, 1); |
paul@165 | 1045 | } |
paul@165 | 1046 | |
paul@165 | 1047 | int |
paul@165 | 1048 | Clock::have_clock(Cpm_regs ®s) |
paul@165 | 1049 | { |
paul@166 | 1050 | if (_gate.is_defined()) |
paul@166 | 1051 | return !_gate.get_field(regs); |
paul@165 | 1052 | else |
paul@165 | 1053 | return true; |
paul@165 | 1054 | } |
paul@165 | 1055 | |
paul@165 | 1056 | void |
paul@165 | 1057 | Clock::start_clock(Cpm_regs ®s) |
paul@165 | 1058 | { |
paul@166 | 1059 | if (_gate.is_defined()) |
paul@166 | 1060 | _gate.set_field(regs, 0); |
paul@165 | 1061 | } |
paul@165 | 1062 | |
paul@165 | 1063 | void |
paul@165 | 1064 | Clock::stop_clock(Cpm_regs ®s) |
paul@165 | 1065 | { |
paul@166 | 1066 | if (_gate.is_defined()) |
paul@166 | 1067 | _gate.set_field(regs, 1); |
paul@165 | 1068 | } |
paul@165 | 1069 | |
paul@165 | 1070 | void |
paul@165 | 1071 | Clock::wait_busy(Cpm_regs ®s) |
paul@165 | 1072 | { |
paul@166 | 1073 | if (_busy.is_defined()) |
paul@166 | 1074 | while (_busy.get_field(regs)); |
paul@165 | 1075 | } |
paul@165 | 1076 | |
paul@165 | 1077 | |
paul@165 | 1078 | |
paul@165 | 1079 | // Clock dividers. |
paul@165 | 1080 | |
paul@165 | 1081 | uint32_t |
paul@165 | 1082 | Clock::get_divider(Cpm_regs ®s) |
paul@165 | 1083 | { |
paul@166 | 1084 | if (_divider.is_defined()) |
paul@166 | 1085 | return _divider.get_field(regs) + 1; |
paul@165 | 1086 | else |
paul@165 | 1087 | return 1; |
paul@165 | 1088 | } |
paul@165 | 1089 | |
paul@165 | 1090 | void |
paul@165 | 1091 | Clock::set_divider(Cpm_regs ®s, uint32_t division) |
paul@165 | 1092 | { |
paul@170 | 1093 | if (!_divider.is_defined()) |
paul@165 | 1094 | return; |
paul@165 | 1095 | |
paul@165 | 1096 | change_enable(regs); |
paul@166 | 1097 | _divider.set_field(regs, division - 1); |
paul@165 | 1098 | wait_busy(regs); |
paul@165 | 1099 | change_disable(regs); |
paul@165 | 1100 | } |
paul@165 | 1101 | |
paul@165 | 1102 | void |
paul@165 | 1103 | Clock::set_source(Cpm_regs ®s, uint8_t source) |
paul@165 | 1104 | { |
paul@165 | 1105 | change_enable(regs); |
paul@165 | 1106 | Clock_base::set_source(regs, source); |
paul@165 | 1107 | wait_busy(regs); |
paul@165 | 1108 | change_disable(regs); |
paul@161 | 1109 | } |
paul@161 | 1110 | |
paul@161 | 1111 | |
paul@161 | 1112 | |
paul@160 | 1113 | // If implemented as a Hw::Device, various properties would be |
paul@160 | 1114 | // initialised in the constructor and obtained from the device tree |
paul@160 | 1115 | // definitions. |
paul@160 | 1116 | |
paul@160 | 1117 | Cpm_x1600_chip::Cpm_x1600_chip(l4_addr_t addr, uint32_t exclk_freq) |
paul@165 | 1118 | : _cpm_regs(addr, exclk_freq) |
paul@160 | 1119 | { |
paul@160 | 1120 | // add_cid("cpm"); |
paul@160 | 1121 | // add_cid("cpm-x1600"); |
paul@165 | 1122 | // register_property("exclk_freq", &exclk_freq); |
paul@161 | 1123 | } |
paul@160 | 1124 | |
paul@161 | 1125 | int |
paul@161 | 1126 | Cpm_x1600_chip::have_clock(enum Clock_identifiers clock) |
paul@161 | 1127 | { |
paul@165 | 1128 | return clocks[clock]->have_clock(_cpm_regs); |
paul@161 | 1129 | } |
paul@161 | 1130 | |
paul@161 | 1131 | void |
paul@161 | 1132 | Cpm_x1600_chip::start_clock(enum Clock_identifiers clock) |
paul@160 | 1133 | { |
paul@165 | 1134 | clocks[clock]->start_clock(_cpm_regs); |
paul@161 | 1135 | } |
paul@161 | 1136 | |
paul@161 | 1137 | void |
paul@161 | 1138 | Cpm_x1600_chip::stop_clock(enum Clock_identifiers clock) |
paul@161 | 1139 | { |
paul@165 | 1140 | clocks[clock]->stop_clock(_cpm_regs); |
paul@160 | 1141 | } |
paul@160 | 1142 | |
paul@161 | 1143 | uint32_t |
paul@161 | 1144 | Cpm_x1600_chip::get_divider(enum Clock_identifiers clock) |
paul@160 | 1145 | { |
paul@165 | 1146 | return clocks[clock]->get_divider(_cpm_regs); |
paul@160 | 1147 | } |
paul@160 | 1148 | |
paul@161 | 1149 | void |
paul@161 | 1150 | Cpm_x1600_chip::set_divider(enum Clock_identifiers clock, uint32_t division) |
paul@160 | 1151 | { |
paul@165 | 1152 | clocks[clock]->set_divider(_cpm_regs, division); |
paul@160 | 1153 | } |
paul@160 | 1154 | |
paul@160 | 1155 | uint8_t |
paul@161 | 1156 | Cpm_x1600_chip::get_source(enum Clock_identifiers clock) |
paul@160 | 1157 | { |
paul@165 | 1158 | return clocks[clock]->get_source(_cpm_regs); |
paul@160 | 1159 | } |
paul@160 | 1160 | |
paul@160 | 1161 | void |
paul@161 | 1162 | Cpm_x1600_chip::set_source(enum Clock_identifiers clock, uint8_t source) |
paul@160 | 1163 | { |
paul@165 | 1164 | clocks[clock]->set_source(_cpm_regs, source); |
paul@160 | 1165 | } |
paul@160 | 1166 | |
paul@161 | 1167 | uint32_t |
paul@161 | 1168 | Cpm_x1600_chip::get_source_frequency(enum Clock_identifiers clock) |
paul@160 | 1169 | { |
paul@165 | 1170 | return clocks[clock]->get_source_frequency(_cpm_regs); |
paul@160 | 1171 | } |
paul@160 | 1172 | |
paul@160 | 1173 | uint32_t |
paul@160 | 1174 | Cpm_x1600_chip::get_frequency(enum Clock_identifiers clock) |
paul@160 | 1175 | { |
paul@165 | 1176 | return clocks[clock]->get_frequency(_cpm_regs); |
paul@160 | 1177 | } |
paul@160 | 1178 | |
paul@160 | 1179 | void |
paul@160 | 1180 | Cpm_x1600_chip::set_frequency(enum Clock_identifiers clock, uint32_t frequency) |
paul@160 | 1181 | { |
paul@160 | 1182 | switch (clock) |
paul@160 | 1183 | { |
paul@160 | 1184 | // The pixel frequency is based on the selected clock source (SCLK_A, MPLL or |
paul@160 | 1185 | // EPLL). |
paul@160 | 1186 | |
paul@160 | 1187 | case Clock_lcd_pixel: |
paul@165 | 1188 | { |
paul@160 | 1189 | |
paul@160 | 1190 | // Switch to the MPLL and attempt to set the divider. |
paul@160 | 1191 | |
paul@165 | 1192 | Clock_base *lcd = clocks[Clock_lcd_pixel]; |
paul@165 | 1193 | Clock_base *pll = clocks[Clock_pll_M]; |
paul@165 | 1194 | |
paul@165 | 1195 | lcd->set_source(_cpm_regs, Source_mME_pll_M); |
paul@165 | 1196 | pll->start_clock(_cpm_regs); |
paul@165 | 1197 | lcd->set_divider(_cpm_regs, lcd->get_source_frequency(_cpm_regs) / frequency); |
paul@160 | 1198 | break; |
paul@165 | 1199 | } |
paul@160 | 1200 | |
paul@160 | 1201 | default: |
paul@160 | 1202 | break; |
paul@160 | 1203 | } |
paul@160 | 1204 | } |
paul@160 | 1205 | |
paul@165 | 1206 | void |
paul@165 | 1207 | Cpm_x1600_chip::set_pll_parameters(enum Clock_identifiers clock, uint16_t multiplier, |
paul@165 | 1208 | uint8_t in_divider, uint8_t out_divider) |
paul@165 | 1209 | { |
paul@165 | 1210 | Pll *pll = dynamic_cast<Pll *>(clocks[clock]); |
paul@165 | 1211 | |
paul@165 | 1212 | pll->set_pll_parameters(_cpm_regs, multiplier, in_divider, out_divider); |
paul@165 | 1213 | } |
paul@165 | 1214 | |
paul@160 | 1215 | |
paul@160 | 1216 | |
paul@160 | 1217 | // C language interface functions. |
paul@160 | 1218 | |
paul@160 | 1219 | void |
paul@160 | 1220 | *x1600_cpm_init(l4_addr_t cpm_base) |
paul@160 | 1221 | { |
paul@160 | 1222 | /* Initialise the clock and power management peripheral with the |
paul@160 | 1223 | register memory region and a 24MHz EXCLK frequency. */ |
paul@160 | 1224 | |
paul@160 | 1225 | return (void *) new Cpm_x1600_chip(cpm_base, 24000000); |
paul@160 | 1226 | } |
paul@160 | 1227 | |
paul@160 | 1228 | int |
paul@160 | 1229 | x1600_cpm_have_clock(void *cpm, enum Clock_identifiers clock) |
paul@160 | 1230 | { |
paul@160 | 1231 | return static_cast<Cpm_x1600_chip *>(cpm)->have_clock(clock); |
paul@160 | 1232 | } |
paul@160 | 1233 | |
paul@160 | 1234 | void |
paul@160 | 1235 | x1600_cpm_start_clock(void *cpm, enum Clock_identifiers clock) |
paul@160 | 1236 | { |
paul@160 | 1237 | static_cast<Cpm_x1600_chip *>(cpm)->start_clock(clock); |
paul@160 | 1238 | } |
paul@160 | 1239 | |
paul@160 | 1240 | void |
paul@160 | 1241 | x1600_cpm_stop_clock(void *cpm, enum Clock_identifiers clock) |
paul@160 | 1242 | { |
paul@160 | 1243 | static_cast<Cpm_x1600_chip *>(cpm)->stop_clock(clock); |
paul@160 | 1244 | } |
paul@160 | 1245 | |
paul@161 | 1246 | uint32_t |
paul@161 | 1247 | x1600_cpm_get_divider(void *cpm, enum Clock_identifiers clock) |
paul@160 | 1248 | { |
paul@161 | 1249 | return static_cast<Cpm_x1600_chip *>(cpm)->get_divider(clock); |
paul@160 | 1250 | } |
paul@160 | 1251 | |
paul@161 | 1252 | void |
paul@161 | 1253 | x1600_cpm_set_divider(void *cpm, enum Clock_identifiers clock, uint32_t divider) |
paul@160 | 1254 | { |
paul@161 | 1255 | return static_cast<Cpm_x1600_chip *>(cpm)->set_divider(clock, divider); |
paul@160 | 1256 | } |
paul@160 | 1257 | |
paul@160 | 1258 | uint8_t |
paul@161 | 1259 | x1600_cpm_get_source(void *cpm, enum Clock_identifiers clock) |
paul@160 | 1260 | { |
paul@161 | 1261 | return static_cast<Cpm_x1600_chip *>(cpm)->get_source(clock); |
paul@160 | 1262 | } |
paul@160 | 1263 | |
paul@160 | 1264 | void |
paul@161 | 1265 | x1600_cpm_set_source(void *cpm, enum Clock_identifiers clock, uint8_t source) |
paul@160 | 1266 | { |
paul@161 | 1267 | static_cast<Cpm_x1600_chip *>(cpm)->set_source(clock, source); |
paul@160 | 1268 | } |
paul@160 | 1269 | |
paul@160 | 1270 | uint32_t |
paul@161 | 1271 | x1600_cpm_get_source_frequency(void *cpm, enum Clock_identifiers clock) |
paul@160 | 1272 | { |
paul@161 | 1273 | return static_cast<Cpm_x1600_chip *>(cpm)->get_source_frequency(clock); |
paul@160 | 1274 | } |
paul@160 | 1275 | |
paul@160 | 1276 | uint32_t |
paul@160 | 1277 | x1600_cpm_get_frequency(void *cpm, enum Clock_identifiers clock) |
paul@160 | 1278 | { |
paul@160 | 1279 | return static_cast<Cpm_x1600_chip *>(cpm)->get_frequency(clock); |
paul@160 | 1280 | } |
paul@160 | 1281 | |
paul@160 | 1282 | void |
paul@160 | 1283 | x1600_cpm_set_frequency(void *cpm, enum Clock_identifiers clock, uint32_t frequency) |
paul@160 | 1284 | { |
paul@160 | 1285 | static_cast<Cpm_x1600_chip *>(cpm)->set_frequency(clock, frequency); |
paul@160 | 1286 | } |
paul@160 | 1287 | |
paul@160 | 1288 | void |
paul@160 | 1289 | x1600_cpm_set_mpll_parameters(void *cpm, uint16_t multiplier, uint8_t in_divider, uint8_t out_divider) |
paul@160 | 1290 | { |
paul@165 | 1291 | static_cast<Cpm_x1600_chip *>(cpm)->set_pll_parameters(Clock_pll_M, multiplier, in_divider, out_divider); |
paul@160 | 1292 | } |