Skip to contentSkip to conversation

net: mdio: Clause 45 support for

PATCH Superseded Florian Fainelli 5 participants 16 messages Nov 13 – Nov 17

Subsystems (4)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Florian Fainelli

author maintainer
#0 lore raw

cover net: mdio: Clause 45 support for

This patch series adds support for Clause 45 MDIO operations within the mdio-bcm-unimac driver. The series breaks things up in this way:

- scope the existing defines to make it clear what is C22 vs. C45 specific
- rework the polling completion loop to be a tigher loop
- add support for clause 45 operations

Florian Fainelli (3):
net: mdio: mdio-bcm-unimac: Define MDIO_OP_SHIFT
net: mdio: mdio-bcm-unimac: Poll for completion at 1us granularity
net: mdio: mdio-bcm-unimac: Add Clause 45 support

 drivers/net/mdio/mdio-bcm-unimac.c | 130 +++++++++++++++++++++++++----
 1 file changed, 115 insertions(+), 15 deletions(-)
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH 1/3 net: mdio: mdio-bcm-unimac: Define MDIO_OP_SHIFT

The MDIO_CMD operation code field starts at bit 26. Define MDIO_OP_SHIFT for it and use it to build the opcodes instead of open coding the shift.

While at it, rename MDIO_RD and MDIO_WR to MDIO_RD_C22 and MDIO_WR_C22 to make it clear that these are the Clause 22 opcodes, in preparation for adding the Clause 45 ones.

No functional change.

---
 drivers/net/mdio/mdio-bcm-unimac.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/mdio/mdio-bcm-unimac.c +6 -4
index 31e396cc9fbf..6df824aba75e 100644
@@ -21,8 +21,9 @@
 #define MDIO_CMD		0x00
 #define  MDIO_START_BUSY	(1 << 29)
 #define  MDIO_READ_FAIL		(1 << 28)
-#define  MDIO_RD		(2 << 26)
-#define  MDIO_WR		(1 << 26)
+#define  MDIO_OP_SHIFT		26
+#define  MDIO_RD_C22		(2 << MDIO_OP_SHIFT)
+#define  MDIO_WR_C22		(1 << MDIO_OP_SHIFT)
 #define  MDIO_PMD_SHIFT		21
 #define  MDIO_PMD_MASK		0x1F
 #define  MDIO_REG_SHIFT		16
@@ -99,7 +100,8 @@ static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
 		return ret;
 
 	/* Prepare the read operation */
-	cmd = MDIO_RD | (phy_id << MDIO_PMD_SHIFT) | (reg << MDIO_REG_SHIFT);
+	cmd = MDIO_RD_C22 | (phy_id << MDIO_PMD_SHIFT) |
+		(reg << MDIO_REG_SHIFT);
 	unimac_mdio_writel(priv, cmd, MDIO_CMD);
 
 	/* Start MDIO transaction */
@@ -139,7 +141,7 @@ static int unimac_mdio_write(struct mii_bus *bus, int phy_id,
 		return ret;
 
 	/* Prepare the write operation */
-	cmd = MDIO_WR | (phy_id << MDIO_PMD_SHIFT) |
+	cmd = MDIO_WR_C22 | (phy_id << MDIO_PMD_SHIFT) |
 		(reg << MDIO_REG_SHIFT) | (0xffff & val);
 	unimac_mdio_writel(priv, cmd, MDIO_CMD);
 
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH net-next 1/3] net: mdio: mdio-bcm-unimac: Define MDIO_OP_SHIFT

Quoted 11 lines · Florian Fainelli

The MDIO_CMD operation code field starts at bit 26. Define MDIO_OP_SHIFT for it and use it to build the opcodes instead of open coding the shift.

While at it, rename MDIO_RD and MDIO_WR to MDIO_RD_C22 and MDIO_WR_C22 to make it clear that these are the Clause 22 opcodes, in preparation for adding the Clause 45 ones.

No functional change.

Andrew

maintainer Reviewed-by on v1 1/3
#3 lore raw

Re: [PATCH net-next 1/3] net: mdio: mdio-bcm-unimac: Define MDIO_OP_SHIFT

In reply to Florian Fainelli
Quoted 8 lines · Florian Fainelli

The MDIO_CMD operation code field starts at bit 26. Define MDIO_OP_SHIFT for it and use it to build the opcodes instead of open coding the shift.

While at it, rename MDIO_RD and MDIO_WR to MDIO_RD_C22 and MDIO_WR_C22 to make it clear that these are the Clause 22 opcodes, in preparation for adding the Clause 45 ones.

Quoted 5 lines

No functional change.

[...]

Thanks,
Nicolai

author maintainer
#4 lore raw

PATCH 2/3 net: mdio: mdio-bcm-unimac: Poll for completion at 1us granularity

In reply to Florian Fainelli

The current polling code unconditionally waits 30us, which was sized for a ~25us Clause 22 transaction, and then polls MDIO_CMD with a sleep of up to 2ms between samples.

Adding Clause 45 support means that every access becomes two back to back transactions (an ADDR cycle followed by a READ/WRITE cycle), so a fixed delay sized for a single C22 transaction is no longer meaningful, and a sleep of up to 2ms between samples can add significant latency to each access when the transaction has not completed at the first sample.

Instead, poll the MDIO_START_BUSY bit every microsecond so that the completion is noticed as soon as it happens, regardless of the type of transaction. This turns the wait into a busy wait, which is bounded by a timeout reduced from 100ms to 1ms: a 64 bit MDIO frame takes about 33us at the lowest MDIO clock the driver can program from a 250MHz reference clock, so even a two frame C45 access completes well within that.

---
 drivers/net/mdio/mdio-bcm-unimac.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/net/mdio/mdio-bcm-unimac.c +15 -8
index 6df824aba75e..15a9880c3573 100644
@@ -6,8 +6,8 @@
  */
 
 #include <linux/clk.h>
-#include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/iopoll.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -36,6 +36,13 @@
 #define  MDIO_CLK_DIV_MASK	0x3F
 #define  MDIO_SUPP_PREAMBLE	(1 << 12)
 
+/* A 64 bit MDIO frame takes ~25us at 2.5MHz and ~33us at the lowest MDIO
+ * clock the driver can program from a 250MHz reference clock. A C45 access is
+ * two frames, so a 1ms timeout leaves a wide margin.
+ */
+#define MDIO_POLL_DELAY_US	1
+#define MDIO_POLL_TIMEOUT_US	1000
+
 struct unimac_mdio_priv {
 	struct mii_bus		*mii_bus;
 	void __iomem		*base;
@@ -79,14 +86,14 @@ static int unimac_mdio_poll(void *wait_func_data)
 	struct unimac_mdio_priv *priv = wait_func_data;
 	u32 val;
 
-	/*
-	 * C22 transactions should take ~25 usec, will need to adjust
-	 * if C45 support is added.
+	/* C22 transactions should take ~25 usec, C45 transactions take about
+	 * twice as long since they need an address and a data cycle.
 	 */
-	udelay(30);
-
-	return read_poll_timeout(unimac_mdio_readl, val, !(val & MDIO_START_BUSY),
-				 2000, 100000, false, priv, MDIO_CMD);
+	return read_poll_timeout_atomic(unimac_mdio_readl, val,
+					!(val & MDIO_START_BUSY),
+					MDIO_POLL_DELAY_US,
+					MDIO_POLL_TIMEOUT_US, false, priv,
+					MDIO_CMD);
 }
 
 static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
Signature · 1 line
2.34.1
maintainer
#5 lore raw

Re: [PATCH net-next 2/3] net: mdio: mdio-bcm-unimac: Poll for completion at 1us granularity

Quoted 17 lines · Florian Fainelli

The current polling code unconditionally waits 30us, which was sized for a ~25us Clause 22 transaction, and then polls MDIO_CMD with a sleep of up to 2ms between samples.

Adding Clause 45 support means that every access becomes two back to back transactions (an ADDR cycle followed by a READ/WRITE cycle), so a fixed delay sized for a single C22 transaction is no longer meaningful, and a sleep of up to 2ms between samples can add significant latency to each access when the transaction has not completed at the first sample.

Instead, poll the MDIO_START_BUSY bit every microsecond so that the completion is noticed as soon as it happens, regardless of the type of transaction. This turns the wait into a busy wait, which is bounded by a timeout reduced from 100ms to 1ms: a 64 bit MDIO frame takes about 33us at the lowest MDIO clock the driver can program from a 250MHz reference clock, so even a two frame C45 access completes well within that.

Quoted 3 lines

Nitpick: Since you are submitting it, your Signed-off-by: should come last.

Apart from that, please add my Reviewed-by: Andrew Lunn <[email protected]>

Andrew

maintainer Reviewed-by on v1 2/3
#6 lore raw

Re: [PATCH net-next 2/3] net: mdio: mdio-bcm-unimac: Poll for completion at 1us granularity

In reply to Florian Fainelli
Quoted 17 lines · Florian Fainelli

The current polling code unconditionally waits 30us, which was sized for a ~25us Clause 22 transaction, and then polls MDIO_CMD with a sleep of up to 2ms between samples.

Adding Clause 45 support means that every access becomes two back to back transactions (an ADDR cycle followed by a READ/WRITE cycle), so a fixed delay sized for a single C22 transaction is no longer meaningful, and a sleep of up to 2ms between samples can add significant latency to each access when the transaction has not completed at the first sample.

Instead, poll the MDIO_START_BUSY bit every microsecond so that the completion is noticed as soon as it happens, regardless of the type of transaction. This turns the wait into a busy wait, which is bounded by a timeout reduced from 100ms to 1ms: a 64 bit MDIO frame takes about 33us at the lowest MDIO clock the driver can program from a 250MHz reference clock, so even a two frame C45 access completes well within that.

Quoted 5 lines

[...]

With what Andrew already asked:

Thanks,
Nicolai

author maintainer
#7 lore raw

PATCH 3/3 net: mdio: mdio-bcm-unimac: Add Clause 45 support

In reply to Florian Fainelli

Add Clause 45 read/write support to the UniMAC MDIO bus controller driver by implementing the read_c45/write_c45 bus callbacks. Each access performs the two-step C45 sequence (ADDR cycle followed by a READ/WRITE cycle) under the bus lock and switches MDIO_CFG between C22 and C45 mode as needed; MDIO_CFG is only written when the mode actually changes.

Also skip the BMSR workaround read in unimac_mdio_reset() for children compatible with "ethernet-phy-ieee802.3-c45", since such PHYs are not expected to respond to C22 accesses.

Note that providing read_c45/write_c45 also makes the MDIO core scan for C45 PHYs at registration time, on addresses that are not masked and do not already have a C22 device.

---
 drivers/net/mdio/mdio-bcm-unimac.c | 105 +++++++++++++++++++++++++++--
 1 file changed, 98 insertions(+), 7 deletions(-)
drivers/net/mdio/mdio-bcm-unimac.c +98 -7
index 15a9880c3573..25f54ee754f9 100644
@@ -24,10 +24,16 @@
 #define  MDIO_OP_SHIFT		26
 #define  MDIO_RD_C22		(2 << MDIO_OP_SHIFT)
 #define  MDIO_WR_C22		(1 << MDIO_OP_SHIFT)
+#define  MDIO_ADDR_C45		(0 << MDIO_OP_SHIFT)
+#define  MDIO_WR_C45		(1 << MDIO_OP_SHIFT)
+#define  MDIO_RD_C45		(3 << MDIO_OP_SHIFT)
 #define  MDIO_PMD_SHIFT		21
 #define  MDIO_PMD_MASK		0x1F
 #define  MDIO_REG_SHIFT		16
 #define  MDIO_REG_MASK		0x1F
+#define  MDIO_DEVAD_SHIFT	16
+#define  MDIO_DEVAD_MASK	GENMASK(20, 16)
+#define  MDIO_C45_REG_MASK	GENMASK(15, 0)
 
 #define MDIO_CFG		0x04
 #define  MDIO_C22		(1 << 0)
