Skip to contentSkip to conversation

Add Aspeed G7 MDIO support

PATCH In review Jacky Chou 4 participants 16 messages Nov 18, 2024 – Oct 27, 2025

Subsystems (5)
lore
Share & tools
lore

Jacky Chou

author
#0 lore raw

cover Add Aspeed G7 MDIO support

The Aspeed 7th generation SoC features three MDIO controllers. The design of AST2700 MDIO controller is the same as AST2600.

Jacky Chou (3):
dt-bindings: net: add support for AST2700
net: mdio: aspeed: Add support for AST2700
net: mdio: aspeed: Add dummy read for fire control

 .../devicetree/bindings/net/aspeed,ast2600-mdio.yaml      | 4 +++-
 drivers/net/mdio/mdio-aspeed.c                            | 8 ++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 1/3 dt-bindings: net: add support for AST2700

The AST2700 is the 7th generation SoC from Aspeed. Add compatible support for AST2700 in yaml.

---
 .../devicetree/bindings/net/aspeed,ast2600-mdio.yaml          | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/aspeed,ast2600-mdio.yaml +3 -1
index d6ef468495c5..6dadca099875 100644
@@ -19,7 +19,9 @@ allOf:
 
 properties:
   compatible:
-    const: aspeed,ast2600-mdio
+    enum:
+      - aspeed,ast2600-mdio
+      - aspeed,ast2700-mdio
 
   reg:
     maxItems: 1
Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [net-next 1/3] dt-bindings: net: add support for AST2700

Quoted 2 lines · Jacky Chou

The AST2700 is the 7th generation SoC from Aspeed. Add compatible support for AST2700 in yaml.

"Add compatible..." is obvious from the diff. Add something about why the diff is how it is. For example, it is not compatible with AST2600 because...

Quoted 24 lines
---
 .../devicetree/bindings/net/aspeed,ast2600-mdio.yaml          | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/aspeed,ast2600-mdio.yaml +3 -1
index d6ef468495c5..6dadca099875 100644
@@ -19,7 +19,9 @@ allOf:
 
 properties:
   compatible:
-    const: aspeed,ast2600-mdio
+    enum:
+      - aspeed,ast2600-mdio
+      - aspeed,ast2700-mdio
 
   reg:
     maxItems: 1
Signature · 1 line
2.25.1
author
#3 lore raw

回覆: [net-next 1/3] dt-bindings: net: add support for AST2700

Hi Rob,

Thank you for your replay.

Quoted 6 lines
Quoted 2 lines

The AST2700 is the 7th generation SoC from Aspeed. Add compatible support for AST2700 in yaml.

"Add compatible..." is obvious from the diff. Add something about why the diff is how it is. For example, it is not compatible with AST2600 because...

I understand what you mean.
We will continue to use compatible ast2600 in 7th generation.

Thanks,
Jacky

author
#4 lore raw

PATCH 2/3 net: mdio: aspeed: Add support for AST2700

In reply to Jacky Chou

The Aspeed 7th generation SoC features three Aspeed MDIO. The design of AST2700 MDIO controller is the same as AST2600. Therefore, just add AST2700 compatible here.

---
 drivers/net/mdio/mdio-aspeed.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/mdio/mdio-aspeed.c +1 -0
index e55be6dc9ae7..4d5a115baf85 100644
@@ -188,6 +188,7 @@ static void aspeed_mdio_remove(struct platform_device *pdev)
 
 static const struct of_device_id aspeed_mdio_of_match[] = {
 	{ .compatible = "aspeed,ast2600-mdio", },
+	{ .compatible = "aspeed,ast2700-mdio", },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, aspeed_mdio_of_match);
Signature · 1 line
2.25.1
maintainer
#5 lore raw

Re: [net-next 2/3] net: mdio: aspeed: Add support for AST2700

Quoted 3 lines · Jacky Chou

The Aspeed 7th generation SoC features three Aspeed MDIO. The design of AST2700 MDIO controller is the same as AST2600. Therefore, just add AST2700 compatible here.

If they are "the same", you don't need to add the compatible here. You still need to add it to the binding, but make ast2600 a fallback compatible.

Quoted 21 lines
---
 drivers/net/mdio/mdio-aspeed.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/mdio/mdio-aspeed.c +1 -0
index e55be6dc9ae7..4d5a115baf85 100644
@@ -188,6 +188,7 @@ static void aspeed_mdio_remove(struct platform_device *pdev)
 
 static const struct of_device_id aspeed_mdio_of_match[] = {
 	{ .compatible = "aspeed,ast2600-mdio", },
+	{ .compatible = "aspeed,ast2700-mdio", },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, aspeed_mdio_of_match);
Signature · 1 line
2.25.1
author
#6 lore raw

PATCH 3/3 net: mdio: aspeed: Add dummy read for fire control

In reply to Jacky Chou

Add a dummy read to ensure triggering mdio controller before starting polling the status of mdio controller.

---
 drivers/net/mdio/mdio-aspeed.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/mdio/mdio-aspeed.c +2 -0
