Skip to content

mesa-demo: runtime PHY-only mode with optional SPI-proxy client#17

Open
vjardin wants to merge 7 commits into
microchip-ung:masterfrom
vjardin:vj_shared_phy_only
Open

mesa-demo: runtime PHY-only mode with optional SPI-proxy client#17
vjardin wants to merge 7 commits into
microchip-ung:masterfrom
vjardin:vj_shared_phy_only

Conversation

@vjardin

@vjardin vjardin commented Jul 6, 2026

Copy link
Copy Markdown

Support the MEPA PHYs (LAN80xx) without a switch instance.

It can be used with 2 modes: either thru direct access to a /dev/spidev or thru a proxy that centralize the access to the /dev/spidev in order to support many users of the same MEPA PHY.

Signed-off-by: Vincent Jardin vjardin@free.fr

@vjardin

vjardin commented Jul 6, 2026

Copy link
Copy Markdown
Author

see
microchip-ung/sw-mepa#11

@vjardin

vjardin commented Jul 6, 2026

Copy link
Copy Markdown
Author

optional: it can use this proxy, https://github.com/vjardin/mepa-spidev-proxy

@vjardin

vjardin commented Jul 6, 2026

Copy link
Copy Markdown
Author

Please, @HoratiuVultur, how would you consider such feature for your next 2026.09 release ? It is the only mean I found about to have many users of mepa PHYs.

vjardin added a commit to vjardin/mesa that referenced this pull request Jul 7, 2026
Support the MEPA PHYs (LAN80xx) without a switch instance.

It can be used with 2 modes: either thru direct access to a
/dev/spidev or thru a proxy that centralize the access to
the /dev/spidev in order to support many users of the
same MEPA PHY.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung/sw-mepa#11 (sw-mepa original)
  microchip-ung#17

integration (vj_integration_allPR):
  cherry-picked from: vj_shared_phy_only @ 32d00f77
  pull request: microchip-ung#17
  pull request: microchip-ung/sw-mepa#11
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 7, 2026
Port the EDS2 board support from sw-mepa's board-configs so mesa-demo
can run on this switch-less board and drive its MEPA PHYs:

- meba/src/eds2/: meba.c (port table, capabilities, reset points
  incl. MEBA_PHY_INITIALIZE / MEBA_ENTRY_PHY_SET, IRQ/event plumbing),
  synce.c and tod.c. The board-configs meba_poe.c is NOT ported: it
  targets an older meba_poe_* API generation than mesa's, and PoE is
  not needed for PHY bring-up.
- eds2_phy_spi_read/write: implement api.meba_phy_spi_read/write by
  forwarding to the application-provided board_info spi_read/spi_write
  accessors (ctrl_idx carries the MMD; slot demux stays in the app).
  Through meba_generic's mepa_callout wiring this gives the MEPA PHY
  drivers (lan80xx) their register path.
- mesa/demo/main.c: phy_only_board_spi_read/write adapters installed
  into board_info when '-P' is given, so the board layer reaches the
  PHYs over /dev/spidev or the lan80xx-spid SPI proxy.
- mepa/CMakeLists: mepa_eds2 aggregate (vtss_ts, ksz9031, lan8814,
  lan884x + lan80xx_ts_msec for the 25G PHY slots).
- meba/CMakeLists: MEBA_LIB(eds2); mesa/demo/CMakeLists:
  APP_TARGET(app_eds2, MESA lan966x, MEBA meba_eds2) -- lan966x only
  provides the MESA API symbols, the board has no switch.

