Thread View: linux.kernel.netdev
5 messages
5 total messages
Started by Fil Dunsky via B4 Relay
Mon, 23 Nov 2026 18:41
[PATCH net-next 0/3] Add Cortina Systems CS7542 MDIO controller support
Author: Fil Dunsky via B4 Relay
Date: Mon, 23 Nov 2026 18:41
Date: Mon, 23 Nov 2026 18:41
51 lines
12842 bytes
12842 bytes
Add an independent Clause 22 MDIO driver for the CS7542 controller used by
Securifi Almond+. The series is based on Linux v7.4-rc4 and has no platform
or ARCH_CORTINA_ACCESS dependency. It is intended for net-next.
Enable manual operation while retaining the prescaler initialized by
firmware and all unrelated configuration bits. The factory bootloader and
vendor driver set the prescaler to 0x20 on this board; the source clock and
exact divisor formula are not documented by the material available here.
Accordingly, this version does not advertise programmable clock-frequency
or preamble suppression. It does not claim Clause 45 support.
Poll short transfers with bounded microsecond waits. A timed-out transfer
remains pending until completion; a later operation cannot replace its
address and consume a stale completion. Device-managed bus allocation and
registration handle probe cleanup and removal.
Validation:
- Full independent ARM vmlinux and modules builds, driver both =y and =m,
COMPILE_TEST=n, without the platform series.
- Binding schema/example and strict source checkpatch pass.
- Actual read/write/wait functions: 5125 address, data, timeout and recovery
cases with mocked MMIO under UBSAN.
- Linux 7.4-rc4 booted in RAM on Almond+. Read PHY ID 004d:d036, performed
an unchanged-value advertisement write/readback and preserved CFG=00200001.
- A RAM-only test slowed the prescaler to induce a real -ETIMEDOUT, restored
the original setting and verified both PHY ID registers again. All hardware
checks passed and the board returned to installed OpenWrt 6.18.64.
No kernel image was installed by these tests. The hardware-test helper and
board integration are not part of the series.
---
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 | 48 ++++++++
MAINTAINERS | 7 ++
drivers/net/mdio/Kconfig | 13 ++
drivers/net/mdio/Makefile | 1 +
drivers/net/mdio/mdio-cs75xx.c | 136 +++++++++++++++++++++
5 files changed, 205 insertions(+)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261123-b4-cs7542-mdio-ec44e757e824
Best regards,
--
Fil Dunsky <filipp.dunsky@gmail.com>
[PATCH net-next 1/3] dt-bindings: net: Add Cortina CS7542 MDIO controller
Author: Fil Dunsky via B4 Relay
Date: Mon, 23 Nov 2026 18:41
Date: Mon, 23 Nov 2026 18:41
69 lines
12073 bytes
12073 bytes
From: Fil Dunsky <filipp.dunsky@gmail.com>
Describe the CS7542 Clause 22 MDIO register bank and devices on its bus.
The firmware initializes the MDC prescaler, which this interface
preserves; clock-frequency and preamble suppression are not supported.
Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
.../bindings/net/cortina,cs7542-mdio.yaml | 48 ++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/cortina,cs7542-mdio.yaml b/Documentation/devicetree/bindings/net/cortina,cs7542-mdio.yaml
new file mode 100644
index 000000000..77b5e2f09
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/cortina,cs7542-mdio.yaml
@@ -0,0 +1,48 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/cortina,cs7542-mdio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cortina Systems CS7542 MDIO controller
+
+maintainers:
+ - Fil Dunsky <filipp.dunsky@gmail.com>
+
+description:
+ Clause 22 MDIO controller. Firmware configures the MDC prescaler before
+ the operating system starts; the driver retains this setting.
+
+allOf:
+ - $ref: mdio.yaml#
+
+properties:
+ compatible:
+ const: cortina,cs7542-mdio
+
+ reg:
+ maxItems: 1
+
+ clock-frequency: false
+ suppress-preamble: false
+
+required:
+ - compatible
+ - reg
+ - "#address-cells"
+ - "#size-cells"
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ mdio@f00700a0 {
+ compatible = "cortina,cs7542-mdio";
+ reg = <0xf00700a0 0x14>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ethernet-phy@0 {
+ reg = <0>;
+ };
+ };
--
2.53.0
Re: [PATCH net-next 1/3] dt-bindings: net: Add Cortina CS7542 MDIO controller
Author: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 19:07
Date: Tue, 24 Nov 2026 19:07
134 lines
12722 bytes
12722 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The binding states the CS7542 MDIO block has an MDC prescaler.
- [Low] The CS7542 MDIO binding
(Documentation/devicetree/bindings/net/cortina,cs7542-mdio.yaml)…
--
dt-bindings: net: Add Cortina CS7542 MDIO controller
This adds a YAML binding for the Cortina CS7542 Clause 22 MDIO controller.
The binding references mdio.yaml and requires compatible, reg and the cell
properties. It disallows clock-frequency and suppress-preamble because the
MDC prescaler set by firmware is kept as is.
> diff --git a/Documentation/devicetree/bindings/net/cortina,cs7542-mdio.yaml b/Documentation/devicetree/bindings/net/cortina,cs7542-mdio.yaml
> new file mode 100644
> index 0000000000000..77b5e2f09f423
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/cortina,cs7542-mdio.yaml
> @@ -0,0 +1,48 @@
[ ... ]
> +description:
> + Clause 22 MDIO controller. Firmware configures the MDC prescaler before
> + the operating system starts; the driver retains this setting.
> +
> +allOf:
> + - $ref: mdio.yaml#
> +
> +properties:
> + compatible:
> + const: cortina,cs7542-mdio
> +
> + reg:
> + maxItems: 1
> +
> + clock-frequency: false
> + suppress-preamble: false
[Severity: Low]
Do these two false constraints describe a hardware limit, or only what the
current driver does?
The description talks about what "the driver retains". The MDC prescaler
also looks like a programmable register. cs75xx_mdio_probe() in
drivers/net/mdio/mdio-cs75xx.c, added later in this series, reads it and
writes it back:
cfg = readl(priv->base + PER_MDIO_CFG);
/* The firmware configures the MDC rate; retain its prescaler. */
cfg |= MDIO_CFG_MANUAL;
writel(cfg, priv->base + PER_MDIO_CFG);
So the hardware seems able to set the MDC rate. Rejecting clock-frequency
then only reflects that the Linux driver doesn't implement it. Nothing in
the binding says the hardware can't suppress the preamble either.
Documentation/devicetree/bindings/writing-bindings.rst says bindings should
not refer to Linux or "device driver". It also says they should be based on
what the hardware has, not on what an OS and driver currently support.
With this binding, a board whose PHYs need a different MDC rate has no
valid way to say so. dt_binding_check also rejects these standard
mdio.yaml properties.
The commit message has the same problem:
clock-frequency and preamble suppression are not supported.
This reads like a hardware limitation.
Could the description be reworded to describe the hardware? And could the
false entries be dropped unless the hardware really lacks these features?
> +
> +required:
> + - compatible
> + - reg
> + - "#address-cells"
> + - "#size-cells"
> +
> +unevaluatedProperties: false
[Severity: Medium]
Is this schema missing an input clock, and possibly a reset?
The description says the block has an MDC prescaler, which means it
divides some input clock. The schema only adds compatible and reg on top of
mdio.yaml. With unevaluatedProperties: false, any DT node that has a clocks
or resets property fails validation.
writing-bindings.rst asks for complete bindings in this case:
- DO attempt to make bindings complete even if a driver doesn't support
some features.
cs75xx_mdio_probe(), added later in the series, never gets or enables a
clock:
priv->base = devm_platform_ioremap_resource(pdev, 0);
...
return devm_of_mdiobus_register(dev, bus, dev->of_node);
What if a Linux clock driver manages the parent clock? clk_disable_unused()
could gate it at late_initcall. Every access would then time out in the
readl_poll_timeout_atomic() call in cs75xx_mdio_wait(), and the attached
PHYs would be unusable.
A rate change on a shared parent clock would also change MDC without
notice, since the driver keeps the firmware divider and never recomputes
it. That could push MDC above the 2.5 MHz Clause 22 limit.
There is no CS7542 clock driver or DTS in the tree yet. So the runtime
failure depends on whether that clock can actually be gated or changed.
If a required clocks property is added later, though, existing DTs written
against this binding would stop validating.
Would it be better to describe the clock now?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123-b4-cs7542-mdio-v1-0-626d0a0e3b4d%40gmail.com
Re: [PATCH net-next 1/3] dt-bindings: net: Add Cortina CS7542 MDIO controller
Author: Andrew Lunn
Date: Tue, 24 Nov 2026 19:28
Date: Tue, 24 Nov 2026 19:28
16 lines
8918 bytes
8918 bytes
> [Severity: Medium] > Is this schema missing an input clock, and possibly a reset? > > The description says the block has an MDC prescaler, which means it > divides some input clock. The schema only adds compatible and reg on top of > mdio.yaml. With unevaluatedProperties: false, any DT node that has a clocks > or resets property fails validation. It does get messy to add this later, since you have to keep backwards compatibility to old DT blobs which don't have it. If you can add the clock to the SoC .dtsi file now, it will make things simpler later, even if the current driver does not use it. Andrew
Re: [PATCH net-next 1/3] dt-bindings: net: Add Cortina CS7542 MDIO controller
Author: Fil Dunsky
Date: Tue, 24 Nov 2026 19:39
Date: Tue, 24 Nov 2026 19:39
17 lines
11889 bytes
11889 bytes
Hi Andrew, I agree about describing the input clock before the binding is merged. The vendor U-Boot sets bit 5 of the MDC prescaler, and the kernel SDK writes 0x20 to that field. Neither source identifies the clock feeding it. I have not found a CS7542 clock diagram that ties it to the APB clock, so I am checking that connection before adding the phandle to the SoC .dtsi. The U-Boot and SDK sites I checked are below. https://github.com/futuretekinc/cortina/blob/aafa3821f0934eebe8137726d4e6d5994c1ac3fa/u-boot/drivers/net/g2_ni_mfe.c#L724-L727 https://github.com/drvlabo/linux_kernel_cs75xx/blob/8bb3f7dc796a59d992572a118448ba196f547ed6/drivers/net/ethernet/cs752x/src/ni/cs752x_eth.c#L3529-L3534 Thanks, Fil
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads