[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251104-qcom-sa8255p-emac-v4-5-f76660087cea@linaro.org>
Date: Tue, 04 Nov 2025 14:08:56 +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 5/8] net: stmmac: qcom-ethqos: split power management
fields into a separate structure
From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Now that we have a separate wrapper for device match data, let's extend
this structure with a pointer to the structure containing fields related
to power-management only. This is done because a device may have the
same device settings but different power management mode (e.g.: firmware
vs manual).
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
---
.../net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index 9cafe101049d5412d649b3beaca350c497ffc981..1f00556bbad997e2ec76b521cffe2eb14fabb79e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -91,14 +91,18 @@ struct ethqos_emac_driver_data {
unsigned int num_por;
bool rgmii_config_loopback_en;
bool has_emac_ge_3;
- const char *link_clk_name;
u32 dma_addr_width;
struct dwmac4_addrs dwmac4_addrs;
bool needs_sgmii_loopback;
};
+struct ethqos_emac_pm_data {
+ const char *link_clk_name;
+};
+
struct ethqos_emac_match_data {
const struct ethqos_emac_driver_data *drv_data;
+ const struct ethqos_emac_pm_data *pm_data;
};
struct qcom_ethqos {
@@ -292,7 +296,6 @@ static const struct ethqos_emac_driver_data emac_v4_0_0_data = {
.num_por = ARRAY_SIZE(emac_v4_0_0_por),
.rgmii_config_loopback_en = false,
.has_emac_ge_3 = true,
- .link_clk_name = "phyaux",
.needs_sgmii_loopback = true,
.dma_addr_width = 36,
.dwmac4_addrs = {
@@ -313,8 +316,13 @@ static const struct ethqos_emac_driver_data emac_v4_0_0_data = {
},
};
+static const struct ethqos_emac_pm_data emac_sa8775p_pm_data = {
+ .link_clk_name = "phyaux",
+};
+
static const struct ethqos_emac_match_data emac_sa8775p_data = {
.drv_data = &emac_v4_0_0_data,
+ .pm_data = &emac_sa8775p_pm_data,
};
static int ethqos_dll_configure(struct qcom_ethqos *ethqos)
@@ -771,11 +779,13 @@ 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 *drv_data;
+ const struct ethqos_emac_pm_data *pm_data;
const struct ethqos_emac_match_data *data;
struct plat_stmmacenet_data *plat_dat;
struct stmmac_resources stmmac_res;
struct device *dev = &pdev->dev;
struct qcom_ethqos *ethqos;
+ const char *clk_name;
int ret, i;
ret = stmmac_get_platform_resources(pdev, &stmmac_res);
@@ -823,6 +833,9 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
data = device_get_match_data(dev);
drv_data = data->drv_data;
+ pm_data = data->pm_data;
+ clk_name = pm_data && pm_data->link_clk_name ?
+ pm_data->link_clk_name : "rgmii";
ethqos->por = drv_data->por;
ethqos->num_por = drv_data->num_por;
@@ -830,7 +843,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
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");
+ ethqos->link_clk = devm_clk_get(dev, clk_name);
if (IS_ERR(ethqos->link_clk))
return dev_err_probe(dev, PTR_ERR(ethqos->link_clk),
"Failed to get link_clk\n");
--
2.51.0
Powered by blists - more mailing lists