@@ -96,7 +102,43 @@ static int unimac_mdio_poll(void *wait_func_data)
 					MDIO_CMD);
 }
 
-static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
+static u32 unimac_mdio_c45_devad(int devad)
+{
+	return ((u32)devad << MDIO_DEVAD_SHIFT) & MDIO_DEVAD_MASK;
+}
+
+static int unimac_mdio_addr_c45(struct unimac_mdio_priv *priv,
+				int phy_id, int devad, int reg)
+{
+	u32 cmd;
+
+	/* Prepare the addr c45 operation */
+	cmd = MDIO_ADDR_C45 | (phy_id << MDIO_PMD_SHIFT) |
+	      unimac_mdio_c45_devad(devad) | (reg & MDIO_C45_REG_MASK);
+	unimac_mdio_writel(priv, cmd, MDIO_CMD);
+
+	/* Start MDIO transaction */
+	unimac_mdio_start(priv);
+
+	return priv->wait_func(priv->wait_func_data);
+}
+
+static void unimac_mdio_set_clause(struct unimac_mdio_priv *priv, bool is_c45)
+{
+	u32 cfg = unimac_mdio_readl(priv, MDIO_CFG);
+	u32 new_cfg = cfg;
+
+	if (is_c45)
+		new_cfg &= ~MDIO_C22;
+	else
+		new_cfg |= MDIO_C22;
+
+	if (new_cfg != cfg)
+		unimac_mdio_writel(priv, new_cfg, MDIO_CFG);
+}
+
+static int unimac_mdio_do_read(struct mii_bus *bus, int phy_id, int devad,
+			       int reg, bool is_c45)
 {
 	struct unimac_mdio_priv *priv = bus->priv;
 	int ret;
@@ -107,8 +149,19 @@ static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
 		return ret;
 
 	/* Prepare the read operation */
-	cmd = MDIO_RD_C22 | (phy_id << MDIO_PMD_SHIFT) |
-		(reg << MDIO_REG_SHIFT);
+	unimac_mdio_set_clause(priv, is_c45);
+	if (is_c45) {
+		ret = unimac_mdio_addr_c45(priv, phy_id, devad, reg);
+		if (ret)
+			goto out;
+
+		cmd = MDIO_RD_C45 | (phy_id << MDIO_PMD_SHIFT) |
+			unimac_mdio_c45_devad(devad) |
+			(reg & MDIO_C45_REG_MASK);
+	} else {
+		cmd = MDIO_RD_C22 | (phy_id << MDIO_PMD_SHIFT) |
+			(reg << MDIO_REG_SHIFT);
+	}
 	unimac_mdio_writel(priv, cmd, MDIO_CMD);
 
 	/* Start MDIO transaction */
@@ -136,8 +189,8 @@ static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
 	return ret;
 }
 
-static int unimac_mdio_write(struct mii_bus *bus, int phy_id,
-			     int reg, u16 val)
+static int unimac_mdio_do_write(struct mii_bus *bus, int phy_id, int devad,
+				int reg, u16 val, bool is_c45)
 {
 	struct unimac_mdio_priv *priv = bus->priv;
 	u32 cmd;
@@ -148,18 +201,50 @@ static int unimac_mdio_write(struct mii_bus *bus, int phy_id,
 		return ret;
 
 	/* Prepare the write operation */
-	cmd = MDIO_WR_C22 | (phy_id << MDIO_PMD_SHIFT) |
-		(reg << MDIO_REG_SHIFT) | (0xffff & val);
+	unimac_mdio_set_clause(priv, is_c45);
+	if (is_c45) {
+		ret = unimac_mdio_addr_c45(priv, phy_id, devad, reg);
+		if (ret)
+			goto out;
+
+		cmd = MDIO_WR_C45 | (phy_id << MDIO_PMD_SHIFT) |
+			unimac_mdio_c45_devad(devad) | (0xffff & val);
+	} else {
+		cmd = MDIO_WR_C22 | (phy_id << MDIO_PMD_SHIFT) |
+			(reg << MDIO_REG_SHIFT) | (0xffff & val);
+	}
 	unimac_mdio_writel(priv, cmd, MDIO_CMD);
 
 	unimac_mdio_start(priv);
 
 	ret = priv->wait_func(priv->wait_func_data);
+out:
 	clk_disable_unprepare(priv->clk);
 
 	return ret;
 }
 
+static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
+{
+	return unimac_mdio_do_read(bus, phy_id, 0, reg, false);
+}
+
+static int unimac_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 val)
+{
+	return unimac_mdio_do_write(bus, phy_id, 0, reg, val, false);
+}
+
+static int unimac_mdio_read_c45(struct mii_bus *bus, int addr, int dev, int reg)
+{
+	return unimac_mdio_do_read(bus, addr, dev, reg, true);
+}
+
+static int unimac_mdio_write_c45(struct mii_bus *bus, int addr, int dev,
+				 int reg, u16 val)
+{
+	return unimac_mdio_do_write(bus, addr, dev, reg, val, true);
+}
+
 /* Workaround for integrated BCM7xxx Gigabit PHYs which have a problem with
  * their internal MDIO management controller making them fail to successfully
  * be read from or written to for the first transaction.  We insert a dummy
@@ -190,6 +275,10 @@ static int unimac_mdio_reset(struct mii_bus *bus)
 			if (addr < 0)
 				continue;
 
+			if (of_device_is_compatible(child,
+						    "ethernet-phy-ieee802.3-c45"))
+				continue;
+
 			read_mask |= 1 << addr;
 		}
 	}
@@ -301,6 +390,8 @@ static int unimac_mdio_probe(struct platform_device *pdev)
 	bus->parent = &pdev->dev;
 	bus->read = unimac_mdio_read;
 	bus->write = unimac_mdio_write;
+	bus->read_c45 = unimac_mdio_read_c45;
+	bus->write_c45 = unimac_mdio_write_c45;
 	bus->reset = unimac_mdio_reset;
 	snprintf(bus->id, MII_BUS_ID_SIZE, "%s-%d", pdev->name, pdev->id);
 
Signature · 1 line
2.34.1
maintainer
#8 lore raw

Re: [PATCH net-next 3/3] net: mdio: mdio-bcm-unimac: Add Clause 45 support

drivers/net/mdio/mdio-bcm-unimac.c static int unimac_mdio_poll(void *wait_func_data) · line 137

Quoted 12 lines
drivers/net/mdio/mdio-bcm-unimac.c +12 -0
+static void unimac_mdio_set_clause(struct unimac_mdio_priv *priv, bool is_c45)
+{
+	u32 cfg = unimac_mdio_readl(priv, MDIO_CFG);
+	u32 new_cfg = cfg;
+
+	if (is_c45)
+		new_cfg &= ~MDIO_C22;
+	else
+		new_cfg |= MDIO_C22;
+
+	if (new_cfg != cfg)
+		unimac_mdio_writel(priv, new_cfg, MDIO_CFG);

Is the write expensive? The bus is not faster, so is this optimisation even noticeable?

Andrew

author maintainer
#9 lore raw

Re: [PATCH net-next 3/3] net: mdio: mdio-bcm-unimac: Add Clause 45 support

Quoted 7 lines · Andrew Lunn
Quoted 7 lines
drivers/net/mdio/mdio-bcm-unimac.c +7 -0
+static void unimac_mdio_set_clause(struct unimac_mdio_priv *priv, bool is_c45)
+{
+	u32 cfg = unimac_mdio_readl(priv, MDIO_CFG);
+	u32 new_cfg = cfg;
+
+	if (is_c45)
+		new_cfg &= ~MDIO_C22;
Quoted 8 lines

drivers/net/mdio/mdio-bcm-unimac.c static int unimac_mdio_poll(void *wait_func_data) · line 137

Quoted 5 lines
drivers/net/mdio/mdio-bcm-unimac.c +5 -0
+	else
+		new_cfg |= MDIO_C22;
+
+	if (new_cfg != cfg)
+		unimac_mdio_writel(priv, new_cfg, MDIO_CFG);

Is the write expensive? The bus is not faster, so is this optimisation even noticeable?

It's not really noticeable, with the firmware images that we have it saves roughly 30ms per firmware load per PHY, but it's a cheap optimization to carry, so I don't see why not?

Signature · 1 line
Florian
maintainer
#10 lore raw

Re: [PATCH net-next 3/3] net: mdio: mdio-bcm-unimac: Add Clause 45 support

In reply to Florian Fainelli

Hi Florian

Quoted 28 lines · Florian Fainelli

Add Clause 45 read/write support to the UniMAC MDIO bus controller driver by implementing the read_c45/write_c45 bus callbacks. Each access performs the two-step C45 sequence (ADDR cycle followed by a READ/WRITE cycle) under the bus lock and switches MDIO_CFG between C22 and C45 mode as needed; MDIO_CFG is only written when the mode actually changes.

Also skip the BMSR workaround read in unimac_mdio_reset() for children compatible with "ethernet-phy-ieee802.3-c45", since such PHYs are not expected to respond to C22 accesses.

Note that providing read_c45/write_c45 also makes the MDIO core scan for C45 PHYs at registration time, on addresses that are not masked and do not already have a C22 device.

---
 drivers/net/mdio/mdio-bcm-unimac.c | 105 +++++++++++++++++++++++++++--
 1 file changed, 98 insertions(+), 7 deletions(-)
drivers/net/mdio/mdio-bcm-unimac.c +0 -0
 
[...]

drivers/net/mdio/mdio-bcm-unimac.c static int unimac_mdio_probe(struct platform_device · line 395

Quoted 6 lines
drivers/net/mdio/mdio-bcm-unimac.c +2 -0
@@ -301,6 +390,8 @@ static int unimac_mdio_probe(struct platform_device 
 *pdev)
 	bus->parent = &pdev->dev;
 	bus->read = unimac_mdio_read;
 	bus->write = unimac_mdio_write;
+	bus->read_c45 = unimac_mdio_read_c45;
+	bus->write_c45 = unimac_mdio_write_c45;

AFAIU this breaks GENET without DT (e.g. Pi 4 with ACPI). Arguably an edge case, but last time I tried it worked at least. With your changes all addresses get a C45 scan there for which the empty ones return -EIO. get_phy_c45_ids() passes that up instead of mapping it to -ENODEV like the C22 path.

A cheap fix would be to do the same mapping in get_phy_c45_ids() as we have for C22.

Thanks,
Nicolai

author maintainer
#11 lore raw

Re: [PATCH net-next 3/3] net: mdio: mdio-bcm-unimac: Add Clause 45 support

Quoted 43 lines · Nicolai Buchwitz

Hi Florian

Quoted 28 lines · Florian Fainelli

Add Clause 45 read/write support to the UniMAC MDIO bus controller driver by implementing the read_c45/write_c45 bus callbacks. Each access performs the two-step C45 sequence (ADDR cycle followed by a READ/WRITE cycle) under the bus lock and switches MDIO_CFG between C22 and C45 mode as needed; MDIO_CFG is only written when the mode actually changes.

Also skip the BMSR workaround read in unimac_mdio_reset() for children compatible with "ethernet-phy-ieee802.3-c45", since such PHYs are not expected to respond to C22 accesses.

Note that providing read_c45/write_c45 also makes the MDIO core scan for C45 PHYs at registration time, on addresses that are not masked and do not already have a C22 device.

---
 drivers/net/mdio/mdio-bcm-unimac.c | 105 +++++++++++++++++++++++++++--

 1 file changed, 98 insertions(+), 7 deletions(-)
drivers/net/mdio/ mdio-bcm-unimac.c renamed from drivers/net/mdio/mdio-bcm-unimac.c +0 -0
 
[...]

drivers/net/mdio/ mdio-bcm-unimac.c static int unimac_mdio_probe(struct · line 395

Quoted 6 lines
drivers/net/mdio/ mdio-bcm-unimac.c renamed from drivers/net/mdio/mdio-bcm-unimac.c +2 -0
@@ -301,6 +390,8 @@ static int unimac_mdio_probe(struct 
 platform_device *pdev)
      bus->parent = &pdev->dev;
      bus->read = unimac_mdio_read;
      bus->write = unimac_mdio_write;
+    bus->read_c45 = unimac_mdio_read_c45;
+    bus->write_c45 = unimac_mdio_write_c45;

AFAIU this breaks GENET without DT (e.g. Pi 4 with ACPI). Arguably an edge case, but last time I tried it worked at least. With your changes all addresses get a C45 scan there for which the empty ones return -EIO. get_phy_c45_ids() passes that up instead of mapping it to -ENODEV like the C22 path.

Quoted 1 line

A cheap fix would be to do the same mapping in get_phy_c45_ids() as we have for C22.

OK, are we the only platform where that is happening? Alignment would make sense, and I don't assume we will be breaking someone's use case AFAICT.

Signature · 1 line
Florian
maintainer
#12 lore raw

Re: [PATCH net-next 3/3] net: mdio: mdio-bcm-unimac: Add Clause 45 support

Hi Florian

Quoted 15 lines · Florian Fainelli

[...]

Quoted 13 lines

drivers/net/mdio/mdio-bcm-unimac.c static int unimac_mdio_probe(struct · line 395

Quoted 7 lines
drivers/net/mdio/mdio-bcm-unimac.c +2 -0
@@ -301,6 +390,8 @@ static int unimac_mdio_probe(struct 
 platform_device *pdev)
      bus->parent = &pdev->dev;
      bus->read = unimac_mdio_read;
      bus->write = unimac_mdio_write;
+    bus->read_c45 = unimac_mdio_read_c45;
+    bus->write_c45 = unimac_mdio_write_c45;

AFAIU this breaks GENET without DT (e.g. Pi 4 with ACPI). Arguably an edge case, but last time I tried it worked at least. With your changes all addresses get a C45 scan there for which the empty ones return -EIO. get_phy_c45_ids() passes that up instead of mapping it to -ENODEV like the C22 path.

Quoted 3 lines
Quoted 1 line

A cheap fix would be to do the same mapping in get_phy_c45_ids() as we have for C22.

OK, are we the only platform where that is happening? Alignment would make sense, and I don't assume we will be breaking someone's use case AFAICT.

The only other I could find ois orion_mdio_xsmi_read_c45 (marvell/mvmdio.c)

Regards
Nicolai

#13 lore raw

Re: [PATCH net-next 3/3] net: mdio: mdio-bcm-unimac: Add Clause 45 support

In reply to Florian Fainelli
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider.

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider.

Critical: 0 · High: 1 · Medium: 2 · 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).

- [High] This patch sets bus->read_c45 unconditionally.
- [Medium] In the new two-cycle C45 sequence, the only completion check for the ADDR cycle is the return value of priv->wait_func().
- [Medium] MDIO_CFG now has two read-modify-write paths that share no lock.
- [Low] C45 callbacks and the MDIO_CFG clause switch are turned on for every compatible in unimac_mdio_ids: brcm,asp-v3.0/v2.2/v2.1-mdio,…

--

net: mdio: mdio-bcm-unimac: Add Clause 45 support

This commit adds Clause 45 read/write callbacks to the UniMAC MDIO driver. Each C45 access issues an ADDR cycle followed by a READ/WRITE cycle, and MDIO_CFG is switched between C22 and C45 mode as needed. The BMSR workaround read in unimac_mdio_reset() is also skipped for children compatible with "ethernet-phy-ieee802.3-c45".

Quoted 4 lines
drivers/net/mdio/mdio-bcm-unimac.c +0 -0
index df267bb826966..6059b32580c54 100644

[ ... ]

Quoted 1 line
drivers/net/mdio/mdio-bcm-unimac.c +0 -0
@@ -96,7 +102,43 @@ static int unimac_mdio_poll(void *wait_func_data)

[ ... ]

drivers/net/mdio/mdio-bcm-unimac.c static int unimac_mdio_poll(void *wait_func_data) · line 135

Quoted 10 lines
drivers/net/mdio/mdio-bcm-unimac.c +10 -0
+static void unimac_mdio_set_clause(struct unimac_mdio_priv *priv, bool is_c45)
+{
+	u32 cfg = unimac_mdio_readl(priv, MDIO_CFG);
+	u32 new_cfg = cfg;
+
+	if (is_c45)
+		new_cfg &= ~MDIO_C22;
+	else
+		new_cfg |= MDIO_C22;
+

[Severity: Low]
Do all of the IP revisions in unimac_mdio_ids support the MDIO_CFG clause bit and the C45 opcodes (ADDR=0b00, READ=0b11)?

The C45 callbacks and this MDIO_CFG read-modify-write are now enabled for every compatible: brcm,asp-v3.0/v2.2/v2.1-mdio, brcm,bcm6846-mdio, brcm,genet-mdio-v1..v5 and brcm,unimac-mdio. They are also enabled for the non-DT GENET pdata instantiation. Nothing gates this per compatible through match data, and unimac_mdio_set_clause() also runs on every C22 access.

If a revision lacks C45 support, C45 accesses would put undefined frames on the bus. Those accesses can come from the core C45 scan on an unmasked bus or from SIOCGMIIREG with a C45 phy_id.

Could the commit message say whether all of these revisions implement C45?

drivers/net/mdio/mdio-bcm-unimac.c static int unimac_mdio_poll(void *wait_func_data) · line 138

Quoted 3 lines
drivers/net/mdio/mdio-bcm-unimac.c +3 -0
+	if (new_cfg != cfg)
+		unimac_mdio_writel(priv, new_cfg, MDIO_CFG);
+}

[Severity: Medium]
Can this read-modify-write of MDIO_CFG race with unimac_mdio_clk_set()?

unimac_mdio_set_clause() runs under bus->mdio_lock. unimac_mdio_clk_set() writes the same register with no lock held:

unimac_mdio_clk_set() {
    ...
	reg = unimac_mdio_readl(priv, MDIO_CFG);
	reg &= ~(MDIO_CLK_DIV_MASK << MDIO_CLK_DIV_SHIFT);
	reg |= div << MDIO_CLK_DIV_SHIFT;
	unimac_mdio_writel(priv, reg, MDIO_CFG);
    ...
}

It is reached from unimac_mdio_resume() after the bus is registered. Before this patch, bus accesses never wrote MDIO_CFG.

The GENET parent resumes first. bcmgenet_resume() calls phy_start_machine() (or phy_start() through bcmgenet_netif_start()). With mac_managed_pm set, the PHY state machine work can then issue MDIO accesses while the child unimac resume is running clk_set.

Two interleavings look possible:

(a) clk_set reads cfg, set_clause flips MDIO_C22, then clk_set writes back the stale clause bit. The next ADDR and data cycles go out in the wrong framing. For example, a WR_C45 becomes a C22 write of val to register devad.

(b) set_clause reads cfg, clk_set writes the new MDC divider, then set_clause writes back the old divider. The restored MDIO clock frequency is lost until the next resume.

This needs a "clock-frequency" property, otherwise clk_set returns early, plus mixed C22/C45 traffic so that the clause bit actually changes.

[ ... ]

Quoted 10 lines
drivers/net/mdio/mdio-bcm-unimac.c +4 -2
@@ -107,8 +149,19 @@ static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
 		return ret;
 
 	/* Prepare the read operation */
