From nobody Sun Feb 8 08:27:35 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E79FB2F28FC; Mon, 3 Nov 2025 10:49:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762166980; cv=none; b=nWJjR7fZd/yxVvF2XJ8Lo9E1flJPdYNvG37d5woX+FJSG5r0tMxDmutwDbqOn+7yk8YvJOUNaKa84RPWZN+T9x6aD/gR/WGmI0zayLWqIuNmG/z4Je8nRPoRy2mEO9A/bPrzP9gHQpt7M0UFqMlUw16Am3DkpOTOr23aegK9vj8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762166980; c=relaxed/simple; bh=0OPJrbTpbWnpgh1IpgBlFhkzIkSzBiYZl1U7Hgvbg3I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sVBz/mYwGa2lAVTwwpoDkTizmXwtI+16cgY4/cjT25LtpaJIM8tBSc/j7lFba7QayZtbwoAm0ItoxOHbyTBjiX5V/vjbVEA7EzIFpm0z57XQnkITsH8PrNMI4gW6FkjSHD4+PuMlP4PYXGVdMKyEVAZr+ROXkhnh/AI6H+xylRU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=gngyqhCs; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="gngyqhCs" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 4030C1A183F; Mon, 3 Nov 2025 10:49:36 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 15A3060628; Mon, 3 Nov 2025 10:49:36 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C00DF10B50003; Mon, 3 Nov 2025 11:49:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1762166975; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=DfdABhxo77Vq2hWxH97QPFhtQeZZYgJJr6yRSjPrA0g=; b=gngyqhCs0gVqdt4b/ON+QymUFz/4cmLsE12V8lsFHKwdis7GNwIJWR9XoGh3+pszOiRbA2 oEJrJDEfXd6/JDSJCVx7bFk0ScTYE8tk2wALSmTlYsw2v+xO0m5/Exg6+eVhA28SI9Ihi8 G5e6wJyqXbCr5yiVxY4ql3dPXqoBjSQiU2oEY6b6hbuPF/76yjqV8p+a7xdLwgd2UOwESD jDRGtEL3EP3DW0JdtSmgmYsDb97fcGqMpGw8wh4JpipZ2BXFd/d0jufPPCzWAL+ZtoncjC 0zqxZg+5wGpUkP7uz31rJgJSfbY1ELkzMfVaW2OYK5fU0z80XYMeB6U32ktXTg== From: Maxime Chevallier To: Andrew Lunn , davem@davemloft.net, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King Cc: Maxime Chevallier , Simon Horman , Boon Khai Ng , =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Thomas Petazzoni , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Lunn Subject: [PATCH net-next v2 1/4] net: altera-tse: Set platform drvdata before registering netdev Date: Mon, 3 Nov 2025 11:49:24 +0100 Message-ID: <20251103104928.58461-2-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20251103104928.58461-1-maxime.chevallier@bootlin.com> References: <20251103104928.58461-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" We don't have to wait until netdev is registered before setting it as the pdev's drvdata. Move it at netdev alloc time. Reviewed-by: Andrew Lunn Signed-off-by: Maxime Chevallier --- drivers/net/ethernet/altera/altera_tse_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/et= hernet/altera/altera_tse_main.c index 3f6204de9e6b..6ba1249f027d 100644 --- a/drivers/net/ethernet/altera/altera_tse_main.c +++ b/drivers/net/ethernet/altera/altera_tse_main.c @@ -1150,6 +1150,7 @@ static int altera_tse_probe(struct platform_device *p= dev) } =20 SET_NETDEV_DEV(ndev, &pdev->dev); + platform_set_drvdata(pdev, ndev); =20 priv =3D netdev_priv(ndev); priv->device =3D &pdev->dev; @@ -1394,8 +1395,6 @@ static int altera_tse_probe(struct platform_device *p= dev) goto err_register_netdev; } =20 - platform_set_drvdata(pdev, ndev); - priv->revision =3D ioread32(&priv->mac_dev->megacore_revision); =20 if (netif_msg_probe(priv)) --=20 2.49.0 From nobody Sun Feb 8 08:27:35 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8154C3009F0 for ; Mon, 3 Nov 2025 10:49:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762166982; cv=none; b=cZkT2ls8R4ea8Y7TPyTZPrj9Cn68UDcqT1lToSh78IJVMyfggU6KC5pQtVPQS3IU450dHMSpZppgLOoIq+sguDfqVEIhni0zqbMkvmMgiWl6dWnPzEx9cVjhG+bSkjufLiT81CH9kIoPmb3ZHUSIfH2uKdftoZ28QvtUqyTreGE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762166982; c=relaxed/simple; bh=InAVLUnBPwjwM5N0wu8ba1szAdFOvcGYqdi4f31hQ8g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AlIvf18Ef/j2rRtmqCwc3FFLPPCxUV6d9oOwmzR2naBJAcMcj7zihMaWHeLWSMpuQTUVMwHBf2y9M748zKh58ACDczsDvvYjSRME/uWnMGjZUVWIs+A+KC1w4i2Rldhik2XrYzDtdeAqCOAAXhP14mvI+d4vhJHWq1km+bzC+cE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=AhoXYc8U; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="AhoXYc8U" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 00F4BC0D7A8; Mon, 3 Nov 2025 10:49:17 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id BFB5B60628; Mon, 3 Nov 2025 10:49:37 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9BBC810B50018; Mon, 3 Nov 2025 11:49:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1762166977; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=JVnvhYZYcU/MclyC3ag8i28LJKKIP3ycGDnvcI+cCrM=; b=AhoXYc8Uu+j1QbV8gyNQGU3NxKrGG6bxDtTswfcKaEJVkaR4cXNKt0SzI2XLwHe/sKMyGr r2tW1w0Viqc+i1WpSCrR+gKxqfv3X8+dl0p/Ibn7FcnJBPR8Wilycs9K8PnGG4CcbibvmG ENCAHVgUP89bfgfRW3gJMvLWM5Nzn9GL+eDXOGjDe3IEE+ry1nmCilamze3On9f1tDSGqE vC2BEGzaAlMUONHSkkpsn81EZB2pWhxTReiK8QXQ1H2UmVis68YI5IolQlzgNvXQgNhQ5M +VkP8QlVFKmLx/mmC1HLhb5pGZwzHUiUFXfozf32pDYq6ZxQYnZA1aVRIcQFWA== From: Maxime Chevallier To: Andrew Lunn , davem@davemloft.net, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King Cc: Maxime Chevallier , Simon Horman , Boon Khai Ng , =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Thomas Petazzoni , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Lunn Subject: [PATCH net-next v2 2/4] net: altera-tse: Warn on bad revision at probe time Date: Mon, 3 Nov 2025 11:49:25 +0100 Message-ID: <20251103104928.58461-3-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20251103104928.58461-1-maxime.chevallier@bootlin.com> References: <20251103104928.58461-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" Instead of reading the core revision at probe time, and print a warning for an unexecpected version at .ndo_open() time, let's print that warning directly in .probe(). This allows getting rid of the "revision" private field, and also prevent a potential race between reading the revision in .probe() after netdev registration, and accessing that revision in .ndo_open(). By printing the warning after register_netdev(), we are sure that we have a netdev name, and that we try to print the revision after having read it from the internal registers. Suggested-by: Andrew Lunn Signed-off-by: Maxime Chevallier Reviewed-by: Andrew Lunn --- drivers/net/ethernet/altera/altera_tse.h | 3 --- drivers/net/ethernet/altera/altera_tse_main.c | 12 ++++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/altera/altera_tse.h b/drivers/net/etherne= t/altera/altera_tse.h index 82f2363a45cd..e5a56bb989da 100644 --- a/drivers/net/ethernet/altera/altera_tse.h +++ b/drivers/net/ethernet/altera/altera_tse.h @@ -401,9 +401,6 @@ struct altera_tse_private { /* MAC address space */ struct altera_tse_mac __iomem *mac_dev; =20 - /* TSE Revision */ - u32 revision; - /* mSGDMA Rx Dispatcher address space */ void __iomem *rx_dma_csr; void __iomem *rx_dma_desc; diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/et= hernet/altera/altera_tse_main.c index 6ba1249f027d..343c78a493a1 100644 --- a/drivers/net/ethernet/altera/altera_tse_main.c +++ b/drivers/net/ethernet/altera/altera_tse_main.c @@ -892,9 +892,6 @@ static int tse_open(struct net_device *dev) netdev_warn(dev, "device MAC address %pM\n", dev->dev_addr); =20 - if ((priv->revision < 0xd00) || (priv->revision > 0xe00)) - netdev_warn(dev, "TSE revision %x\n", priv->revision); - spin_lock(&priv->mac_cfg_lock); =20 ret =3D reset_mac(priv); @@ -1142,6 +1139,7 @@ static int altera_tse_probe(struct platform_device *p= dev) struct net_device *ndev; void __iomem *descmap; int ret =3D -ENODEV; + u32 revision; =20 ndev =3D alloc_etherdev(sizeof(struct altera_tse_private)); if (!ndev) { @@ -1395,12 +1393,14 @@ static int altera_tse_probe(struct platform_device = *pdev) goto err_register_netdev; } =20 - priv->revision =3D ioread32(&priv->mac_dev->megacore_revision); + revision =3D ioread32(&priv->mac_dev->megacore_revision); + + if (revision < 0xd00 || revision > 0xe00) + netdev_warn(ndev, "TSE revision %x\n", revision); =20 if (netif_msg_probe(priv)) dev_info(&pdev->dev, "Altera TSE MAC version %d.%d at 0x%08lx irq %d/%d\= n", - (priv->revision >> 8) & 0xff, - priv->revision & 0xff, + (revision >> 8) & 0xff, revision & 0xff, (unsigned long) control_port->start, priv->rx_irq, priv->tx_irq); =20 --=20 2.49.0 From nobody Sun Feb 8 08:27:35 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A27D301039 for ; Mon, 3 Nov 2025 10:49:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762166983; cv=none; b=dSGeVaS47if+lRBfX+Lo/0osbk7k4u3HzI9SbmajtuYPSChhBVyNCYihtsbaARmkZDqMmGGsRsmPyqdZmeFn0Aho7qynqO4SlCZLAdswJ2yUUTZhYkkzzM8+ObcJUw1RRZiZ1c8lb2eodD4yC4gmRutWMWolHJPuBgSrh8/rLU4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762166983; c=relaxed/simple; bh=xOzYIPM8KTs0S15N0TQI3qQZXr+215520Jm+o6h1zcU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=glIALn5ueQyGrs4JBiNygxgGBcx+MTimXRNSZMkFc68S3/J/XTwM2eXJYN2tddIA73RXt5yXcQfK/SZ1UyB83ISKWg4/1/bsKbDUUePoDpASUSqoac2BvJYU5yvy7dzsaowTx8VPWm+3BaAQCMlMzT3/MFbnXQN1+w74a9gO8Gg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=g0VtCmZg; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="g0VtCmZg" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id D4EA41A183D; Mon, 3 Nov 2025 10:49:39 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A93DF60628; Mon, 3 Nov 2025 10:49:39 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 55E0510B50014; Mon, 3 Nov 2025 11:49:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1762166978; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=om6wHCpy7rTQ5fiCmhmBYc/5JN7l85iZJ6/YxQjLX1c=; b=g0VtCmZgHjb0pB3bwDcm4QpSfQDoVXlx0ge0ujYmBzpxsc12xZLGyWFZTAaYNfbId3dhGV olfOQFok4HXzsdG3dY6uxHaIeX3RL2InA90S6PHg8MBTgwKvJt3wAuvBFO3E6v1B8DtBzg 269c+J6DqN7glyEr4XK55f+Wnkq+qO6I6uU6a5b81PfosIlPgoZKHFgrqH3baCFxq63WJ+ WnDVFKDnZh3OxNWxvkSMTGJMytT2Rz7fY/7sykFBAaTkXzZ6nIuUBeUunIqQzoE2iiC5eC tP2QiWAzjjIvjCaSoOmpKay4VAahWk1XtqYi1fZpEzxzDR8fH4vPUOWxitaaDg== From: Maxime Chevallier To: Andrew Lunn , davem@davemloft.net, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King Cc: Maxime Chevallier , Simon Horman , Boon Khai Ng , =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Thomas Petazzoni , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Lunn Subject: [PATCH net-next v2 3/4] net: altera-tse: Don't use netdev name for the PCS mdio bus Date: Mon, 3 Nov 2025 11:49:26 +0100 Message-ID: <20251103104928.58461-4-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20251103104928.58461-1-maxime.chevallier@bootlin.com> References: <20251103104928.58461-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" The PCS mdio bus must be created before registering the net_device. To do that, we musn't depend on the netdev name to create the mdio bus name. Let's use the device's name instead. Note that this changes the bus name in /sys/bus/mdiobus Reviewed-by: Andrew Lunn Signed-off-by: Maxime Chevallier --- drivers/net/ethernet/altera/altera_tse_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/et= hernet/altera/altera_tse_main.c index 343c78a493a1..003df8970998 100644 --- a/drivers/net/ethernet/altera/altera_tse_main.c +++ b/drivers/net/ethernet/altera/altera_tse_main.c @@ -1404,7 +1404,7 @@ static int altera_tse_probe(struct platform_device *p= dev) (unsigned long) control_port->start, priv->rx_irq, priv->tx_irq); =20 - snprintf(mrc.name, MII_BUS_ID_SIZE, "%s-pcs-mii", ndev->name); + snprintf(mrc.name, MII_BUS_ID_SIZE, "%s-pcs-mii", dev_name(&pdev->dev)); pcs_bus =3D devm_mdio_regmap_register(&pdev->dev, &mrc); if (IS_ERR(pcs_bus)) { ret =3D PTR_ERR(pcs_bus); --=20 2.49.0 From nobody Sun Feb 8 08:27:35 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A398630147F; Mon, 3 Nov 2025 10:49:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762166984; cv=none; b=jhB6/M3p07w8Ks0OjaXY9JhM8a1V3wBjt7AFDUSQFS8Ea3+2EH9y+gfFkD7B2K0Rjz60dgF17CAczwUIEWwpLCL9JlUyyLuq06+Uuv2ibZXF3AirrRKM0xu3UNu5U34yw0FrZLd6qxUmcQnmCvfJ5NCnd+M2z7Ye8eoxKUr1qXQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762166984; c=relaxed/simple; bh=c9t+E3pawcbLcU0pARfnzXYmRo4V+2g7Cp66AAjOSmE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LUBMR6Kmk8EzzZkd3ho8zhSTX8bk8N6/BXSP3ORLKriCj9JS2VlQmEGJ5sLU1NfyU6KB6aDvv9i74/7p6mpidfCvr+v11ewzoMPnnhbjOyVPFRio4KsnL9Aec7uN9ZnFnSR7HjGI19R8xsQi8Xt6CA4gsm0owDU1QsWLHMRdVjM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=XZemZQeV; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="XZemZQeV" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 3D6DAC0D7AA; Mon, 3 Nov 2025 10:49:20 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 09F2B60628; Mon, 3 Nov 2025 10:49:41 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D1F4210B50078; Mon, 3 Nov 2025 11:49:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1762166980; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=8TPCTtZANNTp/VYFJqCDjc/4NduN0XXsteAOjwzluOs=; b=XZemZQeVyfmAD5Ol4lpacCnPomlQc5PGvGZtuF5hUmBD5HgGbMC/ffi/WPb3uMtmymsdCk +m/waRSCjN4WjF3vo0EmkX5HfPT9XCDA96d8HjbZU56WWtrfJ1Us1YdYQE8NUQn6YkKj+e QlWCvRndzfhnEXQVl10nYLKOPpDVo39S7ikz6LXwyqv+kbDysyGoRPJzOfqaowH5DgNsc+ SAHrOwrZfHRokQ+bMw88vpYOCLUnvOsv9YXSS0mj8jwpi4T3+XwyRECA0FmaPgEUwPDZlY H3b27k5JroclJafsHX6JyZqL5t80gytpIjR0t9gxt8+hUSbO8Ec7iaHnRf00mw== From: Maxime Chevallier To: Andrew Lunn , davem@davemloft.net, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King Cc: Maxime Chevallier , Simon Horman , Boon Khai Ng , =?UTF-8?q?Alexis=20Lothor=C3=A9?= , Thomas Petazzoni , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Lunn Subject: [PATCH net-next v2 4/4] net: altera-tse: Init PCS and phylink before registering netdev Date: Mon, 3 Nov 2025 11:49:27 +0100 Message-ID: <20251103104928.58461-5-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20251103104928.58461-1-maxime.chevallier@bootlin.com> References: <20251103104928.58461-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" register_netdev() must be done only once all resources are ready, as they may be used in .ndo_open() immediately upon registration. Move the lynx PCS and phylink initialisation before registerng the netdevice. We also remove the call to netif_carrier_off(), as phylink takes care of that. Reviewed-by: Andrew Lunn Signed-off-by: Maxime Chevallier --- drivers/net/ethernet/altera/altera_tse_main.c | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/et= hernet/altera/altera_tse_main.c index 003df8970998..ca55c5fd11df 100644 --- a/drivers/net/ethernet/altera/altera_tse_main.c +++ b/drivers/net/ethernet/altera/altera_tse_main.c @@ -1386,24 +1386,6 @@ static int altera_tse_probe(struct platform_device *= pdev) spin_lock_init(&priv->tx_lock); spin_lock_init(&priv->rxdma_irq_lock); =20 - netif_carrier_off(ndev); - ret =3D register_netdev(ndev); - if (ret) { - dev_err(&pdev->dev, "failed to register TSE net device\n"); - goto err_register_netdev; - } - - revision =3D ioread32(&priv->mac_dev->megacore_revision); - - if (revision < 0xd00 || revision > 0xe00) - netdev_warn(ndev, "TSE revision %x\n", revision); - - if (netif_msg_probe(priv)) - dev_info(&pdev->dev, "Altera TSE MAC version %d.%d at 0x%08lx irq %d/%d\= n", - (revision >> 8) & 0xff, revision & 0xff, - (unsigned long) control_port->start, priv->rx_irq, - priv->tx_irq); - snprintf(mrc.name, MII_BUS_ID_SIZE, "%s-pcs-mii", dev_name(&pdev->dev)); pcs_bus =3D devm_mdio_regmap_register(&pdev->dev, &mrc); if (IS_ERR(pcs_bus)) { @@ -1441,12 +1423,30 @@ static int altera_tse_probe(struct platform_device = *pdev) goto err_init_phylink; } =20 + ret =3D register_netdev(ndev); + if (ret) { + dev_err(&pdev->dev, "failed to register TSE net device\n"); + goto err_register_netdev; + } + + revision =3D ioread32(&priv->mac_dev->megacore_revision); + + if (revision < 0xd00 || revision > 0xe00) + netdev_warn(ndev, "TSE revision %x\n", revision); + + if (netif_msg_probe(priv)) + dev_info(&pdev->dev, "Altera TSE MAC version %d.%d at 0x%08lx irq %d/%d\= n", + (revision >> 8) & 0xff, revision & 0xff, + (unsigned long)control_port->start, priv->rx_irq, + priv->tx_irq); + return 0; + +err_register_netdev: + phylink_destroy(priv->phylink); err_init_phylink: lynx_pcs_destroy(priv->pcs); err_init_pcs: - unregister_netdev(ndev); -err_register_netdev: netif_napi_del(&priv->napi); altera_tse_mdio_destroy(ndev); err_free_netdev: --=20 2.49.0