103typedef enum : uint32_t {
138 __asm__
volatile(
"nop");
146 __asm__
volatile(
"nop");
206 static const uint16_t k_eth_tx_pins[] = {
214 for (uint32_t i = 0U; i <
sizeof(k_eth_tx_pins) /
sizeof(k_eth_tx_pins[0]); ++i) {
235typedef enum : uint32_t {
323 for (uint8_t step = 0U; step < (uint8_t)(
sizeof(k_chain) /
sizeof(k_chain[0])); ++step) {
329 __asm__
volatile(
"nop");
363 __asm__
volatile(
"nop");
419 .err_irq_enable = 0U,
420 .mon0_irq_enable = 0U,
421 .mon1_irq_enable = 0U,
422 .mon2_irq_enable = 0U,
426 .eswclk_hz = eswclk_hz,
446typedef enum : uint16_t {
535 uint16_t miictrl = 0U;
643 uint32_t eswclk_hz = 0U;
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_board_eth_etha_delay_t
Busy-wait iteration count for the ETHA mode-walk settle delay.
@ k_ra8_board_eth_etha_step_iters
~50 us settle between ETHA mode writes.
static const struct @241054046372047256104030122264354202376012142234 s_eth_routes[]
Pin table walked by ra8_board_ethernet_init.
ra8_err_t ra8_board_ethernet_init(void)
Bring up the on-board RGMII Ethernet PHY and RMAC1/ETHA1.
ra8_board_eth_phy_reg_t
GPY111 PHY register addresses + bit constants for chip-init.
@ k_ra8_board_eth_phy_bmcr_an_en
BMCR.AUTONEG_ENABLE.
@ k_ra8_board_eth_phy_reset_spin
BMCR.RESET self-clear cap.
@ k_ra8_board_eth_phy_bmcr_an_rst
BMCR.AUTONEG_RESTART.
@ k_ra8_board_eth_phy_rxskew_mask
MIICTRL RXSKEW field [14:12].
@ k_ra8_board_eth_phy_reg_miictrl
GPY111 MIICTRL vendor reg.
@ k_ra8_board_eth_phy_bmcr_reset
BMCR.RESET (self-clearing).
@ k_ra8_board_eth_phy_reg_anar
Auto-neg advertisement.
@ k_ra8_board_eth_phy_reg_gbcr
1000BASE-T control.
@ k_ra8_board_eth_phy_gbcr_value
1000BASE-T NOT advertised (see above).
@ k_ra8_board_eth_phy_rxskew_1p0ns
RXSKEW = 0b010 -> 1.0 ns.
@ k_ra8_board_eth_phy_reg_bmcr
BMCR (basic control).
@ k_ra8_board_eth_phy_anar_value
Advertise 100F/100H/10F/10H.
static ra8_err_t internal_eth_etha_to_operation(void)
Promote ETHA1 from CONFIG to OPERATION (post-MPIC programming).
static ra8_err_t internal_eth_phy_start_autoneg(void)
Program the auto-neg advertisement and restart negotiation.
static ra8_err_t internal_eth_phy_chip_init(void)
Full GPY111 PHY chip-init: soft-reset, RX skew, restart AN.
static ra8_err_t internal_eth_route_alt_pins(void)
Route the 15 non-RSTN ETHERC pins to their ETHERC alternate.
ra8_err_t priv_ra8_board_eth_etha_to_config(void)
Walk ETHA1 from RESET through DISABLE to CONFIG.
ra8_board_eth_phy_reset_cycles_t
Cycle-counted PHY reset timings (Cortex-M85 @ ~1 GHz).
@ k_ra8_board_eth_phy_rst_post_iters
>= 60 ms HIGH.
@ k_ra8_board_eth_phy_rst_low_iters
>= 15 ms LOW.
static ra8_err_t internal_eth_rmac_program(uint32_t eswclk_hz)
Programme RMAC1 with the RGMII / 1Gb full-duplex profile.
static ra8_err_t internal_eth_phy_set_rgmii_skew(void)
Program the GPY111 RGMII receive-timing skew to 1.0 ns.
static ra8_err_t internal_eth_phy_hw_reset(void)
Hardware-reset the on-board PEF7071 PHY via GPIO.
ra8_board_eth_pin_t pin
Pin.
ra8_err_t priv_ra8_board_eth_eswm_bring_up(uint32_t *out_eswclk_hz)
Bring the ESWM subsystem live: clocks + power + MSTP + COMA reset.
static ra8_err_t internal_eth_phy_soft_reset(void)
Soft-reset the GPY111 PHY and wait for the reset to clear.
Cross-translation-unit seam for the EK-RA8D2 BSP implementation.
ra8_board_eth_pin_t
Pin assignments for the on-board MaxLinear PEF7071 (GPY111) PHY.
@ k_ra8_board_eth_pin_rxd0
RXD0, P906 (E36).
@ k_ra8_board_eth_pin_mdio
MDIO, P414.
@ k_ra8_board_eth_pin_tx_clk
TX_CLK, P309 (E23).
@ k_ra8_board_eth_pin_rxd2
RXD2, P908 (E33).
@ k_ra8_board_eth_pin_txd1
TXD1, P306 (E20).
@ k_ra8_board_eth_pin_txd2
TXD2, P305 (E19).
@ k_ra8_board_eth_pin_txd0
TXD0, P307 (E21).
@ k_ra8_board_eth_pin_mdint
MDINT, P107.
@ k_ra8_board_eth_pin_rxd3
RXD3, P909 (E24).
@ k_ra8_board_eth_pin_rstn
RSTN, P708.
@ k_ra8_board_eth_pin_mdc
MDC, P415.
@ k_ra8_board_eth_pin_rx_clk
RX_CLK, P905 (E37).
@ k_ra8_board_eth_pin_rx_ctl
RX_CTL, P206 (E38).
@ k_ra8_board_eth_pin_txd3
TXD3, P304 (E18).
@ k_ra8_board_eth_pin_rxd1
RXD1, P907 (E34).
@ k_ra8_board_eth_pin_tx_ctl
TX_CTL, P310 (E22).
@ k_ra8_board_eth_etha_port
ETHA1 (k_ra8_etha_port_1).
@ k_ra8_board_eth_rmac_port
RMAC1 (k_ra8_rmac_port_1).
@ k_ra8_board_eth_phy_addr
MDIO addr of the on-board PHY (HW strap on PEF7071, UM Table 27 p 34).
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.
ra8_err_t ra8_cgc_eswclk_init(void)
Bring up the Ethernet Switch Module (ESWM / RMAC) clock.
Event Link Controller (ELC) register layout for the Renesas RA8D2.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_hw_timeout
Hardware timed out waiting for a flag or handshake.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Ethernet Switch Module (ESWM) + frame TX/RX driver.
ra8_eth_mii_port_t
ESWM media-interface port selector (m = 0, 1).
ra8_err_t ra8_eth_rgmii_select(ra8_eth_mii_port_t port)
Select RGMII on a port's ESWM media-interface mux and enable it.
Ethernet Common Agent (COMA) driver.
ra8_err_t ra8_eth_coma_bringup(void)
Bring the COMA switch out of reset, init the buffer pool, and fan every per-agent clock out.
Per-port Ethernet Agent (ETHA) driver – HUM Ch 32 (p 1627-1702).
ra8_err_t ra8_etha_set_mode(ra8_etha_port_t port, ra8_etha_opc_t mode)
Issue an explicit EAMC mode-change command.
ra8_err_t ra8_etha_init(ra8_etha_port_t port, const ra8_etha_config_t *cfg)
Initialise an ETHA port (MSTP gate + reset registers + initial mode).
Ethernet Agent (ETHA) per-port register layout for the RA8D2.
ra8_etha_port_t
ETHA port index (m = 0, 1).
ra8_etha_opc_t
ETHA EAMC.OPC[1:0] operating mode commands.
@ k_ra8_etha_opc_operation
Enter OPERATION mode.
@ k_ra8_etha_opc_config
Enter CONFIG mode.
@ k_ra8_etha_opc_reset
Enter RESET mode.
@ k_ra8_etha_opc_disable
Enter DISABLE mode.
PSEL codes for peripheral pin routing on the RA8D2.
@ k_ra8_psel_ether_rgmii
11000b: ESWM (RGMII).
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.
Module Stop Control (MSTP) register layout for the Renesas RA8D2.
@ k_ra8_mstp_eswm
MSTPC30 ESWM.
@ k_ra8_pfs_dscr_middle
01b: Middle drive.
Typed Port / Pin Constants for the RA8D2 IOPORT Module.
ra8_port_pin_t
Packed (port << 8) | pin pin identifier.
@ k_ra8_level_high
Drive or read 1.
@ k_ra8_level_low
Drive or read 0.
High-level GPIO helpers on top of the PORT + PFS register layer.
ra8_err_t ra8_pfs_set_drive_strength(ra8_port_pin_t pin, ra8_pfs_dscr_t dscr)
Set the output drive strength (PmnPFS.DSCR) of an already-routed pin.
ra8_err_t ra8_gpio_output_init(ra8_port_pin_t pin, ra8_level_t init_level)
Configure a pin as a digital output and drive it to an initial level.
ra8_err_t ra8_gpio_write(ra8_port_pin_t pin, ra8_level_t level)
Drive a previously-configured output to the given level.
ra8_err_t ra8_pfs_route_peripheral(ra8_port_pin_t pin, ra8_psel_t psel, const char *owner)
Route a pin to a non-IRQ peripheral function via PFS.PSEL.
Per-port Ethernet MAC (RMAC) driver – HUM Ch 33.
ra8_err_t ra8_rmac_mdio_c22_write(ra8_rmac_port_t port, uint8_t phy_addr, uint8_t reg_addr, uint16_t value)
Trigger an MDIO Clause-22 register write on the off-chip PHY.
@ k_ra8_rmac_mdc_default_hz
1 MHz MDC – well below the 2.5 MHz ceiling.
ra8_err_t ra8_rmac_mdio_c22_read(ra8_rmac_port_t port, uint8_t phy_addr, uint8_t reg_addr, uint16_t *out_value)
Trigger an MDIO Clause-22 register read on the off-chip PHY.
ra8_err_t ra8_rmac_init(ra8_rmac_port_t port, const ra8_rmac_config_t *cfg)
Initialise an RMAC port (MSTP gate + reset regs + filter mode).
Ethernet MAC (RMAC) per-port register layout for the RA8D2.
ra8_rmac_mrafc_t
MRAFC reception address filter mode bits (HUM Ch 33.4).
@ k_ra8_rmac_mrafc_broadcast
BCENE|BCENP.
@ k_ra8_rmac_mrafc_unicast_match
UCENE|UCENP.
@ k_ra8_rmac_mrafc_bc_accept
BCACE.
@ k_ra8_rmac_pis_mii
MII (000b) – internal xMII for 10/100 Mbps.
@ k_ra8_rmac_lsc_100mbit
100 Mbit/s.
ra8_rmac_port_t
RMAC port index (m = 0, 1).
@ k_ra8_rmac_duplex_full
Full duplex.
Per-port ETHA configuration knobs.
Per-port RMAC configuration knobs.