-	cmd = MDIO_RD_C22 | (phy_id << MDIO_PMD_SHIFT) |
-		(reg << MDIO_REG_SHIFT);
+	unimac_mdio_set_clause(priv, is_c45);
+	if (is_c45) {
+		ret = unimac_mdio_addr_c45(priv, phy_id, devad, reg);
+		if (ret)

drivers/net/mdio/mdio-bcm-unimac.c static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg) · line 165

Quoted 10 lines
drivers/net/mdio/mdio-bcm-unimac.c +9 -0
+			goto out;
+
+		cmd = MDIO_RD_C45 | (phy_id << MDIO_PMD_SHIFT) |
+			unimac_mdio_c45_devad(devad) |
+			(reg & MDIO_C45_REG_MASK);
+	} else {
+		cmd = MDIO_RD_C22 | (phy_id << MDIO_PMD_SHIFT) |
+			(reg << MDIO_REG_SHIFT);
+	}
 	unimac_mdio_writel(priv, cmd, MDIO_CMD);

[Severity: Medium]
Is the ADDR cycle guaranteed to have finished before MDIO_CMD is overwritten here?

The only completion check is the return value of priv->wait_func() in unimac_mdio_addr_c45(). For GENET-instantiated buses, that is bcmgenet_mii_wait():

