[PATCH net-next v5 0/3] Add Cortina Systems CS7542 MDIO controller support

From: Fil Dunsky via B4 Relay

Date: Thu Dec 03 2026 - 22:58:08 EST


Add the CS7542 Clause 22 MDIO controller with bounded, sleepable polling.
The driver is independent of the pending platform series and COMPILE_TEST.
It retains the firmware MDC prescaler while enabling software-initiated
transactions.

Since v4, the driver acquires and enables the APB input required by the binding
before the first register access. The managed clock remains enabled until
the managed MDIO bus is unregistered. Clock lookup or enable failures,
including probe deferral, return before touching registers. No clock-rate
or MDC-divisor programming is added.

The APB source was established previously on Almond+ by changing APB from
150 to 100 MHz while AXI stayed at 150 MHz and comparing MDIO transaction
timing. The binding describes that source and allows clock-frequency from
mdio.yaml; the exact prescaler divisor encoding remains unestablished.

Validation for v4:
- The actual probe passes 10 allocation, map, clock, registration and
cleanup-order cases with GCC/Clang ASan/UBSan. The pre-fix probe reproduces
an MMIO access without an enabled clock under the same helpers.
- Native ARM driver=y object and exact Linux 6.18 driver=m module compile
with W=1 and KCFLAGS=-Werror; existing configurations are unchanged.
- A read-only consumer probe on the running Almond+ obtained and enabled
cs7542-apb at 150 MHz. MDIO CFG stayed 00200001; all references were dropped,
the same OpenWrt boot continued and its watchdog/settings were preserved.
This exercises the consumer/provider path, not a full live bus reprobe.

Earlier v2/v3 full independent builds, binding checks and RAM PHY read/write
results remain recorded. The transaction logic and firmware prescaler are
unchanged here; the old hardware matrix was not repeated.

Changes in v5:
- Rebase onto current net-next after the HiSilicon FEMAC MDIO driver
was removed (Willem de Bruijn).
- Pick up Rob Herring's Reviewed-by on the unchanged binding.
- Link to v4: https://patch.msgid.link/20261127-b4-cs7542-mdio-v4-0-0e37fc0c47d5@xxxxxxxxx

Changes in v4:
- Enable the required APB input before accessing MDIO registers and keep it
enabled through bus teardown.
- Clarify MANUAL transaction selection and preservation of the firmware
MDC prescaler.
- Link to v3: https://lore.kernel.org/all/20261126-b4-cs7542-mdio-v3-0-35739a0f3225@xxxxxxxxx/

Changes in v3:
- Use sleepable polling in the MDIO bus callbacks.
- Describe the experimentally established APB input and allow the inherited
optional clock-frequency property.
- Remove the unused private mii_bus pointer.
- Link to v2: https://lore.kernel.org/all/20261123-b4-cs7542-mdio-v2-0-30465e831853@xxxxxxxxx/

Changes in v2:
- Drop pending-frame state after Andrew Lunn's review.
- Sort Kconfig/Makefile entries and retain Andrew's Reviewed-by on the
MAINTAINERS patch only.
- Link to v1: https://lore.kernel.org/all/20261123-b4-cs7542-mdio-v1-0-626d0a0e3b4d@xxxxxxxxx/

---
Fil Dunsky (3):
dt-bindings: net: Add Cortina CS7542 MDIO controller
net: mdio: Add Cortina CS7542 bus controller
MAINTAINERS: Add Cortina CS7542 MDIO controller entry

.../bindings/net/cortina,cs7542-mdio.yaml | 52 +++++++++
MAINTAINERS | 7 ++
drivers/net/mdio/Kconfig | 12 ++
drivers/net/mdio/Makefile | 1 +
drivers/net/mdio/mdio-cs75xx.c | 126 +++++++++++++++++++++
5 files changed, 198 insertions(+)
---
base-commit: aea6deaf6b3c8a204242a4ca1fdb26e8e74de5fc
change-id: 20261123-b4-cs7542-mdio-ec44e757e824

Best regards,
--
Fil Dunsky <filipp.dunsky@xxxxxxxxx>