TT-System-Firmware APIs 19.10.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
clock_control_tt_grendel.c File Reference
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/sys/sys_io.h>
#include <zephyr/sys/util.h>
#include <zephyr/logging/log.h>
#include <platform.h>
Include dependency graph for clock_control_tt_grendel.c:

Data Structures

struct  clock_control_tt_grendel_config
struct  clock_control_tt_grendel_data

Macros

#define DT_DRV_COMPAT   tenstorrent_grendel_clock_control
#define CGM_READ(reg)
#define CGM_WRITE(reg, val)
#define POSTDIV_CONFIG_BYPASS_THEN_SWITCH   0x0
#define POSTDIV_CONFIG_ALWAYS_POSTDIV   0x1
#define POSTDIV_CONFIG_FORCE_BYPASS   0x2
#define POSTDIV_CONFIG_FORCE_GATE   0x3
#define FCW_INT_MIN   16
#define FCW_INT_MAX   255
#define FCW_FRAC_BITS   14
#define POSTDIV_MIN   1
#define POSTDIV_MAX   4
#define CGM_NUM_OUTPUTS   4
#define CLOCK_CONTROL_TT_GRENDEL_INIT(_inst)

Functions

 LOG_MODULE_REGISTER (clock_control_tt_grendel, CONFIG_CLOCK_CONTROL_LOG_LEVEL)
static void cgm_strobe_reg_update (const struct clock_control_tt_grendel_config *cfg)
static int cgm_wait_for_lock (const struct clock_control_tt_grendel_config *cfg)
static uint32_t postdiv_mask_for_output (uint8_t output)
static uint8_t cgm_get_postdiv (const struct clock_control_tt_grendel_config *cfg, uint8_t output)
static void cgm_set_postdiv (const struct clock_control_tt_grendel_config *cfg, uint8_t output, uint8_t postdiv)
static void cgm_set_postdiv_config (const struct clock_control_tt_grendel_config *cfg, uint8_t output, uint8_t config_val)
static uint8_t cgm_get_postdiv_config (const struct clock_control_tt_grendel_config *cfg, uint8_t output)
static int clock_control_tt_grendel_on (const struct device *dev, clock_control_subsys_t sys)
static int clock_control_tt_grendel_off (const struct device *dev, clock_control_subsys_t sys)
static int clock_control_tt_grendel_set_rate (const struct device *dev, clock_control_subsys_t sys, clock_control_subsys_rate_t rate)
static int clock_control_tt_grendel_get_rate (const struct device *dev, clock_control_subsys_t sys, uint32_t *rate)
static int clock_control_tt_grendel_init (const struct device *dev)

Variables

static const struct clock_control_driver_api clock_control_tt_grendel_api

Macro Definition Documentation

◆ CGM_NUM_OUTPUTS

#define CGM_NUM_OUTPUTS   4

◆ CGM_READ

#define CGM_READ ( reg)
Value:
sys_read32(cfg->base + SMC_CPU_SMC_WRAP_PLL_CNTL_CGM_0_##reg##_REG_OFFSET)
static ALWAYS_INLINE uint32_t sys_read32(mem_addr_t addr)

◆ CGM_WRITE

#define CGM_WRITE ( reg,
val )
Value:
sys_write32((val), cfg->base + SMC_CPU_SMC_WRAP_PLL_CNTL_CGM_0_##reg##_REG_OFFSET)
static ALWAYS_INLINE void sys_write32(uint32_t data, mem_addr_t addr)

◆ CLOCK_CONTROL_TT_GRENDEL_INIT

#define CLOCK_CONTROL_TT_GRENDEL_INIT ( _inst)
Value:
static struct clock_control_tt_grendel_data clock_control_tt_grendel_data_##_inst; \
\
static const struct clock_control_tt_grendel_config \
clock_control_tt_grendel_config_##_inst = { \
.base = DT_REG_ADDR(DT_DRV_INST(_inst)), \
.ref_clk = DT_PROP(DT_INST_CLOCKS_CTLR(_inst), clock_frequency), \
}; \
\
DEVICE_DT_INST_DEFINE(_inst, clock_control_tt_grendel_init, NULL, \
&clock_control_tt_grendel_data_##_inst, \
&clock_control_tt_grendel_config_##_inst, POST_KERNEL, \
CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &clock_control_tt_grendel_api);
#define NULL
Definition avs.c:45
static int clock_control_tt_grendel_init(const struct device *dev)
Definition clock_control_tt_grendel.c:297
static const struct clock_control_driver_api clock_control_tt_grendel_api
Definition clock_control_tt_grendel.c:304
#define DT_INST_CLOCKS_CTLR(inst)
#define DT_PROP(node_id, prop)
#define DT_DRV_INST(inst)
#define DT_REG_ADDR(node_id)
Definition clock_control_tt_grendel.c:37
Definition clock_control_tt_grendel.c:42

