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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 22 Apr 2022 15:35:05 +0800
From:   Ong Boon Leong <boon.leong.ong@...el.com>
To:     Alexandre Torgue <alexandre.torgue@...com>,
        Jose Abreu <joabreu@...opsys.com>,
        Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>,
        Paolo Abeni <pabeni@...hat.com>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre Torgue <alexandre.torgue@...s.st.com>,
        Giuseppe Cavallaro <peppe.cavallaro@...com>
Cc:     netdev@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Ong Boon Leong <boon.leong.ong@...el.com>
Subject: [PATCH net-next 4/4] stmmac: intel: introduce platform data phyless setting for Ericsson system

Certain platform wants specific GbE controller instance to be in PHY-less
mode, i.e. to be used for 1000BASE-X connection for network switch.

Tested-by: Emilio Riva <emilio.riva@...csson.com>
Signed-off-by: Ong Boon Leong <boon.leong.ong@...el.com>
---
 .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
index 265d39acdd0..9c9577fc15d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
@@ -24,6 +24,8 @@ struct intel_priv_data {
 struct stmmac_pci_func_data {
 	unsigned int func;
 	int phy_addr;
+	phy_interface_t phy_interface;
+	unsigned int phyless;
 };
 
 struct stmmac_pci_dmi_data {
@@ -439,10 +441,65 @@ static void common_default_data(struct plat_stmmacenet_data *plat)
 	plat->rx_queues_cfg[0].pkt_route = 0x0;
 }
 
+static const struct stmmac_pci_func_data ericsson_phyless_func_data[] = {
+	{
+		.func = 2,
+		.phy_interface = PHY_INTERFACE_MODE_1000BASEX,
+		.phyless = true,
+	},
+};
+
+static const struct stmmac_pci_dmi_data ericsson_phyless_dmi_data = {
+	.func = ericsson_phyless_func_data,
+	.nfuncs = ARRAY_SIZE(ericsson_phyless_func_data),
+};
+
+static const struct dmi_system_id intel_mgbe_pci_dmi[] = {
+	{
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Ericsson"),
+			DMI_MATCH(DMI_BOARD_NAME, "SMARC-SXEL"),
+		},
+		.driver_data = (void *)&ericsson_phyless_dmi_data,
+	},
+	{}
+};
+
+static bool stmmac_pci_find_phyless(struct pci_dev *pdev,
+				    const struct dmi_system_id *dmi_list,
+				    phy_interface_t *phy_interface,
+				    unsigned int *phyless)
+{
+	const struct stmmac_pci_func_data *func_data;
+	const struct stmmac_pci_dmi_data *dmi_data;
+	const struct dmi_system_id *dmi_id;
+	int func = PCI_FUNC(pdev->devfn);
+	size_t n;
+
+	dmi_id = dmi_first_match(dmi_list);
+	if (!dmi_id)
+		return false;
+
+	dmi_data = dmi_id->driver_data;
+	func_data = dmi_data->func;
+
+	for (n = 0; n < dmi_data->nfuncs; n++, func_data++)
+		if (func_data->func == func) {
+			*phy_interface = func_data->phy_interface;
+			*phyless = func_data->phyless;
+			return true;
+		}
+
+	return false;
+}
+
 static int intel_mgbe_common_data(struct pci_dev *pdev,
 				  struct plat_stmmacenet_data *plat)
 {
+	phy_interface_t phy_interface;
+	unsigned int phyless;
 	char clk_name[20];
+	bool found;
 	int ret;
 	int i;
 
@@ -559,6 +616,13 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
 	/* Use the last Rx queue */
 	plat->vlan_fail_q = plat->rx_queues_to_use - 1;
 
+	found = stmmac_pci_find_phyless(pdev, intel_mgbe_pci_dmi,
+					&phy_interface, &phyless);
+	if (found) {
+		plat->mdio_bus_data->phyless = phyless;
+		plat->phy_interface = phy_interface;
+	}
+
 	/* Intel mgbe SGMII interface uses pcs-xcps */
 	if (plat->phy_interface == PHY_INTERFACE_MODE_SGMII ||
 	    plat->phy_interface == PHY_INTERFACE_MODE_1000BASEX) {
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