bcmgenet_mii_wait() {
    ...
	wait_event_timeout(priv->wq,
			   !(bcmgenet_umac_readl(priv, UMAC_MDIO_CMD)
			   & MDIO_START_BUSY),
			   HZ / 100);
	return 0;
}

It returns 0 even when the wait timed out with START_BUSY still set. With HZ=100, HZ / 100 is a single jiffy. That can expire well before a ~25 us MDIO frame completes, and the same happens if the MDIO_DONE interrupt is delayed.

In that case unimac_mdio_addr_c45() reports success while the ADDR frame is still in flight. unimac_mdio_do_read() and unimac_mdio_do_write() then write the RD_C45/WR_C45 command and set START_BUSY again without checking that the controller is idle. Could this corrupt the frame, return data from an incomplete read, or send a C45 write to the wrong register?

bcmgenet_mii_wait() behaves this way independently of this patch. What this patch adds is the dependency of the data cycle on the ADDR cycle. The "if (ret) goto out" after the ADDR cycle can never trigger on GENET buses.

[ ... ]

drivers/net/mdio/mdio-bcm-unimac.c static int unimac_mdio_probe(struct platform_device *pdev) · line 394

Quoted 6 lines
drivers/net/mdio/mdio-bcm-unimac.c +2 -0
@@ -301,6 +390,8 @@ static int unimac_mdio_probe(struct platform_device *pdev)
 	bus->parent = &pdev->dev;
 	bus->read = unimac_mdio_read;
 	bus->write = unimac_mdio_write;
+	bus->read_c45 = unimac_mdio_read_c45;
+	bus->write_c45 = unimac_mdio_write_c45;

[Severity: High]
Can setting read_c45 unconditionally make bus registration fail on the non-DT GENET path?

With read_c45 set, __mdiobus_register() runs mdiobus_scan_bus_c45() on every address that is not masked and has no C22 device. On an empty address, a C45 read sets MDIO_READ_FAIL, and unimac_mdio_do_read() returns -EIO:

	if (!(bus->phy_ignore_ta_mask & 1 << phy_id) && (cmd & MDIO_READ_FAIL)) {
		ret = -EIO;
		goto out;
	}

get_phy_c22_id() converts -EIO to -ENODEV. get_phy_c45_ids() does not:

	phy_reg = get_phy_c45_devs_in_pkg(bus, addr, i, &devs_in_pkg);
	if (phy_reg < 0)
		return -EIO;

mdiobus_scan_bus_c45() then aborts on any error other than -ENODEV:

	if (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV))
		return PTR_ERR(phydev);

On the non-DT GENET path, bcmgenet_mii_register() does:

	if (dn)
		platform_device_set_of_node(ppdev, bcmgenet_mii_of_find_mdio(priv));
	else
		ppd.phy_mask = ~0;

That leaves bus->phy_mask = ~pdata->phy_mask = 0. With np == NULL, of_mdiobus_register() calls __mdiobus_register() directly, so all 32 addresses are scanned.

The C45 scan starts at address 0. With a PHY at address 1, as on ACPI systems such as RPi4 BCM6E4E, the first empty address returns -EIO. __mdiobus_register() then removes the C22 PHYs it already found, and unimac_mdio_probe() fails with "MDIO bus registration failed". The MAC is left without a PHY.

DT-described buses are not affected, because __of_mdiobus_register() forces phy_mask = ~0.

Should C45 read failures on empty addresses be reported as -ENODEV (or 0xffff) instead of -EIO, or should the C45 callbacks be limited to buses where the scan is masked?

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113211554.2058181-1-florian.fainelli%40broadcom.com
author maintainer
#14 lore raw

