From: Ong Boon Leong <boon.leong.ong@intel.com>
To: Alexandre Torgue <alexandre.torgue@st.com>,
Jose Abreu <joabreu@synopsys.com>, Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Paolo Abeni <pabeni@redhat.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Ong Boon Leong <boon.leong.ong@intel.com>
Subject: [PATCH net-next 4/4] stmmac: intel: introduce platform data phyless setting for Ericsson system
Date: Fri, 22 Apr 2022 15:35:05 +0800 [thread overview]
Message-ID: <20220422073505.810084-5-boon.leong.ong@intel.com> (raw)
In-Reply-To: <20220422073505.810084-1-boon.leong.ong@intel.com>
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@ericsson.com>
Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.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
prev parent reply other threads:[~2022-04-22 7:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-22 7:35 [PATCH net-next 0/4] pcs-xpcs, stmmac: add 1000BASE-X AN for network switch Ong Boon Leong
2022-04-22 7:35 ` [PATCH net-next 1/4] net: pcs: xpcs: add CL37 1000BASE-X AN support Ong Boon Leong
2022-04-22 8:00 ` Russell King (Oracle)
2022-04-25 3:30 ` Ong, Boon Leong
2022-04-22 17:35 ` kernel test robot
2022-04-23 3:00 ` kernel test robot
2022-04-22 7:35 ` [PATCH net-next 2/4] net: stmmac: introduce PHY-less setup support Ong Boon Leong
2022-04-22 12:58 ` Andrew Lunn
2022-04-23 1:13 ` Ong, Boon Leong
2022-04-22 7:35 ` [PATCH net-next 3/4] stmmac: intel: prepare to support 1000BASE-X phy interface setting Ong Boon Leong
2022-04-22 7:35 ` Ong Boon Leong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220422073505.810084-5-boon.leong.ong@intel.com \
--to=boon.leong.ong@intel.com \
--cc=alexandre.torgue@foss.st.com \
--cc=alexandre.torgue@st.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux@armlinux.org.uk \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).