drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / src / soc / cavium / cn81xx / clock.c
blob0aafefc7e46cc951b8070785fa6f15dcdaa552b2
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #include <soc/clock.h>
3 #include <device/mmio.h>
4 #include <soc/addressmap.h>
6 #define PLL_REF_CLK 50000000 /* 50 MHz */
8 union cavm_rst_boot {
9 u64 u;
10 struct {
11 u64 rboot_pin:1;
12 u64 rboot:1;
13 u64 lboot:10;
14 u64 lboot_ext23:6;
15 u64 lboot_ext45:6;
16 u64 reserved_24_29:6;
17 u64 lboot_oci:3;
18 u64 pnr_mul:6;
19 u64 reserved_39_39:1;
20 u64 c_mul:7;
21 u64 reserved_47_54:8;
22 u64 dis_scan:1;
23 u64 dis_huk:1;
24 u64 vrm_err:1;
25 u64 jt_tstmode:1;
26 u64 ckill_ppdis:1;
27 u64 trusted_mode:1;
28 u64 ejtagdis:1;
29 u64 jtcsrdis:1;
30 u64 chipkill:1;
31 } s;
34 /**
35 * Returns the reference clock speed in Hz
37 u64 thunderx_get_ref_clock(void)
39 return PLL_REF_CLK;
42 /**
43 * Returns the I/O clock speed in Hz
45 u64 thunderx_get_io_clock(void)
47 union cavm_rst_boot rst_boot;
49 rst_boot.u = read64p(RST_PF_BAR0);
51 return ((u64)rst_boot.s.pnr_mul) * PLL_REF_CLK;
54 /**
55 * Returns the core clock speed in Hz
57 u64 thunderx_get_core_clock(void)
59 union cavm_rst_boot rst_boot;
61 rst_boot.u = read64p(RST_PF_BAR0);
63 return ((u64)rst_boot.s.c_mul) * PLL_REF_CLK;