Re: [PATCH net-next 3/3] net: mdio: mdio-bcm-unimac: Add Clause 45 support

Quoted 215 lines · On 11/17/26 13:39, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider.

Critical: 0 · High: 1 · Medium: 2 · 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).

- [High] This patch sets bus->read_c45 unconditionally.
- [Medium] In the new two-cycle C45 sequence, the only completion check for the ADDR cycle is the return value of priv->wait_func().
- [Medium] MDIO_CFG now has two read-modify-write paths that share no lock.
- [Low] C45 callbacks and the MDIO_CFG clause switch are turned on for every compatible in unimac_mdio_ids: brcm,asp-v3.0/v2.2/v2.1-mdio,…

--

net: mdio: mdio-bcm-unimac: Add Clause 45 support

This commit adds Clause 45 read/write callbacks to the UniMAC MDIO driver. Each C45 access issues an ADDR cycle followed by a READ/WRITE cycle, and MDIO_CFG is switched between C22 and C45 mode as needed. The BMSR workaround read in unimac_mdio_reset() is also skipped for children compatible with "ethernet-phy-ieee802.3-c45".

Quoted 4 lines
drivers/net/mdio/mdio-bcm-unimac.c +0 -0
index df267bb826966..6059b32580c54 100644

[ ... ]

Quoted 1 line
drivers/net/mdio/mdio-bcm-unimac.c +0 -0
@@ -96,7 +102,43 @@ static int unimac_mdio_poll(void *wait_func_data)

[ ... ]

drivers/net/mdio/mdio-bcm-unimac.c static int unimac_mdio_poll(void *wait_func_data) · line 135

Quoted 10 lines
drivers/net/mdio/mdio-bcm-unimac.c +10 -0
+static void unimac_mdio_set_clause(struct unimac_mdio_priv *priv, bool is_c45)
+{
+	u32 cfg = unimac_mdio_readl(priv, MDIO_CFG);
+	u32 new_cfg = cfg;
+
+	if (is_c45)
+		new_cfg &= ~MDIO_C22;
+	else
+		new_cfg |= MDIO_C22;
+

[Severity: Low]
Do all of the IP revisions in unimac_mdio_ids support the MDIO_CFG clause bit and the C45 opcodes (ADDR=0b00, READ=0b11)?

The C45 callbacks and this MDIO_CFG read-modify-write are now enabled for every compatible: brcm,asp-v3.0/v2.2/v2.1-mdio, brcm,bcm6846-mdio, brcm,genet-mdio-v1..v5 and brcm,unimac-mdio. They are also enabled for the non-DT GENET pdata instantiation. Nothing gates this per compatible through match data, and unimac_mdio_set_clause() also runs on every C22 access.

If a revision lacks C45 support, C45 accesses would put undefined frames on the bus. Those accesses can come from the core C45 scan on an unmasked bus or from SIOCGMIIREG with a C45 phy_id.

Could the commit message say whether all of these revisions implement C45?

drivers/net/mdio/mdio-bcm-unimac.c static int unimac_mdio_poll(void *wait_func_data) · line 138

Quoted 3 lines
drivers/net/mdio/mdio-bcm-unimac.c +3 -0
+	if (new_cfg != cfg)
+		unimac_mdio_writel(priv, new_cfg, MDIO_CFG);
+}

[Severity: Medium]
Can this read-modify-write of MDIO_CFG race with unimac_mdio_clk_set()?

unimac_mdio_set_clause() runs under bus->mdio_lock. unimac_mdio_clk_set() writes the same register with no lock held:

unimac_mdio_clk_set() {
     ...
	reg = unimac_mdio_readl(priv, MDIO_CFG);
	reg &= ~(MDIO_CLK_DIV_MASK << MDIO_CLK_DIV_SHIFT);
	reg |= div << MDIO_CLK_DIV_SHIFT;
	unimac_mdio_writel(priv, reg, MDIO_CFG);
     ...
}

It is reached from unimac_mdio_resume() after the bus is registered. Before this patch, bus accesses never wrote MDIO_CFG.

The GENET parent resumes first. bcmgenet_resume() calls phy_start_machine() (or phy_start() through bcmgenet_netif_start()). With mac_managed_pm set, the PHY state machine work can then issue MDIO accesses while the child unimac resume is running clk_set.

Two interleavings look possible:

(a) clk_set reads cfg, set_clause flips MDIO_C22, then clk_set writes back the stale clause bit. The next ADDR and data cycles go out in the wrong framing. For example, a WR_C45 becomes a C22 write of val to register devad.

(b) set_clause reads cfg, clk_set writes the new MDC divider, then set_clause writes back the old divider. The restored MDIO clock frequency is lost until the next resume.

This needs a "clock-frequency" property, otherwise clk_set returns early, plus mixed C22/C45 traffic so that the clause bit actually changes.

[ ... ]

Quoted 10 lines
drivers/net/mdio/mdio-bcm-unimac.c +4 -2
@@ -107,8 +149,19 @@ static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
  		return ret;
 
  	/* Prepare the read operation */
-	cmd = MDIO_RD_C22 | (phy_id << MDIO_PMD_SHIFT) |
-		(reg << MDIO_REG_SHIFT);
+	unimac_mdio_set_clause(priv, is_c45);
+	if (is_c45) {
+		ret = unimac_mdio_addr_c45(priv, phy_id, devad, reg);
+		if (ret)

drivers/net/mdio/mdio-bcm-unimac.c static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg) · line 165

Quoted 10 lines
drivers/net/mdio/mdio-bcm-unimac.c +9 -0
+			goto out;
+
+		cmd = MDIO_RD_C45 | (phy_id << MDIO_PMD_SHIFT) |
+			unimac_mdio_c45_devad(devad) |
+			(reg & MDIO_C45_REG_MASK);
+	} else {
+		cmd = MDIO_RD_C22 | (phy_id << MDIO_PMD_SHIFT) |
+			(reg << MDIO_REG_SHIFT);
+	}
  	unimac_mdio_writel(priv, cmd, MDIO_CMD);

