From patchwork Tue Sep 22 00:45:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hilliard X-Patchwork-Id: 3410 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mxe881.netcup.net (Postfix) with ESMTPS id B4E761C3026 for ; Tue, 22 Sep 2026 02:47:32 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=gmail.com; spf=pass (sender IP is 172.234.253.10) smtp.mailfrom=linux-sunxi+bounces-26112-noreply=patchwork.local@lists.linux.dev smtp.helo=sea.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.234.253.10 as permitted sender) client-ip=172.234.253.10; envelope-from=linux-sunxi+bounces-26112-noreply=patchwork.local@lists.linux.dev; helo=sea.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id A857F662CF for ; Tue, 22 Sep 2026 00:45:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A0BF346A0A; Tue, 22 Sep 2026 00:45:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UyQSDt8N" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-oi2-f13.google.com (mail-oi2-f13.google.com [74.125.231.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFFD73515CB for ; Tue, 22 Sep 2026 00:45:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.205 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790037931; cv=none; b=fLGK7OtZ5z6I6/Nxddcm84SBi9FlN8vz4OH+MNupShJaGlTRdTyL7FYlgYl4JIBjP1006pV7T3yvH8PieW2zrEObD5+Uwm+U7Swlx43n/zHzIhcxKLNhLwrqWHpJXBebU897lZcRoTOE7wDja2Q2iU8v/PIC7G7l0C8zZKf+Dw8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790037931; c=relaxed/simple; bh=53OlHK3z2SFt6DREz3cMdJsuFM+JmcGd/PPFzivyI5k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K8fECEG9ZmqFLEp7mAlrsV+JrCjopRw4OZZLSx491cwHCLRPTURHHQ/EIamHkqmE8spqtUzbCtLLBjWFUz5kfZQ/OEdYZIu9CqZcXer23eipRCoP5dvMGEaszP2SSJa/Oq8gufznZAR7dCb40V34ubAukvGQdkFJ/pd8/5Pj60Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UyQSDt8N; arc=none smtp.client-ip=74.125.231.205 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi2-f13.google.com with SMTP id 5614622812f47-4c3b639adbcso2781941b6e.1 for ; Mon, 21 Sep 2026 17:45:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790037928; x=1790642728; darn=lists.linux.dev; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ZuhLhvmyUunUsMDDWLfZKTjtEMkziUs08QZF8zYObXw=; b=UyQSDt8NXBocpDbak45NwnTh7eTSDA6a/Aq/RInjoFfZMfjdRF9FOPbGnfKJczJRm1 XFaDNBHuPnSenfcENPp1PKClmHsNpiUyXz5ABQmWm3upLaYGih4ld9naIbw9ETGVy80K M/0OP17Mp/PaD6kyf8Jp4OKHu8VGSBMsl3rheVhk9X3phJ7B2kL0dD+zXinuGODjJLqK tYB1u5CUuF0VzNnBvveiUcktjU8IUj54I0dcI61CNKMEftFne4Th107L60w+9eWdcFin iQzITOHMKhr6xeGWfAfcuDn8Qy5Qdp2jXjyknv+Fimntazz2mgzWW5ZTtvwhOnfZ+oJE XrBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790037928; x=1790642728; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ZuhLhvmyUunUsMDDWLfZKTjtEMkziUs08QZF8zYObXw=; b=ZzbvBn1YFNjZJgOeor2MqkdxWH5Kk+YT57xqPjlCe61JJzQ+G1cPim+SQABSvfXz4b d3OrDMSh7HychJORHhvFZl7vVvhwbt3Azr6oYzFdGEJk5c59B3muy7Sv3OW15mQsqBtr vJ0Vffi9mRDnQN5XIrGYg+oZBMkqGlp9vgnUubZ5O2dRohRV/HnvRy2/t+Wyye6D5TnQ fbEEhmvwGLMyX8sMKiMX3J5npdNKCEchxbUjKKooUllU3Qb014ROsoMHbA4IeKc/SVnR bhB195ohOqR18Y20+DydWVIaSKobAX7IP5+lcAlhsRjC3rTowWQrHcSGPutZx9cIWnyO o7LQ== X-Forwarded-Encrypted: i=1; AKwUvBykyOYk1gYO92Rx3qy0iBhN6bMAnut0rYmZv/qMh4Za2N5+VfUvihORO0HKhikn+9KQBsLxriC9NNOFKw==@lists.linux.dev X-Gm-Message-State: AFuF++kUdy7j0b8aCmlF5iS7vgNV4pckpjLdtzULNlT/yVS9B4fPBn8M zJgxWVhR4dD/O7Dg81lFZrWn81dhJjZMbrV4DHAahc4qRKSml/WU1wax X-Gm-Gg: AYBFou1dWg5pYw3El9h+eLmsXwAfkU2E8g+keG4kaH+/vb5UbAPc/AHiYTQ7oKc2jAL PIphtRjUe5Np2fefpj+3AIC+3iiPsFK9tWiZaX3gR8AHugTp28fkjCRKTEssdGJ1egWoYus6vzG 0+5PzlUdxzc+tFy3uYmb3AAIPnaUWFTgeDGEndyTvfrrbIMpHs5LdwjYvg9PEYmlNb5ett3cqR4 g48NograzFjiy5MVolEC2ASESPUAtSNj3GUddhFBjgeuEoyZRC9HSYd8Ly8FbyJgq1XWIy8vIQZ D8PfU1jXPXFi7efKKiqQDxk7KGj/5FQaArC1oJxnJe07kB6pi6F90f88c1XbbD+/cLPMrn54rjr 2rI960hn/J8WZ1cSVXjyvDQ53lJ4HjOmLGUwDfTAKumsAdreCVdg0spnFP/6yLIaUUzCXliGfdJ DvgZHK5Jqcdf+d59DNxs4X2fazHtOUuNJCn/VnKUHUXjtZAOG7bA2RVOEx4T2y6xsqEUli98Fb0 jnEd/NYXkR1F0OyjmYyytJ72fNmt/aCY6tLdQDGZxulx+ovC7dmm0bkpILGSQDgcjSqENMZ68yY BUDBX6eFfViE0ALRtQJgmiMiH+suOFTCwt3z7roU9xhR/PZHYi2w6FV7d+DoIgoQvI1n1gGZmjD h3ycczNUhkEAydbG0vET9IiOUtat4bKyE X-Received: by 2002:a05:6808:5243:b0:4b3:7fa3:890b with SMTP id 5614622812f47-4ccf6a788a9mr11024712b6e.2.1790037928310; Mon, 21 Sep 2026 17:45:28 -0700 (PDT) Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4d4bb6be7b3sm60201b6e.0.2026.09.21.17.45.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2026 17:45:27 -0700 (PDT) From: James Hilliard Date: Mon, 21 Sep 2026 18:45:24 -0600 Subject: [PATCH net-next v5 1/3] net: stmmac: sun8i: reset the MAC after PHY initialization Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20260921-submit-h616-emac1-v1-v5-1-ada661ed9e9b@gmail.com> References: <20260921-submit-h616-emac1-v1-v5-0-ada661ed9e9b@gmail.com> In-Reply-To: <20260921-submit-h616-emac1-v1-v5-0-ada661ed9e9b@gmail.com> To: Richard Genoud , Maxime Chevallier , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Maxime Coquelin , Alexandre Torgue , LABBE Corentin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Jose Abreu Cc: Alastair D'Silva , Maxime Ripard , James Hilliard , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org X-Mailer: b4 0.15.2 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= 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. Fixes: 9f93ac8d4085 ("net-next: stmmac: Add dwmac-sun8i") Signed-off-by: James Hilliard --- 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); From patchwork Tue Sep 22 00:45:25 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hilliard X-Patchwork-Id: 3411 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mxe881.netcup.net (Postfix) with ESMTPS id 3F23C1C1EBD for ; Tue, 22 Sep 2026 02:48:02 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=gmail.com; spf=pass (sender IP is 172.234.253.10) smtp.mailfrom=linux-sunxi+bounces-26113-noreply=patchwork.local@lists.linux.dev smtp.helo=sea.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.234.253.10 as permitted sender) client-ip=172.234.253.10; envelope-from=linux-sunxi+bounces-26113-noreply=patchwork.local@lists.linux.dev; helo=sea.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id 926B568CD8 for ; Tue, 22 Sep 2026 00:45:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 842E6357D1D; Tue, 22 Sep 2026 00:45:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UdhcUDx/" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-oi2-f13.google.com (mail-oi2-f13.google.com [74.125.231.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3650348C7B for ; Tue, 22 Sep 2026 00:45:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.205 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790037934; cv=none; b=bbSw23B66JLfBltsKDujywYix5gKUnQ8/OyaFR/a5LmpKHuhbMlFlBQ4nfpo50s6yTeLhC2Ep5ahyDxR0opfEdsr3RuZs7OZFipzA8nn4wIHYaF6GLb0IV2jOdyHN9WeBy1t83UJFMwty49nj9r3kmjYrVPHfW1/ppeGBorkO1s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790037934; c=relaxed/simple; bh=Gj+LzOejuhn4QUWRd2BeQZ06xMLgJHxeiRX4lCDRZzE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aFHOna3HZUVbv1J8BvfY/jHqSxcZVN6jeOOO21R2SzQ0GC8IoWDjCvYPDFtuCHu4Y/TYb/0Y/X9Qr+a47In8f2vJiGYtcoz8irSFcoPdOIGxrYRhTTmo7HpRgS9zK3TM9KK5neG2u6DdjWULygYbGbVPtqLwzqDTXWEn3pNMPwc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UdhcUDx/; arc=none smtp.client-ip=74.125.231.205 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi2-f13.google.com with SMTP id 5614622812f47-4bb359e6878so1340046b6e.0 for ; Mon, 21 Sep 2026 17:45:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790037930; x=1790642730; darn=lists.linux.dev; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=oLXSL+1npHD8gI1D6ujrAzi7XeKmrbhfqQT3WXutYPk=; b=UdhcUDx/SlU40rBuzRzX66/ubXmeQQ+aEEreBv7xZEaLL1/ASCrUXWazCWRRAhZTZ8 T7gh75BqPl+h0mG+xEhQ5tJdkKtzr6BJaRgVVsXqR33eCkaTNR54H8xXknx6xDi0bXDB E1Qnaj7/bFCpmgtI3hQa2myXrPLrQ8l+vIBmld35M6g0Py8Rddohl7sLJ7jbdmbwGTe5 CMH4RlCQWf+oRwtmYkYiU4z1FcBaz+dTZd6YoEPJam8aF3uLKwJ0SBNUnTDfnAKKFaGU 8OOugft/dU9i9kFXvEqs/ckffs+ONoF7NxTZzoOUrfSxt2woTsukiFjsJzj2ubAJEm0o wt1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790037930; x=1790642730; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=oLXSL+1npHD8gI1D6ujrAzi7XeKmrbhfqQT3WXutYPk=; b=09t7jmcN0m0LVknrmIKMakHnbSfHPpaa0q/V9Byfz5RROZ0LVJjAly6z29o0FrnFr5 Sndxcx0HaIcziwtppJ7eMHHJ3d7JaV1yDxDezVGj/9KbQ+ukY08zkUSBjxxO8iTcaYp3 dfrLrf8Qf1jcNXVaiw+866vYzSS7g0T+eLDeTnIcfBts41lyHLiQMfu9S/w3RZEByFqM /j7u6KqXjWselF/QtwQk6HdgCxgIBHB2koKFLvRD0ikVPncYGitUL6lDtaTMDr66q3p/ Lyr52+SdmWaM9OB/8kBxWdwk/lVm4+g+g4TjJxrqy553XUaLFEWyJQ/gDpOQoN9sqDzS yiHA== X-Forwarded-Encrypted: i=1; AKwUvBw2xHZmgcIu9vUBU4HhMpGGWSF6qkWo+QN5/um9VRmgI136AGq537I3WzH886xSUoqbLYttAnxKKJMfdg==@lists.linux.dev X-Gm-Message-State: AFuF++miEWTyrgg33eQ3N21/p4v/TaEIHv3ca9UkRmYXYLCoHUVChqkp nXbmpq2IS8DlW08/WYzVBpNlxVoOXiym6j/1Em0B5n7vdjoDt8heZHrO X-Gm-Gg: AYBFou3F9+7XQ5TF088IrBbY2NjFz02f2fYHINGQ/Ee3GCei+S/4xMxnsWw/xKHBwTH SV6prEyAeoTfgQ4ys78usYhsu228strMAwhGufZXTu9fb0msF2U1WYumO4cd+dFizF2plYaPGzh l4J10lhyJwr44JSuL2ZasaoTvyi/4YSGY2IZhAv+GH3IrTgE8gev8JX9tOHbZiGu3/sZ0D++Trc geQg/1M6HNd5j6SGxOv1rF78PTs0ogNLFVJevcjgAniQmFJMpjiDMh9uJRItWpMGwPPQ7zAJk0h 8br19l1FW3ZasheUpvt8N1QfRwlE4NqZXr6dnf1bnW0TcSeMe39PdYOcQ01Sj5CPM9jfsNN5MKY uW4y479XkuSxqDFQe2fHnhzHz53FlwMwfiZ5iBOP5mKdBd28nSqmkheZzEx5KC6W8d6ZF2J+ONa wETAu4e/PQ1QOEWIsl/8OaUSYh6stYMLbUbS5f2MCA0P7gMg+R9zQQb7Q60dxxa/+p7o4HdtRay 9mtZXh+f5h/MfM9dHmkAh/GMpApxwfmMBxkshliJOhoowL2sqY6xCRi3/nYH0rBzwROp2X7Eud8 z3qff0ny1Mu7rGHY5snAAfZFVlLx4If1QHGngF7GSmytIiBAhjxEJN+buF5zEEzErnS5UfsG8zI poZ+DzfINTWKSGL4TcUk7LA== X-Received: by 2002:a05:6808:1526:b0:4b3:7aeb:1b73 with SMTP id 5614622812f47-4ccf59c8345mr10592065b6e.2.1790037930082; Mon, 21 Sep 2026 17:45:30 -0700 (PDT) Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4d4bb6be7b3sm60201b6e.0.2026.09.21.17.45.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2026 17:45:29 -0700 (PDT) From: James Hilliard Date: Mon, 21 Sep 2026 18:45:25 -0600 Subject: [PATCH net-next v5 2/3] dt-bindings: net: allwinner: add H616 EMAC1 Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20260921-submit-h616-emac1-v1-v5-2-ada661ed9e9b@gmail.com> References: <20260921-submit-h616-emac1-v1-v5-0-ada661ed9e9b@gmail.com> In-Reply-To: <20260921-submit-h616-emac1-v1-v5-0-ada661ed9e9b@gmail.com> To: Richard Genoud , Maxime Chevallier , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Maxime Coquelin , Alexandre Torgue , LABBE Corentin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Jose Abreu Cc: Alastair D'Silva , Maxime Ripard , James Hilliard , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org X-Mailer: b4 0.15.2 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [-1.16 / 15.00]; BAYES_HAM(-5.50)[100.00%]; RBL_SENDERSCORE(2.00)[172.234.253.10:from]; SUSPICIOUS_RECIPS(1.50)[]; DMARC_POLICY_SOFTFAIL(1.00)[gmail.com : SPF not aligned (relaxed), No valid DKIM,none]; MAILLIST(-0.15)[generic]; MIME_GOOD(-0.10)[text/plain]; BAD_REP_POLICIES(0.10)[]; HAS_LIST_UNSUB(-0.01)[]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; RCPT_COUNT_TWELVE(0.00)[27]; FROM_HAS_DN(0.00)[]; PRECEDENCE_BULK(0.00)[]; TAGGED_RCPT(0.00)[netdev,dt]; FORGED_SENDER_MAILLIST(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[d-silva.org:email,sea.lore.kernel.org:rdns,sea.lore.kernel.org:helo]; FREEMAIL_CC(0.00)[d-silva.org,kernel.org,gmail.com,vger.kernel.org,lists.infradead.org,lists.linux.dev,st-md-mailman.stormreply.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; ASN(0.00)[asn:63949, ipnet:172.234.224.0/19, country:SG]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(0.00)[+ip4:172.234.253.10]; TO_DN_SOME(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[100.90.174.1:received,174.29.1.49:received,74.125.231.205:received]; FROM_NEQ_ENVFROM(0.00)[jameshilliard1@gmail.com,linux-sunxi@lists.linux.dev]; FREEMAIL_TO(0.00)[bootlin.com,lunn.ch,davemloft.net,google.com,kernel.org,redhat.com,gmail.com,sholland.org,foss.st.com,st.com,synopsys.com]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[bounces-26113-noreply=patchwork.local]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[172.234.253.10:from] X-Rspamd-Queue-Id: 3F23C1C1EBD X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= 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 Tested-by: Alastair D'Silva Signed-off-by: James Hilliard --- .../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 From patchwork Tue Sep 22 00:45:26 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hilliard X-Patchwork-Id: 3409 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mxe881.netcup.net (Postfix) with ESMTPS id 8C98F1C1EBD for ; Tue, 22 Sep 2026 02:46:18 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=gmail.com; spf=pass (sender IP is 104.64.211.4) smtp.mailfrom=linux-sunxi+bounces-26114-noreply=patchwork.local@lists.linux.dev smtp.helo=sin.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 104.64.211.4 as permitted sender) client-ip=104.64.211.4; envelope-from=linux-sunxi+bounces-26114-noreply=patchwork.local@lists.linux.dev; helo=sin.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sin.lore.kernel.org (Postfix) with ESMTP id 7D5522E873 for ; Tue, 22 Sep 2026 00:45:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4240361DD0; Tue, 22 Sep 2026 00:45:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rhIZS39D" X-Original-To: linux-sunxi@lists.linux.dev Received: from mail-oi2-f13.google.com (mail-oi2-f13.google.com [74.125.231.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63B9C35203C for ; Tue, 22 Sep 2026 00:45:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.205 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790037935; cv=none; b=MypctD8Zqb7+ryBHQl7cSY73URyamII3FkzkYUL/HdTOzYCo9HjkWUEQSWl4eZ5cRD4NZyQy9XywnSQmW6mgsTyH75YKd6fl7rxJks8NuJn1skyknLKXnGTYHHNik7O1WS1wwDHSBGT4XsRydw8ufdy5GOHiDsqcwOp1iFDeZ5o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790037935; c=relaxed/simple; bh=e9hk5Tsdquyr+5avHPEA7bcfLf2nOdnHsiLzbvu4On4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=grD7W9BLcN5lF1YA4PAI8ZLDZoT7KvdA0pLMjcdYTGbZhsUbK0AOJjJS+8OmoYUC5X8G6yJQjS9iQNozEVGtUVGBK07mf2z4Nd2GeqMeR40s/VU1jr7dtTr8z0FSbTz/zKf49d3fwdOrI65gstxtHxsFMaKoDOESxLwKHAKvHro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=rhIZS39D; arc=none smtp.client-ip=74.125.231.205 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi2-f13.google.com with SMTP id 5614622812f47-4c13f2685f2so1996591b6e.1 for ; Mon, 21 Sep 2026 17:45:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790037931; x=1790642731; darn=lists.linux.dev; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=gFndLx5Yqc+lsDlrSDVoBXxkYOfQ85XX/QivbJQF5Mw=; b=rhIZS39Dt+44Iqhtxv/iYgdjTgCzftPzEHI5j58DvpkFhbqwG6AhaY5qfvOen2Dea3 PEgRBCEIvcwBhz4uUKs3Y9IUCDDaujNMs0fYqFpQUzeTAMrNLai7P4zJ/sxNJhz2ByU4 dZ8e35OzQFZQq00Z2RqgZUQoHq76WxcjrJMCYUrweGZrxFe6wE0C/loxe8w7IQpJUsoM 2dAzZGAVt0Y/ZwQtTuSaTj6RqTY4q0vOv8J12OxBsTElj1YY+crWW54oSdUaedvzs8S9 N2E8WhBFXwaLZHrCW0DvBMKFDJtzQXTuuAL/JVv1nKGJgzZedvjIk3RHedOHafiKu7pN ZHkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790037931; x=1790642731; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=gFndLx5Yqc+lsDlrSDVoBXxkYOfQ85XX/QivbJQF5Mw=; b=T5POkv1ln5TfX+vFl2r8GLJWKTZ7b8h6hlSOJJmEuK9t/qgBYdc0efGGh+tLk3ge4v dtUgblzAmeCfLv7XMF930Ynu8hf90cUjMKdMepEXdsfev1K939ApxoCOFBnYNGcg3rqG aYBLsEn2XaJouR2gPeC2W9sOOzGu6dKn1wdwCjkDliAaI2WZ9+pTN82tQs8JCFppJq5b gZ8Oo15H19lpOz9E1KqiIG8wSw6AVLWn3IdzZ0h0lkBVw1mKs6eKtqOkaYGlO6R3HIbn YTPR3Z1XFQkql/e9uXeXUEsB0L6c/GxPZSyIqs6a3Plm09zrV1CfmyclalnuOkRonX2w VL8g== X-Forwarded-Encrypted: i=1; AKwUvBzkP2UHoirOT6swlQxEjSc99bdPazEypSMrqsfRX4HdBE3CJn0I6PKEQJWm43h3v9pMnn2h+p9OMU8C8Q==@lists.linux.dev X-Gm-Message-State: AFuF++mH8BD85uwPQ/hGuyUjIulubmCgw9YuJ9L+Y4QEA5lMpZo5BPNw iwTznRkxvgdB4aA0Gph118N98GjRs9bVQ312HRCVNpRsuFZr7nBY4aeL2Y1XdHtG X-Gm-Gg: AYBFou0N8QwjvIcmEvBr7m8h1R45m5whs+bGkAQ4zx3lrlnrxhvEJcra/pGSx0cw8Mp zIzOrij5Lh6TPRYgYE6LM0SPCElSbHGk+yCbNmo+VUQ3WFw4vEbsEPIu3GMzhsV9ncjrdVTwwNJ 5GJUzVBuc8VDB9PwiQ9rS/Z79BHdz+xCP51BAWQLT/sqb2l5Adr0u0SDvrAGShsAMJ1EhYjJPps GXmAWvjMyHaOa7elxMuP97nP8wPT8CqWf0lY9KuFAkxLjkiwKZsRyBrAPdDdxLuZg62pjFDWEX1 LL1iKA1L8en02M1b9RhOL2/7yyK5OHQDbOPCRm0vcFKsfkMkjC38qAseZ4mg1GOxOKTXZEv4Czj e4mwdL1b7sieBPKrOm1k9BA9vgITPpDQ3iVTXZysB4GlpznkhUGvA9bSY58x8FGAtIkSmUfw4Dy Hdx3m+LYG9xdXsb+TmVU5yQgce5D9FSjathJc/Q+ybbZfTrqR08Sc3ZGwJgRzh28b7n/kf987cC AA0buNefSYoy0R2lluXrUPyo6HCOBzuweWaylwJzuRURbIagdivRHEe0YjjjygX40FpJRZr0UOF U8Ddo+CazUCmd5yygHxZV4VSVjz6R83zvpnsNNdgAkyedbUQKEDWDSMmbLlrTNsCVXSG34ls8Y1 JHyTBd3/vOicU2rJNt1nF2xnnu0/4Nhjg X-Received: by 2002:a05:6808:1701:b0:4b9:a8ac:487 with SMTP id 5614622812f47-4ccf91570e3mr11567524b6e.37.1790037931601; Mon, 21 Sep 2026 17:45:31 -0700 (PDT) Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4d4bb6be7b3sm60201b6e.0.2026.09.21.17.45.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2026 17:45:30 -0700 (PDT) From: James Hilliard Date: Mon, 21 Sep 2026 18:45:26 -0600 Subject: [PATCH net-next v5 3/3] net: stmmac: sun8i: add support for Allwinner H616 EMAC1 Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20260921-submit-h616-emac1-v1-v5-3-ada661ed9e9b@gmail.com> References: <20260921-submit-h616-emac1-v1-v5-0-ada661ed9e9b@gmail.com> In-Reply-To: <20260921-submit-h616-emac1-v1-v5-0-ada661ed9e9b@gmail.com> To: Richard Genoud , Maxime Chevallier , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Maxime Coquelin , Alexandre Torgue , LABBE Corentin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Jose Abreu Cc: Alastair D'Silva , Maxime Ripard , James Hilliard , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Andre Przywara X-Mailer: b4 0.15.2 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= 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 Signed-off-by: Richard Genoud Reviewed-by: Maxime Chevallier Reviewed-by: Andre Przywara Reviewed-by: Alastair D'Silva Tested-by: Alastair D'Silva Signed-off-by: James Hilliard --- 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);