Skip to content

drivers: ethernet: xlnx_gem: cleanup DT dependencies #95940

@venodela

Description

@venodela

Summary

The current ETH_XLNX_GEM_DEV_CONFIG macro in the Xilinx GEM Ethernet driver relies heavily on DeviceTree (DT_INST_PROP) for configuration values that should instead come from driver defaults, or Kconfig. This makes the driver harder to maintain, less portable, and prone to misconfiguration.
Keeping them in DT unnecessarily bloats the DTS files.

https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/ethernet/eth_xlnx_gem_priv.h#L709

https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/ethernet/eth_xlnx_gem_priv.h#L418

Describe the solution you'd like

Refactor the struct eth_xlnx_gem_dev_cfg initialization to minimize DT dependency, align defaults with Linux, and move board-agnostic values into driver defaults or Kconfig.

Keep from DT

.mdio_dev → ETH_XLNX_GEM_MDIO_DEV(port)

.phy_dev → ETH_XLNX_GEM_PHY_DEV(port)

.base_addr → DT_REG_ADDR_BY_IDX(DT_INST(port, xlnx_gem), 0)

.pll_clock_frequency → DT_INST_PROP(port, clock_frequency)

.clk_ctrl_reg_address → DT_REG_ADDR_BY_IDX(DT_INST(port, xlnx_gem), 1)

.enable_sgmii_mode → OK from DT but just remove and get this from phy-mode

Driver only (not DT)

Defaults or Kconfig options; DT properties should be removed:

.config_func → driver internal IRQ config (already handled)

.defer_rxp_to_queue

.defer_txd_to_queue

.amba_dbus_width → read from GEM DCFG1 register; or default = 64 from KCONFIG

.ahb_burst_length → default = 16; Kconfig option

.hw_rx_buffer_size →

.hw_rx_buffer_offset →

.rx_bd_count / .tx_bd_count → default = 32; Kconfig option.

.rx_buffer_size / .tx_buffer_size →

.ignore_ipg_rxer → default = 0; set to 1 only if RGMII half-duplex, no DT property

.enable_ipg_stretch → default = 0; Kconfig option if needed

.enable_rx_chksum_offload / .enable_tx_chksum_offload → default = 1; Kconfig

.discard_rx_fcs → default = 1; Kconfig option

.discard_rx_length_errors → default = 1; Kconfig option

.enable_pause → default = 0;

.enable_tbi → default = 0;

.ext_addr_match → default = 0

.enable_1536_frames → default = 1

.enable_ucast_hash → default = 0

.enable_mcast_hash → default = 0;

.disable_bcast → default = 0;

.copy_all_frames → default = 0; Kconfig option for promiscuous mode

.discard_non_vlan → default = 0; Kconfig option

.tx_buffer_size_full → default = 1; Kconfig option if needed

Drop entirely (debug/unsupported, should never be in driver)

.disable_reject_nsp

.disable_reject_fcs_crc_errors

.disable_pause_copy

.disc_rx_ahb_unavail

Endianness config

.enable_ahb_packet_endian_swap / .enable_ahb_md_endian_swap → set defaults based on CPU architecture

Alternatives

No response

Additional Context

No response

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions