From 21b1572d00bc3e0640e651f005062ab853ac5f29 Mon Sep 17 00:00:00 2001 From: Vincent Jardin Date: Wed, 8 Jul 2026 16:32:44 +0200 Subject: [PATCH] meba: lan966x: forward PHY SPI register access to board_info accessors api.meba_phy_spi_read/write: forward to the application-provided board_info spi_read/spi_write accessors. Boards without spi accessors get a MESA_RC_NOT_IMPLEMENTED, as before. Signed-off-by: Vincent Jardin --- misc information: pushed to: https://github.com/microchip-ung/mesa/pull/21 supersedes: https://github.com/microchip-ung/mesa/pull/20 (closed 2026-07-08: rework onto meba/src/lan966x requested by Microchip) note: standalone since the 2026-07-10 rework -- this PR no longer stacks on PR #17 and no longer carries the eds2 25G demo app (superseded by PR #17's void-board PHY-only app). meba_phy_spi_read/write and the board_info spi_read/spi_write accessors are stock v2026.06; this commit only wires them together on the lan966x MEBA for real EDS2 setups. --- meba/src/lan966x/meba.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/meba/src/lan966x/meba.c b/meba/src/lan966x/meba.c index 8c261f252..66970c77f 100644 --- a/meba/src/lan966x/meba.c +++ b/meba/src/lan966x/meba.c @@ -1354,6 +1354,30 @@ static mesa_port_mux_mode_t lan966x_determine_mux_mode(meba_inst_t inst) return MESA_PORT_MUX_MODE_1; } +static mesa_rc lan966x_phy_spi_read(meba_inst_t inst, + mesa_port_no_t port_no, + uint8_t dev, + uint16_t reg_num, + uint32_t *const data) +{ + if (inst->iface.spi_read == NULL) { + return MESA_RC_NOT_IMPLEMENTED; + } + return inst->iface.spi_read(port_no, dev, 0, reg_num, data); +} + +static mesa_rc lan966x_phy_spi_write(meba_inst_t inst, + mesa_port_no_t port_no, + uint8_t dev, + uint16_t reg_num, + uint32_t *const data) +{ + if (inst->iface.spi_write == NULL) { + return MESA_RC_NOT_IMPLEMENTED; + } + return inst->iface.spi_write(port_no, dev, 0, reg_num, data); +} + meba_inst_t meba_initialize(size_t callouts_size, const meba_board_interface_t *callouts) { meba_inst_t inst; @@ -1555,6 +1579,8 @@ meba_inst_t meba_initialize(size_t callouts_size, const meba_board_interface_t * inst->api_synce = meba_synce_get(); inst->api_tod = meba_tod_get(); inst->api.meba_ptp_external_io_conf_get = lan966x_ptp_external_io_conf_get; + inst->api.meba_phy_spi_read = lan966x_phy_spi_read; + inst->api.meba_phy_spi_write = lan966x_phy_spi_write; inst->api_poe = meba_poe_get(); return inst;