net: stmmac: eic7700: fix EIC7700 eth1 RX sampling timing
Subsystems (5)
cover net: stmmac: eic7700: fix EIC7700 eth1 RX sampling timing
From: Zhi Li <[email protected]>
This series addresses an RX data sampling timing issue observed on the second Ethernet controller (eth1) of the Eswin EIC7700 SoC.
On the EIC7700 SoC, the hardware introduces a receive clock to data skew on eth1 that is not strictly fixed, but remains within a bounded range under normal operating conditions. At Gigabit speed, this skew causes the receive clock edge to occur later than the corresponding RX data at the MAC input, which can result in incorrect RX data sampling.
The existing internal RX delay mechanisms, including the use of rgmii-id mode and rx-internal-delay-ps adjustment, provide only a limited amount of additional delay on the receive path, which does not offer sufficient adjustment range to compensate for this condition. To address this, the EIC7700 MAC provides an EIC7700-specific clock sampling inversion control, which effectively shifts the sampling edge earlier and restores a valid RX sampling window for Gigabit operation.
In addition, this series updates the enum values of the rx-internal-delay-ps and tx-internal-delay-ps properties in the device tree binding to reflect the actual delay step resolution implemented by the EIC7700 hardware. The hardware applies delay in 20 ps increments, while the previous enum values were based on an incorrect 100 ps per step mapping.
The binding enum values and the driver conversion logic are updated together so that the specified delay in picoseconds maps correctly to the underlying hardware delay steps. This change corrects the DT-to- hardware mapping and does not change the meaning or intended usage of the delay properties.
The first patch updates the device tree binding to describe optional clock sampling inversion control and the required HSP CSR registers.
The second patch updates the EIC7700 DWMAC glue driver to apply the sampling correction at Gigabit speed, clear residual delay settings left by the bootloader, and ensure all register accesses are performed only after clocks are enabled.
These changes restore reliable RX operation on eth1 and ensure the hardware is initialized into a known and consistent state.
Zhi Li (2):
dt-bindings: ethernet: eswin: add clock sampling control
net: stmmac: eic7700: enable clocks before syscon access and correct
RX sampling timing
.../bindings/net/eswin,eic7700-eth.yaml | 57 +++++++- .../ethernet/stmicro/stmmac/dwmac-eic7700.c | 132 +++++++++++++----- 2 files changed, 148 insertions(+), 41 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/2 dt-bindings: ethernet: eswin: add clock sampling control
From: Zhi Li <[email protected]>
The second Ethernet controller (eth1) on the EIC7700 SoC may experience RX data sampling issues at high speed due to EIC7700-specific receive clock to data skew at the MAC input.
Add vendor-specific device tree properties to describe optional receive and transmit clock inversion controls used to compensate for the EIC7700 Ethernet MAC, which may be required to ensure correct RX sampling at high speed.
This binding also updates the enum values of the rx-internal-delay-ps and tx-internal-delay-ps properties to reflect the actual delay step resolution implemented by the EIC7700 hardware. The hardware applies delay in 20 ps increments, while the previous enum values were based on an incorrect mapping. This change corrects the DT-to-hardware mapping without changing the meaning of the delay properties.
In addition, the binding also describes the relevant HSP CSR registers accessed by the MAC. The TXD and RXD delay control registers are included so the driver can explicitly clear any residual configuration left by the bootloader, ensuring the hardware is initialized into a known and deterministic state.
--- .../bindings/net/eswin,eic7700-eth.yaml | 57 +++++++++++++++++-- 1 file changed, 51 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml +51 -6
@@ -63,10 +63,25 @@ properties: - const: stmmaceth rx-internal-delay-ps: - enum: [0, 200, 600, 1200, 1600, 1800, 2000, 2200, 2400] + enum: [0, 20, 60, 100, 200, 400, 800, 1600, 2400] tx-internal-delay-ps: - enum: [0, 200, 600, 1200, 1600, 1800, 2000, 2200, 2400] + enum: [0, 20, 60, 100, 200, 400, 800, 1600, 2400] + + eswin,rx-clk-invert: + description: + Invert the receive clock sampling polarity at the MAC input. + This property may be used to compensate for SoC-specific + receive clock to data skew and help ensure correct RX data + sampling at high speed. + type: boolean + + eswin,tx-clk-invert: + description: + Invert the transmit clock polarity driven by the MAC. + This property provides SoC-specific transmit clock control + when required by the platform. + type: boolean eswin,hsp-sp-csr: description:
@@ -81,7 +96,9 @@ properties: or external clock selection - description: Offset of AXI clock controller Low-Power request register + - description: Offset of register controlling TXD delay - description: Offset of register controlling TX/RX clock delay + - description: Offset of register controlling RXD delay required: - compatible
@@ -111,17 +128,45 @@ examples: interrupts = <61>; interrupt-names = "macirq"; phy-mode = "rgmii-id"; - phy-handle = <&phy0>; + phy-handle = <&gmac0_phy0>; resets = <&reset 95>; reset-names = "stmmaceth"; + rx-internal-delay-ps = <20>; + tx-internal-delay-ps = <100>; + eswin,hsp-sp-csr = <&hsp_sp_csr 0x100 0x108 0x114 0x118 0x11c>; + snps,axi-config = <&stmmac_axi_setup_gmac0>; + snps,aal; + snps,fixed-burst; + snps,tso; + stmmac_axi_setup_gmac0: stmmac-axi-config { + snps,blen = <0 0 0 0 16 8 4>; + snps,rd_osr_lmt = <2>; + snps,wr_osr_lmt = <2>; + }; + }; + + ethernet@50410000 { + compatible = "eswin,eic7700-qos-eth", "snps,dwmac-5.20"; + reg = <0x50410000 0x10000>; + clocks = <&d0_clock 186>, <&d0_clock 171>, <&d0_clock 40>, + <&d0_clock 194>; + clock-names = "axi", "cfg", "stmmaceth", "tx"; + interrupt-parent = <&plic>; + interrupts = <70>; + interrupt-names = "macirq"; + phy-mode = "rgmii-rxid"; + phy-handle = <&gmac1_phy0>; + resets = <&reset 94>; + reset-names = "stmmaceth"; rx-internal-delay-ps = <200>; tx-internal-delay-ps = <200>; - eswin,hsp-sp-csr = <&hsp_sp_csr 0x100 0x108 0x118>; - snps,axi-config = <&stmmac_axi_setup>; + eswin,rx-clk-invert; + eswin,hsp-sp-csr = <&hsp_sp_csr 0x200 0x208 0x214 0x218 0x21c>; + snps,axi-config = <&stmmac_axi_setup_gmac1>; snps,aal; snps,fixed-burst; snps,tso; - stmmac_axi_setup: stmmac-axi-config { + stmmac_axi_setup_gmac1: stmmac-axi-config { snps,blen = <0 0 0 0 16 8 4>; snps,rd_osr_lmt = <2>; snps,wr_osr_lmt = <2>;
Signature · 1 line
2.25.1
PATCH 2/2 net: stmmac: eic7700: enable clocks before syscon access and correct RX sampling timing
In reply to [email protected]From: Zhi Li <[email protected]>
The second Ethernet controller (eth1) on the Eswin EIC7700 SoC may fail to sample RX data correctly at Gigabit speed due to EIC7700-specific receive clock to data skew at the MAC input.
The existing internal delay configuration does not provide sufficient adjustment range to compensate for this condition. Update the EIC7700 DWMAC glue driver to optionally apply EIC7700-specific clock sampling inversion for Gigabit operation.
TXD and RXD delay registers are explicitly cleared during initialization to override any residual configuration left by the bootloader. All HSP CSR register accesses are performed only after the required clocks are enabled.
--- .../ethernet/stmicro/stmmac/dwmac-eic7700.c | 132 +++++++++++++----- 1 file changed, 97 insertions(+), 35 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c +97 -35
@@ -28,20 +28,34 @@/* * TX/RX Clock Delay Bit Masks: -* - TX Delay: bits [14:8] — TX_CLK delay (unit: 0.1ns per bit) -* - RX Delay: bits [30:24] — RX_CLK delay (unit: 0.1ns per bit) +* - TX Delay: bits [14:8] — TX_CLK delay (unit: 0.02ns per bit) +* - TX Invert : bit [15] +* - RX Delay: bits [30:24] — RX_CLK delay (unit: 0.02ns per bit) +* - RX Invert : bit [31] */ #define EIC7700_ETH_TX_ADJ_DELAY GENMASK(14, 8)#define EIC7700_ETH_RX_ADJ_DELAY GENMASK(30, 24) +#define EIC7700_ETH_TX_INV_DELAY BIT(15) +#define EIC7700_ETH_RX_INV_DELAY BIT(31) -#define EIC7700_MAX_DELAY_UNIT 0x7F +#define EIC7700_MAX_DELAY_STEPS 0x7Fstatic const char *const eic7700_clk_names[] = {"tx" ,"axi" ,"cfg" , };struct eic7700_qos_priv { +struct device *dev;struct plat_stmmacenet_data *plat_dat; +struct regmap *eic7700_hsp_regmap; +u32 eth_axi_lp_ctrl_offset; +u32 eth_phy_ctrl_offset; +u32 eth_txd_offset; +u32 eth_clk_offset; +u32 eth_rxd_offset; +u32 eth_clk_dly_param; +bool eth_tx_clk_inv; +bool eth_rx_clk_inv; };static int eic7700_clks_config (void *priv,bool enabled)
@@ -61,8 +75,27 @@ static int eic7700_clks_config(void *priv, bool enabled)static int eic7700_dwmac_init (struct device *dev,void *priv) {struct eic7700_qos_priv *dwc = priv; +u32 eth_phy_ctrl_regset; +int ret =0 ; -return eic7700_clks_config (dwc, true); + ret =eic7700_clks_config (dwc, true); +if (ret) +return ret; + +regmap_read (dwc->eic7700_hsp_regmap, dwc->eth_phy_ctrl_offset, + ð_phy_ctrl_regset); + eth_phy_ctrl_regset |= + (EIC7700_ETH_TX_CLK_SEL |EIC7700_ETH_PHY_INTF_SELI ); +regmap_write (dwc->eic7700_hsp_regmap, dwc->eth_phy_ctrl_offset, + eth_phy_ctrl_regset); + +regmap_write (dwc->eic7700_hsp_regmap, dwc->eth_axi_lp_ctrl_offset, +EIC7700_ETH_CSYSREQ_VAL ); + +regmap_write (dwc->eic7700_hsp_regmap, dwc->eth_txd_offset,0 ); +regmap_write (dwc->eic7700_hsp_regmap, dwc->eth_rxd_offset,0 ); + +return ret; }static void eic7700_dwmac_exit (struct device *dev,void *priv)
@@ -88,17 +121,34 @@ static int eic7700_dwmac_resume(struct device *dev, void *priv)return ret; } +static void eic7700_dwmac_fix_speed (void *priv,int speed,unsigned int mode) +{ +struct eic7700_qos_priv *dwc = (struct eic7700_qos_priv *)priv; +u32 dly_param = dwc->eth_clk_dly_param; + +switch (speed) { +case SPEED_1000 : +if (dwc->eth_tx_clk_inv) + dly_param |=EIC7700_ETH_TX_INV_DELAY ; +if (dwc->eth_rx_clk_inv) + dly_param |=EIC7700_ETH_RX_INV_DELAY ; +break ; +case SPEED_100 : +case SPEED_10 : +break ; +default : +dev_err (dwc->dev,"invalid speed %u\n" , speed); +break ; + } + +regmap_write (dwc->eic7700_hsp_regmap, dwc->eth_clk_offset, dly_param); +} +static int eic7700_dwmac_probe (struct platform_device *pdev) {struct plat_stmmacenet_data *plat_dat;struct stmmac_resources stmmac_res;struct eic7700_qos_priv *dwc_priv; -struct regmap *eic7700_hsp_regmap; -u32 eth_axi_lp_ctrl_offset; -u32 eth_phy_ctrl_offset; -u32 eth_phy_ctrl_regset; -u32 eth_rxd_dly_offset; -u32 eth_dly_param =0 ;u32 delay_ps;int i, ret;
@@ -116,13 +166,16 @@ static int eic7700_dwmac_probe(struct platform_device *pdev)if (!dwc_priv)return -ENOMEM ; + dwc_priv->dev = &pdev->dev; +/* Read rx-internal-delay-ps and update rx_clk delay */ if (!of_property_read_u32 (pdev->dev.of_node,"rx-internal-delay-ps" , &delay_ps)) { -u32 val =min (delay_ps /100 ,EIC7700_MAX_DELAY_UNIT ); +u32 val =min (delay_ps /20 ,EIC7700_MAX_DELAY_STEPS ); - eth_dly_param &= ~EIC7700_ETH_RX_ADJ_DELAY ; - eth_dly_param |=FIELD_PREP (EIC7700_ETH_RX_ADJ_DELAY , val); + dwc_priv->eth_clk_dly_param &= ~EIC7700_ETH_RX_ADJ_DELAY ; + dwc_priv->eth_clk_dly_param |= +FIELD_PREP (EIC7700_ETH_RX_ADJ_DELAY , val); }else {return dev_err_probe (&pdev->dev, -EINVAL ,"missing required property rx-internal-delay-ps\n" );
@@ -131,55 +184,63 @@ static int eic7700_dwmac_probe(struct platform_device *pdev)/* Read tx-internal-delay-ps and update tx_clk delay */ if (!of_property_read_u32 (pdev->dev.of_node,"tx-internal-delay-ps" , &delay_ps)) { -u32 val =min (delay_ps /100 ,EIC7700_MAX_DELAY_UNIT ); +u32 val =min (delay_ps /20 ,EIC7700_MAX_DELAY_STEPS ); - eth_dly_param &= ~EIC7700_ETH_TX_ADJ_DELAY ; - eth_dly_param |=FIELD_PREP (EIC7700_ETH_TX_ADJ_DELAY , val); + dwc_priv->eth_clk_dly_param &= ~EIC7700_ETH_TX_ADJ_DELAY ; + dwc_priv->eth_clk_dly_param |= +FIELD_PREP (EIC7700_ETH_TX_ADJ_DELAY , val); }else {return dev_err_probe (&pdev->dev, -EINVAL ,"missing required property tx-internal-delay-ps\n" ); } - eic7700_hsp_regmap =syscon_regmap_lookup_by_phandle (pdev->dev.of_node, -"eswin,hsp-sp-csr" ); -if (IS_ERR (eic7700_hsp_regmap)) + dwc_priv->eth_tx_clk_inv = +of_property_read_bool (pdev->dev.of_node,"eswin,tx-clk-invert" ); + dwc_priv->eth_rx_clk_inv = +of_property_read_bool (pdev->dev.of_node,"eswin,rx-clk-invert" ); + + dwc_priv->eic7700_hsp_regmap = +syscon_regmap_lookup_by_phandle (pdev->dev.of_node, +"eswin,hsp-sp-csr" ); +if (IS_ERR (dwc_priv->eic7700_hsp_regmap))return dev_err_probe (&pdev->dev, -PTR_ERR (eic7700_hsp_regmap), +PTR_ERR (dwc_priv->eic7700_hsp_regmap),"Failed to get hsp-sp-csr regmap\n" ); ret =of_property_read_u32_index (pdev->dev.of_node,"eswin,hsp-sp-csr" , -1 , ð_phy_ctrl_offset); +1 , &dwc_priv->eth_phy_ctrl_offset);if (ret)return dev_err_probe (&pdev->dev, ret,"can't get eth_phy_ctrl_offset\n" ); -regmap_read (eic7700_hsp_regmap, eth_phy_ctrl_offset, - ð_phy_ctrl_regset); - eth_phy_ctrl_regset |= - (EIC7700_ETH_TX_CLK_SEL |EIC7700_ETH_PHY_INTF_SELI ); -regmap_write (eic7700_hsp_regmap, eth_phy_ctrl_offset, - eth_phy_ctrl_regset); - ret =of_property_read_u32_index (pdev->dev.of_node,"eswin,hsp-sp-csr" , -2 , ð_axi_lp_ctrl_offset); +2 , &dwc_priv->eth_axi_lp_ctrl_offset);if (ret)return dev_err_probe (&pdev->dev, ret,"can't get eth_axi_lp_ctrl_offset\n" ); -regmap_write (eic7700_hsp_regmap, eth_axi_lp_ctrl_offset, -EIC7700_ETH_CSYSREQ_VAL ); + ret =of_property_read_u32_index (pdev->dev.of_node, +"eswin,hsp-sp-csr" , +3 , &dwc_priv->eth_txd_offset); +if (ret) +return dev_err_probe (&pdev->dev, ret, +"can't get eth_txd_offset\n" ); ret =of_property_read_u32_index (pdev->dev.of_node,"eswin,hsp-sp-csr" , -3 , ð_rxd_dly_offset); +4 , &dwc_priv->eth_clk_offset);if (ret)return dev_err_probe (&pdev->dev, ret, -"can't get eth_rxd_dly_offset\n" ); +"can't get eth_clk_offset\n" ); -regmap_write (eic7700_hsp_regmap, eth_rxd_dly_offset, - eth_dly_param); + ret =of_property_read_u32_index (pdev->dev.of_node, +"eswin,hsp-sp-csr" , +5 , &dwc_priv->eth_rxd_offset); +if (ret) +return dev_err_probe (&pdev->dev, ret, +"can't get eth_rxd_offset\n" ); plat_dat->num_clks =ARRAY_SIZE (eic7700_clk_names); plat_dat->clks = devm_kcalloc(&pdev->dev,
@@ -208,6 +269,7 @@ static int eic7700_dwmac_probe(struct platform_device *pdev) plat_dat->exit = eic7700_dwmac_exit; plat_dat->suspend = eic7700_dwmac_suspend; plat_dat->resume = eic7700_dwmac_resume; + plat_dat->fix_mac_speed = eic7700_dwmac_fix_speed;return devm_stmmac_pltfr_probe (pdev, plat_dat, &stmmac_res); }
Signature · 1 line
2.25.1
Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
In reply to [email protected]Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml properties: · line 69
Quoted 7 lines
rx-internal-delay-ps:
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml +2
-2- enum: [0, 200, 600, 1200, 1600, 1800, 2000, 2200, 2400] + enum: [0, 20, 60, 100, 200, 400, 800, 1600, 2400] tx-internal-delay-ps: - enum: [0, 200, 600, 1200, 1600, 1800, 2000, 2200, 2400] + enum: [0, 20, 60, 100, 200, 400, 800, 1600, 2400]
You need to add some text to the Changelog to indicate why this is safe to do, and will not cause any regressions for DT blobs already in use. Backwards compatibility is very important and needs to be addressed.
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml properties: · line 77
Quoted 7 lines
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml +7
-0+ eswin,rx-clk-invert: + description: + Invert the receive clock sampling polarity at the MAC input. + This property may be used to compensate for SoC-specific + receive clock to data skew and help ensure correct RX data + sampling at high speed. + type: boolean
This does not make too much sense to me. The RGMII standard indicates sampling happens on both edges of the clock. The rising edge is for the lower 4 bits, the falling edge for the upper 4 bits. Flipping the polarity would only swap the nibbles around.
Andrew
Re: [PATCH v1 2/2] net: stmmac: eic7700: enable clocks before syscon access and correct RX sampling timing
In reply to [email protected]drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c static int eic7700_dwmac_probe(struct platform_device *pdev) · line 208
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c +5
-1+ dwc_priv->eic7700_hsp_regmap = +syscon_regmap_lookup_by_phandle (pdev->dev.of_node, +"eswin,hsp-sp-csr" ); +if (IS_ERR (dwc_priv->eic7700_hsp_regmap))return dev_err_probe (&pdev->dev, -PTR_ERR (eic7700_hsp_regmap), +PTR_ERR (dwc_priv->eic7700_hsp_regmap),"Failed to get hsp-sp-csr regmap\n" );
In order to be backwards compatible, you cannot error out here, because old DT blobs won't have this property.
Andrew
Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
In reply to Andrew LunnQuoted 21 lines · Andrew Lunn
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml properties: · line 69
Quoted 7 lines
rx-internal-delay-ps:
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml +2
-2- enum: [0, 200, 600, 1200, 1600, 1800, 2000, 2200, 2400] + enum: [0, 20, 60, 100, 200, 400, 800, 1600, 2400] tx-internal-delay-ps: - enum: [0, 200, 600, 1200, 1600, 1800, 2000, 2200, 2400] + enum: [0, 20, 60, 100, 200, 400, 800, 1600, 2400]You need to add some text to the Changelog to indicate why this is safe to do, and will not cause any regressions for DT blobs already in use. Backwards compatibility is very important and needs to be addressed.
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml properties: · line 77
Quoted 7 lines
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml +7
-0+ eswin,rx-clk-invert: + description: + Invert the receive clock sampling polarity at the MAC input. + This property may be used to compensate for SoC-specific + receive clock to data skew and help ensure correct RX data + sampling at high speed. + type: boolean
Quoted 4 lines
This does not make too much sense to me. The RGMII standard indicates sampling happens on both edges of the clock. The rising edge is for the lower 4 bits, the falling edge for the upper 4 bits. Flipping the polarity would only swap the nibbles around.
I'm going to ask a rather pertinent question. Why do we have this eswin stuff in the kernel tree?
I've just been looking to see whether I can understand more about this, and although I've discovered the TRM is available for the EIC7700:
https://github.com/eswincomputing/EIC7700X-SoC-Technical-Reference-Manual/releases
that isn't particularly helpful on its own.
There doesn't appear to be any device tree source files that describe the hardware. The DT bindings that I can find seem to describe only ethernet and USB. describe the ethernet and USB, and maybe sdhci.
I was looking for something that would lead me to what this eswin,hsp-sp-csr thing is, but that doesn't seem to exist in our DT binding documentation, nor does greping for "hsp.sp.csr" in arch/*/boot/dts find anything.
So, we can't know what this "hsp" thing is to even know where to look in the 80MiB of PDF documentation.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Quoted 41 lines · Russell King (Oracle)
Quoted 21 lines · Andrew Lunn
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml properties: · line 69
Quoted 7 lines
rx-internal-delay-ps:
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml +2
-2- enum: [0, 200, 600, 1200, 1600, 1800, 2000, 2200, 2400] + enum: [0, 20, 60, 100, 200, 400, 800, 1600, 2400] tx-internal-delay-ps: - enum: [0, 200, 600, 1200, 1600, 1800, 2000, 2200, 2400] + enum: [0, 20, 60, 100, 200, 400, 800, 1600, 2400]You need to add some text to the Changelog to indicate why this is safe to do, and will not cause any regressions for DT blobs already in use. Backwards compatibility is very important and needs to be addressed.
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml properties: · line 77
Quoted 7 lines
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml +7
-0+ eswin,rx-clk-invert: + description: + Invert the receive clock sampling polarity at the MAC input. + This property may be used to compensate for SoC-specific + receive clock to data skew and help ensure correct RX data + sampling at high speed. + type: booleanQuoted 4 lines
This does not make too much sense to me. The RGMII standard indicates sampling happens on both edges of the clock. The rising edge is for the lower 4 bits, the falling edge for the upper 4 bits. Flipping the polarity would only swap the nibbles around.
I'm going to ask a rather pertinent question. Why do we have this eswin stuff in the kernel tree?
I've just been looking to see whether I can understand more about this, and although I've discovered the TRM is available for the EIC7700:
https://github.com/eswincomputing/EIC7700X-SoC-Technical-Reference-Manual/releases
that isn't particularly helpful on its own.
There doesn't appear to be any device tree source files that describe the hardware. The DT bindings that I can find seem to describe only ethernet and USB. describe the ethernet and USB, and maybe sdhci.
Quoted 8 lines
I was looking for something that would lead me to what this eswin,hsp-sp-csr thing is, but that doesn't seem to exist in our DT binding documentation, nor does greping for "hsp.sp.csr" in
arch/*/boot/dtsfind anything.So, we can't know what this "hsp" thing is to even know where to look in the 80MiB of PDF documentation.
HSP -> High-Speed Peripheral. eswin,hsp-sp-csr is mentioned in
Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml Documentation/devicetree/bindings/usb/eswin,eic7700-usb.yaml
From ESWIN's vendor/testing kernel tree:
hsp_sp_csr: hsp-sp-top-csr@0x50440000 {
compatible = "syscon";
#size-cells = <2>;
reg = <0x0 0x50440000 0x0 0x2000>;
};
Apparently it's just a register block that controls varies behaviors of high speed peripherals. I'm not sure if DT bindings mandates it, but it's undocumented in the TRM. Perhaps ESWIN should properly document it going forward? Also, I think ESWIN needs to check-in the sdhci/eth/usb device- tree components ASAP, so folks can test it.
Bo
Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
In reply to Andrew LunnQuoted 14 lines
-----原始邮件-----
发件人: "Andrew Lunn" <[email protected]>
发送时间:2026-01-10 02:27:54 (星期六)
收件人: [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: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling controlQuoted 4 lines
rx-internal-delay-ps:
(quoted diff) +1
-1- enum: [0, 200, 600, 1200, 1600, 1800, 2000, 2200, 2400] + enum: [0, 20, 60, 100, 200, 400, 800, 1600, 2400]
Quoted 9 lines
Review
Quoted 3 lines
tx-internal-delay-ps:
(quoted diff) +1
-1- enum: [0, 200, 600, 1200, 1600, 1800, 2000, 2200, 2400] + enum: [0, 20, 60, 100, 200, 400, 800, 1600, 2400]You need to add some text to the Changelog to indicate why this is safe to do, and will not cause any regressions for DT blobs already in use. Backwards compatibility is very important and needs to be addressed.
Thanks for the review.
Understood. Our understanding is that changing the allowed values of rx-internal-delay-ps / tx-internal-delay-ps needs to be explicitly justified as DT ABI safe.
For v2, we are planning to replace the enum with a min/max constraint. These properties carry literal delay values in picoseconds, and all previously valid values will remain valid and retain the same meaning. Existing DT blobs will therefore continue to work unchanged.
We will also add explicit text to the commit message explaining why this change is DT ABI safe and why no regressions are expected.
Quoted 8 lines
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml properties: · line 77
Quoted 7 lines
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml +7
-0+ eswin,rx-clk-invert: + description: + Invert the receive clock sampling polarity at the MAC input. + This property may be used to compensate for SoC-specific + receive clock to data skew and help ensure correct RX data + sampling at high speed. + type: boolean
Quoted 5 lines
This does not make too much sense to me. The RGMII standard indicates sampling happens on both edges of the clock. The rising edge is for the lower 4 bits, the falling edge for the upper 4 bits. Flipping the polarity would only swap the nibbles around.
You are correct about the RGMII specification. The intent of eswin,rx-clk-invert is not to change the RGMII sampling rule, but to compensate for SoC-internal RXC-to-RXD skew and restore the correct sampling relationship at the MAC input.
On EIC7700, RXC and RXD experience an internal skew before reaching the MAC. At high speed, this can shift the effective sampling point by approximately half a cycle, causing the MAC to sample the wrong nibble on each edge.
Conceptually, the situations are as follows.
RGMII-specified behavior (correct):
RXC: __/‾‾\__/‾‾\__
↑ ↓
| |
| |
| +--------- sample RXD[4:7]
+------------ sample RXD[0:3]SoC-internal skew causing incorrect sampling (without invert):
RXC: __/‾‾\__/‾‾\__
↑ ↓
| |
| |
| +--------- sample RXD[0:3] (wrong)
+------------ sample RXD[4:7] (wrong)After enabling internal RX clock invert:
RXC: __/‾‾\__/‾‾\__
↑ ↓
| |
| |
| +--------- sample RXD[4:7] (correct)
+------------ sample RXD[0:3] (correct)The invert control restores sampling of RXD[0:3] on the rising edge and RXD[4:7] on the falling edge, exactly as defined by the RGMII specification. No protocol-level behavior or edge assignment is changed.
Thanks,
Li Zhi
Re: Re: [PATCH v1 2/2] net: stmmac: eic7700: enable clocks before syscon access and correct RX sampling timing
In reply to Andrew LunnQuoted 10 lines
-----原始邮件-----
发件人: "Andrew Lunn" <[email protected]>
发送时间:2026-01-10 02:31:09 (星期六)
收件人: [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: [PATCH v1 2/2] net: stmmac: eic7700: enable clocks before syscon access and correct RX sampling timing
Quoted 12 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c static int eic7700_dwmac_probe(struct platform_device *pdev) · line 208
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c +5
-1+ dwc_priv->eic7700_hsp_regmap = +syscon_regmap_lookup_by_phandle (pdev->dev.of_node, +"eswin,hsp-sp-csr" ); +if (IS_ERR (dwc_priv->eic7700_hsp_regmap))return dev_err_probe (&pdev->dev, -PTR_ERR (eic7700_hsp_regmap), +PTR_ERR (dwc_priv->eic7700_hsp_regmap),"Failed to get hsp-sp-csr regmap\n" );In order to be backwards compatible, you cannot error out here, because old DT blobs won't have this property.
Thanks for the review.
We would like to clarify our understanding before changing the behavior.
'eswin,hsp-sp-csr' has been documented as a required property since the initial EIC7700 DWMAC binding, and the existing driver already relies on it for RX/TX clock delay programming. From our understanding, this property is fundamental to correct MAC clock configuration on EIC7700, rather than an optional enhancement.
Given this, could you please clarify whether we should still treat eswin,hsp-sp-csr as optional at runtime purely for DT ABI robustness, even though it is required by the binding and hardware design?
Once confirmed, we will update the driver and binding accordingly.
Thanks,
Li Zhi
Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
In reply to Bo GanQuoted 75 lines
-----原始邮件-----
发件人: "Bo Gan" <[email protected]>
发送时间:2026-01-11 12:05:31 (星期日)
收件人: "Russell King (Oracle)" <[email protected]>, "Andrew Lunn" <[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: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling controlQuoted 41 lines · Russell King (Oracle)
Quoted 21 lines · Andrew Lunn
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml properties: · line 69
Quoted 7 lines
rx-internal-delay-ps:
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml +2
-2- enum: [0, 200, 600, 1200, 1600, 1800, 2000, 2200, 2400] + enum: [0, 20, 60, 100, 200, 400, 800, 1600, 2400] tx-internal-delay-ps: - enum: [0, 200, 600, 1200, 1600, 1800, 2000, 2200, 2400] + enum: [0, 20, 60, 100, 200, 400, 800, 1600, 2400]You need to add some text to the Changelog to indicate why this is safe to do, and will not cause any regressions for DT blobs already in use. Backwards compatibility is very important and needs to be addressed.
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml properties: · line 77
Quoted 7 lines
Documentation/devicetree/bindings/net/eswin,eic7700-eth.yaml +7
-0+ eswin,rx-clk-invert: + description: + Invert the receive clock sampling polarity at the MAC input. + This property may be used to compensate for SoC-specific + receive clock to data skew and help ensure correct RX data + sampling at high speed. + type: booleanQuoted 4 lines
This does not make too much sense to me. The RGMII standard indicates sampling happens on both edges of the clock. The rising edge is for the lower 4 bits, the falling edge for the upper 4 bits. Flipping the polarity would only swap the nibbles around.
I'm going to ask a rather pertinent question. Why do we have this eswin stuff in the kernel tree?
I've just been looking to see whether I can understand more about this, and although I've discovered the TRM is available for the EIC7700:
https://github.com/eswincomputing/EIC7700X-SoC-Technical-Reference-Manual/releases
that isn't particularly helpful on its own.
There doesn't appear to be any device tree source files that describe the hardware. The DT bindings that I can find seem to describe only ethernet and USB. describe the ethernet and USB, and maybe sdhci.
Quoted 8 lines
I was looking for something that would lead me to what this eswin,hsp-sp-csr thing is, but that doesn't seem to exist in our DT binding documentation, nor does greping for "hsp.sp.csr" in
arch/*/boot/dtsfind anything.So, we can't know what this "hsp" thing is to even know where to look in the 80MiB of PDF documentation.
HSP -> High-Speed Peripheral. eswin,hsp-sp-csr is mentioned in
Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yamlDocumentation/devicetree/bindings/net/eswin,eic7700-eth.yamlDocumentation/devicetree/bindings/usb/eswin,eic7700-usb.yamlFrom ESWIN's vendor/testing kernel tree:
hsp_sp_csr: hsp-sp-top-csr@0x50440000 { compatible = "syscon"; #size-cells = <2>; reg = <0x0 0x50440000 0x0 0x2000>; };
Quoted 6 lines
Apparently it's just a register block that controls varies behaviors of high speed peripherals. I'm not sure if DT bindings mandates it, but it's undocumented in the TRM. Perhaps ESWIN should properly document it going forward? Also, I think ESWIN needs to check-in the sdhci/eth/usb device- tree components ASAP, so folks can test it.
Yes, that’s correct. hsp-sp-csr is a shared register block used to control various high-speed peripherals (Ethernet, USB, SDHCI) on EIC7700.
This block is currently not well documented in the public TRM. We acknowledge this gap and plan to improve it by adding proper documentation. We also intend to upstream complete DTS files for EIC7700 so the bindings can be validated against real hardware.
Thanks for raising this concern.
Li Zhi
Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Quoted 3 lines
We also intend
to upstream complete DTS files for EIC7700 so the bindings can be validated against real hardware.
I suggest you prioritise this. ARM-SOC is pretty flexible for accepting work in progress support for new SoCs. All you really need is for the board to boot to a login prompt on a serial port using an initramsfs. So the .dtsi and .dts file can be very slim, CPUs, memory and UARTs.
Once you have that merged you can work on the other drivers, their bindings, etc.
As Russell pointed out, at the moment, most of the code you have in the kernel is unusable, so it is a candidate for being thrown out.
Andrew
Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
In reply to 李志Quoted 4 lines
On EIC7700, RXC and RXD experience an internal skew before reaching the MAC. At high speed, this can shift the effective sampling point by approximately half a cycle, causing the MAC to sample the wrong nibble on each edge.
You say internal. So the skew is fixed, it is a property of the silicon? If so, why a DT property? Why not just hard code it in the driver? Since it is internal, different boards should not need it set differently?
Andrew
Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
In reply to Andrew LunnQuoted 10 lines · Andrew Lunn
Quoted 3 lines
We also intend
to upstream complete DTS files for EIC7700 so the bindings can be validated against real hardware.I suggest you prioritise this. ARM-SOC is pretty flexible for accepting work in progress support for new SoCs. All you really need is for the board to boot to a login prompt on a serial port using an initramsfs. So the .dtsi and .dts file can be very slim, CPUs, memory and UARTs.
Quoted 5 lines
Once you have that merged you can work on the other drivers, their bindings, etc.
As Russell pointed out, at the moment, most of the code you have in the kernel is unusable, so it is a candidate for being thrown out.
Indeed, and we've had drivers merged before for platforms that never made it in, and they just hang around for decades, adding to the maintainer's burden for no benefit what so ever.
So please, no more drivers for EIC7700 until there is functional support for the platform, as Andrew states.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Re: Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
In reply to Andrew LunnQuoted 15 lines
-----原始邮件-----
发件人: "Andrew Lunn" <[email protected]>
发送时间:2026-01-22 21:32:34 (星期四)
收件人: 李志 <[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: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling controlQuoted 4 lines
On EIC7700, RXC and RXD experience an internal skew before reaching the MAC. At high speed, this can shift the effective sampling point by approximately half a cycle, causing the MAC to sample the wrong nibble on each edge.
Quoted 5 lines
You say internal. So the skew is fixed, it is a property of the silicon? If so, why a DT property? Why not just hard code it in the driver? Since it is internal, different boards should not need it set differently?
Thanks for the question.
EIC7700 has two Ethernet MACs. Only eth1 has this internal RXC/RXD skew, eth0 does not.
So this is not a chip-wide constant that can be hardcoded in the driver. We need a way to distinguish the two MAC instances, which is why this is described per-port in DTS.
--
Li Zhi
Re: Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Quoted 5 lines
Quoted 5 lines
You say internal. So the skew is fixed, it is a property of the silicon? If so, why a DT property? Why not just hard code it in the driver? Since it is internal, different boards should not need it set differently?
Quoted 8 lines
Thanks for the question.
EIC7700 has two Ethernet MACs. Only eth1 has this internal RXC/RXD skew, eth0 does not.
So this is not a chip-wide constant that can be hardcoded in the driver. We need a way to distinguish the two MAC instances, which is why this is described per-port in DTS.
I assume the address of the interface is fixed. So you can just key off that to distinguish the two instances.
Since this is an internal property, not a board property, it is not clear it actually belongs on DT.
Andrew
Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Hi Andrew,
Quoted 14 lines · Andrew Lunn
Quoted 5 lines
Quoted 5 lines
You say internal. So the skew is fixed, it is a property of the silicon? If so, why a DT property? Why not just hard code it in the driver? Since it is internal, different boards should not need it set differently?
Quoted 8 lines
Thanks for the question.
EIC7700 has two Ethernet MACs. Only eth1 has this internal RXC/RXD skew, eth0 does not.
So this is not a chip-wide constant that can be hardcoded in the driver. We need a way to distinguish the two MAC instances, which is why this is described per-port in DTS.
Quoted 7 lines
I assume the address of the interface is fixed. So you can just key off that to distinguish the two instances.
Since this is an internal property, not a board property, it is not clear it actually belongs on DT.
Andrew
IMO, they should be in DT to provide maximum flexibility. The SoC .dtsi can provide some sane defaults, and the board vendor can later override them if the mac/phy requires further tuning. Applying such tuning by the address of MAC seems messy and it hides the parameters used behind driver. Through DT, everything becomes really clear.
I assume this is not uncommon: E.g., starfive/jh7110:
https://lore.kernel.org/all/[email protected]/
BTW, no need to worry about backward compat. ESWIN hasn't checked-in any DT for eth yet. As you and Russell said, they need to do it, pronto.
Bo
Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Quoted 41 lines
-----原始邮件-----
发件人: "Bo Gan" <[email protected]>
发送时间:2026-01-23 15:39:29 (星期五)
收件人: "Andrew Lunn" <[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: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling controlHi Andrew,
Quoted 14 lines · Andrew Lunn
Quoted 5 lines
Quoted 5 lines
You say internal. So the skew is fixed, it is a property of the silicon? If so, why a DT property? Why not just hard code it in the driver? Since it is internal, different boards should not need it set differently?
Quoted 8 lines
Thanks for the question.
EIC7700 has two Ethernet MACs. Only eth1 has this internal RXC/RXD skew, eth0 does not.
So this is not a chip-wide constant that can be hardcoded in the driver. We need a way to distinguish the two MAC instances, which is why this is described per-port in DTS.
Quoted 7 lines
I assume the address of the interface is fixed. So you can just key off that to distinguish the two instances.
Since this is an internal property, not a board property, it is not clear it actually belongs on DT.
Andrew
IMO, they should be in DT to provide maximum flexibility. The SoC .dtsi can provide some sane defaults, and the board vendor can later override them if the mac/phy requires further tuning. Applying such tuning by the address of MAC seems messy and it hides the parameters used behind driver. Through DT, everything becomes really clear.
Quoted 6 lines
I assume this is not uncommon: E.g., starfive/jh7110:
https://lore.kernel.org/all/[email protected]/BTW, no need to worry about backward compat. ESWIN hasn't checked-in any DT for eth yet. As you and Russell said, they need to do it, pronto.
Yes, this can be hardcoded for eth1, similar to what is done in dwmac-loongson1.c.
However, considering EIC7702, which integrates two EIC7700 dies and thus has four MACs in total, we believe describing this via DTS is more appropriate. We are currently working on upstreaming the DTS support for EIC7702.
With the DT approach, the internal RXC/RXD skew can be described explicitly for gmac1 and gmac3, without requiring changes to dwmac-eic7700.c when bringing up EIC7702.
As Bo Gan also mentioned, there are vendors handling similar internal quirks through DT configuration.
--
Li Zhi
Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
In reply to Bo GanQuoted 9 lines · Bo Gan
Quoted 7 lines
I assume the address of the interface is fixed. So you can just key off that to distinguish the two instances.
Since this is an internal property, not a board property, it is not clear it actually belongs on DT.
Andrew
IMO, they should be in DT to provide maximum flexibility. The SoC .dtsi
This is not the purpose of DT. Please rather use arguments in terms of DT rules (see docs, presentations).
We really do not care about maximum flexibility.
Best regards,
Krzysztof
Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Hi Krzysztof,
Quoted 7 lines · Krzysztof Kozlowski
Quoted 6 lines · Bo Gan
Quoted 6 lines
I assume the address of the interface is fixed. So you can just key off that to distinguish the two instances.
Since this is an internal property, not a board property, it is not clear it actually belongs on DT.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Andrew
IMO, they should be in DT to provide maximum flexibility. The SoC .dtsi
This is not the purpose of DT. Please rather use arguments in terms of DT rules (see docs, presentations).
Any examples? links? Thank you for your patience.
I'd say if the board .dts never overrides the eswin,rx-clk-invert, (E.g., the SoC .dtsi has rx-clk-invert, later the board /delete-property/'s it) then yes, it can be treated as something inherent to the mac, and then "use arguments in terms of DT rules". I was thinking about use cases like:
https://lore.kernel.org/all/[email protected]/
Quoted 4 lines
We really do not care about maximum flexibility.
Best regards,
Krzysztof
Bo
Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Quoted 17 lines · Bo Gan
Hi Krzysztof,
Quoted 7 lines · Krzysztof Kozlowski
Quoted 6 lines · Bo Gan
Quoted 6 lines
I assume the address of the interface is fixed. So you can just key off that to distinguish the two instances.
Since this is an internal property, not a board property, it is not clear it actually belongs on DT.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Andrew
IMO, they should be in DT to provide maximum flexibility. The SoC .dtsi
This is not the purpose of DT. Please rather use arguments in terms of DT rules (see docs, presentations).
Quoted 7 lines
Any examples? links? Thank you for your patience.
I'd say if the board .dts never overrides the eswin,rx-clk-invert, (E.g., the SoC .dtsi has rx-clk-invert, later the board /delete-property/'s it) then yes, it can be treated as something inherent to the mac, and then "use arguments in terms of DT rules". I was thinking about use cases like:
https://lore.kernel.org/all/[email protected]/
Your device should be compliant with the RGMII standard by default. There should not be a DT property to ask it nicely to follow the standard.
Properties like
motorcomm,tx-clk-adj-enabled;
motorcomm,tx-clk-100-inverted;
motorcomm,tx-clk-1000-inverted;
are for broken boards which break the standard and require the MAC do also break the standard so that everything works. We should not start out with the assumption you need to support broken boards which ignore the standard.
Andrew
Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Hi Andrew,
Quoted 32 lines · Andrew Lunn
Quoted 17 lines · Bo Gan
Hi Krzysztof,
Quoted 7 lines · Krzysztof Kozlowski
Quoted 6 lines · Bo Gan
Quoted 6 lines
I assume the address of the interface is fixed. So you can just key off that to distinguish the two instances.
Since this is an internal property, not a board property, it is not clear it actually belongs on DT.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Andrew
IMO, they should be in DT to provide maximum flexibility. The SoC .dtsi
This is not the purpose of DT. Please rather use arguments in terms of DT rules (see docs, presentations).
Quoted 7 lines
Any examples? links? Thank you for your patience.
I'd say if the board .dts never overrides the eswin,rx-clk-invert, (E.g., the SoC .dtsi has rx-clk-invert, later the board /delete-property/'s it) then yes, it can be treated as something inherent to the mac, and then "use arguments in terms of DT rules". I was thinking about use cases like:
https://lore.kernel.org/all/[email protected]/Your device should be compliant with the RGMII standard by default. There should not be a DT property to ask it nicely to follow the standard.
Properties like
Quoted 8 lines
motorcomm,tx-clk-adj-enabled;
motorcomm,tx-clk-100-inverted;
motorcomm,tx-clk-1000-inverted;are for broken boards which break the standard and require the MAC do also break the standard so that everything works. We should not start out with the assumption you need to support broken boards which ignore the standard.
My reading of
https://lore.kernel.org/all/[email protected]/
is that the eth1 MAC is already breaking the standard at SoC level, and the boards can un-break it or break it even more. Hence, even for proper designed board, SoC .dtsi still needs eswin,rx-clk-invert (for *eth1*). For broken boards, they may require eswin,rx-clk-invert for *eth0*, even though SoC doesn't mandate. For *eth1* broken boards might have to /delete-property/ it and use eswin,tx-clk-invert or something else. It's clearer to have all these parameters visible and explicit in DT.
ESWIN, please correct me if I'm wrong.
P.S. I'm not affiliated to ESWIN, but I do own eic7700/hifive-premier board, and I can talk to someone who owns eic7700/megrez. I can help validating ESWIN's patches independently.
Quoted 3 lines
Andrew
Bo
Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Hi Bo Gan
Quoted 61 lines
-----Original Messages-----
From: "Bo Gan" <[email protected]>
Send time:Saturday, 24/01/2026 12:57:23
To: "Andrew Lunn" <[email protected]>
Cc: "Krzysztof Kozlowski" <[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]
Subject: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling controlHi Andrew,
Quoted 32 lines · Andrew Lunn
Quoted 17 lines · Bo Gan
Hi Krzysztof,
Quoted 7 lines · Krzysztof Kozlowski
Quoted 6 lines · Bo Gan
Quoted 6 lines
I assume the address of the interface is fixed. So you can just key off that to distinguish the two instances.
Since this is an internal property, not a board property, it is not clear it actually belongs on DT.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Andrew
IMO, they should be in DT to provide maximum flexibility. The SoC .dtsi
This is not the purpose of DT. Please rather use arguments in terms of DT rules (see docs, presentations).
Quoted 7 lines
Any examples? links? Thank you for your patience.
I'd say if the board .dts never overrides the eswin,rx-clk-invert, (E.g., the SoC .dtsi has rx-clk-invert, later the board /delete-property/'s it) then yes, it can be treated as something inherent to the mac, and then "use arguments in terms of DT rules". I was thinking about use cases like:
https://lore.kernel.org/all/[email protected]/Your device should be compliant with the RGMII standard by default. There should not be a DT property to ask it nicely to follow the standard.
Properties like
Quoted 8 lines
motorcomm,tx-clk-adj-enabled;
motorcomm,tx-clk-100-inverted;
motorcomm,tx-clk-1000-inverted;are for broken boards which break the standard and require the MAC do also break the standard so that everything works. We should not start out with the assumption you need to support broken boards which ignore the standard.
My reading of
https://lore.kernel.org/all/[email protected]/
is that the eth1 MAC is already breaking the standard at SoC level, and the boards can un-break it or break it even more. Hence, even for proper designed board, SoC .dtsi still needs eswin,rx-clk-invert (for *eth1*). For broken boards, they may require eswin,rx-clk-invert for *eth0*, even though SoC doesn't mandate. For *eth1* broken boards might have to /delete-property/ it and use eswin,tx-clk-invert or something else. It's clearer to have all these parameters visible and explicit in DT.
Quoted 1 line
ESWIN, please correct me if I'm wrong.
Due to chip backend reasons, there is already a ~4-5ns skew between the RX clock and data of the eth1 MAC controller inside the silicon.
The RX clock must be inverted since it's not able to match the RGMII timing only by adding rx-internal-delay-ps on the MAC and 2ns delay on the PHY. So, yes, even for a properly designed board, eth1 still requires eswin,rx-clk-invert.
This is a chip-level defect, and indeed, it breaks the RGMII standard at the SoC level.
For the TX of eth1, there is also a skew between the TX clock and data on the MAC controller inside the silicon. This skew happens to be approximately ~2ns. Therefore, we can consider that the 2ns delay of TX is provided by the MAC, so the TX is compliant with the RGMII standard.
Regards,
Lin Min
Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Quoted 2 lines · Min Lin
Due to chip backend reasons, there is already a ~4-5ns skew between the RX clock and data of the eth1 MAC controller inside the silicon.
Let's analyse this.
TXC / RXC TXC / RXC
Speed Clock rate Clock period
1G 125MHz 8ns
100M 25MHz 40ns
10M 2.5MHz 400ns
The required skew for TXC and RXC at the receiver is specified to be between 1 and 2.6ns irrespective of the speed. The edge of the clock is also important: the rising edge indicates the lower 4 bits, and the falling edge indicates the upper 4 bits.
At 1G speed, with a "4 to 5ns" skew in the chip. If this is accurate, then inverting the clock and adding 1ns of additional skew by some means (PCB trace, or at the MAC or PHY) will give the required clock at the receiver.
The timing table in the RGMII standard (3.3) allows for Tcyc (the clock rate) to be scaled, but there is no allowance for scaling TskewR (the required 1 to 2.6ns skew.) This skew parameter is fixed.
So, at the other speeds, you are completely unable to meet the timing specification, whether irrespective of the clock inversion. In effect, the only speed that you can meet the specification is 1G.
Thus, I think this is something that needs a lot more than just "do we need to invert the clock". You also need to prevent 10M and 100M being supported IMHO.
I can't get my head around why someone would come up with this crazy, crippled design, but maybe they didn't bother reading the RGMII specification and ensuring that their design met the requirements before implementing the hardware.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Re: Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Hi Russell,
Quoted 24 lines
-----Original Messages-----
From: "Russell King (Oracle)" <[email protected]>
Send time:Tuesday, 27/01/2026 02:29:09
To: "Min Lin" <[email protected]>
Cc: "Bo Gan" <[email protected]>, "Andrew Lunn" <[email protected]>, "Krzysztof Kozlowski" <[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]
Subject: Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling controlQuoted 2 lines · Min Lin
Due to chip backend reasons, there is already a ~4-5ns skew between the RX clock and data of the eth1 MAC controller inside the silicon.
Let's analyse this.
TXC / RXC TXC / RXC
Speed Clock rate Clock period
1G 125MHz 8ns
100M 25MHz 40ns
10M 2.5MHz 400nsThe required skew for TXC and RXC at the receiver is specified to be between 1 and 2.6ns irrespective of the speed. The edge of the clock is also important: the rising edge indicates the lower 4 bits, and the falling edge indicates the upper 4 bits.
Quoted 5 lines
At 1G speed, with a "4 to 5ns" skew in the chip. If this is accurate, then inverting the clock and adding 1ns of additional skew by some means (PCB trace, or at the MAC or PHY) will give the required clock at the receiver.
Yes, that's exactly the case.
Quoted 9 lines
The timing table in the RGMII standard (3.3) allows for Tcyc (the clock rate) to be scaled, but there is no allowance for scaling TskewR (the required 1 to 2.6ns skew.) This skew parameter is fixed.
So, at the other speeds, you are completely unable to meet the timing specification, whether irrespective of the clock inversion. In effect, the only speed that you can meet the specification is 1G.
The timing table in the RGMII standard(3.3) says the max value of Tskew for 10/100 is unspecified.
Quotation:"note1: ...,For 10/100 the Max value is unspecified."
I think for 10/100, the "4 to 5ns" skew in the chip doesn't break the standard. At 10/100 speeds, it meets the timing specification without having to to add clock inversion.
In practice, it works at 10/100 speeds in the rgmii-id phy mode.
Quoted 4 lines
Thus, I think this is something that needs a lot more than just "do we need to invert the clock". You also need to prevent 10M and 100M being supported IMHO.
Regards,
Lin Min
Re: Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
In reply to Andrew LunnHi Andrew,
Thank you for taking the time to review the patch.
Quoted 11 lines
-----Original Messages-----
From: "Andrew Lunn" <[email protected]>
Send time:Thursday, 22/01/2026 21:27:34
To: 李志 <[email protected]>
Cc: "Bo Gan" <[email protected]>, "Russell King (Oracle)" <[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]
Subject: Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling controlQuoted 3 lines
We also intend
to upstream complete DTS files for EIC7700 so the bindings can be validated against real hardware.
Quoted 9 lines
I suggest you prioritise this. ARM-SOC is pretty flexible for accepting work in progress support for new SoCs. All you really need is for the board to boot to a login prompt on a serial port using an initramsfs. So the .dtsi and .dts file can be very slim, CPUs, memory and UARTs.
Once you have that merged you can work on the other drivers, their bindings, etc.
The eic7700.dtsi and eic7700-hifive-premier-p550.dts are already in v6.19-rc6. As you said, it only includes CPUs, memory and UARTs right now. It has been verified to be able to login prompt on a serial port using an initramfs.
Besides, the reset driver for eic7700 has already been merged in v6.19-rc6.
Because the device drivers such as Ethernet rely on the clock driver, our plan is that once the clock driver is applied, we will add other device nodes such as Ethernet and eMMC in the next upstream patch of the DTS. Is this reasonable?
Regards,
Lin Min
Re: Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Quoted 21 lines · Min Lin
Hi Andrew,
Thank you for taking the time to review the patch.
Quoted 17 lines
-----Original Messages-----
From: "Andrew Lunn" <[email protected]>
Send time:Thursday, 22/01/2026 21:27:34
To: 李志 <[email protected]>
Cc: "Bo Gan" <[email protected]>, "Russell King (Oracle)" <[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]
Subject: Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling controlQuoted 3 lines
We also intend
to upstream complete DTS files for EIC7700 so the bindings can be validated against real hardware.I suggest you prioritise this. ARM-SOC is pretty flexible for accepting work in progress support for new SoCs. All you really need is for the board to boot to a login prompt on a serial port using an initramsfs. So the .dtsi and .dts file can be very slim, CPUs, memory and UARTs.
Quoted 5 lines
Quoted 3 lines
Once you have that merged you can work on the other drivers, their bindings, etc.
The
eic7700.dtsiandeic7700-hifive-premier-p550.dtsare already in v6.19-rc6.
Great.
Quoted 4 lines
Because the device drivers such as Ethernet rely on the clock driver, our plan is that once the clock driver is applied, we will add other device nodes such as Ethernet and eMMC in the next upstream patch of the DTS. Is this reasonable?
Yes, this is reasonable. When you submit Ethernet support, please include the DT patches as part of the series, so we can see the full picture. When it comes to actually merging it could be the DT patches get separated out and go a different path, but we can decide that when we get to that stage.
Given the new information, it becomes clear that backwards compatibility is not an issue. Since mainline does not have any users of the Ethernet driver, you should make non-backwards compatible changes in order to keep things clean. Just ensure the commit messages point out there are no users, so the changes are safe.
Andrew
Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
In reply to Min LinHi Min, Russell, Krzysztof,
Quoted 54 lines · Min Lin
Hi Russell,
Quoted 24 lines
-----Original Messages-----
From: "Russell King (Oracle)" <[email protected]>
Send time:Tuesday, 27/01/2026 02:29:09
To: "Min Lin" <[email protected]>
Cc: "Bo Gan" <[email protected]>, "Andrew Lunn" <[email protected]>, "Krzysztof Kozlowski" <[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]
Subject: Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling controlQuoted 2 lines · Min Lin
Due to chip backend reasons, there is already a ~4-5ns skew between the RX clock and data of the eth1 MAC controller inside the silicon.
Let's analyse this.
TXC / RXC TXC / RXC
Speed Clock rate Clock period
1G 125MHz 8ns
100M 25MHz 40ns
10M 2.5MHz 400nsThe required skew for TXC and RXC at the receiver is specified to be between 1 and 2.6ns irrespective of the speed. The edge of the clock is also important: the rising edge indicates the lower 4 bits, and the falling edge indicates the upper 4 bits.
Quoted 5 lines
At 1G speed, with a "4 to 5ns" skew in the chip. If this is accurate, then inverting the clock and adding 1ns of additional skew by some means (PCB trace, or at the MAC or PHY) will give the required clock at the receiver.
Yes, that's exactly the case.
Quoted 9 lines
The timing table in the RGMII standard (3.3) allows for Tcyc (the clock rate) to be scaled, but there is no allowance for scaling TskewR (the required 1 to 2.6ns skew.) This skew parameter is fixed.
So, at the other speeds, you are completely unable to meet the timing specification, whether irrespective of the clock inversion. In effect, the only speed that you can meet the specification is 1G.
The timing table in the RGMII standard(3.3) says the max value of Tskew for 10/100 is unspecified.
Quotation:"note1: ...,For 10/100 the Max value is unspecified."I think for 10/100, the "4 to 5ns" skew in the chip doesn't break the standard. At 10/100 speeds, it meets the timing specification without having to to add clock inversion.
In practice, it works at 10/100 speeds in the rgmii-id phy mode.
Quoted 7 lines
Quoted 4 lines
Thus, I think this is something that needs a lot more than just "do we need to invert the clock". You also need to prevent 10M and 100M being supported IMHO.
Regards,
Lin Min
I had an offline discussion with Yao Zi and others regarding this. We feel like the proper way for ESWIN to deal with this broken eth1 is to have a different compatible string just for eth1, where it can be associated with platform data with quirks to do eswin,rx-clk-invert at 1G. The property is therefore not required to be exposed in DT. (Pretend it conforms to spec for 1G). Need confirmation for 10M/100M, though. I double checked Lin Min's claim, and indeed the spec says "For 10/100 the Max value is unspecified":
https://community.nxp.com/pwmxy87654/attachments/pwmxy87654/imx-processors/20655/1/RGMIIv2_0_final_hp.pdf
Thoughts?
Bo
Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Hi Bo Gan,
Quoted 79 lines
-----Original Messages-----
From: "Bo Gan" <[email protected]>
Send time:Wednesday, 28/01/2026 10:38:28
To: "Min Lin" <[email protected]>, "Russell King (Oracle)" <[email protected]>
Cc: "Andrew Lunn" <[email protected]>, "Krzysztof Kozlowski" <[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]
Subject: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling controlHi Min, Russell, Krzysztof,
Quoted 45 lines · Min Lin
Hi Russell,
Quoted 24 lines
-----Original Messages-----
From: "Russell King (Oracle)" <[email protected]>
Send time:Tuesday, 27/01/2026 02:29:09
To: "Min Lin" <[email protected]>
Cc: "Bo Gan" <[email protected]>, "Andrew Lunn" <[email protected]>, "Krzysztof Kozlowski" <[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]
Subject: Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling controlQuoted 2 lines · Min Lin
Due to chip backend reasons, there is already a ~4-5ns skew between the RX clock and data of the eth1 MAC controller inside the silicon.
Let's analyse this.
TXC / RXC TXC / RXC
Speed Clock rate Clock period
1G 125MHz 8ns
100M 25MHz 40ns
10M 2.5MHz 400nsThe required skew for TXC and RXC at the receiver is specified to be between 1 and 2.6ns irrespective of the speed. The edge of the clock is also important: the rising edge indicates the lower 4 bits, and the falling edge indicates the upper 4 bits.
Quoted 5 lines
At 1G speed, with a "4 to 5ns" skew in the chip. If this is accurate, then inverting the clock and adding 1ns of additional skew by some means (PCB trace, or at the MAC or PHY) will give the required clock at the receiver.
Yes, that's exactly the case.
Quoted 9 lines
The timing table in the RGMII standard (3.3) allows for Tcyc (the clock rate) to be scaled, but there is no allowance for scaling TskewR (the required 1 to 2.6ns skew.) This skew parameter is fixed.
So, at the other speeds, you are completely unable to meet the timing specification, whether irrespective of the clock inversion. In effect, the only speed that you can meet the specification is 1G.
Quoted 13 lines
The timing table in the RGMII standard(3.3) says the max value of Tskew for 10/100 is unspecified.
Quotation:"note1: ...,For 10/100 the Max value is unspecified."I think for 10/100, the "4 to 5ns" skew in the chip doesn't break the standard. At 10/100 speeds, it meets the timing specification without having to to add clock inversion.
In practice, it works at 10/100 speeds in the rgmii-id phy mode.Quoted 4 lines
Thus, I think this is something that needs a lot more than just "do we need to invert the clock". You also need to prevent 10M and 100M being supported IMHO.
I had an offline discussion with Yao Zi and others regarding this. We feel like the proper way for ESWIN to deal with this broken eth1 is to have a different compatible string just for eth1, where it can be associated with platform data with quirks to do eswin,rx-clk-invert at 1G. The property is therefore not required to be exposed in DT. (Pretend it conforms to spec for 1G). Need confirmation for 10M/100M, though. I double checked Lin Min's claim, and indeed the spec says "For 10/100 the Max value is unspecified":
https://community.nxp.com/pwmxy87654/attachments/pwmxy87654/imx-processors/20655/1/RGMIIv2_0_final_hp.pdf
Quoted 1 line
Thoughts?
I agree with your approach.
Regards,
Lin Min
Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
In reply to Bo GanQuoted 10 lines · Bo Gan
Hi Krzysztof,
Quoted 7 lines · Krzysztof Kozlowski
Quoted 6 lines · Bo Gan
Quoted 6 lines
I assume the address of the interface is fixed. So you can just key off that to distinguish the two instances.
Since this is an internal property, not a board property, it is not clear it actually belongs on DT.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Andrew
IMO, they should be in DT to provide maximum flexibility. The SoC .dtsi
This is not the purpose of DT. Please rather use arguments in terms of DT rules (see docs, presentations).
Any examples? links? Thank you for your patience.
Really, doing simple search for it is your homework, not our task. You need to try harder if you want to prove that you are not wasting our time.
Documentation/devicetree/bindings
Or any elinux resources or any recent talks of mine.
Best regards,
Krzysztof
Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Quoted 23 lines · Krzysztof Kozlowski
Quoted 10 lines · Bo Gan
Hi Krzysztof,
Quoted 7 lines · Krzysztof Kozlowski
Quoted 6 lines · Bo Gan
Quoted 6 lines
I assume the address of the interface is fixed. So you can just key off that to distinguish the two instances.
Since this is an internal property, not a board property, it is not clear it actually belongs on DT.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Andrew
IMO, they should be in DT to provide maximum flexibility. The SoC .dtsi
This is not the purpose of DT. Please rather use arguments in terms of DT rules (see docs, presentations).
Any examples? links? Thank you for your patience.
Really, doing simple search for it is your homework, not our task. You need to try harder if you want to prove that you are not wasting our time.
Quoted 6 lines
Documentation/devicetree/bindingsOr any elinux resources or any recent talks of mine.
Best regards,
Krzysztof
You brought up the "use arguments in terms of DT rules" approach. and all I ask is just some pointers to make sure I'm not misinterpreting. No offense, but The way you slamming people w/ "not doing their homework" is truly not constructive.
Bo
Re: Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
In reply to Min LinHi Russell, Krzysztof,
Quoted 89 lines
-----Original Messages-----
From: "Min Lin" <[email protected]>
Send time:Wednesday, 28/01/2026 13:48:59
To: "Bo Gan" <[email protected]>
Cc: "Russell King (Oracle)" <[email protected]>, "Andrew Lunn" <[email protected]>, "Krzysztof Kozlowski" <[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]
Subject: Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling controlHi Bo Gan,
Quoted 79 lines
-----Original Messages-----
From: "Bo Gan" <[email protected]>
Send time:Wednesday, 28/01/2026 10:38:28
To: "Min Lin" <[email protected]>, "Russell King (Oracle)" <[email protected]>
Cc: "Andrew Lunn" <[email protected]>, "Krzysztof Kozlowski" <[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]
Subject: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling controlHi Min, Russell, Krzysztof,
Quoted 45 lines · Min Lin
Hi Russell,
Quoted 24 lines
-----Original Messages-----
From: "Russell King (Oracle)" <[email protected]>
Send time:Tuesday, 27/01/2026 02:29:09
To: "Min Lin" <[email protected]>
Cc: "Bo Gan" <[email protected]>, "Andrew Lunn" <[email protected]>, "Krzysztof Kozlowski" <[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]
Subject: Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling controlQuoted 2 lines · Min Lin
Due to chip backend reasons, there is already a ~4-5ns skew between the RX clock and data of the eth1 MAC controller inside the silicon.
Let's analyse this.
TXC / RXC TXC / RXC
Speed Clock rate Clock period
1G 125MHz 8ns
100M 25MHz 40ns
10M 2.5MHz 400nsThe required skew for TXC and RXC at the receiver is specified to be between 1 and 2.6ns irrespective of the speed. The edge of the clock is also important: the rising edge indicates the lower 4 bits, and the falling edge indicates the upper 4 bits.
Quoted 5 lines
At 1G speed, with a "4 to 5ns" skew in the chip. If this is accurate, then inverting the clock and adding 1ns of additional skew by some means (PCB trace, or at the MAC or PHY) will give the required clock at the receiver.
Yes, that's exactly the case.
Quoted 9 lines
The timing table in the RGMII standard (3.3) allows for Tcyc (the clock rate) to be scaled, but there is no allowance for scaling TskewR (the required 1 to 2.6ns skew.) This skew parameter is fixed.
So, at the other speeds, you are completely unable to meet the timing specification, whether irrespective of the clock inversion. In effect, the only speed that you can meet the specification is 1G.
Quoted 13 lines
The timing table in the RGMII standard(3.3) says the max value of Tskew for 10/100 is unspecified.
Quotation:"note1: ...,For 10/100 the Max value is unspecified."I think for 10/100, the "4 to 5ns" skew in the chip doesn't break the standard. At 10/100 speeds, it meets the timing specification without having to to add clock inversion.
In practice, it works at 10/100 speeds in the rgmii-id phy mode.Quoted 4 lines
Thus, I think this is something that needs a lot more than just "do we need to invert the clock". You also need to prevent 10M and 100M being supported IMHO.
I had an offline discussion with Yao Zi and others regarding this. We feel like the proper way for ESWIN to deal with this broken eth1 is to have a different compatible string just for eth1, where it can be associated with platform data with quirks to do eswin,rx-clk-invert at 1G. The property is therefore not required to be exposed in DT. (Pretend it conforms to spec for 1G). Need confirmation for 10M/100M, though. I double checked Lin Min's claim, and indeed the spec says "For 10/100 the Max value is unspecified":
https://community.nxp.com/pwmxy87654/attachments/pwmxy87654/imx-processors/20655/1/RGMIIv2_0_final_hp.pdf
Quoted 4 lines
Quoted 1 line
Thoughts?
I agree with your approach.
Do you think it would be reasonable for eth1 to have another different compatible string, such as "eswin,eic7700-qos-eth-quirk"?
Thanks for your comments.
Regards,
Lin Min
Re: Re: Re: [PATCH v1 1/2] dt-bindings: ethernet: eswin: add clock sampling control
Quoted 2 lines
Do you think it would be reasonable for eth1 to have another different compatible string, such as "eswin,eic7700-qos-eth-quirk"?
I think you can argue the two Ethernets are not compatible with each other. But i personally would not use 'quirk'. Maybe something which says how they differ?
Andrew