From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Richard Cochran <richardcochran@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Vinod Koul <vkoul@kernel.org>,
Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Jose Abreu <joabreu@synopsys.com>
Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH v3 4/8] net: stmmac: qcom-ethqos: wrap emac driver data in additional structure
Date: Mon, 27 Oct 2025 16:44:52 +0100 [thread overview]
Message-ID: <20251027-qcom-sa8255p-emac-v3-4-75767b9230ab@linaro.org> (raw)
In-Reply-To: <20251027-qcom-sa8255p-emac-v3-0-75767b9230ab@linaro.org>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
As the first step in enabling power domain support in the driver, we'll
split the device match data and runtime data structures into their
general and power-management-specific parts. To allow that: first wrap
the emac driver data in another layer which will later be expanded.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
.../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 51 ++++++++++++++++------
1 file changed, 37 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index ed799da4e4079b4da4b555dd119cce8c6591aa39..2739bc00e7525a5913bd3a5d28d9c9a8871fb7cf 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -101,6 +101,10 @@ struct ethqos_emac_driver_data {
bool needs_sgmii_loopback;
};
+struct ethqos_emac_match_data {
+ const struct ethqos_emac_driver_data *drv_data;
+};
+
struct qcom_ethqos {
struct platform_device *pdev;
void __iomem *rgmii_base;
@@ -218,6 +222,10 @@ static const struct ethqos_emac_driver_data emac_v2_3_0_data = {
.has_emac_ge_3 = false,
};
+static const struct ethqos_emac_match_data emac_qcs404_data = {
+ .drv_data = &emac_v2_3_0_data,
+};
+
static const struct ethqos_emac_por emac_v2_1_0_por[] = {
{ .offset = RGMII_IO_MACRO_CONFIG, .value = 0x40C01343 },
{ .offset = SDCC_HC_REG_DLL_CONFIG, .value = 0x2004642C },
@@ -234,6 +242,10 @@ static const struct ethqos_emac_driver_data emac_v2_1_0_data = {
.has_emac_ge_3 = false,
};
+static const struct ethqos_emac_match_data emac_sm8150_data = {
+ .drv_data = &emac_v2_1_0_data,
+};
+
static const struct ethqos_emac_por emac_v3_0_0_por[] = {
{ .offset = RGMII_IO_MACRO_CONFIG, .value = 0x40c01343 },
{ .offset = SDCC_HC_REG_DLL_CONFIG, .value = 0x2004642c },
@@ -266,6 +278,10 @@ static const struct ethqos_emac_driver_data emac_v3_0_0_data = {
},
};
+static const struct ethqos_emac_match_data emac_sc8280xp_data = {
+ .drv_data = &emac_v3_0_0_data,
+};
+
static const struct ethqos_emac_por emac_v4_0_0_por[] = {
{ .offset = RGMII_IO_MACRO_CONFIG, .value = 0x40c01343 },
{ .offset = SDCC_HC_REG_DLL_CONFIG, .value = 0x2004642c },
@@ -301,6 +317,10 @@ static const struct ethqos_emac_driver_data emac_v4_0_0_data = {
},
};
+static const struct ethqos_emac_match_data emac_sa8775p_data = {
+ .drv_data = &emac_v4_0_0_data,
+};
+
static int ethqos_dll_configure(struct qcom_ethqos *ethqos)
{
struct device *dev = ðqos->pdev->dev;
@@ -764,7 +784,8 @@ static void ethqos_ptp_clk_freq_config(struct stmmac_priv *priv)
static int qcom_ethqos_probe(struct platform_device *pdev)
{
- const struct ethqos_emac_driver_data *data;
+ const struct ethqos_emac_driver_data *drv_data;
+ const struct ethqos_emac_match_data *data;
struct plat_stmmacenet_data *plat_dat;
struct stmmac_resources stmmac_res;
struct device *dev = &pdev->dev;
@@ -815,13 +836,15 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
ethqos->mac_base = stmmac_res.addr;
data = device_get_match_data(dev);
- ethqos->por = data->por;
- ethqos->num_por = data->num_por;
- ethqos->rgmii_config_loopback_en = data->rgmii_config_loopback_en;
- ethqos->has_emac_ge_3 = data->has_emac_ge_3;
- ethqos->needs_sgmii_loopback = data->needs_sgmii_loopback;
+ drv_data = data->drv_data;
- ethqos->link_clk = devm_clk_get(dev, data->link_clk_name ?: "rgmii");
+ ethqos->por = drv_data->por;
+ ethqos->num_por = drv_data->num_por;
+ ethqos->rgmii_config_loopback_en = drv_data->rgmii_config_loopback_en;
+ ethqos->has_emac_ge_3 = drv_data->has_emac_ge_3;
+ ethqos->needs_sgmii_loopback = drv_data->needs_sgmii_loopback;
+
+ ethqos->link_clk = devm_clk_get(dev, drv_data->link_clk_name ?: "rgmii");
if (IS_ERR(ethqos->link_clk))
return dev_err_probe(dev, PTR_ERR(ethqos->link_clk),
"Failed to get link_clk\n");
@@ -849,14 +872,14 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
plat_dat->ptp_clk_freq_config = ethqos_ptp_clk_freq_config;
plat_dat->core_type = DWMAC_CORE_GMAC4;
if (ethqos->has_emac_ge_3)
- plat_dat->dwmac4_addrs = &data->dwmac4_addrs;
+ plat_dat->dwmac4_addrs = &drv_data->dwmac4_addrs;
plat_dat->pmt = 1;
if (device_property_present(dev, "snps,tso"))
plat_dat->flags |= STMMAC_FLAG_TSO_EN;
if (device_is_compatible(dev, "qcom,qcs404-ethqos"))
plat_dat->flags |= STMMAC_FLAG_RX_CLK_RUNS_IN_LPI;
- if (data->dma_addr_width)
- plat_dat->host_dma_width = data->dma_addr_width;
+ if (drv_data->dma_addr_width)
+ plat_dat->host_dma_width = drv_data->dma_addr_width;
if (ethqos->serdes_phy) {
plat_dat->serdes_powerup = qcom_ethqos_serdes_powerup;
@@ -871,10 +894,10 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
}
static const struct of_device_id qcom_ethqos_match[] = {
- { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_data},
- { .compatible = "qcom,sa8775p-ethqos", .data = &emac_v4_0_0_data},
- { .compatible = "qcom,sc8280xp-ethqos", .data = &emac_v3_0_0_data},
- { .compatible = "qcom,sm8150-ethqos", .data = &emac_v2_1_0_data},
+ { .compatible = "qcom,qcs404-ethqos", .data = &emac_qcs404_data},
+ { .compatible = "qcom,sa8775p-ethqos", .data = &emac_sa8775p_data},
+ { .compatible = "qcom,sc8280xp-ethqos", .data = &emac_sc8280xp_data},
+ { .compatible = "qcom,sm8150-ethqos", .data = &emac_sm8150_data},
{ }
};
MODULE_DEVICE_TABLE(of, qcom_ethqos_match);
--
2.48.1
next prev parent reply other threads:[~2025-10-27 15:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 15:44 [PATCH v3 0/8] net: stmmac: qcom-ethqos: add support for SCMI power domains Bartosz Golaszewski
2025-10-27 15:44 ` [PATCH v3 1/8] dt-bindings: net: qcom: document the ethqos device for SCMI-based systems Bartosz Golaszewski
2025-10-28 8:16 ` Krzysztof Kozlowski
2025-11-03 17:18 ` Bartosz Golaszewski
2025-11-04 7:20 ` Krzysztof Kozlowski
2025-10-27 15:44 ` [PATCH v3 2/8] net: stmmac: qcom-ethqos: use generic device properties Bartosz Golaszewski
2025-10-27 15:44 ` [PATCH v3 3/8] net: stmmac: qcom-ethqos: improve typing in devres callback Bartosz Golaszewski
2025-10-27 15:44 ` Bartosz Golaszewski [this message]
2025-10-27 15:44 ` [PATCH v3 5/8] net: stmmac: qcom-ethqos: split power management fields into a separate structure Bartosz Golaszewski
2025-10-27 15:44 ` [PATCH v3 6/8] net: stmmac: qcom-ethqos: split power management context into a separate struct Bartosz Golaszewski
2025-10-27 15:44 ` [PATCH v3 7/8] net: stmmac: qcom-ethqos: define a callback for setting the serdes speed Bartosz Golaszewski
2025-10-27 15:44 ` [PATCH v3 8/8] net: stmmac: qcom-ethqos: add support for sa8255p Bartosz Golaszewski
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=20251027-qcom-sa8255p-emac-v3-4-75767b9230ab@linaro.org \
--to=brgl@bgdev.pl \
--cc=alexandre.torgue@foss.st.com \
--cc=andersson@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bartosz.golaszewski@linaro.org \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=joabreu@synopsys.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=vkoul@kernel.org \
/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).