TT-System-Firmware APIs 19.15.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
reset_tt_bh.c File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <zephyr/device.h>
#include <zephyr/drivers/reset.h>
#include <zephyr/drivers/reset/reset_tt_bh.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/sys_io.h>
Include dependency graph for reset_tt_bh.c:

Data Structures

struct  tt_bh_reset_config
struct  tt_bh_reset_data

Macros

#define DT_DRV_COMPAT   tenstorrent_bh_reset
#define TT_BH_RESET_MASK_FROM_NRESETS(_n)
#define TT_BH_RESET_MASK(_n)
#define TT_BH_NUM_RESET_SPECIFIERS(_n)
#define TT_BH_RESET_MASK_DEFINE(_n)
#define TT_BH_RESET_DEFINE(_n)

Functions

static bool tt_bh_reset_is_valid_id (const struct device *dev, uint32_t id)
static bool tt_bh_reset_is_valid_offset (const struct device *dev, uint32_t offset)
static int tt_bh_reset_status (const struct device *dev, uint32_t id, uint8_t *status)
static int tt_bh_reset_line_assert (const struct device *dev, uint32_t id)
static int tt_bh_reset_line_deassert (const struct device *dev, uint32_t id)
static int tt_bh_reset_line_toggle (const struct device *dev, uint32_t id)
int reset_tt_bh_write (const struct device *dev, uint32_t value)
 Absolute write to a BH reset-unit bank register.
int reset_tt_bh_lines_assert (const struct device *dev, uint32_t offset, uint32_t mask)
 Assert lines in mask at offset with a single RMW.
int reset_tt_bh_lines_deassert (const struct device *dev, uint32_t offset, uint32_t mask)
 Deassert lines in mask at offset with a single RMW.
static int tt_bh_reset_init (const struct device *dev)
static DEVICE_API (reset, tt_bh_reset_api)
 DT_INST_FOREACH_STATUS_OKAY (TT_BH_RESET_DEFINE)

Macro Definition Documentation

◆ DT_DRV_COMPAT

#define DT_DRV_COMPAT   tenstorrent_bh_reset

◆ TT_BH_NUM_RESET_SPECIFIERS

#define TT_BH_NUM_RESET_SPECIFIERS ( _n)
Value:
(!!DT_INST_PROP_OR(_n, nresets, 0) + !!DT_INST_PROP_OR(_n, reset_mask, 0))
#define DT_INST_PROP_OR(inst, prop, default_value)

◆ TT_BH_RESET_DEFINE

#define TT_BH_RESET_DEFINE ( _n)
Value:
"Maximally 1 of nresets or reset-mask may be specified"); \
BUILD_ASSERT((DT_INST_REG_SIZE(_n) % TT_BH_RESET_BANK_STRIDE) == 0, \
"reg size must be a multiple of bank stride"); \
\
static struct tt_bh_reset_data tt_bh_reset_data_##_n; \
static const struct tt_bh_reset_config tt_bh_reset_config_##_n = { \
.base = DT_INST_REG_ADDR(_n), \
.size = DT_INST_REG_SIZE(_n), \
.reset_mask = TT_BH_RESET_MASK_DEFINE(_n), \
}; \
\
BUILD_ASSERT(TT_BH_RESET_MASK_DEFINE(_n) != 0, "reset mask should never be zero"); \
\
DEVICE_DT_INST_DEFINE(_n, tt_bh_reset_init, NULL, &tt_bh_reset_data_##_n, \
&tt_bh_reset_config_##_n, PRE_KERNEL_1, CONFIG_RESET_INIT_PRIORITY, \
&tt_bh_reset_api);
#define NULL
Definition avs.c:45
BUILD_ASSERT((int) BH_PCIE_MODE_DISABLED==FwTable_PciPropertyTable_PcieMode_DISABLED)
#define DT_INST_REG_SIZE(inst)
#define DT_INST_REG_ADDR(inst)
#define TT_BH_NUM_RESET_SPECIFIERS(_n)
Definition reset_tt_bh.c:196
#define TT_BH_RESET_MASK_DEFINE(_n)
Definition reset_tt_bh.c:199
static int tt_bh_reset_init(const struct device *dev)
Definition reset_tt_bh.c:180
#define TT_BH_RESET_BANK_STRIDE
Definition reset_tt_bh.h:21
Definition reset_tt_bh.c:19
Definition reset_tt_bh.c:25

