[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251104-qcom-sa8255p-emac-v4-4-f76660087cea@linaro.org>
Date: Tue, 04 Nov 2025 14:08:55 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Richard Cochran <richardcochran@...il.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
"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>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Vinod Koul <vkoul@...nel.org>, Giuseppe Cavallaro <peppe.cavallaro@...com>,
Jose Abreu <joabreu@...opsys.com>, Chen-Yu Tsai <wens@...nel.org>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Samuel Holland <samuel@...lland.org>,
Matthew Gerlach <matthew.gerlach@...era.com>,
Neil Armstrong <neil.armstrong@...aro.org>,
Kevin Hilman <khilman@...libre.com>, Jerome Brunet <jbrunet@...libre.com>,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
Keguang Zhang <keguang.zhang@...il.com>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>, Jan Petrous <jan.petrous@....nxp.com>,
s32@....com, Romain Gantois <romain.gantois@...tlin.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>,
Heiko Stuebner <heiko@...ech.de>, Chen Wang <unicorn_wang@...look.com>,
Inochi Amaoto <inochiama@...il.com>, Emil Renner Berthing <kernel@...il.dk>,
Minda Chen <minda.chen@...rfivetech.com>, Drew Fustini <fustini@...nel.org>,
Guo Ren <guoren@...nel.org>, Fu Wei <wefu@...hat.com>,
Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@...l.toshiba>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>, Maxime Ripard <mripard@...nel.org>,
Shuang Liang <liangshuang@...incomputing.com>,
Zhi Li <lizhi2@...incomputing.com>,
Shangjuan Wei <weishangjuan@...incomputing.com>,
"G. Jaya Kumaran" <vineetha.g.jaya.kumaran@...el.com>,
Clark Wang <xiaoning.wang@....com>, Linux Team <linux-imx@....com>,
Frank Li <Frank.Li@....com>, David Wu <david.wu@...k-chips.com>,
Samin Guo <samin.guo@...rfivetech.com>,
Christophe Roullier <christophe.roullier@...s.st.com>,
Swathi K S <swathi.ks@...sung.com>
Cc: linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org,
Drew Fustini <dfustini@...storrent.com>, linux-sunxi@...ts.linux.dev,
linux-amlogic@...ts.infradead.org, linux-mips@...r.kernel.org,
imx@...ts.linux.dev, linux-renesas-soc@...r.kernel.org,
linux-rockchip@...ts.infradead.org, sophgo@...ts.linux.dev,
linux-riscv@...ts.infradead.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: [PATCH v4 4/8] net: stmmac: qcom-ethqos: wrap emac driver data in
additional structure
From: Bartosz Golaszewski <bartosz.golaszewski@...aro.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@...aro.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 8493131ca32f5c6ca7e1654da0bbf4ffa1eefa4e..9cafe101049d5412d649b3beaca350c497ffc981 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -97,6 +97,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;
@@ -214,6 +218,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 },
@@ -230,6 +238,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 },
@@ -262,6 +274,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 },
@@ -297,6 +313,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;
@@ -750,7 +770,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;
@@ -801,13 +822,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");
@@ -835,14 +858,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;
@@ -857,10 +880,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.51.0
Powered by blists - more mailing lists