Thread (15 messages) 15 messages, 3 authors, 2025-08-26

Re: [net-next v2 4/4] net: ftgmac100: Add RGMII delay configuration for AST2600

From: Andrew Lunn <andrew@lunn.ch>
Date: 2025-08-15 18:23:29
Also in: linux-arm-kernel, linux-aspeed, linux-devicetree, lkml

On Wed, Aug 13, 2025 at 02:33:01PM +0800, Jacky Chou wrote:
In AST2600, the RGMII delay is configured in SCU register.
The MAC0/1 and the MAC2/3 on AST2600 have different delay unit with
their delay chain.
These MACs all have the 32 stage to configure delay chain.
      |Delay Unit|Delay Stage|TX Edge Stage|RX Edge Stage|
------+----------+-----------+-------------+-------------+
MAC0/1|     45 ps|        32 |           0 |           0 |
------+----------+-----------+-------------+-------------+
MAC2/3|    250 ps|        32 |           0 |          26 |
------+----------+-----------+-------------+-------------+
The RX edge stage of MAC2 and MAC3 are strating from 26.
strating? 
+static void ftgmac100_set_internal_delay(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	struct regmap *scu;
+	u32 rgmii_tx_delay;
+	u32 rgmii_rx_delay;
+	int dly_mask;
+	int dly_reg;
+	int id;
+
+	if (!(of_device_is_compatible(np, "aspeed,ast2600-mac01") ||
+	      of_device_is_compatible(np, "aspeed,ast2600-mac23")))
+		return;
+
+	/* If lack one of them, do not configure anything */
+	if (of_property_read_u32(np, "tx-internal-delay-ps", &rgmii_tx_delay)) {
+		dev_warn(&pdev->dev, "failed to get tx-internal-delay-ps\n");
+		return;
+	}
+	if (of_property_read_u32(np, "rx-internal-delay-ps", &rgmii_rx_delay)) {
+		dev_warn(&pdev->dev, "failed to get tx-internal-delay-ps\n");
+		return;
+	}
If these properties are required, but are missing, the DT blob is
broken. Please return -EINVAL, and fail the probe.

Please make all errors in this function due to a bad DT blob fatal.

	Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help