◆ TT_BH_RESET_MASK

#define TT_BH_RESET_MASK ( _n)
Value:
DT_INST_PROP_OR(_n, reset_mask, 0)

◆ TT_BH_RESET_MASK_DEFINE

#define TT_BH_RESET_MASK_DEFINE ( _n)
Value:
#define TT_BH_RESET_MASK(_n)
Definition reset_tt_bh.c:195
#define TT_BH_RESET_MASK_FROM_NRESETS(_n)
Definition reset_tt_bh.c:194
#define UINT32_MAX

◆ TT_BH_RESET_MASK_FROM_NRESETS

#define TT_BH_RESET_MASK_FROM_NRESETS ( _n)
Value:
((uint32_t)BIT64_MASK(DT_INST_PROP_OR(_n, nresets, 0)))
#define BIT64_MASK(n)
__UINT32_TYPE__ uint32_t

Function Documentation

◆ DEVICE_API()

DEVICE_API ( reset ,
tt_bh_reset_api  )
static

◆ DT_INST_FOREACH_STATUS_OKAY()

DT_INST_FOREACH_STATUS_OKAY ( TT_BH_RESET_DEFINE )

◆ reset_tt_bh_lines_assert()

int reset_tt_bh_lines_assert ( const struct device * dev,
uint32_t offset,
uint32_t mask )

Assert lines in mask at offset with a single RMW.

offset is a byte offset from the controller base (typically a multiple of TT_BH_RESET_BANK_STRIDE). Active-low: clears bits in mask. Invalid if offset is out of range or mask shares no bits with the controller's reset-mask.

◆ reset_tt_bh_lines_deassert()

int reset_tt_bh_lines_deassert ( const struct device * dev,
uint32_t offset,
uint32_t mask )

Deassert lines in mask at offset with a single RMW.

Active-low: sets bits in mask. Used for dual-field banks (eth/ddr) where tile and RISC halves share one MMIO word, multi-bank tensix regions, and full-bank releases.

◆ reset_tt_bh_write()

int reset_tt_bh_write ( const struct device * dev,
uint32_t value )

Absolute write to a BH reset-unit bank register.

Sets the entire bank word at offset 0 (no read-modify-write). Use when init must force a known full-register state (e.g. dual-field tile half deasserted with RISC half still asserted). Prefer reset_tt_bh_lines_assert/deassert when only selected lines should change.

◆ tt_bh_reset_init()

int tt_bh_reset_init ( const struct device * dev)
static

◆ tt_bh_reset_is_valid_id()

bool tt_bh_reset_is_valid_id ( const struct device * dev,
uint32_t id )
inlinestatic

◆ tt_bh_reset_is_valid_offset()

bool tt_bh_reset_is_valid_offset ( const struct device * dev,
uint32_t offset )
inlinestatic

◆ tt_bh_reset_line_assert()

int tt_bh_reset_line_assert ( const struct device * dev,
uint32_t id )
static

◆ tt_bh_reset_line_deassert()

int tt_bh_reset_line_deassert ( const struct device * dev,
uint32_t id )
static

◆ tt_bh_reset_line_toggle()

int tt_bh_reset_line_toggle ( const struct device * dev,
uint32_t id )
static

◆ tt_bh_reset_status()

int tt_bh_reset_status ( const struct device * dev,
uint32_t id,
uint8_t * status )
static