◆ DT_DRV_COMPAT

#define DT_DRV_COMPAT   tenstorrent_grendel_clock_control

◆ FCW_FRAC_BITS

#define FCW_FRAC_BITS   14

◆ FCW_INT_MAX

#define FCW_INT_MAX   255

◆ FCW_INT_MIN

#define FCW_INT_MIN   16

◆ POSTDIV_CONFIG_ALWAYS_POSTDIV

#define POSTDIV_CONFIG_ALWAYS_POSTDIV   0x1

◆ POSTDIV_CONFIG_BYPASS_THEN_SWITCH

#define POSTDIV_CONFIG_BYPASS_THEN_SWITCH   0x0

◆ POSTDIV_CONFIG_FORCE_BYPASS

#define POSTDIV_CONFIG_FORCE_BYPASS   0x2

◆ POSTDIV_CONFIG_FORCE_GATE

#define POSTDIV_CONFIG_FORCE_GATE   0x3

◆ POSTDIV_MAX

#define POSTDIV_MAX   4

◆ POSTDIV_MIN

#define POSTDIV_MIN   1

Function Documentation

◆ cgm_get_postdiv()

uint8_t cgm_get_postdiv ( const struct clock_control_tt_grendel_config * cfg,
uint8_t output )
static

◆ cgm_get_postdiv_config()

uint8_t cgm_get_postdiv_config ( const struct clock_control_tt_grendel_config * cfg,
uint8_t output )
static

◆ cgm_set_postdiv()

void cgm_set_postdiv ( const struct clock_control_tt_grendel_config * cfg,
uint8_t output,
uint8_t postdiv )
static

◆ cgm_set_postdiv_config()

void cgm_set_postdiv_config ( const struct clock_control_tt_grendel_config * cfg,
uint8_t output,
uint8_t config_val )
static

◆ cgm_strobe_reg_update()

void cgm_strobe_reg_update ( const struct clock_control_tt_grendel_config * cfg)
inlinestatic

◆ cgm_wait_for_lock()

int cgm_wait_for_lock ( const struct clock_control_tt_grendel_config * cfg)
static

◆ clock_control_tt_grendel_get_rate()

int clock_control_tt_grendel_get_rate ( const struct device * dev,
clock_control_subsys_t sys,
uint32_t * rate )
static

◆ clock_control_tt_grendel_init()

int clock_control_tt_grendel_init ( const struct device * dev)
static

◆ clock_control_tt_grendel_off()

int clock_control_tt_grendel_off ( const struct device * dev,
clock_control_subsys_t sys )
static

◆ clock_control_tt_grendel_on()

int clock_control_tt_grendel_on ( const struct device * dev,
clock_control_subsys_t sys )
static

◆ clock_control_tt_grendel_set_rate()

int clock_control_tt_grendel_set_rate ( const struct device * dev,
clock_control_subsys_t sys,
clock_control_subsys_rate_t rate )
static

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( clock_control_tt_grendel ,
CONFIG_CLOCK_CONTROL_LOG_LEVEL  )

◆ postdiv_mask_for_output()

uint32_t postdiv_mask_for_output ( uint8_t output)
static

Variable Documentation

◆ clock_control_tt_grendel_api

const struct clock_control_driver_api clock_control_tt_grendel_api
static
Initial value:
= {
}
static int clock_control_tt_grendel_get_rate(const struct device *dev, clock_control_subsys_t sys, uint32_t *rate)
Definition clock_control_tt_grendel.c:257
static int clock_control_tt_grendel_set_rate(const struct device *dev, clock_control_subsys_t sys, clock_control_subsys_rate_t rate)
Definition clock_control_tt_grendel.c:196
static int clock_control_tt_grendel_off(const struct device *dev, clock_control_subsys_t sys)
Definition clock_control_tt_grendel.c:176
static int clock_control_tt_grendel_on(const struct device *dev, clock_control_subsys_t sys)
Definition clock_control_tt_grendel.c:143