index 4d5a115baf85..feae30bc3e78 100644
@@ -62,6 +62,8 @@ static int aspeed_mdio_op(struct mii_bus *bus, u8 st, u8 op, u8 phyad, u8 regad,
 		| FIELD_PREP(ASPEED_MDIO_DATA_MIIRDATA, data);
 
 	iowrite32(ctrl, ctx->base + ASPEED_MDIO_CTRL);
+	/* Add dummy read to ensure triggering mdio controller */
+	(void)ioread32(ctx->base + ASPEED_MDIO_CTRL);
 
 	return readl_poll_timeout(ctx->base + ASPEED_MDIO_CTRL, ctrl,
 				!(ctrl & ASPEED_MDIO_CTRL_FIRE),
Signature · 1 line
2.25.1
maintainer
#7 lore raw

Re: [net-next 3/3] net: mdio: aspeed: Add dummy read for fire control

Hi Jacky,

Quoted 16 lines · Jacky Chou

Add a dummy read to ensure triggering mdio controller before starting polling the status of mdio controller.

---
 drivers/net/mdio/mdio-aspeed.c | 2 ++

 1 file changed, 2 insertions(+)
drivers/net/mdio/mdio- renamed from drivers/net/mdio/mdio-aspeed.c +0 -0

aspeed.c
index 4d5a115baf85..feae30bc3e78 100644

drivers/net/mdio/mdio-aspeed.c +0 -0
@@ -62,6 +62,8 @@ static int aspeed_mdio_op(struct mii_bus *bus, u8
 st, u8 op, u8 phyad, u8 regad,
                 | FIELD_PREP(ASPEED_MDIO_DATA_MIIRDATA, data);
Quoted 4 lines


        iowrite32(ctrl, ctx->base + ASPEED_MDIO_CTRL); +       /* Add dummy read to ensure triggering mdio controller */ +       (void)ioread32(ctx->base + ASPEED_MDIO_CTRL);

Why do this when the same register is immediately read by readl_poll_timeout() below?

If there is a reason, I'd like some more explanation in the comment you've added, discussing the details of the problem it's solving when taking into account the readl_poll_timeout() call.

Quoted 3 lines


        return readl_poll_timeout(ctx->base + ASPEED_MDIO_CTRL, ctrl, !(ctrl & ASPEED_MDIO_CTRL_FIRE),

Cheers,

Andrew

maintainer
#8 lore raw

Re: [net-next 3/3] net: mdio: aspeed: Add dummy read for fire control

Quoted 27 lines · Andrew Jeffery

Hi Jacky,

Quoted 16 lines · Jacky Chou

Add a dummy read to ensure triggering mdio controller before starting polling the status of mdio controller.

---
 drivers/net/mdio/mdio-aspeed.c | 2 ++

 1 file changed, 2 insertions(+)
drivers/net/mdio/mdio- renamed from drivers/net/mdio/mdio-aspeed.c +0 -0

aspeed.c
index 4d5a115baf85..feae30bc3e78 100644

drivers/net/mdio/mdio-aspeed.c +0 -0
@@ -62,6 +62,8 @@ static int aspeed_mdio_op(struct mii_bus *bus, u8
 st, u8 op, u8 phyad, u8 regad,
                 | FIELD_PREP(ASPEED_MDIO_DATA_MIIRDATA, data);
Quoted 4 lines


        iowrite32(ctrl, ctx->base + ASPEED_MDIO_CTRL); +       /* Add dummy read to ensure triggering mdio controller */ +       (void)ioread32(ctx->base + ASPEED_MDIO_CTRL);

Why do this when the same register is immediately read by readl_poll_timeout() below?

Quoted 3 lines

If there is a reason, I'd like some more explanation in the comment you've added, discussing the details of the problem it's solving when taking into account the readl_poll_timeout() call.

Also, is this a fix? Should it have a Fixes: tag? If so, it should not be part of this series, assuming the older devices have the same issue.

Andrew

author
#9 lore raw

回覆: [net-next 3/3] net: mdio: aspeed: Add dummy read for fire control

Hi Andrew Lunn,

Thank you for your reply.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

        iowrite32(ctrl, ctx->base + ASPEED_MDIO_CTRL); +       /* Add dummy read to ensure triggering mdio controller */ +       (void)ioread32(ctx->base + ASPEED_MDIO_CTRL);

Why do this when the same register is immediately read by readl_poll_timeout() below?

Quoted 6 lines
Quoted 3 lines

If there is a reason, I'd like some more explanation in the comment you've added, discussing the details of the problem it's solving when taking into account the readl_poll_timeout() call.

Also, is this a fix? Should it have a Fixes: tag? If so, it should not be part of this series, assuming the older devices have the same issue.

Agree.
It may be a fix. The patch is also applied in older device. I will separate from this series and send it to net tree.

Thanks,
Jacky

author
#10 lore raw

回覆: [net-next 3/3] net: mdio: aspeed: Add dummy read for fire control

In reply to Andrew Jeffery

Hi Andrew Jeffery,

Thank you for your reply.

Quoted 11 lines
Quoted 3 lines

        iowrite32(ctrl, ctx->base + ASPEED_MDIO_CTRL); +       /* Add dummy read to ensure triggering mdio controller */ +       (void)ioread32(ctx->base + ASPEED_MDIO_CTRL);

Why do this when the same register is immediately read by readl_poll_timeout() below?

If there is a reason, I'd like some more explanation in the comment you've added, discussing the details of the problem it's solving when taking into account the readl_poll_timeout() call.

Agree.
When the bus is sometimes busy, it may cause the driver is unable to write the register to the MDIO controller immediately. Therefore, add a dummy read to ensure the previous write command has arrived to the MDIO controller before polling MDIO controller status. I will add more details in next version of the commit.

Thanks,
Jacky

maintainer
#11 lore raw
In reply to Jacky Chou
Quoted 2 lines · Jacky Chou

The Aspeed 7th generation SoC features three MDIO controllers. The design of AST2700 MDIO controller is the same as AST2600.

If they are identical, why do you need a new compatible?

Andrew

author
#12 lore raw

Hi Andrew Lunn

Thank you for your reply.

Quoted 4 lines
Quoted 2 lines

The Aspeed 7th generation SoC features three MDIO controllers. The design of AST2700 MDIO controller is the same as AST2600.

If they are identical, why do you need a new compatible?

We want consistent naming in the DTS of the new SoC, even if Its design is the same as the older SoC.

Thanks,
Jacky

maintainer
#13 lore raw
Quoted 11 lines · Jacky Chou

Hi Andrew Lunn

Thank you for your reply.

Quoted 4 lines
Quoted 2 lines

The Aspeed 7th generation SoC features three MDIO controllers. The design of AST2700 MDIO controller is the same as AST2600.

If they are identical, why do you need a new compatible?

We want consistent naming in the DTS of the new SoC, even if Its design is the same as the older SoC.

You might find the DT Maintainers push back against this. What you want is effectively a Marketing game, it has little to do with technology, describing the hardware.

Andrew

author
#14 lore raw
In reply to Andrew Lunn

Hi Andrew,

This is Jacky from ASPEED.
Last year, I submitted a series of patches to add a new compatible string "aspeed,ast2700-mdio". At that time, the feedback I received was that if there were no functional changes, a new compatible string would not be necessary. Recently, we are submitting the AST2700 platform support to the Linux kernel. In the following discussion thread, it appears that the MDIO driver might need a new compatible string for the AST2700 platform:
https://lore.kernel.org/all/[email protected]/
I would like to confirm whether this case should be submitted separately to net-next, and in general, if there are no hardware or design changes, is it still required to introduce a new compatible string? Thank you for your guidance.

Thanks,
Jacky

************* Email Confidentiality Notice ********************
免責聲明:
本信件(或其附件)可能包含機密資訊,並受法律保護。如 台端非指定之收件者,請以電子郵件通知本電子郵件之發送者, 並請立即刪除本電子郵件及其附件和銷毀所有複印件。謝謝您的合作!

DISCLAIMER:
This message (and any attachments) may contain legally privileged and/or other confidential information. If you have received it in error, please notify the sender by reply e-mail and immediately delete the e-mail and any attachments without copying or disclosing the contents. Thank you.

________________________________
寄件者: Andrew Lunn <[email protected]>
寄件日期: 2024年11月19日 上午 09:50
收件者: Jacky Chou <[email protected]>
副本: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]> 主旨: Re: [net-next 0/3] Add Aspeed G7 MDIO support

Quoted 2 lines · Jacky Chou

The Aspeed 7th generation SoC features three MDIO controllers. The design of AST2700 MDIO controller is the same as AST2600.

If they are identical, why do you need a new compatible?

Andrew

maintainer
#15 lore raw
Quoted 13 lines · Jacky Chou

Hi Andrew,

This is Jacky from ASPEED.
Last year, I submitted a series of patches to add a new compatible string "aspeed,ast2700-mdio". At that time, the feedback I received was that if there were no functional changes, a new compatible string would not be necessary. Recently, we are submitting the AST2700 platform support to the Linux kernel. In the following discussion thread, it appears that the MDIO driver might need a new compatible string for the AST2700 platform:
https://lore.kernel.org/all/[email protected]/
I would like to confirm whether this case should be submitted separately to net-next, and in general, if there are no hardware or design changes, is it still required to introduce a new compatible string?

Are you sure it is identical? And are you sure there are no bugs in the driver which would require breaking backwards compatibility, like you are going to be doing for the MAC driver?

Take the reset handling for example. It looks like it was added after basic support for the 2600 has added, so it had to be optional, to not break backwards compatibility with older DT blobs. But since there is no support for the 2700 yet, you could make the reset mandatory, without breaking anything.

How is the clock handled on this hardware? The MDC is currently ticking at 2.5MHz. However many PHYs and MDIO based Ethernet switches will happy run at a faster speed. So you could implemented 'clock-frequency'. But for that, do you need a clock listed? Should that clock be listed now, as a mandatory property for the 2700?

Having a specific compatible and a fallback costs nothing, so i would do it.

Andrew