[Severity: Medium]
Is the ADDR cycle guaranteed to have finished before MDIO_CMD is overwritten here?

The only completion check is the return value of priv->wait_func() in unimac_mdio_addr_c45(). For GENET-instantiated buses, that is bcmgenet_mii_wait():

bcmgenet_mii_wait() {
     ...
	wait_event_timeout(priv->wq,
			   !(bcmgenet_umac_readl(priv, UMAC_MDIO_CMD)
			   & MDIO_START_BUSY),
			   HZ / 100);
	return 0;
}

It returns 0 even when the wait timed out with START_BUSY still set. With HZ=100, HZ / 100 is a single jiffy. That can expire well before a ~25 us MDIO frame completes, and the same happens if the MDIO_DONE interrupt is delayed.

In that case unimac_mdio_addr_c45() reports success while the ADDR frame is still in flight. unimac_mdio_do_read() and unimac_mdio_do_write() then write the RD_C45/WR_C45 command and set START_BUSY again without checking that the controller is idle. Could this corrupt the frame, return data from an incomplete read, or send a C45 write to the wrong register?

bcmgenet_mii_wait() behaves this way independently of this patch. What this patch adds is the dependency of the data cycle on the ADDR cycle. The "if (ret) goto out" after the ADDR cycle can never trigger on GENET buses.

[ ... ]

drivers/net/mdio/mdio-bcm-unimac.c static int unimac_mdio_probe(struct platform_device *pdev) · line 394

Quoted 6 lines
drivers/net/mdio/mdio-bcm-unimac.c +2 -0
@@ -301,6 +390,8 @@ static int unimac_mdio_probe(struct platform_device *pdev)
  	bus->parent = &pdev->dev;
  	bus->read = unimac_mdio_read;
  	bus->write = unimac_mdio_write;
+	bus->read_c45 = unimac_mdio_read_c45;
+	bus->write_c45 = unimac_mdio_write_c45;

[Severity: High]
Can setting read_c45 unconditionally make bus registration fail on the non-DT GENET path?

With read_c45 set, __mdiobus_register() runs mdiobus_scan_bus_c45() on every address that is not masked and has no C22 device. On an empty address, a C45 read sets MDIO_READ_FAIL, and unimac_mdio_do_read() returns -EIO:

	if (!(bus->phy_ignore_ta_mask & 1 << phy_id) && (cmd & MDIO_READ_FAIL)) {
		ret = -EIO;
		goto out;
	}

get_phy_c22_id() converts -EIO to -ENODEV. get_phy_c45_ids() does not:

	phy_reg = get_phy_c45_devs_in_pkg(bus, addr, i, &devs_in_pkg);
	if (phy_reg < 0)
		return -EIO;

mdiobus_scan_bus_c45() then aborts on any error other than -ENODEV:

	if (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV))
		return PTR_ERR(phydev);

On the non-DT GENET path, bcmgenet_mii_register() does:

	if (dn)
		platform_device_set_of_node(ppdev, bcmgenet_mii_of_find_mdio(priv));
	else
		ppd.phy_mask = ~0;

That leaves bus->phy_mask = ~pdata->phy_mask = 0. With np == NULL, of_mdiobus_register() calls __mdiobus_register() directly, so all 32 addresses are scanned.

The C45 scan starts at address 0. With a PHY at address 1, as on ACPI systems such as RPi4 BCM6E4E, the first empty address returns -EIO. __mdiobus_register() then removes the C22 PHYs it already found, and unimac_mdio_probe() fails with "MDIO bus registration failed". The MAC is left without a PHY.

Quoted 7 lines

DT-described buses are not affected, because __of_mdiobus_register() forces phy_mask = ~0.

Should C45 read failures on empty addresses be reported as -ENODEV (or 0xffff) instead of -EIO, or should the C45 callbacks be limited to buses where the scan is masked?

The clause bit is present on every GENET v1–v5, ASP and UniMAC block in the RDB (register data base), and that C45 is only functionally validated on the the ASP/GENET and 4908.

Regarding the other findings:

- High (read_c45 set unconditionally): fixed by "[PATCH net-next v2
1/4] net: phy: Map C45 probe read errors to -ENODEV during bus scan" in the v2 posting. It maps C45 probe read errors to -ENODEV, so the empty-address -EIO no longer aborts the scan.

- Medium (ADDR cycle completion): valid. bcmgenet_mii_wait() returns
0 even when wait_event_timeout() expires with START_BUSY still set. I will add an unimac_mdio_poll() call at the end of unimac_mdio_addr_c45(), so the data cycle never starts on a busy controller. The C22 path has the same weakness today, and I left it alone. Making bcmgenet_mii_wait() return -ETIMEDOUT would be a separate GENET patch.

- Medium (MDIO_CFG race): valid, but only in the resume path.
unimac_mdio_resume() now takes bus->mdio_lock around unimac_mdio_clk_set(). I didn't lock inside clk_set itself, because probe calls it before __mdiobus_register() has initialised the mutex.

pw-bot: cr

Signature · 1 line
Florian
Tested-by on the v1 series
#15 lore raw
In reply to Florian Fainelli
Quoted 2 lines · Florian Fainelli

This patch series adds support for Clause 45 MDIO operations within the mdio-bcm-unimac driver.

Tested on a TP-Link Archer AX6000 (BCM4908) with OpenWrt and Linux 6.18.55, with this series in place of our own C45 support. The bus has the switch's internal PHYs, which are C22, and the BCM54991E WAN PHY at address 0x1d, which is C45.

The BCM54991E takes its firmware over C45 and links at 1000 Mbit/s, ethtool -r brings the link back, and the WAN carries traffic. 8000 reads through SIOCGMIIREG gave no errors. Such a read, ioctl included, takes 18 us on average for C45 and 10 us for C22, against 64 and 32 us with the old polling, which starts with a fixed 30 us delay per frame (our C45 code used the same wait).

The PHY's DT node has only its ID compatible; our PHY driver, which is not upstream, switches it to C45 in probe. So the new check in unimac_mdio_reset() never matched, and since the bus is registered from DT, the C45 scan at registration did not run either.