lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <SA0PR12MB44138E48A245378CF54D2F9ED98AA@SA0PR12MB4413.namprd12.prod.outlook.com>
Date:   Fri, 8 Dec 2023 07:02:19 +0000
From:   Jiangfeng Ma <Jiangfeng.Ma@...opsys.com>
To:     Alexandre Torgue <alexandre.torgue@...s.st.com>,
        Jose Abreu <Jose.Abreu@...opsys.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Simon Horman <horms@...nel.org>,
        Andrew Halaney <ahalaney@...hat.com>,
        Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
        Shenwei Wang <shenwei.wang@....com>,
        Johannes Zink <j.zink@...gutronix.de>,
        "Russell King (Oracle" <rmk+kernel@...linux.org.uk>,
        Jiangfeng Ma <Jiangfeng.Ma@...opsys.com>,
        Jochen Henneberg <jh@...neberg-systemdesign.com>
CC:     "open list:STMMAC ETHERNET DRIVER" <netdev@...r.kernel.org>,
        "moderated list:ARM/STM32 ARCHITECTURE" 
        <linux-stm32@...md-mailman.stormreply.com>,
        "moderated list:ARM/STM32 ARCHITECTURE" 
        <linux-arm-kernel@...ts.infradead.org>,
        open list <linux-kernel@...r.kernel.org>,
        James Li <James.Li1@...opsys.com>,
        Martin McKenny <Martin.McKenny@...opsys.com>
Subject: [PATCH] net:stmmac:stmmac_platform:Add snps,xpcs devicetree parsing

In order to setup xpcs, has_xpcs must be set to a non-zero value.
Add new optional devicetree properties representing this.

If has_xpcs is set to true, then xpcs_an_inband should preferably be
consistent with it, Otherwise, some errors may occur when starting
the network, For example, the phy interface that xpcs already supports,
but link up fails.

The types of has_xpcs and xpcs_an_inband are unsigned int,
and generally used as flags. So it may be more reasonable to set them to
bool type. This can also be confirmed from the type of @ovr_an_inband.

Signed-off-by: Jiangfeng Ma <Jiangfeng.Ma@...opsys.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 5 +++++
 include/linux/stmmac.h                                | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 1ffde55..6ebc2a9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -324,6 +324,7 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
 			 struct device_node *np, struct device *dev)
 {
 	bool mdio = !of_phy_is_fixed_link(np);
+	bool has_xpcs = false;
 	static const struct of_device_id need_mdio_ids[] = {
 		{ .compatible = "snps,dwc-qos-ethernet-4.10" },
 		{},
@@ -345,6 +346,7 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
 
 	if (plat->mdio_node) {
 		dev_dbg(dev, "Found MDIO subnode\n");
+		has_xpcs = of_property_read_bool(plat->mdio_node, "snps,xpcs");
 		mdio = true;
 	}
 
@@ -356,6 +358,9 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
 			return -ENOMEM;
 
 		plat->mdio_bus_data->needs_reset = true;
+		plat->mdio_bus_data->has_xpcs = has_xpcs;
+		if (plat->mdio_bus_data->has_xpcs)
+			plat->mdio_bus_data->xpcs_an_inband = true;
 	}
 
 	return 0;
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index dee5ad6..dea35ee 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -82,8 +82,8 @@
 
 struct stmmac_mdio_bus_data {
 	unsigned int phy_mask;
-	unsigned int has_xpcs;
-	unsigned int xpcs_an_inband;
+	bool has_xpcs;
+	bool xpcs_an_inband;
 	int *irqs;
 	int probed_phy_irq;
 	bool needs_reset;
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