43static const char*
s_tag =
"CGC";
45typedef enum : uint8_t {
65typedef enum : uint32_t {
120 if (expected != 0U) {
158 volatile uint8_t* divcr_reg,
172 *ckcr_reg = (uint8_t)(*ckcr_reg | sreq_mask);
177 *divcr_reg = div_code;
179 *ckcr_reg = (uint8_t)(src | sreq_mask | srdy_mask);
180 *ckcr_reg = (uint8_t)(*ckcr_reg & (uint8_t)~sreq_mask);
208 const uint8_t mask = (uint8_t)(1U << bit);
240 const uint8_t state = *pd;
305 ra8_log_info(
s_tag,
"eswclk init (PLL1P/4 = 250 MHz, eswphyclk PLL1P/2 = 500 MHz)");
324 return ethphy_mst_err;
338 if (out_hz ==
nullptr) {
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_eswclk_hz(uint32_t *out_hz)
Query the current ESWCLK (Ethernet Switch clock) frequency.
static ra8_err_t internal_wait_pdctreswm_clear(uint8_t bit)
Wait for a PDCTRESWM status bit to clear within a bounded budget.
static ra8_err_t internal_switch_eswcr_to_pll1p(volatile uint8_t *ckcr_reg, volatile uint8_t *divcr_reg, uint8_t div_code)
Switch one ESW-family peripheral clock to PLL1P with the given divider code.
ra8_err_t ra8_cgc_eswclk_init(void)
Bring up the Ethernet Switch Module (ESWM / RMAC) clock.
static ra8_err_t internal_wait_cksrdy(volatile const uint8_t *ckcr_reg, uint8_t expected)
Spin-wait for a peripheral clock control register's CKSRDY bit to match expected.
@ k_ra8_eswckdivcr_div32
/32
@ k_ra8_eswckdivcr_div4
/4 – PLL1P/4 = 250 MHz (ESWCLK target).
@ k_ra8_eswckdivcr_div2
/2 – PLL1P/2 = 500 MHz (ESWPHYCLK target).
@ k_ra8_eswckdivcr_div64
/64
@ k_ra8_eswckdivcr_div1
/1
@ k_ra8_eswckdivcr_div16
/16
@ k_ra8_eswckdivcr_div8
/8
static ra8_err_t internal_eswclk_power_on_domain(void)
Power on the ESWM peripheral domain via PDCTRESWM.
static ra8_err_t internal_eswclk_program_cks(void)
Switch ESWCLK + ESWPHYCLK to PLL1P (250 MHz + 500 MHz).
static uint32_t s_eswclk_hz
Live ESWCLK frequency, published by ra8_cgc_eswclk_init.
ra8_cgc_eswclk_const_t
Constants used by the ESWCLK bring-up path.
@ k_ra8_cgc_eswclk_poll_limit
CKSRDY spin budget.
@ k_ra8_cgc_eswphyclk_target_hz
ESWPHYCLK = PLL1P / 2.
@ k_ra8_cgc_eswclk_target_hz
ESWCLK = PLL1P / 4.
Cross-TU sharing for the split Clock Generation Circuit driver.
ra8_err_t priv_ra8_cgc_ensure_hoco_running_for_usb_ck(void)
Ensure HOCO is running so a USBCKCR/USB60CKCR/ESWCKCR SREQ->SRDY handshake can drain.
Clock Generation Circuit (CGC) field layouts for the Renesas RA8D2.
Validation and Error-Checking Macros for ra8-firmware.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Bounded wait-flag primitives for RA8D2 HAL drivers.
static ra8_err_t ra8_hw_wait_flag_clear8(volatile const uint8_t *reg, uint8_t mask, uint32_t budget)
Spin until (*reg & mask) == 0 or budget runs out.
static ra8_err_t ra8_hw_wait_flag_set8(volatile const uint8_t *reg, uint8_t mask, uint32_t budget)
Spin until (*reg & mask) != 0 or budget runs out.
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_info(tag, message)
RA8 log info.
#define ra8_log_error(tag, message)
RA8 log error.
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_enable(ra8_mstp_t id)
Reference-counted "ungate this peripheral" request.
@ k_ra8_mstp_ethphyclk
MSTPC28 Ether-PHY clock.
Scoped PRCR unlock helper.
#define RA8_PROTECTED_WRITE(unlock_val)
Scoped PRCR unlock block.
System Control (SYSC) register layout for the Renesas RA8D2.
@ k_ra8_prcr_unlock_cgc
RA8 prcr unlock cgc.
@ k_ra8_prcr_unlock_lpm
RA8 prcr unlock lpm.
static volatile uint8_t * ra8_sys_eswpckcr(void)
Get pointer to the 8-bit ESWPCKCR (Ethernet-PHY clock source).
static volatile uint8_t * ra8_sys_eswckcr(void)
Get pointer to the 8-bit ESWCKCR (Ethernet Switch / RMAC clock source).
static volatile uint8_t * ra8_sys_eswpckdivcr(void)
Get pointer to the 8-bit ESWPCKDIVCR (ESWPHYCLK divider; 4-bit CKDIV field).
static volatile uint8_t * ra8_sys_pdctreswm(void)
Get pointer to the 8-bit PDCTRESWM (ESWM power-domain control).
@ k_ra8_eswcksel_pll1p
PLL1P (preferred for 125 MHz ESWCLK).
@ k_ra8_eswckcr_mask_sel
CKSEL field is 4 bits wide.
@ k_ra8_eswckcr_bit_sreq
CKSREQ – request switch.
@ k_ra8_eswckcr_bit_srdy
CKSRDY – handshake ready.
static volatile uint8_t * ra8_sys_eswckdivcr(void)
Get pointer to the 8-bit ESWCKDIVCR (ESWCLK divider; 4-bit CKDIV field).
@ k_ra8_pdctr_bit_pdpgsf
Read-only: power-gating status flag.
@ k_ra8_pdctr_bit_pdcsf
Read-only: power-control status flag.
@ k_ra8_pdctr_bit_pdde
1 = power disabled, 0 = power enabled.
Named Time Unit Constants for Delay / Timeout / Tick Math.