Verified end-to-end on a host build: meba_only_eds2 and the full
mesa-demo-lan966x binary build and link; running it with
'-P proxy:<sock>' against a lan80xx-spid instance enters PHY-only mode
and issues its PHY SPI operations through the proxy (confirmed by the
daemon's per-client accounting).

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
depends on: the "mesa-demo: runtime PHY-only mode" commit (branch vj_shared_phy_only,
  microchip-ung#17)
source: ported from sw-mepa board-configs/src/eds2 (branch br-pkg-aarch64)

integration (vj_integration_allPR):
  cherry-picked from: vj_eds2_board @ fd27e55e
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 7, 2026
Support the MEPA PHYs (LAN80xx) without a switch instance.

It can be used with 2 modes: either thru direct access to a
/dev/spidev or thru a proxy that centralize the access to
the /dev/spidev in order to support many users of the
same MEPA PHY.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung/sw-mepa#11 (sw-mepa original)
  microchip-ung#17
status: sw-mepa PR microchip-ung#11 closed 2026-07-03 by Microchip (HoratiuVultur):
  "a PR in MESA was open for this, I will add my comments there" --
  review continues on mesa PR microchip-ung#17.
@vjardin
vjardin force-pushed the vj_shared_phy_only branch from 215af95 to 61df500 Compare July 7, 2026 11:20
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 7, 2026
Port the EDS2 board support from sw-mepa's board-configs so mesa-demo
can run on this switch-less board and drive its MEPA PHYs:

- meba/src/eds2/: meba.c (port table, capabilities, reset points
  incl. MEBA_PHY_INITIALIZE / MEBA_ENTRY_PHY_SET, IRQ/event plumbing),
  synce.c and tod.c. The board-configs meba_poe.c is NOT ported: it
  targets an older meba_poe_* API generation than mesa's, and PoE is
  not needed for PHY bring-up.
- eds2_phy_spi_read/write: implement api.meba_phy_spi_read/write by
  forwarding to the application-provided board_info spi_read/spi_write
  accessors (ctrl_idx carries the MMD; slot demux stays in the app).
  Through meba_generic's mepa_callout wiring this gives the MEPA PHY
  drivers (lan80xx) their register path.
- mesa/demo/main.c: phy_only_board_spi_read/write adapters installed
  into board_info when '-P' is given, so the board layer reaches the
  PHYs over /dev/spidev or the lan80xx-spid SPI proxy.
- mepa/CMakeLists: mepa_eds2 aggregate (vtss_ts, ksz9031, lan8814,
  lan884x + lan80xx_ts_msec for the 25G PHY slots).
- meba/CMakeLists: MEBA_LIB(eds2); mesa/demo/CMakeLists:
  APP_TARGET(app_eds2, MESA lan966x, MEBA meba_eds2) -- lan966x only
  provides the MESA API symbols, the board has no switch.

Verified end-to-end on a host build: meba_only_eds2 and the full
mesa-demo-lan966x binary build and link; running it with
'-P proxy:<sock>' against a lan80xx-spid instance enters PHY-only mode
and issues its PHY SPI operations through the proxy (confirmed by the
daemon's per-client accounting).

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
depends on: the "mesa-demo: runtime PHY-only mode" commit (branch vj_shared_phy_only,
  microchip-ung#17)
source: ported from sw-mepa board-configs/src/eds2 (branch br-pkg-aarch64)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 7, 2026
Support the MEPA PHYs (LAN80xx) without a switch instance.

It can be used with 2 modes: either thru direct access to a
/dev/spidev or thru a proxy that centralize the access to
the /dev/spidev in order to support many users of the
same MEPA PHY.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung/sw-mepa#11 (sw-mepa original)
  microchip-ung#17
status: sw-mepa PR microchip-ung#11 closed 2026-07-03 by Microchip (HoratiuVultur):
  "a PR in MESA was open for this, I will add my comments there" --
  review continues on mesa PR microchip-ung#17.

integration (vj_integration_allPR):
  cherry-picked from: vj_shared_phy_only @ 61df500
  pull request: microchip-ung#17 (open)
  pull request: microchip-ung/sw-mepa#11 (closed 2026-07-03)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 7, 2026
Port the EDS2 board support from sw-mepa's board-configs so mesa-demo
can run on this switch-less board and drive its MEPA PHYs:

- meba/src/eds2/: meba.c (port table, capabilities, reset points
  incl. MEBA_PHY_INITIALIZE / MEBA_ENTRY_PHY_SET, IRQ/event plumbing),
  synce.c and tod.c. The board-configs meba_poe.c is NOT ported: it
  targets an older meba_poe_* API generation than mesa's, and PoE is
  not needed for PHY bring-up.
- eds2_phy_spi_read/write: implement api.meba_phy_spi_read/write by
  forwarding to the application-provided board_info spi_read/spi_write
  accessors (ctrl_idx carries the MMD; slot demux stays in the app).
  Through meba_generic's mepa_callout wiring this gives the MEPA PHY
  drivers (lan80xx) their register path.
- mesa/demo/main.c: phy_only_board_spi_read/write adapters installed
  into board_info when '-P' is given, so the board layer reaches the
  PHYs over /dev/spidev or the lan80xx-spid SPI proxy.
- mepa/CMakeLists: mepa_eds2 aggregate (vtss_ts, ksz9031, lan8814,
  lan884x + lan80xx_ts_msec for the 25G PHY slots).
- meba/CMakeLists: MEBA_LIB(eds2); mesa/demo/CMakeLists:
  APP_TARGET(app_eds2, MESA lan966x, MEBA meba_eds2) -- lan966x only
  provides the MESA API symbols, the board has no switch.

Verified end-to-end on a host build: meba_only_eds2 and the full
mesa-demo-lan966x binary build and link; running it with
'-P proxy:<sock>' against a lan80xx-spid instance enters PHY-only mode
and issues its PHY SPI operations through the proxy (confirmed by the
daemon's per-client accounting).

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
depends on: the "mesa-demo: runtime PHY-only mode" commit (branch vj_shared_phy_only,
  microchip-ung#17)
source: ported from sw-mepa board-configs/src/eds2 (branch br-pkg-aarch64)

integration (vj_integration_allPR):
  cherry-picked from: vj_eds2_board @ 1525e01
@HoratiuVultur

Copy link
Copy Markdown
Contributor

Hi @vjardin,

I am not sure about this, we will need to talk more internally about this. Because I can see that you are kind of change the mesa-demo to talk only with PHYs if I understand correctly. This is just a demo APP on how to use the MESA and MEPA libraries and I think it would be best if you create your own APP that does exactly what you need and then just use the libraries.

Thanks,
/Horatiu

@vjardin

vjardin commented Jul 7, 2026

Copy link
Copy Markdown
Author

It allows to support any applications with 3rd parties apps combined like a ptp (zls) daemon.

vjardin added a commit to vjardin/mesa that referenced this pull request Jul 7, 2026
Port the EDS2 board support from sw-mepa's board-configs so mesa-demo
can run on this switch-less board and drive its MEPA PHYs:

- meba/src/eds2/: meba.c (port table, capabilities, reset points
  incl. MEBA_PHY_INITIALIZE / MEBA_ENTRY_PHY_SET, IRQ/event plumbing),
  synce.c and tod.c. The board-configs meba_poe.c is NOT ported: it
  targets an older meba_poe_* API generation than mesa's, and PoE is
  not needed for PHY bring-up.
- eds2_phy_spi_read/write: implement api.meba_phy_spi_read/write by
  forwarding to the application-provided board_info spi_read/spi_write
  accessors (ctrl_idx carries the MMD; slot demux stays in the app).
  Through meba_generic's mepa_callout wiring this gives the MEPA PHY
  drivers (lan80xx) their register path.
- mesa/demo/main.c: phy_only_board_spi_read/write adapters installed
  into board_info when '-P' is given, so the board layer reaches the
  PHYs over /dev/spidev or the lan80xx-spid SPI proxy.
- mepa/CMakeLists: mepa_eds2 aggregate (vtss_ts, ksz9031, lan8814,
  lan884x + lan80xx_ts_msec for the 25G PHY slots).
- meba/CMakeLists: MEBA_LIB(eds2); mesa/demo/CMakeLists:
  APP_TARGET(app_eds2, MESA lan966x, MEBA meba_eds2) -- lan966x only
  provides the MESA API symbols, the board has no switch.

Verified end-to-end on a host build: meba_only_eds2 and the full
mesa-demo-lan966x binary build and link; running it with
'-P proxy:<sock>' against a lan80xx-spid instance enters PHY-only mode
and issues its PHY SPI operations through the proxy (confirmed by the
daemon's per-client accounting).

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
depends on: the "mesa-demo: runtime PHY-only mode" commit (branch vj_shared_phy_only,
  microchip-ung#17)
source: ported from sw-mepa board-configs/src/eds2 (branch br-pkg-aarch64)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 7, 2026
Port the EDS2 board support from sw-mepa's board-configs so mesa-demo
can run on this switch-less board and drive its MEPA PHYs:

- meba/src/eds2/: meba.c (port table, capabilities, reset points
  incl. MEBA_PHY_INITIALIZE / MEBA_ENTRY_PHY_SET, IRQ/event plumbing),
  synce.c and tod.c. The board-configs meba_poe.c is NOT ported: it
  targets an older meba_poe_* API generation than mesa's, and PoE is
  not needed for PHY bring-up.
- eds2_phy_spi_read/write: implement api.meba_phy_spi_read/write by
  forwarding to the application-provided board_info spi_read/spi_write
  accessors (ctrl_idx carries the MMD; slot demux stays in the app).
  Through meba_generic's mepa_callout wiring this gives the MEPA PHY
  drivers (lan80xx) their register path.
- mesa/demo/main.c: phy_only_board_spi_read/write adapters installed
  into board_info when '-P' is given, so the board layer reaches the
  PHYs over /dev/spidev or the lan80xx-spid SPI proxy.

Verified end-to-end on a host build: meba_only_eds2 and the full
mesa-demo-lan966x binary build and link; running it with
'-P proxy:<sock>' against a lan80xx-spid instance enters PHY-only mode
and issues its PHY SPI operations through the proxy (confirmed by the
daemon's per-client accounting).

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
depends on: the "mesa-demo: runtime PHY-only mode" commit (branch vj_shared_phy_only,
  microchip-ung#17)
source: ported from sw-mepa board-configs/src/eds2 (branch br-pkg-aarch64)
@vjardin vjardin mentioned this pull request Jul 7, 2026
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 7, 2026
Support the MEPA PHYs (LAN80xx) without a switch instance.

It can be used with 2 modes: either thru direct access to a
/dev/spidev or thru a proxy that centralize the access to
the /dev/spidev in order to support many users of the
same MEPA PHY.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung/sw-mepa#11 (sw-mepa original)
  microchip-ung#17
status: sw-mepa PR microchip-ung#11 closed 2026-07-03 by Microchip (HoratiuVultur):
  "a PR in MESA was open for this, I will add my comments there" --
  review continues on mesa PR microchip-ung#17.

integration (vj_integration_allPR):
  cherry-picked from: vj_shared_phy_only @ 61df500
  pull request: microchip-ung#17 (open)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 7, 2026
Make glues and proxy glue.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#20
depends on: mesa PR microchip-ung#17 (vj_shared_phy_only, runtime PHY-only mode)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 7, 2026
Support the MEPA PHYs (LAN80xx) without a switch instance.

It can be used with 2 modes: either thru direct access to a
/dev/spidev or thru a proxy that centralize the access to
the /dev/spidev in order to support many users of the
same MEPA PHY.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung/sw-mepa#11 (sw-mepa original)
  microchip-ung#17
status: sw-mepa PR microchip-ung#11 closed 2026-07-03 by Microchip (HoratiuVultur):
  "a PR in MESA was open for this, I will add my comments there" --
  review continues on mesa PR microchip-ung#17.

integration (vj_integration_allPR):
  cherry-picked from: vj_shared_phy_only @ 61df500
  pull request: microchip-ung#17 (open)
  pull request: microchip-ung/sw-mepa#11 (closed 2026-07-03)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 7, 2026
Make glues and proxy glue.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#20
depends on: mesa PR microchip-ung#17 (vj_shared_phy_only, runtime PHY-only mode)

integration (vj_integration_allPR):
  cherry-picked from: vj_eds2_board @ 7ef2465
  pull request: microchip-ung#20 (open)
@HoratiuVultur

Copy link
Copy Markdown
Contributor

It wouldn't make more sense to integrate the libraries in 3rd party apps?

@vjardin

vjardin commented Jul 8, 2026

Copy link
Copy Markdown
Author

Which one ? It needs to be legacy to be used for any mepa's consumers (boards + zls + debug tools).

vjardin added a commit to vjardin/mesa that referenced this pull request Jul 8, 2026
Support the MEPA PHYs (LAN80xx) without a switch instance.

It can be used with 2 modes: either thru direct access to a
/dev/spidev or thru a proxy that centralize the access to
the /dev/spidev in order to support many users of the
same MEPA PHY.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung/sw-mepa#11 (sw-mepa original)
  microchip-ung#17
status: sw-mepa PR microchip-ung#11 closed 2026-07-03 by Microchip (HoratiuVultur):
  "a PR in MESA was open for this, I will add my comments there" --
  review continues on mesa PR microchip-ung#17.

integration (vj_integration_allPR):
  cherry-picked from: vj_shared_phy_only @ 61df500
  pull request: microchip-ung#17 (open)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
Support the MEPA PHYs (LAN80xx) without a switch instance.

It can be used with 2 modes: either thru direct access to a
/dev/spidev or thru a proxy that centralize the access to
the /dev/spidev in order to support many users of the
same MEPA PHY.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung/sw-mepa#11 (sw-mepa original)
  microchip-ung#17
status: sw-mepa PR microchip-ung#11 closed 2026-07-03 by Microchip (HoratiuVultur):
  "a PR in MESA was open for this, I will add my comments there" --
  review continues on mesa PR microchip-ung#17.
@vjardin
vjardin force-pushed the vj_shared_phy_only branch from 61df500 to 3032ae7 Compare July 9, 2026 15:13
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
Support the MEPA PHYs (LAN80xx) without a switch instance.

It can be used with 2 modes: either thru direct access to a
/dev/spidev or thru a proxy that centralize the access to
the /dev/spidev in order to support many users of the
same MEPA PHY.

Fake few models for the purposes of this phy-only case: the board
conf answers select the EDS2 board (pcb 0x8385) with the LAN8814
plugin module in slot A, so the board comes up with 4 ports (base
port 0) matching the '-P' PHY slot router.

It was tested with a LAN8024 target.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung/sw-mepa#11 (sw-mepa original)
  microchip-ung#17
status: sw-mepa PR microchip-ung#11 closed 2026-07-03 by Microchip (HoratiuVultur):
  "a PR in MESA was open for this, I will add my comments there" --
  review continues on mesa PR microchip-ung#17.
@vjardin
vjardin force-pushed the vj_shared_phy_only branch from 3032ae7 to 42ad66e Compare July 9, 2026 15:18
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
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 <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#21
depends on:
  microchip-ung#17 (runtime PHY-only mode; first
  commit of PR microchip-ung#21's stack)
supersedes:
  microchip-ung#20 (closed 2026-07-08: rework onto
  meba/src/lan966x requested by Microchip)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#21
depends on:
  microchip-ung#17 (runtime PHY-only mode; first
  commit of PR microchip-ung#21's stack)
supersedes:
  microchip-ung#20 (closed 2026-07-08: rework onto
  meba/src/lan966x requested by Microchip)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
Support the MEPA PHYs (LAN80xx) without a switch instance.

It can be used with 2 modes: either thru direct access to a
/dev/spidev or thru a proxy that centralize the access to
the /dev/spidev in order to support many users of the
same MEPA PHY.

Fake few models for the purposes of this phy-only case: the board
conf answers select the EDS2 board (pcb 0x8385) with the LAN8814
plugin module in slot A, so the board comes up with 4 ports (base
port 0) matching the '-P' PHY slot router.

It was tested with a LAN8024 target.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung/sw-mepa#11 (sw-mepa original)
  microchip-ung#17
status: sw-mepa PR microchip-ung#11 closed 2026-07-03 by Microchip (HoratiuVultur):
  "a PR in MESA was open for this, I will add my comments there" --
  review continues on mesa PR microchip-ung#17.

integration (vj_integration_allPR):
  cherry-picked from: vj_shared_phy_only @ 42ad66e
  pull request: microchip-ung#17 (open; also the
    first commit of PR microchip-ung#21's stack)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
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 <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#21
depends on:
  microchip-ung#17 (runtime PHY-only mode; first
  commit of PR microchip-ung#21's stack)
supersedes:
  microchip-ung#20 (closed 2026-07-08: rework onto
  meba/src/lan966x requested by Microchip)

integration (vj_integration_allPR):
  cherry-picked from: vj_eds2_board_v2 @ 739211c
  pull request: microchip-ung#21 (open)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#21
depends on:
  microchip-ung#17 (runtime PHY-only mode; first
  commit of PR microchip-ung#21's stack)
supersedes:
  microchip-ung#20 (closed 2026-07-08: rework onto
  meba/src/lan966x requested by Microchip)

integration (vj_integration_allPR):
  cherry-picked from: vj_eds2_board_v2 @ fd8e9fe
  pull request: microchip-ung#21 (open)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
Support the MEPA PHYs (LAN80xx) without a switch instance.

It can be used with 2 modes: either thru direct access to a
/dev/spidev or thru a proxy that centralize the access to
the /dev/spidev in order to support many users of the
same MEPA PHY.

Fake few models for the purposes of this phy-only case: the board
conf answers select the EDS2 board (pcb 0x8385) with the LAN8814
plugin module in slot A, so the board comes up with 4 ports (base
port 0) matching the '-P' PHY slot router.

It was tested with a LAN8024 target.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung/sw-mepa#11 (sw-mepa original)
  microchip-ung#17
status: sw-mepa PR microchip-ung#11 closed 2026-07-03 by Microchip (HoratiuVultur):
  "a PR in MESA was open for this, I will add my comments there" --
  review continues on mesa PR microchip-ung#17.

integration (vj_integration_allPR):
  cherry-picked from: vj_shared_phy_only @ 42ad66e
  pull request: microchip-ung#17 (open; also the
    first commit of PR microchip-ung#21's stack)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
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 <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#21
depends on:
  microchip-ung#17 (runtime PHY-only mode; first
  commit of PR microchip-ung#21's stack)
supersedes:
  microchip-ung#20 (closed 2026-07-08: rework onto
  meba/src/lan966x requested by Microchip)

integration (vj_integration_allPR):
  cherry-picked from: vj_eds2_board_v2 @ 739211c
  pull request: microchip-ung#21 (open)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#21
depends on:
  microchip-ung#17 (runtime PHY-only mode; first
  commit of PR microchip-ung#21's stack)
supersedes:
  microchip-ung#20 (closed 2026-07-08: rework onto
  meba/src/lan966x requested by Microchip)

integration (vj_integration_allPR):
  cherry-picked from: vj_eds2_board_v2 @ fd8e9fe
  pull request: microchip-ung#21 (open)
@vjardin

vjardin commented Jul 9, 2026

Copy link
Copy Markdown
Author

draft notes of the upcoming updates

The purpose of the following update is to handle a PHY-only operation case: having
MEPA PHYs (for instance the LAN80xx 1G/10G/25G family) on a system that
has no Microchip switch such as evaluation boards, PTP daemons, debug
tooling, or a host SoC whose Ethernet MACs face the PHY directly.

This design is made of 3 layers:

  1. the runtime PHY-only mode of mesa-demo (phy_only.c): PHY
    register access over /dev/spidev or a SPI proxy daemon;
  2. the void MEBA board (meba/src/void/): a board layer with no
    switch and no fixed PHY population;
  3. the optional MESA_PHY_ONLY build flavor: the application is
    built without any MESA switch chip library at all.

Each piece works with the previous ones:

  • 1+2 alone still link a MESA chip library for its API symbols
  • 1+2+3 remove it.

Design

Runtime PHY-only mode (mesa/demo/phy_only.c)

At startup mesa-demo probes for a switch UIO device. When none is
found (and a -P option is given), it enters PHY-only mode:

  • the switch-only CLI/RPC modules are not initialized: only the PHY
    command set (PHY Dev Create/Del/Attach/conf, PHY EYE_DIAG,
    PHY TX_EQA/RX_EQA, PHY PRBS_*, PHY MCU *, serdes_get,
    Dev reset, ...);
  • MESA register access is stubbed (phy_only_reg_read/write return an
    error: there is no switch);
  • PHY register access is routed to the transport named by -P:
    • -P /dev/spidevB.C[@pad[@freq]][:ports] — for direct spidev;
    • -P proxy:<socket>[:ports] — then through the lan80xx-spid SPI
      proxy daemon (github.com/vjardin/mepa-spidev-proxy), which serializes
      concurrent users of the same PHY (the demo, a PTP daemon, debug
      tools) over one spidev.

The -P slot demultiplexes ports onto SPI channels. Several -P
options may be given if you have multiple PHYs.

The void board (meba/src/void/)

A MEBA board for PHY-only setups. It has no switch and no fixed PHY
population:

  • port_cnt MEPA port slots (from the conf_get tag, default 4), all
    with phy_base_port = 0 (single-package anchor for mepa_link_base_port)

  • MEBA_PHY_INITIALIZE wires the (empty) device table and the MEPA
    callouts, but it does not probe: with no fixed population there is
    nothing to detect, and the application creates each device
    explicitly (PHY Dev Create is the only path running the
    PRE/DEFAULT/POST reset sequence and SKU detection)

  • PHY SPI register access is forwarded to the application-provided
    board_info accessors (meba_phy_spi_read/write), so the transport
    choice (spidev, proxy) stays in the application;

  • MIIM/MMD go through the standard meba_generic callouts.

The callout wiring is shared with the probing boards through
meba_phy_callout_init(), factored out of meba_phy_driver_init().

The MESA_PHY_ONLY build flavor

Without it, the PHY-only app still links a MESA switch chip library purely to
satisfy the linker. -DMESA_PHY_ONLY=ON removes it.

The major benefit: the binary size shrinks of about 50%.

Build notes

For a basic build with PHY-only app with a MESA chip library
(as symbol filler):

cmake -B build -S . -DBUILD_MESA_DEMO=ON -Dapp_void=ON
cmake --build build --target app_void --target cli

For a MESA-less build:

cmake -B build -S . -DBUILD_MESA_DEMO=ON -DMESA_PHY_ONLY=ON -Dapp_void=ON
cmake --build build --target app_void --target cli

It produces build/mesa/demo/mesa-demo-void and build/mesa/demo/mesa-cmd.

Note: for static linkage, add -DCMAKE_EXE_LINKER_FLAGS=-static.

If needex, the external dependencies are the spidev header files and
the json library.

Run

Direct spidev (one user of the PHY):

./mesa-demo-void -f -P /dev/spidev0.1@2@5000000:4

Through the SPI proxy (many users of the PHY — demo + PTP daemon +
debug tools):

lan80xx-spid -d /dev/spidev0.1 -p 2 -s /var/run/spid.sock -r <reset-gpio-line>
./mesa-demo-void -f -P proxy:/var/run/spid.sock:4

At startup the demo prints the mode and the port span:

No switch UIO device found: PHY-only mode (MEPA slots over SPI only)
PHY-only board conf: port_cnt=4 (from the '-P' slots)

Then drive the PHY with mesa-cmd (CLI ports are 1-based; port 0 is
reserved). For example, the bring-up of one port, with a JSON port
configuration is:

mesa-cmd PHY Dev Create 1
mesa-cmd PHY Dev Attach 1 sfi
mesa-cmd PHY Dev conf 1 -f ch0.json
mesa-cmd PHY STATE 1
mesa-cmd PHY EYE_DIAG 1 fast host   # RX eye scan, host side

@vjardin
vjardin marked this pull request as draft July 9, 2026 20:47
vjardin added 7 commits July 9, 2026 22:48
The empty-__VA_ARGS__ argument counter has two implementations: a
__VA_OPT__(,) variant (correct when the compiler does not swallow the
comma after ##__VA_ARGS__) and a legacy ##__VA_ARGS__ variant.

Since __GNUC__ >= 13; __VA_OPT__ is available on every GCC.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#18
Newer toolchains (GCC >= 15 at least) and distro hardening are
too restrictive.

It fixes issues such as:
  base/ail/vtss_api.c: error: format not a string literal and no format
    arguments [-Werror=format-security]
    (prntf(buf) on a runtime, non-user-controlled string)

  mesa/demo/mepa_apps/phy_gpio_demo.c: error: ignoring return value of
    'scanf' declared with attribute 'warn_unused_result'
    [-Werror=unused-result]

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#19
A MEBA board without switch and without fixed PHY population, for setups
where an application drives only MEPA PHYs: evaluation boards, PTP
daemons, debug tooling, SPI-attached 10G/25G PHYs such as the LAN80xx.

The board exposes "port_cnt" MEPA port slots (conf tag, default 4) and
deliberately does not probe or pre-create PHY devices at
MEBA_PHY_INITIALIZE: without fixed population there is nothing to
detect, and the application creates each device explicitly.
PHY register access is forwarded to the application-provided board_info
accessors: MIIM/MMD through the standard meba_generic callouts, SPI
through meba_phy_spi_read/write.

The mepa_void aggregate bundles the common PHY drivers including the
LAN80xx (Malibu-25G) TS+MACsec driver.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#17
Support the MEPA PHYs (LAN80xx) without a switch instance.

It can be used with 2 modes:
  - either thru direct access to a /dev/spidev,
  - thru a proxy that centralize the access to the /dev/spidev
    in order to support many users of the same MEPA PHY.

It runs with '-P <spidev|proxy:sock>'.
It was tested with a LAN8024 target.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung/sw-mepa#11 (sw-mepa original)
  microchip-ung#17
status: sw-mepa PR microchip-ung#11 closed 2026-07-03 by Microchip (HoratiuVultur):
  "a PR in MESA was open for this, I will add my comments there" --
  review continues on mesa PR microchip-ung#17.
…t GPIO

For the boards where the LAN80xx INTR (MDINT) pin is wired to a host GPIO,
the MCU mailbox can wait on the real interrupt instead of polling the
flag register over SPI.

Let's bind the MEPA gpio callback to a Linux GPIO chardev line with
falling-edge events. The INTR line is board-specific, set from
$LAN80XX_MDINT, else a built-in default
The new CLI command "PHY MCU intr <port_no>" performs the binding.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#17
complements:
  microchip-ung#12 (driver-side no-GPIO
  SPI-flag fallback; independent, reviewable separately)
It complements microchip-ung#12 but neither
depends on the other.
Detect unresolved argument types up front and skip the method, removing
it from the JSON-RPC method table as well. Full-API generations are
unaffected: all types resolve, nothing is skipped.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#17
…rary

The PHY-only application (app_void) so far linked a full MESA switch
chip library purely to satisfy the linker: no switch register is ever
touched at runtime. Add a build flavor that removes it entirely.

It is exclusive with the switch apps in the same build tree
(-DMESA_PHY_ONLY=ON -Dapp_void=ON).

The default builds are unchanged.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#17
@vjardin
vjardin force-pushed the vj_shared_phy_only branch from 42ad66e to 60ca841 Compare July 9, 2026 22:06
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
A MEBA board without switch and without fixed PHY population, for setups
where an application drives only MEPA PHYs: evaluation boards, PTP
daemons, debug tooling, SPI-attached 10G/25G PHYs such as the LAN80xx.

The board exposes "port_cnt" MEPA port slots (conf tag, default 4) and
deliberately does not probe or pre-create PHY devices at
MEBA_PHY_INITIALIZE: without fixed population there is nothing to
detect, and the application creates each device explicitly.
PHY register access is forwarded to the application-provided board_info
accessors: MIIM/MMD through the standard meba_generic callouts, SPI
through meba_phy_spi_read/write.

The mepa_void aggregate bundles the common PHY drivers including the
LAN80xx (Malibu-25G) TS+MACsec driver.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#17

integration (vj_integration_allPR):
  cherry-picked from: vj_shared_phy_only @ ca4a67d
  pull request: microchip-ung#17 (open)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
Support the MEPA PHYs (LAN80xx) without a switch instance.

It can be used with 2 modes:
  - either thru direct access to a /dev/spidev,
  - thru a proxy that centralize the access to the /dev/spidev
    in order to support many users of the same MEPA PHY.

It runs with '-P <spidev|proxy:sock>'.
It was tested with a LAN8024 target.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung/sw-mepa#11 (sw-mepa original)
  microchip-ung#17
status: sw-mepa PR microchip-ung#11 closed 2026-07-03 by Microchip (HoratiuVultur):
  "a PR in MESA was open for this, I will add my comments there" --
  review continues on mesa PR microchip-ung#17.

integration (vj_integration_allPR):
  cherry-picked from: vj_shared_phy_only @ 29f195e
  pull request: microchip-ung#17 (open)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
…t GPIO

For the boards where the LAN80xx INTR (MDINT) pin is wired to a host GPIO,
the MCU mailbox can wait on the real interrupt instead of polling the
flag register over SPI.

Let's bind the MEPA gpio callback to a Linux GPIO chardev line with
falling-edge events. The INTR line is board-specific, set from
$LAN80XX_MDINT, else a built-in default
The new CLI command "PHY MCU intr <port_no>" performs the binding.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#17
complements:
  microchip-ung#12 (driver-side no-GPIO
  SPI-flag fallback; independent, reviewable separately)
It complements microchip-ung#12 but neither
depends on the other.

integration (vj_integration_allPR):
  cherry-picked from: vj_shared_phy_only @ 79314df
  pull request: microchip-ung#17 (open)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
Detect unresolved argument types up front and skip the method, removing
it from the JSON-RPC method table as well. Full-API generations are
unaffected: all types resolve, nothing is skipped.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#17

integration (vj_integration_allPR):
  cherry-picked from: vj_shared_phy_only @ 8c27a9d
  pull request: microchip-ung#17 (open)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
…rary

The PHY-only application (app_void) so far linked a full MESA switch
chip library purely to satisfy the linker: no switch register is ever
touched at runtime. Add a build flavor that removes it entirely.

It is exclusive with the switch apps in the same build tree
(-DMESA_PHY_ONLY=ON -Dapp_void=ON).

The default builds are unchanged.

Signed-off-by: Vincent Jardin <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#17

integration (vj_integration_allPR):
  cherry-picked from: vj_shared_phy_only @ 60ca841
  pull request: microchip-ung#17 (open)
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 9, 2026
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 <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#21
supersedes:
  microchip-ung#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 microchip-ung#17 and no longer carries the eds2 25G demo app (superseded by PR microchip-ung#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.
@vjardin
vjardin marked this pull request as ready for review July 9, 2026 22:40
vjardin added a commit to vjardin/mesa that referenced this pull request Jul 10, 2026
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 <vjardin@free.fr>

---
misc information:
pushed to:
  microchip-ung#21
supersedes:
  microchip-ung#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 microchip-ung#17 and no longer carries the eds2 25G demo app (superseded by PR microchip-ung#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.

integration (vj_integration_allPR):
  cherry-picked from: vj_eds2_board_v2 @ 21b1572
  pull request: microchip-ung#21 (open)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants