coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
clock.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #include <soc/clock.h>
3 #include <device/mmio.h>
4 #include <soc/addressmap.h>
5 
6 #define PLL_REF_CLK 50000000 /* 50 MHz */
7 
8 union cavm_rst_boot {
9  u64 u;
10  struct {
13  u64 lboot:10;
31  } s;
32 };
33 
34 /**
35  * Returns the reference clock speed in Hz
36  */
38 {
39  return PLL_REF_CLK;
40 }
41 
42 /**
43  * Returns the I/O clock speed in Hz
44  */
46 {
47  union cavm_rst_boot rst_boot;
48 
49  rst_boot.u = read64((void *)RST_PF_BAR0);
50 
51  return ((u64)rst_boot.s.pnr_mul) * PLL_REF_CLK;
52 }
53 
54 /**
55  * Returns the core clock speed in Hz
56  */
58 {
59  union cavm_rst_boot rst_boot;
60 
61  rst_boot.u = read64((void *)RST_PF_BAR0);
62 
63  return ((u64)rst_boot.s.c_mul) * PLL_REF_CLK;
64 }
uint64_t read64(const void *addr)
u64 thunderx_get_core_clock(void)
Returns the core clock speed in Hz.
Definition: clock.c:57
#define PLL_REF_CLK
Definition: clock.c:6
u64 thunderx_get_ref_clock(void)
Returns the reference clock speed in Hz.
Definition: clock.c:37
u64 thunderx_get_io_clock(void)
Returns the I/O clock speed in Hz.
Definition: clock.c:45
#define RST_PF_BAR0
Definition: addressmap.h:51
uint64_t u64
Definition: stdint.h:54
u64 reserved_47_54
Definition: clock.c:21
u64 ckill_ppdis
Definition: clock.c:26
u64 reserved_24_29
Definition: clock.c:16
u64 lboot_ext23
Definition: clock.c:14
u64 vrm_err
Definition: clock.c:24
u64 reserved_39_39
Definition: clock.c:19
u64 lboot_ext45
Definition: clock.c:15
u64 rboot_pin
Definition: clock.c:11
u64 lboot_oci
Definition: clock.c:17
u64 jt_tstmode
Definition: clock.c:25
u64 u
Definition: clock.c:9
u64 dis_scan
Definition: clock.c:22
u64 rboot
Definition: clock.c:12
u64 jtcsrdis
Definition: clock.c:29
struct cavm_rst_boot::@430 s
u64 chipkill
Definition: clock.c:30
u64 lboot
Definition: clock.c:13
u64 pnr_mul
Definition: clock.c:18
u64 c_mul
Definition: clock.c:20
u64 ejtagdis
Definition: clock.c:28
u64 dis_huk
Definition: clock.c:23
u64 trusted_mode
Definition: clock.c:27