* [PATCH net-next v4 1/6] net: phylink: allow stopping a suspended instance
2026-09-20 19:45 [PATCH net-next v4 0/6] net: stmmac: add Allwinner H616 EMAC1 support James Hilliard
@ 2026-09-20 19:45 ` James Hilliard
2026-09-20 19:45 ` [PATCH net-next v4 2/6] net: stmmac: close the interface after a failed MTU reopen James Hilliard
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: James Hilliard @ 2026-09-20 19:45 UTC (permalink / raw)
To: Richard Genoud, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Alexandre Torgue, Giuseppe Cavallaro, Jose Abreu,
Maxime Chevallier, Maxime Coquelin, Russell King,
Christian Marangi, Andrew Lunn, Heiner Kallweit, Tiezhu Yang,
Huacai Chen
Cc: Maxime Ripard, Alastair D'Silva, netdev, devicetree,
linux-arm-kernel, linux-sunxi, linux-kernel, linux-stm32,
James Hilliard
A MAC which cannot restore its hardware after system sleep may need to
close the network device instead of calling phylink_resume(). Without MAC
Wake-on-LAN, phylink_suspend() has already stopped the PHY and PCS, so
another phylink_stop() repeats their shutdown. With MAC Wake-on-LAN, the
saved link-up state still needs a matching mac_link_down(), and leaving
PHYLINK_DISABLE_MAC_WOL set prevents a subsequent start from resolving
the link.
Allow phylink_stop() to finish shutdown directly from either suspended
state. Leave an already stopped instance alone. For MAC Wake-on-LAN,
stop resolution, drain pending resolve work, complete the deferred
link-down and clear the WoL disable bit while retaining the stopped bit.
This does not restart the PHY, reconfigure the MAC or bring its link up.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
drivers/net/phy/phylink.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 390d3eb3e6f7..8ecf2dec3a7d 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -2615,11 +2615,17 @@ EXPORT_SYMBOL_GPL(phylink_start);
*
* This will synchronously bring down the link if the link is not already
* down (in other words, it will trigger a mac_link_down() method call.)
+ * It may also be called after phylink_suspend() if the MAC cannot resume
+ * and the network device must be closed instead.
*/
void phylink_stop(struct phylink *pl)
{
ASSERT_RTNL();
+ /* phylink_suspend() already stops the link without MAC WoL. */
+ if (test_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state))
+ return;
+
if (pl->sfp_bus)
sfp_upstream_stop(pl->sfp_bus);
if (pl->phydev)
@@ -2632,6 +2638,16 @@ void phylink_stop(struct phylink *pl)
phylink_run_resolve_and_disable(pl, PHYLINK_DISABLE_STOPPED);
+ if (test_bit(PHYLINK_DISABLE_MAC_WOL, &pl->phylink_disable_state)) {
+ /* Finish the link-down deferred by MAC WoL, without restarting. */
+ flush_work(&pl->resolve);
+ mutex_lock(&pl->state_mutex);
+ if (pl->suspend_link_up)
+ phylink_link_down(pl);
+ __clear_bit(PHYLINK_DISABLE_MAC_WOL, &pl->phylink_disable_state);
+ mutex_unlock(&pl->state_mutex);
+ }
+
pl->pcs_state = PCS_STATE_DOWN;
phylink_pcs_disable(pl->pcs);
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH net-next v4 2/6] net: stmmac: close the interface after a failed MTU reopen
2026-09-20 19:45 [PATCH net-next v4 0/6] net: stmmac: add Allwinner H616 EMAC1 support James Hilliard
2026-09-20 19:45 ` [PATCH net-next v4 1/6] net: phylink: allow stopping a suspended instance James Hilliard
@ 2026-09-20 19:45 ` James Hilliard
2026-09-20 19:45 ` [PATCH net-next v4 3/6] net: stmmac: close the interface after failed hardware resume James Hilliard
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: James Hilliard @ 2026-09-20 19:45 UTC (permalink / raw)
To: Richard Genoud, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Alexandre Torgue, Giuseppe Cavallaro, Jose Abreu,
Maxime Chevallier, Maxime Coquelin, Russell King,
Christian Marangi, Andrew Lunn, Heiner Kallweit, Tiezhu Yang,
Huacai Chen
Cc: Maxime Ripard, Alastair D'Silva, netdev, devicetree,
linux-arm-kernel, linux-sunxi, linux-kernel, linux-stm32,
James Hilliard
An MTU change stops the data path and then reopens it using a newly
allocated DMA configuration. If reopening fails, the new allocation is
freed while the netdev remains up and priv->dma_conf retains copies of
the freed pointers. A subsequent close repeats NAPI disable and IRQ and
DMA-resource teardown. It can hang in napi_disable() or access resources
which have already been freed.
Track successful opens of the data path separately from the netdev's
administrative state. Clear that state when releasing the data path and
skip a second release after a failed reopen. Close the netdev through the
network core on the MTU error path, so the PHY attachment and runtime-PM
reference are released and the interface is marked down. A subsequent
open can then allocate fresh resources and retry normally.
Keep successful MTU changes on the existing path, retaining the PHY
attachment and runtime-PM reference. Allocation failures before stopping
the original data path still leave the running interface unchanged.
Fixes: 3470079687448 ("net: ethernet: stmicro: stmmac: permit MTU change with interface up")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 ++
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 ++++++++++
2 files changed, 12 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 4fc96b317d79..363872ff00d6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -281,6 +281,8 @@ struct stmmac_priv {
struct mutex lock;
struct stmmac_dma_conf dma_conf;
+ /* Paired __stmmac_open()/__stmmac_release(), serialized by RTNL. */
+ bool opened;
/* Generic channel for NAPI */
struct stmmac_channel channel[STMMAC_CH_MAX];
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index bf9e7e4cb1c3..89b773370894 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4212,6 +4212,7 @@ static int __stmmac_open(struct net_device *dev,
stmmac_enable_all_queues(priv);
netif_tx_start_all_queues(priv->dev);
stmmac_enable_all_dma_irq(priv);
+ priv->opened = true;
return 0;
@@ -4287,6 +4288,11 @@ static void __stmmac_release(struct net_device *dev)
struct stmmac_priv *priv = netdev_priv(dev);
u8 chan;
+ /* A failed MTU reopen has already released the data path. */
+ if (!priv->opened)
+ return;
+ priv->opened = false;
+
/* Stop and disconnect the PHY */
phylink_stop(priv->phylink);
@@ -6212,6 +6218,10 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu)
if (ret) {
free_dma_desc_resources(priv, dma_conf);
kfree(dma_conf);
+ /* Finish closing the PHY and PM state, but do not repeat
+ * the data-path teardown after the failed reopen.
+ */
+ netif_close(dev);
netdev_err(priv->dev, "failed reopening the interface after MTU change\n");
return ret;
}
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH net-next v4 3/6] net: stmmac: close the interface after failed hardware resume
2026-09-20 19:45 [PATCH net-next v4 0/6] net: stmmac: add Allwinner H616 EMAC1 support James Hilliard
2026-09-20 19:45 ` [PATCH net-next v4 1/6] net: phylink: allow stopping a suspended instance James Hilliard
2026-09-20 19:45 ` [PATCH net-next v4 2/6] net: stmmac: close the interface after a failed MTU reopen James Hilliard
@ 2026-09-20 19:45 ` James Hilliard
2026-09-20 19:45 ` [PATCH net-next v4 4/6] net: stmmac: sun8i: reset the MAC after PHY initialization James Hilliard
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: James Hilliard @ 2026-09-20 19:45 UTC (permalink / raw)
To: Richard Genoud, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Alexandre Torgue, Giuseppe Cavallaro, Jose Abreu,
Maxime Chevallier, Maxime Coquelin, Russell King,
Christian Marangi, Andrew Lunn, Heiner Kallweit, Tiezhu Yang,
Huacai Chen
Cc: Maxime Ripard, Alastair D'Silva, netdev, devicetree,
linux-arm-kernel, linux-sunxi, linux-kernel, linux-stm32,
James Hilliard
System suspend disables NAPI and suspends phylink but retains the IRQs
and DMA resources. If hardware setup fails during resume, the interface
remains administratively up with NAPI still disabled. Closing it later
calls napi_disable() a second time and can hang indefinitely.
On hardware-setup or timestamping failure, stop DMA and disable the MAC,
then release the suspended data path without repeating NAPI disable.
Stop phylink directly from its suspended state rather than restarting
the link on hardware which failed to resume. Drop the driver mutex
before teardown, retaining RTNL across cleanup and network-core close.
Close the netdev to detach the PHY, release its runtime-PM reference and
clear its administrative state. Reattach the now-down netdev so a later
open can allocate new resources and retry. Preserve the original resume
error and leave successful resume unchanged.
Fixes: 6896c2449a18 ("net: stmmac: Check stmmac_hw_setup() in stmmac_resume()")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 89b773370894..18630ae62316 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4283,7 +4283,7 @@ static int stmmac_open(struct net_device *dev)
return ret;
}
-static void __stmmac_release(struct net_device *dev)
+static void __stmmac_release(struct net_device *dev, bool napi_disabled)
{
struct stmmac_priv *priv = netdev_priv(dev);
u8 chan;
@@ -4296,7 +4296,9 @@ static void __stmmac_release(struct net_device *dev)
/* Stop and disconnect the PHY */
phylink_stop(priv->phylink);
- stmmac_disable_all_queues(priv);
+ /* Suspend has already disabled NAPI when hardware resume fails. */
+ if (!napi_disabled)
+ stmmac_disable_all_queues(priv);
for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
@@ -4335,7 +4337,7 @@ static int stmmac_release(struct net_device *dev)
if (device_may_wakeup(priv->device))
phylink_speed_down(priv->phylink, false);
- __stmmac_release(dev);
+ __stmmac_release(dev, false);
stmmac_legacy_serdes_power_down(priv);
phylink_disconnect_phy(priv->phylink);
@@ -6212,7 +6214,7 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu)
return PTR_ERR(dma_conf);
}
- __stmmac_release(dev);
+ __stmmac_release(dev, false);
ret = __stmmac_open(dev, dma_conf);
if (ret) {
@@ -8415,7 +8417,7 @@ int stmmac_resume(struct device *dev)
ret = stmmac_hw_setup(ndev);
if (ret < 0) {
netdev_err(priv->dev, "%s: Hw setup failed\n", __func__);
- goto error_unlock;
+ goto error_stop_dma;
}
if (priv->ptp_enabled) {
@@ -8454,9 +8456,13 @@ int stmmac_resume(struct device *dev)
error_stop_dma:
stmmac_stop_all_dma(priv);
stmmac_mac_set(priv, priv->ioaddr, false);
-error_unlock:
- stmmac_legacy_serdes_power_down(priv);
mutex_unlock(&priv->lock);
+ /* Release the suspended data path before ndo_stop(), which must not
+ * disable NAPI or free these resources a second time.
+ */
+ __stmmac_release(ndev, true);
+ netif_close(ndev);
+ netif_device_attach(ndev);
rtnl_unlock();
return ret;
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH net-next v4 4/6] net: stmmac: sun8i: reset the MAC after PHY initialization
2026-09-20 19:45 [PATCH net-next v4 0/6] net: stmmac: add Allwinner H616 EMAC1 support James Hilliard
` (2 preceding siblings ...)
2026-09-20 19:45 ` [PATCH net-next v4 3/6] net: stmmac: close the interface after failed hardware resume James Hilliard
@ 2026-09-20 19:45 ` James Hilliard
2026-09-20 19:45 ` [PATCH net-next v4 5/6] dt-bindings: net: allwinner: add H616 EMAC1 James Hilliard
2026-09-20 19:45 ` [PATCH net-next v4 6/6] net: stmmac: sun8i: add support for Allwinner " James Hilliard
5 siblings, 0 replies; 7+ messages in thread
From: James Hilliard @ 2026-09-20 19:45 UTC (permalink / raw)
To: Richard Genoud, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Alexandre Torgue, Giuseppe Cavallaro, Jose Abreu,
Maxime Chevallier, Maxime Coquelin, Russell King,
Christian Marangi, Andrew Lunn, Heiner Kallweit, Tiezhu Yang,
Huacai Chen
Cc: Maxime Ripard, Alastair D'Silva, netdev, devicetree,
linux-arm-kernel, linux-sunxi, linux-kernel, linux-stm32,
James Hilliard
The MAC software reset needs a running receive clock from the PHY.
Resetting the MAC at the end of probe therefore fails when the PHY driver
has not been loaded or its probe has deferred on a missing supplier. The
failure removes the MAC and its MDIO bus, so loading the missing driver
later cannot recover the interface without reprobing the MAC.
Perform the software reset in the DMA reset callback instead. The stmmac
core calls it during hardware setup after attaching and initializing the
PHY, and resumes a suspended PHY before reopening or resuming the MAC.
Mask interrupts before requesting the reset and retain the existing
DMA and interrupt-register clearing even if the reset times out. Return
reset errors through the normal hardware-setup error path.
Remove the unconditional reset from probe. Keep the separate H3 MDIO-mux
reset after switching the mux and powering the selected PHY, since it is
needed to latch the selected interface before MDIO accesses.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 53 +++++++++++------------
1 file changed, 26 insertions(+), 27 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 48c52eb96233..9598c386bb21 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -269,11 +269,33 @@ static const struct emac_variant emac_variant_h6 = {
#define SYSCON_ETCS_EXT_GMII 0x1
#define SYSCON_ETCS_INT_GMII 0x2
+static int sun8i_dwmac_reset(void __iomem *ioaddr)
+{
+ u32 v;
+
+ v = readl(ioaddr + EMAC_BASIC_CTL1);
+ writel(v | 0x01, ioaddr + EMAC_BASIC_CTL1);
+
+ /* The timeout was previously set to 10ms, but some board (OrangePI0)
+ * need more if no cable plugged. 100ms seems OK
+ */
+ return readl_poll_timeout(ioaddr + EMAC_BASIC_CTL1, v,
+ !(v & 0x01), 100, 100000);
+}
+
/* sun8i_dwmac_dma_reset() - reset the EMAC
* Called from stmmac via stmmac_dma_ops->reset
*/
static int sun8i_dwmac_dma_reset(void __iomem *ioaddr)
{
+ int ret;
+
+ writel(0, ioaddr + EMAC_INT_EN);
+
+ /* The PHY receive clock must be running for the reset to complete. */
+ ret = sun8i_dwmac_reset(ioaddr);
+
+ /* Leave DMA and interrupts disabled even if the reset timed out. */
writel(0, ioaddr + EMAC_RX_CTL1);
writel(0, ioaddr + EMAC_TX_CTL1);
writel(0, ioaddr + EMAC_RX_FRM_FLT);
@@ -281,7 +303,7 @@ static int sun8i_dwmac_dma_reset(void __iomem *ioaddr)
writel(0, ioaddr + EMAC_TX_DESC_LIST);
writel(0, ioaddr + EMAC_INT_EN);
writel(0x1FFFFFF, ioaddr + EMAC_INT_STA);
- return 0;
+ return ret;
}
/* sun8i_dwmac_dma_init() - initialize the EMAC
@@ -738,27 +760,6 @@ static void sun8i_dwmac_flow_ctrl(struct mac_device_info *hw,
writel(v, ioaddr + EMAC_TX_FLOW_CTL);
}
-static int sun8i_dwmac_reset(struct stmmac_priv *priv)
-{
- u32 v;
- int err;
-
- v = readl(priv->ioaddr + EMAC_BASIC_CTL1);
- writel(v | 0x01, priv->ioaddr + EMAC_BASIC_CTL1);
-
- /* The timeout was previously set to 10ms, but some board (OrangePI0)
- * need more if no cable plugged. 100ms seems OK
- */
- err = readl_poll_timeout(priv->ioaddr + EMAC_BASIC_CTL1, v,
- !(v & 0x01), 100, 100000);
-
- if (err) {
- dev_err(priv->device, "EMAC reset timeout\n");
- return err;
- }
- return 0;
-}
-
/* Search in mdio-mux node for internal PHY node and get its clk/reset */
static int get_ephy_nodes(struct stmmac_priv *priv)
{
@@ -895,7 +896,9 @@ static int mdio_mux_syscon_switch_fn(int current_child, int desired_child,
/* After changing syscon value, the MAC need reset or it will
* use the last value (and so the last PHY set).
*/
- ret = sun8i_dwmac_reset(priv);
+ ret = sun8i_dwmac_reset(priv->ioaddr);
+ if (ret)
+ dev_err(priv->device, "EMAC reset timeout\n");
}
return ret;
}
@@ -1217,10 +1220,6 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Failed to register mux\n");
goto dwmac_mux;
}
- } else {
- ret = sun8i_dwmac_reset(priv);
- if (ret)
- goto dwmac_remove;
}
pm_runtime_put(&pdev->dev);
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH net-next v4 5/6] dt-bindings: net: allwinner: add H616 EMAC1
2026-09-20 19:45 [PATCH net-next v4 0/6] net: stmmac: add Allwinner H616 EMAC1 support James Hilliard
` (3 preceding siblings ...)
2026-09-20 19:45 ` [PATCH net-next v4 4/6] net: stmmac: sun8i: reset the MAC after PHY initialization James Hilliard
@ 2026-09-20 19:45 ` James Hilliard
2026-09-20 19:45 ` [PATCH net-next v4 6/6] net: stmmac: sun8i: add support for Allwinner " James Hilliard
5 siblings, 0 replies; 7+ messages in thread
From: James Hilliard @ 2026-09-20 19:45 UTC (permalink / raw)
To: Richard Genoud, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Alexandre Torgue, Giuseppe Cavallaro, Jose Abreu,
Maxime Chevallier, Maxime Coquelin, Russell King,
Christian Marangi, Andrew Lunn, Heiner Kallweit, Tiezhu Yang,
Huacai Chen
Cc: Maxime Ripard, Alastair D'Silva, netdev, devicetree,
linux-arm-kernel, linux-sunxi, linux-kernel, linux-stm32,
James Hilliard
The H616 secondary EMAC uses a separate system-control clock register
and supports only RMII at 10/100 Mbps. Add its distinct compatible
without an older fallback, since using the primary EMAC clock register
would not work.
Constrain the PHY interface mode to RMII, matching the hardware.
Reviewed-by: Alastair D'Silva <alastair@d-silva.org>
Tested-by: Alastair D'Silva <alastair@d-silva.org>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
.../devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml | 13 +++++++++++++
Documentation/devicetree/bindings/net/snps,dwmac.yaml | 2 ++
2 files changed, 15 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml
index 323a669fa982..2cae0133b3cd 100644
--- a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml
+++ b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml
@@ -21,6 +21,7 @@ select:
- allwinner,sun8i-r40-gmac
- allwinner,sun8i-v3s-emac
- allwinner,sun50i-a64-emac
+ - allwinner,sun50i-h616-emac1
- allwinner,sun55i-a523-gmac200
required:
- compatible
@@ -33,6 +34,7 @@ properties:
- const: allwinner,sun8i-r40-gmac
- const: allwinner,sun8i-v3s-emac
- const: allwinner,sun50i-a64-emac
+ - const: allwinner,sun50i-h616-emac1
- items:
- enum:
- allwinner,sun20i-d1-emac
@@ -91,6 +93,17 @@ required:
allOf:
- $ref: snps,dwmac.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: allwinner,sun50i-h616-emac1
+
+ then:
+ properties:
+ phy-mode:
+ const: rmii
+
- if:
properties:
compatible:
diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 0ff9e3284a06..3fa6e17c3d12 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -57,6 +57,7 @@ properties:
- allwinner,sun8i-r40-gmac
- allwinner,sun8i-v3s-emac
- allwinner,sun50i-a64-emac
+ - allwinner,sun50i-h616-emac1
- amlogic,meson6-dwmac
- amlogic,meson8b-dwmac
- amlogic,meson8m2-dwmac
@@ -623,6 +624,7 @@ allOf:
- allwinner,sun8i-r40-gmac
- allwinner,sun8i-v3s-emac
- allwinner,sun50i-a64-emac
+ - allwinner,sun50i-h616-emac1
- loongson,ls2k-dwmac
- loongson,ls7a-dwmac
- ingenic,jz4775-mac
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH net-next v4 6/6] net: stmmac: sun8i: add support for Allwinner H616 EMAC1
2026-09-20 19:45 [PATCH net-next v4 0/6] net: stmmac: add Allwinner H616 EMAC1 support James Hilliard
` (4 preceding siblings ...)
2026-09-20 19:45 ` [PATCH net-next v4 5/6] dt-bindings: net: allwinner: add H616 EMAC1 James Hilliard
@ 2026-09-20 19:45 ` James Hilliard
5 siblings, 0 replies; 7+ messages in thread
From: James Hilliard @ 2026-09-20 19:45 UTC (permalink / raw)
To: Richard Genoud, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Alexandre Torgue, Giuseppe Cavallaro, Jose Abreu,
Maxime Chevallier, Maxime Coquelin, Russell King,
Christian Marangi, Andrew Lunn, Heiner Kallweit, Tiezhu Yang,
Huacai Chen
Cc: Maxime Ripard, Alastair D'Silva, netdev, devicetree,
linux-arm-kernel, linux-sunxi, linux-kernel, linux-stm32,
James Hilliard, Andre Przywara
The H616 secondary EMAC uses a separate system-control clock register
and supports only RMII at 10/100 Mbps. It connects internally to the
co-packaged AC200 or AC300 EPHY and has no external PHY pins.
Add an EMAC1 variant using the dedicated register and enable only RMII.
Leave PHY initialization to the PHY driver instead of using the H3
internal-PHY controls. No RX or TX clock delays are configured for this
RMII-only variant.
Co-developed-by: Richard Genoud <richard.genoud@bootlin.com>
Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Alastair D'Silva <alastair@d-silva.org>
Tested-by: Alastair D'Silva <alastair@d-silva.org>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 9598c386bb21..0ea1860cf203 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -81,6 +81,13 @@ static const struct reg_field sun8i_syscon_reg_field = {
.msb = 31,
};
+/* EMAC1 clock register @ 0x34 in the "system control" address range */
+static const struct reg_field sun8i_syscon_reg_field_emac1 = {
+ .reg = 0x34,
+ .lsb = 0,
+ .msb = 31,
+};
+
/* EMAC clock register @ 0x164 in the CCU address range */
static const struct reg_field sun8i_ccu_reg_field = {
.reg = 0x164,
@@ -143,6 +150,13 @@ static const struct emac_variant emac_variant_h6 = {
.tx_delay_max = 7,
};
+static const struct emac_variant emac_variant_h616_emac1 = {
+ .syscon_field = &sun8i_syscon_reg_field_emac1,
+ /* The co-packaged AC200/AC300 PHY does not use the H3 PHY controls. */
+ .soc_has_internal_phy = false,
+ .support_rmii = true,
+};
+
#define EMAC_BASIC_CTL0 0x00
#define EMAC_BASIC_CTL1 0x04
#define EMAC_INT_STA 0x08
@@ -1277,6 +1291,8 @@ static const struct of_device_id sun8i_dwmac_match[] = {
.data = &emac_variant_a64 },
{ .compatible = "allwinner,sun50i-h6-emac",
.data = &emac_variant_h6 },
+ { .compatible = "allwinner,sun50i-h616-emac1",
+ .data = &emac_variant_h616_emac1 },
{ }
};
MODULE_DEVICE_TABLE(of, sun8i_dwmac_match);
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread