From nobody Wed Dec 17 04:02:29 2025 Received: from canpmsgout02.his.huawei.com (canpmsgout02.his.huawei.com [113.46.200.217]) (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 9869F10957; Mon, 15 Dec 2025 12:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.217 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765803601; cv=none; b=sgolEaH1oda0jJu1fuCONhx002UT7b7EU1REq1Eg8DQr4O/UBoNQ09xyMx2MsKDEITLnj4m0dSmWnsPOIfen6CCD+6SS2OlHeEdyG3NZfPHLzrrSnrhTcU/CicDSgAkrqxSGUaKqdjL2S4eU5zKkFdPK2I7X/GPoU+pMokXtJOw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765803601; c=relaxed/simple; bh=Si6RvWyw94wYHTyp4BE0LyHi1xMMrfcs0bHNwGU8Nbw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hFsIFSy8XjFt7jxwIgiL2ePPu6ybtrcqZ4q6QJeH13bP27vwtP0KSfwfGrFqm4NdnS5vH3isTVQ9bn7X/8q817H/cBK/XgJWG3abYy+U7flEzSTErNLVxjPxQV6ArCH4TmxDJvel2+lMZezbhM8q4pfYpBgWn15c/JHv/6HhDZc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=PjNGwJCd; arc=none smtp.client-ip=113.46.200.217 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="PjNGwJCd" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=gvv806IIngKsCS+RthrpGnKcpWnhs1K6eyI0UEm1pBY=; b=PjNGwJCddisb0aHJPTWim/JL5CyLy6PiGZ+ue1fTqbdWEfpDlTpd+QF90qnpFZlmO3YXWDYKh s0NtLTVc6vAJCBMSYAFsAI+D2jxb8IvPgnrrMXfUjLxOfYvNmbwpe/fd03X62vCOKR2UHBu6uG0 0OnEnZROUb3HXZLAoTI6Wpg= Received: from mail.maildlp.com (unknown [172.19.88.105]) by canpmsgout02.his.huawei.com (SkyGuard) with ESMTPS id 4dVKp26H3tzcb1N; Mon, 15 Dec 2025 20:56:58 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id E17BD140203; Mon, 15 Dec 2025 20:59:48 +0800 (CST) Received: from localhost.localdomain (10.90.31.46) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 15 Dec 2025 20:59:48 +0800 From: Jijie Shao To: , , , , , , , , CC: , , , , , , , , Subject: [PATCH RFC net-next 1/6] net: phy: change of_phy_leds() to fwnode_phy_leds() Date: Mon, 15 Dec 2025 20:57:00 +0800 Message-ID: <20251215125705.1567527-2-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20251215125705.1567527-1-shaojijie@huawei.com> References: <20251215125705.1567527-1-shaojijie@huawei.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-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" Change of_phy_leds() to fwnode_phy_leds(), to support of node, acpi node, and software node together. Signed-off-by: Jijie Shao --- drivers/net/phy/phy_device.c | 37 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 81984d4ebb7c..c5ce057f88ff 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3208,8 +3208,8 @@ static void phy_leds_unregister(struct phy_device *ph= ydev) } } =20 -static int of_phy_led(struct phy_device *phydev, - struct device_node *led) +static int fwnode_phy_led(struct phy_device *phydev, + struct fwnode_handle *led) { struct device *dev =3D &phydev->mdio.dev; struct led_init_data init_data =3D {}; @@ -3226,17 +3226,17 @@ static int of_phy_led(struct phy_device *phydev, cdev =3D &phyled->led_cdev; phyled->phydev =3D phydev; =20 - err =3D of_property_read_u32(led, "reg", &index); + err =3D fwnode_property_read_u32(led, "reg", &index); if (err) return err; if (index > U8_MAX) return -EINVAL; =20 - if (of_property_read_bool(led, "active-high")) + if (fwnode_property_read_bool(led, "active-high")) set_bit(PHY_LED_ACTIVE_HIGH, &modes); - if (of_property_read_bool(led, "active-low")) + if (fwnode_property_read_bool(led, "active-low")) set_bit(PHY_LED_ACTIVE_LOW, &modes); - if (of_property_read_bool(led, "inactive-high-impedance")) + if (fwnode_property_read_bool(led, "inactive-high-impedance")) set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes); =20 if (WARN_ON(modes & BIT(PHY_LED_ACTIVE_LOW) && @@ -3273,7 +3273,7 @@ static int of_phy_led(struct phy_device *phydev, #endif cdev->max_brightness =3D 1; init_data.devicename =3D dev_name(&phydev->mdio.dev); - init_data.fwnode =3D of_fwnode_handle(led); + init_data.fwnode =3D led; init_data.devname_mandatory =3D true; =20 err =3D led_classdev_register_ext(dev, cdev, &init_data); @@ -3285,19 +3285,16 @@ static int of_phy_led(struct phy_device *phydev, return 0; } =20 -static int of_phy_leds(struct phy_device *phydev) +static int fwnode_phy_leds(struct phy_device *phydev) { - struct device_node *node =3D phydev->mdio.dev.of_node; - struct device_node *leds; + struct fwnode_handle *fwnode =3D dev_fwnode(&phydev->mdio.dev); + struct fwnode_handle *leds, *led; int err; =20 - if (!IS_ENABLED(CONFIG_OF_MDIO)) - return 0; - - if (!node) + if (!fwnode) return 0; =20 - leds =3D of_get_child_by_name(node, "leds"); + leds =3D fwnode_get_named_child_node(fwnode, "leds"); if (!leds) return 0; =20 @@ -3311,17 +3308,17 @@ static int of_phy_leds(struct phy_device *phydev) goto exit; } =20 - for_each_available_child_of_node_scoped(leds, led) { - err =3D of_phy_led(phydev, led); + fwnode_for_each_available_child_node(leds, led) { + err =3D fwnode_phy_led(phydev, led); if (err) { - of_node_put(leds); + fwnode_handle_put(leds); phy_leds_unregister(phydev); return err; } } =20 exit: - of_node_put(leds); + fwnode_handle_put(leds); return 0; } =20 @@ -3516,7 +3513,7 @@ static int phy_probe(struct device *dev) * LEDs for them. */ if (IS_ENABLED(CONFIG_PHYLIB_LEDS) && !phy_driver_is_genphy(phydev)) - err =3D of_phy_leds(phydev); + err =3D fwnode_phy_leds(phydev); =20 out: /* Re-assert the reset signal on error */ --=20 2.33.0 From nobody Wed Dec 17 04:02:29 2025 Received: from canpmsgout05.his.huawei.com (canpmsgout05.his.huawei.com [113.46.200.220]) (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 AF87428314C; Mon, 15 Dec 2025 12:59:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.220 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765803599; cv=none; b=DJnoK7A67h8JeQqqy2uAXTVYqjWo3AKKG7SmsRo2tJwGnTsZjHFdbi6Nft7X/wu1mAQX/pfo2ivGbmjGucNTjmXa4miC23VTzWCYn/8vudf4xQ/mWoV/mZPr9YT2irAKnt1QyieW+UFiBr/jhAd5d6hJ+CF4iOZYU4rTO17yTRs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765803599; c=relaxed/simple; bh=R4Xzecd54OJmMh4TJGjXIZ9a7lE0KHo3ViFXr9BIvQA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kTmIdoaCo7n3MINVTsP+AdjqZWqPYzr16bGpZVRAI4xF/W5W3IomD04iICHJAxskkrPHR8ImAX3SX9dl242rGNXu+IQkefY+VVVHLYS5C6nZ9PIraG88eFPSpDgzkFK2gI59GiVoF839qgF3kaKcYSRdWwvh6va4NYv2tTxe1hk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=PS5w+HxT; arc=none smtp.client-ip=113.46.200.220 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="PS5w+HxT" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=Rb4tGSAlhwE5xmc71ZEpWi9znYIU9Ma+BEfBMd337Cs=; b=PS5w+HxTQsauvl5a224Ru8IOW9HqZSEFIy9QAMa3p+4rvaa+CxqMy3+eyYT4rWCZ+cOp95U4M fTGz6IJXg3l7u4iB618MEW8RVkQbdz1YjSlDCqbN6/k25Cri4X54lqbZIBMpRSDNpeM8x+PhNhd /hp5vNHroWizuo+hjri9oEI= Received: from mail.maildlp.com (unknown [172.19.163.252]) by canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4dVKpk4k9qz12LDf; Mon, 15 Dec 2025 20:57:34 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id 6FEEC180B6A; Mon, 15 Dec 2025 20:59:49 +0800 (CST) Received: from localhost.localdomain (10.90.31.46) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 15 Dec 2025 20:59:48 +0800 From: Jijie Shao To: , , , , , , , , CC: , , , , , , , , Subject: [PATCH RFC net-next 2/6] net: phy: add support to set default rules Date: Mon, 15 Dec 2025 20:57:01 +0800 Message-ID: <20251215125705.1567527-3-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20251215125705.1567527-1-shaojijie@huawei.com> References: <20251215125705.1567527-1-shaojijie@huawei.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-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" The node of led need add new property: rules, and rules can be set as: BIT(TRIGGER_NETDEV_LINK) | BIT(TRIGGER_NETDEV_RX) Signed-off-by: Jijie Shao --- drivers/net/phy/phy_device.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index c5ce057f88ff..65bd0bf11e78 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3208,6 +3208,26 @@ static void phy_leds_unregister(struct phy_device *p= hydev) } } =20 +static int fwnode_phy_led_set_rules(struct phy_device *phydev, + struct fwnode_handle *led, u32 index) +{ + u32 rules; + int err; + + if (!fwnode_property_present(led, "rules")) + return 0; + + err =3D fwnode_property_read_u32(led, "rules", &rules); + if (err) + return err; + + err =3D phydev->drv->led_hw_is_supported(phydev, index, rules); + if (err) + return err; + + return phydev->drv->led_hw_control_set(phydev, index, rules); +} + static int fwnode_phy_led(struct phy_device *phydev, struct fwnode_handle *led) { @@ -3253,6 +3273,11 @@ static int fwnode_phy_led(struct phy_device *phydev, return err; } =20 + err =3D fwnode_phy_led_set_rules(phydev, led, index); + if (err) + phydev_warn(phydev, "failed to set rules for led%u, err =3D %d\n", + index, err); + phyled->index =3D index; if (phydev->drv->led_brightness_set) cdev->brightness_set_blocking =3D phy_led_set_brightness; --=20 2.33.0 From nobody Wed Dec 17 04:02:29 2025 Received: from canpmsgout05.his.huawei.com (canpmsgout05.his.huawei.com [113.46.200.220]) (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 26AB728D850; Mon, 15 Dec 2025 12:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.220 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765803600; cv=none; b=ISowDzhamX00a8iLtqjSGSszPXsJsfQmcuer+cFkrx4O4kGkYabZ2nluaCI7AOe744aOQwl1vPSILvJ2/aFgLu1HBfwDkrtrqZQW1QgNcL8Yir+mFs/Q7gmbL98d1cx1gHTaYEJtDtcO73CpLPrlkFFKA9/VwSgymUFsjBTcnu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765803600; c=relaxed/simple; bh=8sIdV1vSPUwp0OuguQeVcd+qoz7KzJoL8HsTzLVh7EI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WyVlhO98pVS+hQWG1TyqON5NSIPos4x66e3z8cvvIzhXs41YM9WQkuPwpHJl8kLubuxtSUlVsXL66O3iIx/S3n9EDEzg80rbZ0jjbUpi1aC6jzGAmfiYdrPABNdlGX1RaegVvCQo/MCzHfaOpe+qfQJwGSntPj1N53GFi4KlkrU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=DxZVX2jl; arc=none smtp.client-ip=113.46.200.220 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="DxZVX2jl" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=5U6BHLA8ULqFPpbl15/Pen372oWN+BOp1QgNe1s7QOQ=; b=DxZVX2jlI92jmiO9UDFckb4GThu0dO3LrPm+6lMGvvbPvUwKBZvDTzY57h+sZ5lN75BZXPF34 zj4f/HD1fw20eS1gTMm5aJXHARvbuv2ydcq4F60/P5B27HqC3rX0mUvYThTXfKtAUiapPIqZ+BF nHz4e1FlstWjlZXeHI+Pp8U= Received: from mail.maildlp.com (unknown [172.19.88.194]) by canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4dVKpl1j5cz12LDf; Mon, 15 Dec 2025 20:57:35 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id 08D6E140133; Mon, 15 Dec 2025 20:59:50 +0800 (CST) Received: from localhost.localdomain (10.90.31.46) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 15 Dec 2025 20:59:49 +0800 From: Jijie Shao To: , , , , , , , , CC: , , , , , , , , Subject: [PATCH RFC net-next 3/6] net: hibmcge: create a software node for phy_led Date: Mon, 15 Dec 2025 20:57:02 +0800 Message-ID: <20251215125705.1567527-4-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20251215125705.1567527-1-shaojijie@huawei.com> References: <20251215125705.1567527-1-shaojijie@huawei.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-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" Currently, phy_led supports of node, acpi node, and software node. The hibmcge hardware(including leds) is on the BMC side, while the driver runs on the host side. An apic or of node needs to be created on the host side to support phy_led; otherwise, phy_led will not be supported. Therefore, in order to support phy_led, this patch will create a software node when it detects that the phy device is not bound to any fwnode. Closes: https://lore.kernel.org/all/023a85e4-87e2-4bd3-9727-69a2bfdc4145@lu= nn.ch/ Signed-off-by: Jijie Shao --- .../ethernet/hisilicon/hibmcge/hbg_common.h | 11 ++ .../net/ethernet/hisilicon/hibmcge/hbg_mdio.c | 120 +++++++++++++++++- 2 files changed, 124 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_common.h b/drivers/= net/ethernet/hisilicon/hibmcge/hbg_common.h index 8e134da3e217..d20dd324e129 100644 --- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_common.h +++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_common.h @@ -5,8 +5,10 @@ #define __HBG_COMMON_H =20 #include +#include #include #include +#include #include #include "hbg_reg.h" =20 @@ -130,6 +132,9 @@ struct hbg_vector { u32 info_array_len; }; =20 +#define HBG_LED_MAX_NUM (sizeof(u32) / sizeof(u8)) +#define HBG_LED_SOFTWARE_NODE_MAX_NUM (HBG_LED_MAX_NUM + 2) + struct hbg_mac { struct mii_bus *mdio_bus; struct phy_device *phydev; @@ -140,6 +145,12 @@ struct hbg_mac { u32 autoneg; u32 link_status; u32 pause_autoneg; + + struct software_node phy_node; + struct software_node leds_node; + struct software_node led_nodes[HBG_LED_MAX_NUM]; + struct property_entry leds_props[HBG_LED_MAX_NUM][4]; + const struct software_node *nodes[HBG_LED_SOFTWARE_NODE_MAX_NUM + 1]; }; =20 struct hbg_mac_table_entry { diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c b/drivers/ne= t/ethernet/hisilicon/hibmcge/hbg_mdio.c index b6f0a2780ea8..edd8ccefbb62 100644 --- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c +++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c @@ -263,11 +263,119 @@ static int hbg_fixed_phy_init(struct hbg_priv *priv) return hbg_phy_connect(priv); } =20 -int hbg_mdio_init(struct hbg_priv *priv) +static void hbg_phy_device_free(void *data) +{ + phy_device_free((struct phy_device *)data); +} + +static void hbg_phy_device_remove(void *data) +{ + phy_device_remove((struct phy_device *)data); +} + +static void hbg_software_node_unregister_group(void *data) +{ + const struct software_node **node =3D data; + + software_node_unregister_node_group(node); +} + +static void hbg_device_remove_software_node(void *data) +{ + device_remove_software_node((struct device *)data); +} + +static int hbg_register_phy_leds_software_node(struct hbg_priv *priv, + struct phy_device *phydev) { + struct fwnode_handle *fwnode =3D dev_fwnode(&phydev->mdio.dev); struct device *dev =3D &priv->pdev->dev; struct hbg_mac *mac =3D &priv->mac; + u32 node_index =3D 0, i; + const char *label; + int ret; + + if (fwnode) { + dev_dbg(dev, "phy fwnode is already exists\n"); + return 0; + } + + mac->phy_node.name =3D devm_kasprintf(dev, GFP_KERNEL, "%s-%s-%u", + "mii", dev_name(dev), + mac->phy_addr); + mac->nodes[node_index++] =3D &mac->phy_node; + + mac->leds_node.name =3D devm_kasprintf(dev, GFP_KERNEL, "leds"); + mac->leds_node.parent =3D &mac->phy_node; + mac->nodes[node_index++] =3D &mac->leds_node; + + for (i =3D 0; i < HBG_LED_MAX_NUM; i++) { + mac->leds_props[i][0] =3D PROPERTY_ENTRY_U32("reg", i); + label =3D devm_kasprintf(dev, GFP_KERNEL, "%u", i); + mac->leds_props[i][1] =3D PROPERTY_ENTRY_STRING("label", label); + + mac->led_nodes[i].name =3D devm_kasprintf(dev, GFP_KERNEL, + "led@%u", i); + mac->led_nodes[i].properties =3D mac->leds_props[i]; + mac->led_nodes[i].parent =3D &mac->leds_node; + + mac->nodes[node_index++] =3D &mac->led_nodes[i]; + } + + ret =3D software_node_register_node_group(mac->nodes); + if (ret) + return dev_err_probe(dev, ret, + "failed to register software node\n"); + + ret =3D devm_add_action_or_reset(dev, hbg_software_node_unregister_group, + mac->nodes); + if (ret) + return ret; + + ret =3D device_add_software_node(&phydev->mdio.dev, &mac->phy_node); + if (ret) + return dev_err_probe(dev, ret, "failed to add software node\n"); + + return devm_add_action_or_reset(dev, hbg_device_remove_software_node, + &phydev->mdio.dev); +} + +static int hbg_find_phy_device(struct hbg_priv *priv, struct mii_bus *mdio= _bus) +{ + struct device *dev =3D &priv->pdev->dev; struct phy_device *phydev; + int ret; + + phydev =3D get_phy_device(mdio_bus, priv->mac.phy_addr, false); + if (IS_ERR(phydev)) + return dev_err_probe(dev, -ENODEV, + "failed to get phy device\n"); + + ret =3D devm_add_action_or_reset(dev, hbg_phy_device_free, phydev); + if (ret) + return ret; + + ret =3D hbg_register_phy_leds_software_node(priv, phydev); + if (ret) + return ret; + + ret =3D phy_device_register(phydev); + if (ret) + return dev_err_probe(dev, ret, + "failed to register phy device\n"); + + ret =3D devm_add_action_or_reset(dev, hbg_phy_device_remove, phydev); + if (ret) + return ret; + + priv->mac.phydev =3D phydev; + return 0; +} + +int hbg_mdio_init(struct hbg_priv *priv) +{ + struct device *dev =3D &priv->pdev->dev; + struct hbg_mac *mac =3D &priv->mac; struct mii_bus *mdio_bus; int ret; =20 @@ -281,7 +389,7 @@ int hbg_mdio_init(struct hbg_priv *priv) =20 mdio_bus->parent =3D dev; mdio_bus->priv =3D priv; - mdio_bus->phy_mask =3D ~(1 << mac->phy_addr); + mdio_bus->phy_mask =3D 0xFFFFFFFF; /* not scan phy device */ mdio_bus->name =3D "hibmcge mii bus"; mac->mdio_bus =3D mdio_bus; =20 @@ -293,12 +401,10 @@ int hbg_mdio_init(struct hbg_priv *priv) if (ret) return dev_err_probe(dev, ret, "failed to register MDIO bus\n"); =20 - phydev =3D mdiobus_get_phy(mdio_bus, mac->phy_addr); - if (!phydev) - return dev_err_probe(dev, -ENODEV, - "failed to get phy device\n"); + ret =3D hbg_find_phy_device(priv, mdio_bus); + if (ret) + return ret; =20 - mac->phydev =3D phydev; hbg_mdio_init_hw(priv); return hbg_phy_connect(priv); } --=20 2.33.0 From nobody Wed Dec 17 04:02:29 2025 Received: from canpmsgout10.his.huawei.com (canpmsgout10.his.huawei.com [113.46.200.225]) (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 0CB1C22126D; Mon, 15 Dec 2025 12:59:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.225 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765803596; cv=none; b=ELM/IOtLQ0aHoS04/Gt4gKryWxKHT3QbNalIwwXHT9iTXCS829fiAfm5gsA0iF54rGdxKOX2rkkerRtDWtZlKl9lDUaalXqf8ZUC8Vyuku7hAFCCVjIDjL48V7f6ILSI1YQGzMUhoH1ddM4MiIXRhIEFG+Y8m6Ar+PUvPofmf3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765803596; c=relaxed/simple; bh=1oKKlliL80ez6J+gp81xQm3XIykbctCbR2t5Qs7tyIw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rERlzoYX1jeHLzmmTs1SoBcc7Bm566bCHeiAxK48H/c6qjqyfNaAlMDwL3nU011t6URFuz92JzDfnQQ7jj3gDhIDU+Vm/ChGAKm9uvCwONNn6G1IrX0cL8dhAx5WWzUkmJ472zv6HGs5WnFJKwaOK5gFgEqsv0B8hRz7s+9zDZA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=pRGCylMc; arc=none smtp.client-ip=113.46.200.225 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="pRGCylMc" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=mVkdXmykPJNKJDJHkZAT5FNe3kKnBzb91qGf7nsJFis=; b=pRGCylMc7RWcziuCdeoKBR0VlAcxK8XHhECzmKU2N+pS4r6krle1Sb35PVKVWqt6vDliAsUvp 7OvfOdrS9mwHgc2sa868mgDMJYs/6q3rK1MAL8JScTCFRRYCu/3t9tZhyqwdRdLEg1DhvEqQxZ+ 51R8RqpAM9IX0Dkr3OWYDeg= Received: from mail.maildlp.com (unknown [172.19.163.44]) by canpmsgout10.his.huawei.com (SkyGuard) with ESMTPS id 4dVKq44r2Zz1K968; Mon, 15 Dec 2025 20:57:52 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id 8E60A1402C6; Mon, 15 Dec 2025 20:59:50 +0800 (CST) Received: from localhost.localdomain (10.90.31.46) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 15 Dec 2025 20:59:49 +0800 From: Jijie Shao To: , , , , , , , , CC: , , , , , , , , Subject: [PATCH RFC net-next 4/6] net: hibmcge: support get phy_leds_reg from spec register Date: Mon, 15 Dec 2025 20:57:03 +0800 Message-ID: <20251215125705.1567527-5-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20251215125705.1567527-1-shaojijie@huawei.com> References: <20251215125705.1567527-1-shaojijie@huawei.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-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" support get phy_leds_reg from spec register, and init the software node according to the value. Signed-off-by: Jijie Shao --- drivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c | 12 ++++++++++-- drivers/net/ethernet/hisilicon/hibmcge/hbg_reg.h | 5 +++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c b/drivers/ne= t/ethernet/hisilicon/hibmcge/hbg_mdio.c index edd8ccefbb62..fb6ece3935e7 100644 --- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c +++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c @@ -289,9 +289,11 @@ static int hbg_register_phy_leds_software_node(struct = hbg_priv *priv, struct phy_device *phydev) { struct fwnode_handle *fwnode =3D dev_fwnode(&phydev->mdio.dev); + u32 phy_reg_num =3D hbg_reg_read(priv, HBG_REG_PHY_LEDS_REG); struct device *dev =3D &priv->pdev->dev; struct hbg_mac *mac =3D &priv->mac; - u32 node_index =3D 0, i; + u32 node_index =3D 0, i, reg; + unsigned long rules; const char *label; int ret; =20 @@ -310,12 +312,18 @@ static int hbg_register_phy_leds_software_node(struct= hbg_priv *priv, mac->nodes[node_index++] =3D &mac->leds_node; =20 for (i =3D 0; i < HBG_LED_MAX_NUM; i++) { + reg =3D (phy_reg_num >> (8 * i)) & 0xFF; + mac->leds_props[i][0] =3D PROPERTY_ENTRY_U32("reg", i); label =3D devm_kasprintf(dev, GFP_KERNEL, "%u", i); mac->leds_props[i][1] =3D PROPERTY_ENTRY_STRING("label", label); =20 + rules =3D hbg_reg_read(priv, + HBG_REG_PHY_LED0_RULES_ADDR + i * 4); + mac->leds_props[i][2] =3D PROPERTY_ENTRY_U32("rules", rules); + mac->led_nodes[i].name =3D devm_kasprintf(dev, GFP_KERNEL, - "led@%u", i); + "led@%u", reg); mac->led_nodes[i].properties =3D mac->leds_props[i]; mac->led_nodes[i].parent =3D &mac->leds_node; =20 diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_reg.h b/drivers/net= /ethernet/hisilicon/hibmcge/hbg_reg.h index 30b3903c8f2d..2ad7b60874c7 100644 --- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_reg.h +++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_reg.h @@ -12,12 +12,17 @@ #define HBG_REG_MAC_ADDR_ADDR 0x0010 #define HBG_REG_MAC_ADDR_HIGH_ADDR 0x0014 #define HBG_REG_UC_MAC_NUM_ADDR 0x0018 +#define HBG_REG_PHY_LEDS_REG 0x0020 #define HBG_REG_MDIO_FREQ_ADDR 0x0024 #define HBG_REG_MAX_MTU_ADDR 0x0028 #define HBG_REG_MIN_MTU_ADDR 0x002C #define HBG_REG_TX_FIFO_NUM_ADDR 0x0030 #define HBG_REG_RX_FIFO_NUM_ADDR 0x0034 #define HBG_REG_VLAN_LAYERS_ADDR 0x0038 +#define HBG_REG_PHY_LED0_RULES_ADDR 0x003C +#define HBG_REG_PHY_LED1_RULES_ADDR 0x0040 +#define HBG_REG_PHY_LED2_RULES_ADDR 0x0044 +#define HBG_REG_PHY_LED3_RULES_ADDR 0x0048 #define HBG_REG_PUSH_REQ_ADDR 0x00F0 #define HBG_REG_MSG_HEADER_ADDR 0x00F4 #define HBG_REG_MSG_HEADER_OPCODE_M GENMASK(7, 0) --=20 2.33.0 From nobody Wed Dec 17 04:02:29 2025 Received: from canpmsgout04.his.huawei.com (canpmsgout04.his.huawei.com [113.46.200.219]) (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 5FC5F1487E9; Mon, 15 Dec 2025 12:59:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.219 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765803598; cv=none; b=SbWP2mEKuRTQqFi/1pghdHH6ze+ElRI6uAgQaPDaNPnt1kdgSGYXHhdrWBSWGbQqknxXp5jCsHnEvNNmsUSZQ8Qk3H48dvwN4SrUr7akSXp2k5c8ZwtLFfUxzqBjqAD/aXI0WhKaTMydfH94m7nj+hIxVgoVNGUAzE3fvW/S6f0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765803598; c=relaxed/simple; bh=bwdu7BgczwxVS19Z5tjz0gT9XRdUBc54mzmiO7ERc1k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SUbKIsR9wspPEKwey02A4kNs4+SY+KwewtuxUq1RE5kZ8TZm6DwJsE2N0P10DRL0Y6hTqeg1+74XcZ4WmdRHKBee9XRoqJxsOkhZnerVJGB6RHCgtYgSY5VzGASIFtcon9vJJDuPaoQkxKzORCjy00O6G7XQ3Xdel3JV+w7c0V8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=CHYyXwoj; arc=none smtp.client-ip=113.46.200.219 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="CHYyXwoj" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=7tciCYRPK0qkdByByNvvvvMGEYxrxnq1OwZmH1xLhxc=; b=CHYyXwojEQ7mw3EiJekJIUcWDSyYCCUKwaYUspyAg+9KUvzG9hhAy7z4aGe3IePKJhF1Ikr0Z dHNecv/M4djF3k2Z+S84ib2Rpe6Yc2zNpkP0txY82bPBfWhRT5aqutNrWiTU2+uLSNhJLvcDdup Mgf72VFtqHDXsGM4nXMUwsM= Received: from mail.maildlp.com (unknown [172.19.163.48]) by canpmsgout04.his.huawei.com (SkyGuard) with ESMTPS id 4dVKq21NW6z1prMW; Mon, 15 Dec 2025 20:57:50 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id 132D518048A; Mon, 15 Dec 2025 20:59:51 +0800 (CST) Received: from localhost.localdomain (10.90.31.46) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 15 Dec 2025 20:59:50 +0800 From: Jijie Shao To: , , , , , , , , CC: , , , , , , , , Subject: [PATCH RFC net-next 5/6] net: hibmcge: support get phy device from apci Date: Mon, 15 Dec 2025 20:57:04 +0800 Message-ID: <20251215125705.1567527-6-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20251215125705.1567527-1-shaojijie@huawei.com> References: <20251215125705.1567527-1-shaojijie@huawei.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-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" support get phy device from apci. Signed-off-by: Jijie Shao --- .../net/ethernet/hisilicon/hibmcge/hbg_mdio.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c b/drivers/ne= t/ethernet/hisilicon/hibmcge/hbg_mdio.c index fb6ece3935e7..36997634486b 100644 --- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c +++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ // Copyright (c) 2024 Hisilicon Limited. =20 +#include #include #include #include @@ -348,12 +349,36 @@ static int hbg_register_phy_leds_software_node(struct= hbg_priv *priv, &phydev->mdio.dev); } =20 +static int hbg_find_phy_device_from_acpi(struct hbg_priv *priv) +{ + struct device *dev =3D &priv->pdev->dev; + struct fwnode_handle *phy_fwnode; + struct phy_device *phydev; + + phy_fwnode =3D fwnode_get_phy_node(dev_fwnode(dev)); + if (IS_ERR(phy_fwnode)) + return dev_err_probe(dev, PTR_ERR(phydev), + "failed to get phy fwnode\n"); + + phydev =3D fwnode_phy_find_device(phy_fwnode); + /* We're done with the phy_node handle */ + fwnode_handle_put(phy_fwnode); + if (!phydev) + return dev_err_probe(dev, -ENODEV, + "failed to get phy fwnode device\n"); + priv->mac.phydev =3D phydev; + return 0; +} + static int hbg_find_phy_device(struct hbg_priv *priv, struct mii_bus *mdio= _bus) { struct device *dev =3D &priv->pdev->dev; struct phy_device *phydev; int ret; =20 + if (has_acpi_companion(dev)) + return hbg_find_phy_device_from_acpi(priv); + phydev =3D get_phy_device(mdio_bus, priv->mac.phy_addr, false); if (IS_ERR(phydev)) return dev_err_probe(dev, -ENODEV, --=20 2.33.0 From nobody Wed Dec 17 04:02:29 2025 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 5589A2D7D2E; Mon, 15 Dec 2025 13:00:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765803605; cv=none; b=ZK8aDf4AlmcW0HTA9zpAqvnEF6TvvOsg4cQPgWHnIbPoWvJaDybG5cKLGk1572R/GEBRohQ8lp42beGopxEXM9jOxEQj+/uBJAaAJ27qFMnlbHbALTinKDWe+MLsmCKLpUKsgHHzSwQJbSVlHfkm9fbgNHogwWY94/c0QmzQU8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765803605; c=relaxed/simple; bh=bFW5wc7teN8wCrjLWApoNlxe5ivNEhXG0ZFJWMv1Om0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uIhpxnCY4glOKqpHaxykHlL3NETBp1CKRNfhSbUBkAJSGboo8RFyeWmaHr/ZidSSBBQb6xkb02R4p0NF6lRsvHRxfscs8YynroNbpehDfb24ra7X2mm3TSUHGHR9gD5ah3qE+pUbcHmkI6nXrbI5J+pk8TMA3bNkR7BGEIztSsw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=LfrZfV0+; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=LfrZfV0+; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="LfrZfV0+"; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="LfrZfV0+" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=/BAOnQl4PiBFWoROmLFA/gBRGEHU/8ET6VKFmfi7mQQ=; b=LfrZfV0+uuxrwE+xZihutr3i0daDSADpyAvJGAOuxVA1L1K8rrxycuDlXU1+Bvp8Vm7Sld1nu 71sqlVorS2fJaRL/KEeXD2LdBXQ6fpSc8Br7lgE5pSqUJTImVt0IUR1spTQf/qj4ZEmoQz/aD0p 0xJsKmz5PdBgO0ccYIUCXzI= Received: from canpmsgout11.his.huawei.com (unknown [172.19.92.148]) by szxga01-in.huawei.com (SkyGuard) with ESMTPS id 4dVKs94Ttgz1BG4S; Mon, 15 Dec 2025 20:59:41 +0800 (CST) dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=/BAOnQl4PiBFWoROmLFA/gBRGEHU/8ET6VKFmfi7mQQ=; b=LfrZfV0+uuxrwE+xZihutr3i0daDSADpyAvJGAOuxVA1L1K8rrxycuDlXU1+Bvp8Vm7Sld1nu 71sqlVorS2fJaRL/KEeXD2LdBXQ6fpSc8Br7lgE5pSqUJTImVt0IUR1spTQf/qj4ZEmoQz/aD0p 0xJsKmz5PdBgO0ccYIUCXzI= Received: from mail.maildlp.com (unknown [172.19.163.44]) by canpmsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4dVKq33MvnzKm6s; Mon, 15 Dec 2025 20:57:51 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id 9BB601402C6; Mon, 15 Dec 2025 20:59:51 +0800 (CST) Received: from localhost.localdomain (10.90.31.46) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 15 Dec 2025 20:59:50 +0800 From: Jijie Shao To: , , , , , , , , CC: , , , , , , , , Subject: [PATCH RFC net-next 6/6] net: phy: motorcomm: fix duplex setting error for phy leds Date: Mon, 15 Dec 2025 20:57:05 +0800 Message-ID: <20251215125705.1567527-7-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20251215125705.1567527-1-shaojijie@huawei.com> References: <20251215125705.1567527-1-shaojijie@huawei.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-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" fix duplex setting error for phy leds Fixes: 355b82c54c12 ("net: phy: motorcomm: Add support for PHY LEDs on YT85= 21") Signed-off-by: Jijie Shao --- drivers/net/phy/motorcomm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c index 89b5b19a9bd2..42d46b5758fc 100644 --- a/drivers/net/phy/motorcomm.c +++ b/drivers/net/phy/motorcomm.c @@ -1741,10 +1741,10 @@ static int yt8521_led_hw_control_set(struct phy_dev= ice *phydev, u8 index, val |=3D YT8521_LED_1000_ON_EN; =20 if (test_bit(TRIGGER_NETDEV_FULL_DUPLEX, &rules)) - val |=3D YT8521_LED_HDX_ON_EN; + val |=3D YT8521_LED_FDX_ON_EN; =20 if (test_bit(TRIGGER_NETDEV_HALF_DUPLEX, &rules)) - val |=3D YT8521_LED_FDX_ON_EN; + val |=3D YT8521_LED_HDX_ON_EN; =20 if (test_bit(TRIGGER_NETDEV_TX, &rules) || test_bit(TRIGGER_NETDEV_RX, &rules)) --=20 2.33.0