Thread (21 messages) 21 messages, 5 authors, 2025-02-04

RE: [PATCH v5 2/4] net: stmmac: dwc-qos: Add FSD EQoS support

From: Swathi K S <hidden>
Date: 2025-01-29 11:15:35
Also in: linux-arm-kernel, linux-devicetree, linux-samsung-soc, lkml

-----Original Message-----
From: Andrew Lunn <andrew@lunn.ch>
Sent: 28 January 2025 19:19
To: Swathi K S <redacted>
Cc: krzk@kernel.org; robh@kernel.org; davem@davemloft.net;
edumazet@google.com; kuba@kernel.org; pabeni@redhat.com;
conor+dt@kernel.org; richardcochran@gmail.com;
mcoquelin.stm32@gmail.com; alim.akhtar@samsung.com; linux-
fsd@tesla.com; netdev@vger.kernel.org; devicetree@vger.kernel.org; linux-
kernel@vger.kernel.org; linux-stm32@st-md-mailman.stormreply.com;
linux-arm-kernel@lists.infradead.org; linux-samsung-soc@vger.kernel.org;
alexandre.torgue@foss.st.com; peppe.cavallaro@st.com;
joabreu@synopsys.com; rcsekar@samsung.com; ssiddha@tesla.com;
jayati.sahu@samsung.com; pankaj.dubey@samsung.com;
ravi.patel@samsung.com; gost.dev@samsung.com
Subject: Re: [PATCH v5 2/4] net: stmmac: dwc-qos: Add FSD EQoS support
quoted
+static int fsd_clks_endisable(void *priv, bool enabled) {
+	struct fsd_eqos_plat_data *plat = priv;
+
+	if (enabled) {
+		return clk_bulk_prepare_enable(plat->num_clks, plat->clks);
+	} else {
+		clk_bulk_disable_unprepare(plat->num_clks, plat->clks);
+		return 0;
+	}
+}
+
+static int fsd_eqos_probe(struct platform_device *pdev,
+			  struct plat_stmmacenet_data *data,
+			  struct stmmac_resources *res)
+{
+	struct fsd_eqos_plat_data *priv_plat;
+	struct clk *rx1 = NULL;
+	struct clk *rx2 = NULL;
+	int ret = 0;
+
+	priv_plat = devm_kzalloc(&pdev->dev, sizeof(*priv_plat),
GFP_KERNEL);
quoted
+	if (!priv_plat)
+		return -ENOMEM;
+
+	priv_plat->dev = &pdev->dev;
+
+	ret = devm_clk_bulk_get_all(&pdev->dev, &priv_plat->clks);
+	if (ret < 0)
+		return dev_err_probe(&pdev->dev, ret, "No clocks
available\n");
quoted
+
+	priv_plat->num_clks = ret;
It looks like you should be able to share all the clk_bulk code with
tegra_eqos_probe(). The stmmac driver suffers from lots of cut/paste code
with no consolidation. You can at least not make the tegra code worse by
doing a little refactoring.
Hi Andrew, 
Just to clarify, you were referring to refactoring tegra code to use
clk_bulk APIs, right?
In that case, will look into this and evaluate the best approach for
refactoring the code. 

- Swathi
	Andrew
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help