🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24169

Re: [PATCH net-next v4 5/5] net: hix5hd2_gmac: Support fixed-link

#24169
From: Andrew Lunn
Date: Sun, 29 Nov 2026 16:01
46 lines
9880 bytes
> @@ -1176,37 +1176,55 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
>  		hix5hd2_phy_reset(priv);
>  	}
>  
> -	bus = devm_mdiobus_alloc(dev);
> -	if (bus == NULL) {
> -		ret = -ENOMEM;
> +	priv->phy_node = of_parse_phandle(node, "phy-handle", 0);
> +
> +	/* In the case of a fixed PHY, the DT node associated
> +	 * to the PHY is the Ethernet MAC DT node.
> +	 */
> +	if (!priv->phy_node && of_phy_is_fixed_link(node)) {
> +		ret = of_phy_register_fixed_link(node);
> +		if (ret < 0)
> +			goto out_disable_clk;
> +		priv->phy_node = of_node_get(node);
> +	} else if (!priv->phy_node) {
> +		netdev_err(ndev, "not find phy-handle\n");
> +		ret = -EINVAL;
>  		goto out_disable_clk;
>  	}
>  
> -	bus->priv = priv;
> -	bus->name = "hix5hd2_mii_bus";
> -	bus->read = hix5hd2_mdio_read;
> -	bus->write = hix5hd2_mdio_write;
> -	bus->parent = &pdev->dev;
> -	snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(&pdev->dev));
> -	priv->bus = bus;
> -
> +	bus = NULL;
>  	mdio_np = of_get_available_child_by_name(node, "mdio");
> -	ret = of_mdiobus_register(bus, mdio_np ?: node);
> +	if (mdio_np || (priv->phy_node != node &&
> +			!of_phy_is_fixed_link(node))) {
> +		bus = devm_mdiobus_alloc(dev);

Fixed link and mdio are not mutually exclusive.

If there is a fixed link, and no mdio node, you should bail out early
and return EINVAL. The DT blob is invalid. But i would always expect
to register the MDIO bus for all valid configurations.

   Andrew
Technical Details
Message-ID: <ace68f64-afa3-4708-923e-5a64562e3359@lunn.ch>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373558-linux-kernel-netdev=dewy.ru
References: <20261126005524.4156940-1-mmyangfl@gmail.com> <20261126005524.4156940-6-mmyangfl@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373558-linux-kernel-netdev=dewy.ru
From: andrew@lunn.ch (Andrew Lunn)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v4 5/5] net: hix5hd2_gmac: Support fixed-link
Date: Sun, 29 Nov 2026 17:01:36 +0100
Organization: Usenet Network
Message-ID: <ace68f64-afa3-4708-923e-5a64562e3359@lunn.ch>
References: <20261126005524.4156940-1-mmyangfl@gmail.com>
 <20261126005524.4156940-6-mmyangfl@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="1203292"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:1iituq2uxWZMSMKUfcm5yiiD8TE= sha256:3e2KXWMohen7UCcgcgwKANTvQXABDCCKOT68ATJzziY=
	sha1:dPsxx17fNnYjbxqDqZ+UtP4zM8s= sha256:Q1EPGrj4jcDt/C0huz82ncxhKz6GiYBvZ9fxK45WtaU=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id C05E3125F9A; Sun, 29 Nov 2026 19:02:22 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=lunn.ch
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id Pf4Zcu_0JIy0;
	Sun, 29 Nov 2026 19:02:19 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373558-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id DA051125F99; Sun, 29 Nov 2026 19:02:10 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 43DA622E55; Sun, 29 Nov 2026 16:02:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795968129;
	b=Tk3TKqQ8I0rEZCn0lp3JiIGNsKs7UCj5jOmtNFl1JLLsyRxQaNWGorJ7TEi6FrTCuXlX
	 5+WBY/VOHi90EPK6vVLMo8ZXUuu7Z7PS3UU0qsDXN+hObqUvDo8NARFfBOx+mATdNibeZ
	 F1uRm9z5YBjri1Ht63x7bEtHLzvVRU9g6TsUWu2P1GxajG0/E6DsnQoScpouqcv2nhJQ3
	 b/Ck2cnX8h9VnfQXLMq/SnNr13IAxASVFMXAOJ21IbufeNIDVAJSbGosy0HRVOdoI+J/G
	 hgODbeJeD480qQh0aalVop35i1QbmatN+UARo/aKD2DHjm7SFPY56K7FdltHsQFVN9g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795968129;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date:
	 From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=nxQOPs0mrD5tz3HY4UHxpWVIbZo2K9lFDyOoQ3W9oiM=;
	b=wFJ3kbq69iOcJDd0d0e7QQXNHkwGPf4JNzsQHfWArUo1AOz1rfwUCki61LZgqAeiHNl6
	 9J+4gun805KAdjM5GcgPXHHdJYTGuQAtYu1le26xB/IwWuL8F1XX0ANYIFdId2boaiTCR
	 fjRFiapAEb31IZp7jkFKh2i9k15fZf7/3Il1Dj6E/ENKI5ZamURr64B9Y0edf8u+f6XYs
	 3lLjKsXHNi2AhGZf+yTw/jpcO/8zaP23YkMmj++0ZKYPiLfWRaNSk5KWHcvpXctqQpuM9
	 xbtlKnyO7MxhxqnvwgvFYFZg29HhleFbVosndffxXeg8M4sPGrD9gw97YX6vnClo34w==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=OMGRcWKh;
	dmarc=pass header.from=lunn.ch;
	spf=pass smtp.mailfrom=lunn.ch;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C9EA606A32D;
	Sun, 29 Nov 2026 16:02:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=OMGRcWKh
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795968123;
	b=aWNYp64elePdhjz/gBQVKpJh5IIKawzPihK7x/v/keBk5U1NfiWWm74OkQF9atFEN8uY
	 0TRDrAIJc9FD2oNTQqExhP58KDB01fu6EJgC0eEnbXsNVxhZHhbFQ0jv5x1S3HJEn/onn
	 2KBuzXrDU5f8vkMbBrEybcMC7+RduUQ82bU1P7WjbEqeU4WUj/QVnHqEQEURC1DH/stB0
	 cxaaGBxlZmRqKDz4PTE4Q5kbbALMHCi+ReX7Mn1dRy6KfuMo9RbwLKEOX68E0/ju9X4F/
	 tzdXJf9Zl5UHR6fzHM4OAM30WaVUJcH3PfojvCmVunun6Pmv/eOfUhVy/e8+yN76T1A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795968123;
	h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject:
	 Message-ID:References:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To;
	bh=nxQOPs0mrD5tz3HY4UHxpWVIbZo2K9lFDyOoQ3W9oiM=;
	b=iEUw2GAyQzbDEqwAgp75QAmKmMBTTwPuRPUulWvVIULB9tL2WU+Dr55Rbp/wcN+oU9sZ
	 TkCdLWfxf9HRRUGNtShc/N2ZkUccSVmqWkOukrqfDcCIbXgfgTeqtdQXXSOVD8v1Mq/8I
	 zTLF2BVeYoAbB2cPtm0w5wHhTUoM8kibEIpzk5WyS/xDCORclF9TgYaJibxz7in9+wPbb
	 /ZEuUaBS7Bwxm0qzdrtDQJXEwIkr/gjxEHg4sxxvOcxeoI8t693DubiXgyaRjJl34B+Q7
	 e4JUVktU1lTuNpRvE91WvSEa/tPQFdT79SHoXZ7ayDerBjOLN7ty5MSm9+q2oc44AOw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=lunn.ch;
	spf=pass smtp.mailfrom=lunn.ch;
	dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=OMGRcWKh;
	arc=none smtp.remote-ip=156.67.10.101
X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id E18D3606A31C;
	Sun, 29 Nov 2026 16:02:02 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E18D3606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch
X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch;
	s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version:
	References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject:
	Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:
	Content-ID:Content-Description:Content-Disposition:In-Reply-To:References;
	bh=nxQOPs0mrD5tz3HY4UHxpWVIbZo2K9lFDyOoQ3W9oiM=; b=OMGRcWKhjXwrPqUnwbyfuAMyfp
	igHVaD4EKRMv59+YQcoLvs+SrKw7nyM5vX4JTtHdh0di1vDXelQSwuF03h83khlPuY4z7oTwOWe6S
	TaFu9JTb1bEigjfC19TBoMZOBwBD4AL+/K8FJrV7AHE/U/62BYSqArvSPd2f8NwKO+6M=;
X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2)
	(envelope-from <andrew@lunn.ch>)
	id 1xXhLM-002AMp-Rx; Sun, 29 Nov 2026 17:01:36 +0100
X-Cc: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Jian Shen <shenjian15@huawei.com>,
	Jijie Shao <shaojijie@huawei.com>, devicetree@vger.kernel.org
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261126005524.4156940-6-mmyangfl@gmail.com>