* [PATCH net-next v2 0/3] riscv: spacemit: Add ethernet support for K3
@ 2026-01-21 7:13 Inochi Amaoto
2026-01-21 7:13 ` [PATCH net-next v2 1/3] dt-bindings: net: Add support for Spacemit K3 dwmac Inochi Amaoto
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Inochi Amaoto @ 2026-01-21 7:13 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Yixun Lan, Maxime Coquelin, Alexandre Torgue, Richard Cochran,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Russell King (Oracle), Yao Zi, Yanteng Si, Vladimir Oltean,
Inochi Amaoto, Lad Prabhakar, Chen-Yu Tsai, Choong Yong Liang,
Shangjuan Wei, Jernej Skrabec, Boon Khai Ng, Maxime Chevallier,
Quentin Schulz, Giuseppe Cavallaro, Jose Abreu
Cc: netdev, devicetree, linux-kernel, linux-riscv, spacemit,
linux-stm32, linux-arm-kernel, Longbin Li
Add initial support for ethernet controller of the Spacemit K3 SoC.
This ethernet controller is almost a standard Synopsys DesignWare
MAC (version 5.40a). This controller require a syscon device to
configure some basic features, like interface type and internal delay.
Change from v1:
- https://lore.kernel.org/netdev/20260120043609.910302-1-inochiama@gmail.com
patch 1:
1. remove phy clock
patch 3:
1. improve comment and include something special about Spacmit K3 dwmac
2. reorder the included file
3. fix wrong delay macro used in spacemit_dwmac_set_delay.
4. add check for maximum supported delay.
5. use DIV_ROUND_CLOSEST to calculate best delay configuration.
6. use assign for the ctrl register initial value.
7. fix input when calling of_property_read_u32().
Inochi Amaoto (3):
dt-bindings: net: Add support for Spacemit K3 dwmac
net: stmmac: platform: Add snps,dwmac-5.40a IP compatible string
net: stmmac: Add glue layer for Spacemit K3 SoC
.../devicetree/bindings/net/snps,dwmac.yaml | 3 +
.../bindings/net/spacemit,k3-dwmac.yaml | 103 ++++++++
drivers/net/ethernet/stmicro/stmmac/Kconfig | 12 +
drivers/net/ethernet/stmicro/stmmac/Makefile | 1 +
.../ethernet/stmicro/stmmac/dwmac-spacemit.c | 221 ++++++++++++++++++
.../ethernet/stmicro/stmmac/stmmac_platform.c | 1 +
6 files changed, 341 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/spacemit,k3-dwmac.yaml
create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-spacemit.c
--
2.52.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net-next v2 1/3] dt-bindings: net: Add support for Spacemit K3 dwmac
2026-01-21 7:13 [PATCH net-next v2 0/3] riscv: spacemit: Add ethernet support for K3 Inochi Amaoto
@ 2026-01-21 7:13 ` Inochi Amaoto
2026-01-21 16:21 ` Rob Herring
2026-01-21 7:13 ` [PATCH net-next v2 2/3] net: stmmac: platform: Add snps,dwmac-5.40a IP compatible string Inochi Amaoto
2026-01-21 7:13 ` [PATCH net-next v2 3/3] net: stmmac: Add glue layer for Spacemit K3 SoC Inochi Amaoto
2 siblings, 1 reply; 10+ messages in thread
From: Inochi Amaoto @ 2026-01-21 7:13 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Yixun Lan, Maxime Coquelin, Alexandre Torgue, Richard Cochran,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Russell King (Oracle), Yao Zi, Yanteng Si, Vladimir Oltean,
Inochi Amaoto, Lad Prabhakar, Chen-Yu Tsai, Choong Yong Liang,
Shangjuan Wei, Jernej Skrabec, Boon Khai Ng, Maxime Chevallier,
Quentin Schulz, Giuseppe Cavallaro, Jose Abreu
Cc: netdev, devicetree, linux-kernel, linux-riscv, spacemit,
linux-stm32, linux-arm-kernel, Longbin Li
The GMAC IP on Spacemit K3 is almost a standard Synopsys DesignWare
MAC (version 5.40a) with some extra clock.
Add necessary compatible string for this device.
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
---
.../devicetree/bindings/net/snps,dwmac.yaml | 3 +
.../bindings/net/spacemit,k3-dwmac.yaml | 103 ++++++++++++++++++
2 files changed, 106 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/spacemit,k3-dwmac.yaml
diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index dd3c72e8363e..3c2c6cb6b10b 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -34,6 +34,7 @@ select:
- snps,dwmac-5.10a
- snps,dwmac-5.20
- snps,dwmac-5.30a
+ - snps,dwmac-5.40a
- snps,dwxgmac
- snps,dwxgmac-2.10
@@ -108,6 +109,7 @@ properties:
- snps,dwmac-5.10a
- snps,dwmac-5.20
- snps,dwmac-5.30a
+ - snps,dwmac-5.40a
- snps,dwxgmac
- snps,dwxgmac-2.10
- sophgo,sg2042-dwmac
@@ -653,6 +655,7 @@ allOf:
- snps,dwmac-5.10a
- snps,dwmac-5.20
- snps,dwmac-5.30a
+ - snps,dwmac-5.40a
- snps,dwxgmac
- snps,dwxgmac-2.10
- st,spear600-gmac
diff --git a/Documentation/devicetree/bindings/net/spacemit,k3-dwmac.yaml b/Documentation/devicetree/bindings/net/spacemit,k3-dwmac.yaml
new file mode 100644
index 000000000000..e69f3b60c51f
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/spacemit,k3-dwmac.yaml
@@ -0,0 +1,103 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/spacemit,k3-dwmac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Spacemit K3 DWMAC glue layer
+
+maintainers:
+ - Inochi Amaoto <inochiama@gmail.com>
+
+select:
+ properties:
+ compatible:
+ contains:
+ const: spacemit,k3-dwmac
+ required:
+ - compatible
+
+properties:
+ compatible:
+ items:
+ - const: spacemit,k3-dwmac
+ - const: snps,dwmac-5.40a
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ items:
+ - description: GMAC main clock
+ - description: PTP clock
+ - description: TX clock
+
+ clock-names:
+ items:
+ - const: stmmaceth
+ - const: ptp_ref
+ - const: tx
+
+ interrupts:
+ minItems: 1
+ items:
+ - description: MAC interrupt
+ - description: MAC wake interrupt
+
+ interrupt-names:
+ minItems: 1
+ items:
+ - const: macirq
+ - const: eth_wake_irq
+
+ resets:
+ maxItems: 1
+
+ reset-names:
+ const: stmmaceth
+
+ spacemit,apmu:
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ items:
+ - items:
+ - description: phandle to the syscon node which control the glue register
+ - description: offset of the control register
+ - description: offset of the dline register
+
+ description:
+ A phandle to syscon with offset to control registers for this MAC
+
+required:
+ - compatible
+ - reg
+ - clocks
+ - clock-names
+ - interrupts
+ - interrupt-names
+ - resets
+ - reset-names
+
+allOf:
+ - $ref: snps,dwmac.yaml#
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+
+ eth0: ethernet@cac80000 {
+ compatible = "spacemit,k3-dwmac", "snps,dwmac-5.40a";
+ reg = <0xcac80000 0x2000>;
+ clocks = <&syscon_apmu 66>, <&syscon_apmu 68>,
+ <&syscon_apmu 69>;
+ clock-names = "stmmaceth", "ptp_ref", "tx";
+ interrupts = <131 IRQ_TYPE_LEVEL_HIGH>, <276 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "macirq", "eth_wake_irq";
+ phy-mode = "rgmii-id";
+ phy-handle = <&phy0>;
+ resets = <&syscon_apmu 67>;
+ reset-names = "stmmaceth";
+ spacemit,apmu = <&syscon_apmu 0x384 0x38c>;
+ };
+
--
2.52.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next v2 2/3] net: stmmac: platform: Add snps,dwmac-5.40a IP compatible string
2026-01-21 7:13 [PATCH net-next v2 0/3] riscv: spacemit: Add ethernet support for K3 Inochi Amaoto
2026-01-21 7:13 ` [PATCH net-next v2 1/3] dt-bindings: net: Add support for Spacemit K3 dwmac Inochi Amaoto
@ 2026-01-21 7:13 ` Inochi Amaoto
2026-01-21 7:13 ` [PATCH net-next v2 3/3] net: stmmac: Add glue layer for Spacemit K3 SoC Inochi Amaoto
2 siblings, 0 replies; 10+ messages in thread
From: Inochi Amaoto @ 2026-01-21 7:13 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Yixun Lan, Maxime Coquelin, Alexandre Torgue, Richard Cochran,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Russell King (Oracle), Yao Zi, Yanteng Si, Vladimir Oltean,
Inochi Amaoto, Lad Prabhakar, Chen-Yu Tsai, Choong Yong Liang,
Shangjuan Wei, Jernej Skrabec, Boon Khai Ng, Maxime Chevallier,
Quentin Schulz, Giuseppe Cavallaro, Jose Abreu
Cc: netdev, devicetree, linux-kernel, linux-riscv, spacemit,
linux-stm32, linux-arm-kernel, Longbin Li
Add compatible string for 5.40a version that can avoid to define some
platform data in the glue layer.
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 8979a50b5507..54c7b1537ab9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -396,6 +396,7 @@ static const char * const stmmac_gmac4_compats[] = {
"snps,dwmac-5.10a",
"snps,dwmac-5.20",
"snps,dwmac-5.30a",
+ "snps,dwmac-5.40a",
NULL
};
--
2.52.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next v2 3/3] net: stmmac: Add glue layer for Spacemit K3 SoC
2026-01-21 7:13 [PATCH net-next v2 0/3] riscv: spacemit: Add ethernet support for K3 Inochi Amaoto
2026-01-21 7:13 ` [PATCH net-next v2 1/3] dt-bindings: net: Add support for Spacemit K3 dwmac Inochi Amaoto
2026-01-21 7:13 ` [PATCH net-next v2 2/3] net: stmmac: platform: Add snps,dwmac-5.40a IP compatible string Inochi Amaoto
@ 2026-01-21 7:13 ` Inochi Amaoto
2026-01-21 12:05 ` Russell King (Oracle)
2 siblings, 1 reply; 10+ messages in thread
From: Inochi Amaoto @ 2026-01-21 7:13 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Yixun Lan, Maxime Coquelin, Alexandre Torgue, Richard Cochran,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Russell King (Oracle), Yao Zi, Yanteng Si, Vladimir Oltean,
Inochi Amaoto, Lad Prabhakar, Chen-Yu Tsai, Choong Yong Liang,
Shangjuan Wei, Jernej Skrabec, Boon Khai Ng, Maxime Chevallier,
Quentin Schulz, Giuseppe Cavallaro, Jose Abreu
Cc: netdev, devicetree, linux-kernel, linux-riscv, spacemit,
linux-stm32, linux-arm-kernel, Longbin Li
The etherenet controller on Spacemit K3 SoC is Synopsys DesignWare
MAC (version 5.40a), with the following special point:
1. The rate of the tx clock line is auto changed when the mac speed
rate is changed, and no need for changing the input tx clock.
2. This controller require a extra syscon device to configure the
interface type, enable wake up interrupt and delay configuration
if needed.
Add Spacemit dwmac driver support on the Spacemit K3 SoC.
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/Kconfig | 12 +
drivers/net/ethernet/stmicro/stmmac/Makefile | 1 +
.../ethernet/stmicro/stmmac/dwmac-spacemit.c | 221 ++++++++++++++++++
3 files changed, 234 insertions(+)
create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-spacemit.c
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index 907fe2e927f0..583a4692f5da 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -216,6 +216,18 @@ config DWMAC_SOPHGO
for the stmmac device driver. This driver is used for the
ethernet controllers on various Sophgo SoCs.
+config DWMAC_SPACEMIT
+ tristate "Spacemit dwmac support"
+ depends on OF && (ARCH_SPACEMIT || COMPILE_TEST)
+ select MFD_SYSCON
+ default m if ARCH_SPACEMIT
+ help
+ Support for ethernet controllers on Spacemit RISC-V SoCs
+
+ This selects the Spacemit platform specific glue layer support
+ for the stmmac device driver. This driver is used for the
+ Spacemit K3 ethernet controllers.
+
config DWMAC_STARFIVE
tristate "StarFive dwmac support"
depends on OF && (ARCH_STARFIVE || COMPILE_TEST)
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 7bf528731034..9e32045631d8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_DWMAC_RZN1) += dwmac-rzn1.o
obj-$(CONFIG_DWMAC_S32) += dwmac-s32.o
obj-$(CONFIG_DWMAC_SOCFPGA) += dwmac-altr-socfpga.o
obj-$(CONFIG_DWMAC_SOPHGO) += dwmac-sophgo.o
+obj-$(CONFIG_DWMAC_SPACEMIT) += dwmac-spacemit.o
obj-$(CONFIG_DWMAC_STARFIVE) += dwmac-starfive.o
obj-$(CONFIG_DWMAC_STI) += dwmac-sti.o
obj-$(CONFIG_DWMAC_STM32) += dwmac-stm32.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-spacemit.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-spacemit.c
new file mode 100644
index 000000000000..ca600c068aaa
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-spacemit.c
@@ -0,0 +1,221 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Spacemit DWMAC platform driver
+ *
+ * Copyright (C) 2026 Inochi Amaoto <inochiama@gmail.com>
+ */
+
+#include <linux/clk.h>
+#include <linux/math.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/mfd/syscon.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/property.h>
+#include <linux/regmap.h>
+
+#include "stmmac_platform.h"
+
+/* ctrl register bits */
+#define PHY_INTF_RGMII BIT(3)
+#define PHY_INTF_MII BIT(4)
+
+#define WAKE_IRQ_EN BIT(9)
+#define PHY_IRQ_EN BIT(12)
+
+/* dline register bits */
+#define RGMII_RX_DLINE_EN BIT(0)
+#define RGMII_RX_DLINE_STEP GENMASK(5, 4)
+#define RGMII_RX_DLINE_CODE GENMASK(15, 8)
+#define RGMII_TX_DLINE_EN BIT(16)
+#define RGMII_TX_DLINE_STEP GENMASK(21, 20)
+#define RGMII_TX_DLINE_CODE GENMASK(31, 24)
+
+#define MAX_DLINE_DELAY_CODE 0xff
+#define MAX_WORKED_DELAY 2800
+
+/* Note: the delay step value is at 0.1ps */
+static const unsigned int k3_delay_step_10x[4] = {
+ 367, 493, 559, 685
+};
+
+static int spacemit_dwmac_set_delay(struct regmap *apmu,
+ unsigned int dline_offset,
+ unsigned int tx_code, unsigned int tx_config,
+ unsigned int rx_code, unsigned int rx_config)
+{
+ unsigned int mask, val;
+
+ mask = RGMII_RX_DLINE_STEP | RGMII_TX_DLINE_CODE | RGMII_TX_DLINE_EN |
+ RGMII_TX_DLINE_STEP | RGMII_RX_DLINE_CODE | RGMII_RX_DLINE_EN;
+ val = FIELD_PREP(RGMII_TX_DLINE_STEP, tx_config) |
+ FIELD_PREP(RGMII_TX_DLINE_CODE, tx_code) | RGMII_TX_DLINE_EN |
+ FIELD_PREP(RGMII_RX_DLINE_STEP, rx_config) |
+ FIELD_PREP(RGMII_RX_DLINE_CODE, rx_code) | RGMII_RX_DLINE_EN;
+
+ return regmap_update_bits(apmu, dline_offset, mask, val);
+}
+
+static int spacemit_dwmac_detected_delay_value(unsigned int delay,
+ unsigned int *config)
+{
+ unsigned int best_delay = 0;
+ unsigned int best_config = 0;
+ int best_code = 0;
+ int i;
+
+ if (delay == 0)
+ return 0;
+
+ if (delay > MAX_WORKED_DELAY)
+ return -EINVAL;
+
+ for (i = 0; i < ARRAY_SIZE(k3_delay_step_10x); i++) {
+ unsigned int step = k3_delay_step_10x[i];
+ int code = DIV_ROUND_CLOSEST(delay * 10 * 10, step * 9);
+ unsigned int tmp = code * step * 9 / 10 / 10;
+
+ if (abs(tmp - delay) < abs(best_delay - delay)) {
+ best_code = code;
+ best_delay = tmp;
+ best_config = i;
+ }
+ }
+
+ *config = best_config;
+
+ return best_code;
+}
+
+static int spacemit_dwmac_fix_delay(struct plat_stmmacenet_data *plat_dat,
+ struct regmap *apmu,
+ unsigned int dline_offset,
+ unsigned int tx_delay, unsigned int rx_delay)
+{
+ bool mac_rxid = rx_delay != 0;
+ bool mac_txid = tx_delay != 0;
+ unsigned int rx_config = 0;
+ unsigned int tx_config = 0;
+ int rx_code;
+ int tx_code;
+
+ plat_dat->phy_interface = phy_fix_phy_mode_for_mac_delays(plat_dat->phy_interface,
+ mac_txid,
+ mac_rxid);
+
+ if (plat_dat->phy_interface == PHY_INTERFACE_MODE_NA)
+ return -EINVAL;
+
+ rx_code = spacemit_dwmac_detected_delay_value(rx_delay, &rx_config);
+ if (rx_code < 0)
+ return rx_code;
+
+ tx_code = spacemit_dwmac_detected_delay_value(tx_delay, &tx_config);
+ if (tx_code < 0)
+ return tx_code;
+
+ return spacemit_dwmac_set_delay(apmu, dline_offset,
+ tx_code, tx_config,
+ rx_code, rx_config);
+}
+
+static int spacemit_dwmac_update_ifconfig(struct plat_stmmacenet_data *plat_dat,
+ struct stmmac_resources *stmmac_res,
+ struct regmap *apmu,
+ unsigned int ctrl_offset)
+{
+ unsigned int mask = PHY_INTF_MII | PHY_INTF_RGMII | WAKE_IRQ_EN;
+ unsigned int val = 0;
+
+ switch (plat_dat->phy_interface) {
+ case PHY_INTERFACE_MODE_MII:
+ val = PHY_INTF_MII;
+ break;
+
+ case PHY_INTERFACE_MODE_RMII:
+ break;
+
+ case PHY_INTERFACE_MODE_RGMII:
+ case PHY_INTERFACE_MODE_RGMII_ID:
+ case PHY_INTERFACE_MODE_RGMII_RXID:
+ case PHY_INTERFACE_MODE_RGMII_TXID:
+ val = PHY_INTF_RGMII;
+ break;
+
+ default:
+ return -EOPNOTSUPP;
+ }
+
+ if (stmmac_res->wol_irq >= 0)
+ val |= WAKE_IRQ_EN;
+
+ return regmap_update_bits(apmu, ctrl_offset, mask, val);
+}
+
+static int spacemit_dwmac_probe(struct platform_device *pdev)
+{
+ struct plat_stmmacenet_data *plat_dat;
+ struct stmmac_resources stmmac_res;
+ struct device *dev = &pdev->dev;
+ unsigned int offset[2];
+ struct regmap *apmu;
+ u32 rx_delay = 0;
+ u32 tx_delay = 0;
+ int ret;
+
+ ret = stmmac_get_platform_resources(pdev, &stmmac_res);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "failed to get platform resources\n");
+
+ plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac);
+ if (IS_ERR(plat_dat))
+ return dev_err_probe(dev, PTR_ERR(plat_dat),
+ "failed to parse DT parameters\n");
+
+ plat_dat->clk_tx_i = devm_clk_get_enabled(&pdev->dev, "tx");
+ if (IS_ERR(plat_dat->clk_tx_i))
+ return dev_err_probe(&pdev->dev, PTR_ERR(plat_dat->clk_tx_i),
+ "failed to get tx clock\n");
+
+ apmu = syscon_regmap_lookup_by_phandle_args(pdev->dev.of_node, "spacemit,apmu", 2, offset);
+ if (IS_ERR(apmu))
+ return dev_err_probe(dev, PTR_ERR(apmu),
+ "Failed to get apmu regmap\n");
+
+ ret = spacemit_dwmac_update_ifconfig(plat_dat, &stmmac_res,
+ apmu, offset[0]);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to configure ifconfig\n");
+
+ of_property_read_u32(pdev->dev.of_node, "tx-internal-delay-ps", &tx_delay);
+ of_property_read_u32(pdev->dev.of_node, "rx-internal-delay-ps", &rx_delay);
+
+ ret = spacemit_dwmac_fix_delay(plat_dat, apmu, offset[1], tx_delay, rx_delay);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to configure delay\n");
+
+ return stmmac_dvr_probe(dev, plat_dat, &stmmac_res);
+}
+
+static const struct of_device_id spacemit_dwmac_match[] = {
+ { .compatible = "spacemit,k3-dwmac" },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, spacemit_dwmac_match);
+
+static struct platform_driver spacemit_dwmac_driver = {
+ .probe = spacemit_dwmac_probe,
+ .remove = stmmac_pltfr_remove,
+ .driver = {
+ .name = "spacemit-dwmac",
+ .pm = &stmmac_pltfr_pm_ops,
+ .of_match_table = spacemit_dwmac_match,
+ },
+};
+module_platform_driver(spacemit_dwmac_driver);
+
+MODULE_AUTHOR("Inochi Amaoto <inochiama@gmail.com>");
+MODULE_DESCRIPTION("Spacemit DWMAC platform driver");
+MODULE_LICENSE("GPL");
--
2.52.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH net-next v2 3/3] net: stmmac: Add glue layer for Spacemit K3 SoC
2026-01-21 7:13 ` [PATCH net-next v2 3/3] net: stmmac: Add glue layer for Spacemit K3 SoC Inochi Amaoto
@ 2026-01-21 12:05 ` Russell King (Oracle)
2026-01-21 13:45 ` Andrew Lunn
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Russell King (Oracle) @ 2026-01-21 12:05 UTC (permalink / raw)
To: Inochi Amaoto
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Yixun Lan, Maxime Coquelin, Alexandre Torgue, Richard Cochran,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Yao Zi,
Yanteng Si, Vladimir Oltean, Lad Prabhakar, Chen-Yu Tsai,
Choong Yong Liang, Shangjuan Wei, Jernej Skrabec, Boon Khai Ng,
Maxime Chevallier, Quentin Schulz, Giuseppe Cavallaro, Jose Abreu,
netdev, devicetree, linux-kernel, linux-riscv, spacemit,
linux-stm32, linux-arm-kernel, Longbin Li
On Wed, Jan 21, 2026 at 03:13:11PM +0800, Inochi Amaoto wrote:
> + mask = RGMII_RX_DLINE_STEP | RGMII_TX_DLINE_CODE | RGMII_TX_DLINE_EN |
> + RGMII_TX_DLINE_STEP | RGMII_RX_DLINE_CODE | RGMII_RX_DLINE_EN;
> + val = FIELD_PREP(RGMII_TX_DLINE_STEP, tx_config) |
> + FIELD_PREP(RGMII_TX_DLINE_CODE, tx_code) | RGMII_TX_DLINE_EN |
> + FIELD_PREP(RGMII_RX_DLINE_STEP, rx_config) |
> + FIELD_PREP(RGMII_RX_DLINE_CODE, rx_code) | RGMII_RX_DLINE_EN;
So your reply where you basically stated that all the RGMII.*DLINE.*
constants here should be the same was nonsense. How can we trust your
replies?
> +static int spacemit_dwmac_fix_delay(struct plat_stmmacenet_data *plat_dat,
> + struct regmap *apmu,
> + unsigned int dline_offset,
> + unsigned int tx_delay, unsigned int rx_delay)
> +{
> + bool mac_rxid = rx_delay != 0;
> + bool mac_txid = tx_delay != 0;
> + unsigned int rx_config = 0;
> + unsigned int tx_config = 0;
> + int rx_code;
> + int tx_code;
> +
> + plat_dat->phy_interface = phy_fix_phy_mode_for_mac_delays(plat_dat->phy_interface,
> + mac_txid,
> + mac_rxid);
Maybe Andrew can confirm, but this function was to fix up existing
broken DT, and shouldn't be used by brand new drivers.
> + plat_dat->clk_tx_i = devm_clk_get_enabled(&pdev->dev, "tx");
> + if (IS_ERR(plat_dat->clk_tx_i))
> + return dev_err_probe(&pdev->dev, PTR_ERR(plat_dat->clk_tx_i),
> + "failed to get tx clock\n");
As stated on the previous series, please don't abuse clk_tx_i for
soemthing that isn't the dwmac's clk_tx_i signal.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next v2 3/3] net: stmmac: Add glue layer for Spacemit K3 SoC
2026-01-21 12:05 ` Russell King (Oracle)
@ 2026-01-21 13:45 ` Andrew Lunn
2026-01-21 22:37 ` Inochi Amaoto
2026-01-21 23:58 ` Inochi Amaoto
2026-01-22 0:29 ` Inochi Amaoto
2 siblings, 1 reply; 10+ messages in thread
From: Andrew Lunn @ 2026-01-21 13:45 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Inochi Amaoto, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Yixun Lan, Maxime Coquelin, Alexandre Torgue,
Richard Cochran, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Yao Zi, Yanteng Si, Vladimir Oltean,
Lad Prabhakar, Chen-Yu Tsai, Choong Yong Liang, Shangjuan Wei,
Jernej Skrabec, Boon Khai Ng, Maxime Chevallier, Quentin Schulz,
Giuseppe Cavallaro, Jose Abreu, netdev, devicetree, linux-kernel,
linux-riscv, spacemit, linux-stm32, linux-arm-kernel, Longbin Li
On Wed, Jan 21, 2026 at 12:05:30PM +0000, Russell King (Oracle) wrote:
> On Wed, Jan 21, 2026 at 03:13:11PM +0800, Inochi Amaoto wrote:
> > + mask = RGMII_RX_DLINE_STEP | RGMII_TX_DLINE_CODE | RGMII_TX_DLINE_EN |
> > + RGMII_TX_DLINE_STEP | RGMII_RX_DLINE_CODE | RGMII_RX_DLINE_EN;
> > + val = FIELD_PREP(RGMII_TX_DLINE_STEP, tx_config) |
> > + FIELD_PREP(RGMII_TX_DLINE_CODE, tx_code) | RGMII_TX_DLINE_EN |
> > + FIELD_PREP(RGMII_RX_DLINE_STEP, rx_config) |
> > + FIELD_PREP(RGMII_RX_DLINE_CODE, rx_code) | RGMII_RX_DLINE_EN;
>
> So your reply where you basically stated that all the RGMII.*DLINE.*
> constants here should be the same was nonsense. How can we trust your
> replies?
>
> > +static int spacemit_dwmac_fix_delay(struct plat_stmmacenet_data *plat_dat,
> > + struct regmap *apmu,
> > + unsigned int dline_offset,
> > + unsigned int tx_delay, unsigned int rx_delay)
> > +{
> > + bool mac_rxid = rx_delay != 0;
> > + bool mac_txid = tx_delay != 0;
> > + unsigned int rx_config = 0;
> > + unsigned int tx_config = 0;
> > + int rx_code;
> > + int tx_code;
> > +
> > + plat_dat->phy_interface = phy_fix_phy_mode_for_mac_delays(plat_dat->phy_interface,
> > + mac_txid,
> > + mac_rxid);
>
> Maybe Andrew can confirm, but this function was to fix up existing
> broken DT, and shouldn't be used by brand new drivers.
Hi Russell, thanks for pointing this out.
This function should not be used in this case. MAC drivers in general
only add small delays, in order to do fine tuning. The PHY adds the
2ns delay. There are however some MACs who cannot disable their 2ns
delay, or have historically been broken, and add 2ns delay. In such
cases, the phy_interface passed to the PHY needs masking, to indicate
the PHY should not add the 2ns delays. That is what this function
does.
Please don't call it. Pass phy_interface as is to the PHY.
Andrew
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next v2 1/3] dt-bindings: net: Add support for Spacemit K3 dwmac
2026-01-21 7:13 ` [PATCH net-next v2 1/3] dt-bindings: net: Add support for Spacemit K3 dwmac Inochi Amaoto
@ 2026-01-21 16:21 ` Rob Herring
0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2026-01-21 16:21 UTC (permalink / raw)
To: Inochi Amaoto
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Krzysztof Kozlowski, Conor Dooley, Yixun Lan,
Maxime Coquelin, Alexandre Torgue, Richard Cochran, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Russell King (Oracle),
Yao Zi, Yanteng Si, Vladimir Oltean, Lad Prabhakar, Chen-Yu Tsai,
Choong Yong Liang, Shangjuan Wei, Jernej Skrabec, Boon Khai Ng,
Maxime Chevallier, Quentin Schulz, Giuseppe Cavallaro, Jose Abreu,
netdev, devicetree, linux-kernel, linux-riscv, spacemit,
linux-stm32, linux-arm-kernel, Longbin Li
On Wed, Jan 21, 2026 at 03:13:09PM +0800, Inochi Amaoto wrote:
> The GMAC IP on Spacemit K3 is almost a standard Synopsys DesignWare
> MAC (version 5.40a) with some extra clock.
>
> Add necessary compatible string for this device.
>
> Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
> ---
> .../devicetree/bindings/net/snps,dwmac.yaml | 3 +
> .../bindings/net/spacemit,k3-dwmac.yaml | 103 ++++++++++++++++++
> 2 files changed, 106 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/net/spacemit,k3-dwmac.yaml
>
> diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> index dd3c72e8363e..3c2c6cb6b10b 100644
> --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> @@ -34,6 +34,7 @@ select:
> - snps,dwmac-5.10a
> - snps,dwmac-5.20
> - snps,dwmac-5.30a
> + - snps,dwmac-5.40a
You don't need this in select as the spacemit schema references this
one.
> - snps,dwxgmac
> - snps,dwxgmac-2.10
>
> @@ -108,6 +109,7 @@ properties:
> - snps,dwmac-5.10a
> - snps,dwmac-5.20
> - snps,dwmac-5.30a
> + - snps,dwmac-5.40a
> - snps,dwxgmac
> - snps,dwxgmac-2.10
> - sophgo,sg2042-dwmac
> @@ -653,6 +655,7 @@ allOf:
> - snps,dwmac-5.10a
> - snps,dwmac-5.20
> - snps,dwmac-5.30a
> + - snps,dwmac-5.40a
> - snps,dwxgmac
> - snps,dwxgmac-2.10
> - st,spear600-gmac
> diff --git a/Documentation/devicetree/bindings/net/spacemit,k3-dwmac.yaml b/Documentation/devicetree/bindings/net/spacemit,k3-dwmac.yaml
> new file mode 100644
> index 000000000000..e69f3b60c51f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/spacemit,k3-dwmac.yaml
> @@ -0,0 +1,103 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/spacemit,k3-dwmac.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Spacemit K3 DWMAC glue layer
> +
> +maintainers:
> + - Inochi Amaoto <inochiama@gmail.com>
> +
> +select:
> + properties:
> + compatible:
> + contains:
> + const: spacemit,k3-dwmac
> + required:
> + - compatible
> +
> +properties:
> + compatible:
> + items:
> + - const: spacemit,k3-dwmac
> + - const: snps,dwmac-5.40a
> +
> + reg:
> + maxItems: 1
> +
> + clocks:
> + items:
> + - description: GMAC main clock
> + - description: PTP clock
> + - description: TX clock
> +
> + clock-names:
> + items:
> + - const: stmmaceth
> + - const: ptp_ref
> + - const: tx
> +
> + interrupts:
> + minItems: 1
> + items:
> + - description: MAC interrupt
> + - description: MAC wake interrupt
> +
> + interrupt-names:
> + minItems: 1
> + items:
> + - const: macirq
> + - const: eth_wake_irq
> +
> + resets:
> + maxItems: 1
> +
> + reset-names:
> + const: stmmaceth
> +
> + spacemit,apmu:
> + $ref: /schemas/types.yaml#/definitions/phandle-array
> + items:
> + - items:
> + - description: phandle to the syscon node which control the glue register
> + - description: offset of the control register
> + - description: offset of the dline register
> +
Drop blank line
> + description:
> + A phandle to syscon with offset to control registers for this MAC
> +
> +required:
> + - compatible
> + - reg
> + - clocks
> + - clock-names
> + - interrupts
> + - interrupt-names
> + - resets
> + - reset-names
spacemit,apmu is not required? Looks like the driver requires it.
> +
> +allOf:
> + - $ref: snps,dwmac.yaml#
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/irq.h>
> +
> + eth0: ethernet@cac80000 {
Drop unused label.
> + compatible = "spacemit,k3-dwmac", "snps,dwmac-5.40a";
> + reg = <0xcac80000 0x2000>;
> + clocks = <&syscon_apmu 66>, <&syscon_apmu 68>,
> + <&syscon_apmu 69>;
> + clock-names = "stmmaceth", "ptp_ref", "tx";
> + interrupts = <131 IRQ_TYPE_LEVEL_HIGH>, <276 IRQ_TYPE_LEVEL_HIGH>;
> + interrupt-names = "macirq", "eth_wake_irq";
> + phy-mode = "rgmii-id";
> + phy-handle = <&phy0>;
> + resets = <&syscon_apmu 67>;
> + reset-names = "stmmaceth";
> + spacemit,apmu = <&syscon_apmu 0x384 0x38c>;
> + };
> +
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next v2 3/3] net: stmmac: Add glue layer for Spacemit K3 SoC
2026-01-21 13:45 ` Andrew Lunn
@ 2026-01-21 22:37 ` Inochi Amaoto
0 siblings, 0 replies; 10+ messages in thread
From: Inochi Amaoto @ 2026-01-21 22:37 UTC (permalink / raw)
To: Andrew Lunn, Russell King (Oracle)
Cc: Inochi Amaoto, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Yixun Lan, Maxime Coquelin, Alexandre Torgue,
Richard Cochran, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Yao Zi, Yanteng Si, Vladimir Oltean,
Lad Prabhakar, Chen-Yu Tsai, Choong Yong Liang, Shangjuan Wei,
Jernej Skrabec, Boon Khai Ng, Maxime Chevallier, Quentin Schulz,
Giuseppe Cavallaro, Jose Abreu, netdev, devicetree, linux-kernel,
linux-riscv, spacemit, linux-stm32, linux-arm-kernel, Longbin Li
On Wed, Jan 21, 2026 at 02:45:24PM +0100, Andrew Lunn wrote:
> On Wed, Jan 21, 2026 at 12:05:30PM +0000, Russell King (Oracle) wrote:
> > On Wed, Jan 21, 2026 at 03:13:11PM +0800, Inochi Amaoto wrote:
> > > + mask = RGMII_RX_DLINE_STEP | RGMII_TX_DLINE_CODE | RGMII_TX_DLINE_EN |
> > > + RGMII_TX_DLINE_STEP | RGMII_RX_DLINE_CODE | RGMII_RX_DLINE_EN;
> > > + val = FIELD_PREP(RGMII_TX_DLINE_STEP, tx_config) |
> > > + FIELD_PREP(RGMII_TX_DLINE_CODE, tx_code) | RGMII_TX_DLINE_EN |
> > > + FIELD_PREP(RGMII_RX_DLINE_STEP, rx_config) |
> > > + FIELD_PREP(RGMII_RX_DLINE_CODE, rx_code) | RGMII_RX_DLINE_EN;
> >
> > So your reply where you basically stated that all the RGMII.*DLINE.*
> > constants here should be the same was nonsense. How can we trust your
> > replies?
> >
> > > +static int spacemit_dwmac_fix_delay(struct plat_stmmacenet_data *plat_dat,
> > > + struct regmap *apmu,
> > > + unsigned int dline_offset,
> > > + unsigned int tx_delay, unsigned int rx_delay)
> > > +{
> > > + bool mac_rxid = rx_delay != 0;
> > > + bool mac_txid = tx_delay != 0;
> > > + unsigned int rx_config = 0;
> > > + unsigned int tx_config = 0;
> > > + int rx_code;
> > > + int tx_code;
> > > +
> > > + plat_dat->phy_interface = phy_fix_phy_mode_for_mac_delays(plat_dat->phy_interface,
> > > + mac_txid,
> > > + mac_rxid);
> >
> > Maybe Andrew can confirm, but this function was to fix up existing
> > broken DT, and shouldn't be used by brand new drivers.
>
> Hi Russell, thanks for pointing this out.
>
> This function should not be used in this case. MAC drivers in general
> only add small delays, in order to do fine tuning. The PHY adds the
> 2ns delay. There are however some MACs who cannot disable their 2ns
> delay, or have historically been broken, and add 2ns delay. In such
> cases, the phy_interface passed to the PHY needs masking, to indicate
> the PHY should not add the 2ns delays. That is what this function
> does.
>
> Please don't call it. Pass phy_interface as is to the PHY.
>
Great, I will remove this call and pass the phy_interface.
Regards,
Inochi
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next v2 3/3] net: stmmac: Add glue layer for Spacemit K3 SoC
2026-01-21 12:05 ` Russell King (Oracle)
2026-01-21 13:45 ` Andrew Lunn
@ 2026-01-21 23:58 ` Inochi Amaoto
2026-01-22 0:29 ` Inochi Amaoto
2 siblings, 0 replies; 10+ messages in thread
From: Inochi Amaoto @ 2026-01-21 23:58 UTC (permalink / raw)
To: Russell King (Oracle), Inochi Amaoto
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Yixun Lan, Maxime Coquelin, Alexandre Torgue, Richard Cochran,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Yao Zi,
Yanteng Si, Vladimir Oltean, Lad Prabhakar, Chen-Yu Tsai,
Choong Yong Liang, Shangjuan Wei, Jernej Skrabec, Boon Khai Ng,
Maxime Chevallier, Quentin Schulz, Giuseppe Cavallaro, Jose Abreu,
netdev, devicetree, linux-kernel, linux-riscv, spacemit,
linux-stm32, linux-arm-kernel, Longbin Li
On Wed, Jan 21, 2026 at 12:05:30PM +0000, Russell King (Oracle) wrote:
> On Wed, Jan 21, 2026 at 03:13:11PM +0800, Inochi Amaoto wrote:
> > + mask = RGMII_RX_DLINE_STEP | RGMII_TX_DLINE_CODE | RGMII_TX_DLINE_EN |
> > + RGMII_TX_DLINE_STEP | RGMII_RX_DLINE_CODE | RGMII_RX_DLINE_EN;
> > + val = FIELD_PREP(RGMII_TX_DLINE_STEP, tx_config) |
> > + FIELD_PREP(RGMII_TX_DLINE_CODE, tx_code) | RGMII_TX_DLINE_EN |
> > + FIELD_PREP(RGMII_RX_DLINE_STEP, rx_config) |
> > + FIELD_PREP(RGMII_RX_DLINE_CODE, rx_code) | RGMII_RX_DLINE_EN;
>
> So your reply where you basically stated that all the RGMII.*DLINE.*
> constants here should be the same was nonsense. How can we trust your
> replies?
>
Sorry, I have found there is a mistake for replying you.
Now I give a detailed description about this registers.
You can check it at
https://lore.kernel.org/netdev/aXFnmXIwSdKCS9Uc@inochi.infowork/
Regards,
Inochi
> > +static int spacemit_dwmac_fix_delay(struct plat_stmmacenet_data *plat_dat,
> > + struct regmap *apmu,
> > + unsigned int dline_offset,
> > + unsigned int tx_delay, unsigned int rx_delay)
> > +{
> > + bool mac_rxid = rx_delay != 0;
> > + bool mac_txid = tx_delay != 0;
> > + unsigned int rx_config = 0;
> > + unsigned int tx_config = 0;
> > + int rx_code;
> > + int tx_code;
> > +
> > + plat_dat->phy_interface = phy_fix_phy_mode_for_mac_delays(plat_dat->phy_interface,
> > + mac_txid,
> > + mac_rxid);
>
> Maybe Andrew can confirm, but this function was to fix up existing
> broken DT, and shouldn't be used by brand new drivers.
>
> > + plat_dat->clk_tx_i = devm_clk_get_enabled(&pdev->dev, "tx");
> > + if (IS_ERR(plat_dat->clk_tx_i))
> > + return dev_err_probe(&pdev->dev, PTR_ERR(plat_dat->clk_tx_i),
> > + "failed to get tx clock\n");
>
> As stated on the previous series, please don't abuse clk_tx_i for
> soemthing that isn't the dwmac's clk_tx_i signal.
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next v2 3/3] net: stmmac: Add glue layer for Spacemit K3 SoC
2026-01-21 12:05 ` Russell King (Oracle)
2026-01-21 13:45 ` Andrew Lunn
2026-01-21 23:58 ` Inochi Amaoto
@ 2026-01-22 0:29 ` Inochi Amaoto
2 siblings, 0 replies; 10+ messages in thread
From: Inochi Amaoto @ 2026-01-22 0:29 UTC (permalink / raw)
To: Russell King (Oracle), Inochi Amaoto
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Yixun Lan, Maxime Coquelin, Alexandre Torgue, Richard Cochran,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Yao Zi,
Yanteng Si, Vladimir Oltean, Lad Prabhakar, Chen-Yu Tsai,
Choong Yong Liang, Shangjuan Wei, Jernej Skrabec, Boon Khai Ng,
Maxime Chevallier, Quentin Schulz, Giuseppe Cavallaro, Jose Abreu,
netdev, devicetree, linux-kernel, linux-riscv, spacemit,
linux-stm32, linux-arm-kernel, Longbin Li
On Wed, Jan 21, 2026 at 12:05:30PM +0000, Russell King (Oracle) wrote:
> On Wed, Jan 21, 2026 at 03:13:11PM +0800, Inochi Amaoto wrote:
> > + mask = RGMII_RX_DLINE_STEP | RGMII_TX_DLINE_CODE | RGMII_TX_DLINE_EN |
> > + RGMII_TX_DLINE_STEP | RGMII_RX_DLINE_CODE | RGMII_RX_DLINE_EN;
> > + val = FIELD_PREP(RGMII_TX_DLINE_STEP, tx_config) |
> > + FIELD_PREP(RGMII_TX_DLINE_CODE, tx_code) | RGMII_TX_DLINE_EN |
> > + FIELD_PREP(RGMII_RX_DLINE_STEP, rx_config) |
> > + FIELD_PREP(RGMII_RX_DLINE_CODE, rx_code) | RGMII_RX_DLINE_EN;
>
> So your reply where you basically stated that all the RGMII.*DLINE.*
> constants here should be the same was nonsense. How can we trust your
> replies?
>
> > +static int spacemit_dwmac_fix_delay(struct plat_stmmacenet_data *plat_dat,
> > + struct regmap *apmu,
> > + unsigned int dline_offset,
> > + unsigned int tx_delay, unsigned int rx_delay)
> > +{
> > + bool mac_rxid = rx_delay != 0;
> > + bool mac_txid = tx_delay != 0;
> > + unsigned int rx_config = 0;
> > + unsigned int tx_config = 0;
> > + int rx_code;
> > + int tx_code;
> > +
> > + plat_dat->phy_interface = phy_fix_phy_mode_for_mac_delays(plat_dat->phy_interface,
> > + mac_txid,
> > + mac_rxid);
>
> Maybe Andrew can confirm, but this function was to fix up existing
> broken DT, and shouldn't be used by brand new drivers.
>
> > + plat_dat->clk_tx_i = devm_clk_get_enabled(&pdev->dev, "tx");
> > + if (IS_ERR(plat_dat->clk_tx_i))
> > + return dev_err_probe(&pdev->dev, PTR_ERR(plat_dat->clk_tx_i),
> > + "failed to get tx clock\n");
>
> As stated on the previous series, please don't abuse clk_tx_i for
> soemthing that isn't the dwmac's clk_tx_i signal.
>
I have seen this comments, I will switch to a local variable in the
next version
Regards,
Inochi
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-01-22 1:32 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-21 7:13 [PATCH net-next v2 0/3] riscv: spacemit: Add ethernet support for K3 Inochi Amaoto
2026-01-21 7:13 ` [PATCH net-next v2 1/3] dt-bindings: net: Add support for Spacemit K3 dwmac Inochi Amaoto
2026-01-21 16:21 ` Rob Herring
2026-01-21 7:13 ` [PATCH net-next v2 2/3] net: stmmac: platform: Add snps,dwmac-5.40a IP compatible string Inochi Amaoto
2026-01-21 7:13 ` [PATCH net-next v2 3/3] net: stmmac: Add glue layer for Spacemit K3 SoC Inochi Amaoto
2026-01-21 12:05 ` Russell King (Oracle)
2026-01-21 13:45 ` Andrew Lunn
2026-01-21 22:37 ` Inochi Amaoto
2026-01-21 23:58 ` Inochi Amaoto
2026-01-22 0:29 ` Inochi Amaoto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox