netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/3] net: xilinx: emaclite: Adopt clock support
@ 2024-10-09 16:28 Radhey Shyam Pandey
  2024-10-09 16:28 ` [PATCH net-next v3 1/3] dt-bindings: net: emaclite: Add " Radhey Shyam Pandey
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Radhey Shyam Pandey @ 2024-10-09 16:28 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt,
	michal.simek, harini.katakam
  Cc: netdev, devicetree, linux-kernel, linux-arm-kernel, git,
	Radhey Shyam Pandey

This patchset adds emaclite clock support. AXI Ethernet Lite IP can also
be used on SoC platforms like Zynq UltraScale+ MPSoC which combines
powerful processing system (PS) and user-programmable logic (PL) into
the same device. On these platforms it is mandatory to explicitly enable
IP clocks for proper functionality.

Changes for v3:
- Add Conor's ack to 1/3 patch.
- Remove braces around dev_err_probe().

Changes for v2:
- Make clocks as required property.

Abin Joseph (3):
  dt-bindings: net: emaclite: Add clock support
  net: emaclite: Replace alloc_etherdev() with devm_alloc_etherdev()
  net: emaclite: Adopt clock support

 .../bindings/net/xlnx,emaclite.yaml           |  5 +++++
 drivers/net/ethernet/xilinx/xilinx_emaclite.c | 21 ++++++++++---------
 2 files changed, 16 insertions(+), 10 deletions(-)


base-commit: 6607c17c6c5e029da03a90085db22daf518232bf
-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net-next v3 1/3] dt-bindings: net: emaclite: Add clock support
  2024-10-09 16:28 [PATCH net-next v3 0/3] net: xilinx: emaclite: Adopt clock support Radhey Shyam Pandey
@ 2024-10-09 16:28 ` Radhey Shyam Pandey
  2024-10-09 16:28 ` [PATCH net-next v3 2/3] net: emaclite: Replace alloc_etherdev() with devm_alloc_etherdev() Radhey Shyam Pandey
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Radhey Shyam Pandey @ 2024-10-09 16:28 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt,
	michal.simek, harini.katakam
  Cc: netdev, devicetree, linux-kernel, linux-arm-kernel, git,
	Abin Joseph, Radhey Shyam Pandey

From: Abin Joseph <abin.joseph@amd.com>

Add s_axi_aclk AXI4 clock support. Traditionally this IP was used on
microblaze platforms which had fixed clocks enabled all the time. But
since its a PL IP, it can also be used on SoC platforms like Zynq
UltraScale+ MPSoC which combines processing system (PS) and user
programmable logic (PL) into the same device. On these platforms instead
of fixed enabled clocks it is mandatory to explicitly enable IP clocks
for proper functionality.

So make clock a required property and also define max supported clock
constraints.

Signed-off-by: Abin Joseph <abin.joseph@amd.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
---
Changes for v3:
- Add Conor acked-by tag.

Changes for v2:
- Make clocks as required property.
---
 Documentation/devicetree/bindings/net/xlnx,emaclite.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/xlnx,emaclite.yaml b/Documentation/devicetree/bindings/net/xlnx,emaclite.yaml
index 92d8ade988f6..e16384aff557 100644
--- a/Documentation/devicetree/bindings/net/xlnx,emaclite.yaml
+++ b/Documentation/devicetree/bindings/net/xlnx,emaclite.yaml
@@ -29,6 +29,9 @@ properties:
   interrupts:
     maxItems: 1
 
+  clocks:
+    maxItems: 1
+
   phy-handle: true
 
   local-mac-address: true
@@ -45,6 +48,7 @@ required:
   - compatible
   - reg
   - interrupts
+  - clocks
   - phy-handle
 
 additionalProperties: false
@@ -56,6 +60,7 @@ examples:
         reg = <0x40e00000 0x10000>;
         interrupt-parent = <&axi_intc_1>;
         interrupts = <1>;
+        clocks = <&dummy>;
         local-mac-address = [00 00 00 00 00 00];
         phy-handle = <&phy0>;
         xlnx,rx-ping-pong;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net-next v3 2/3] net: emaclite: Replace alloc_etherdev() with devm_alloc_etherdev()
  2024-10-09 16:28 [PATCH net-next v3 0/3] net: xilinx: emaclite: Adopt clock support Radhey Shyam Pandey
  2024-10-09 16:28 ` [PATCH net-next v3 1/3] dt-bindings: net: emaclite: Add " Radhey Shyam Pandey
@ 2024-10-09 16:28 ` Radhey Shyam Pandey
  2024-10-10  9:55   ` Simon Horman
  2024-10-09 16:28 ` [PATCH net-next v3 3/3] net: emaclite: Adopt clock support Radhey Shyam Pandey
  2024-10-11 22:50 ` [PATCH net-next v3 0/3] net: xilinx: " patchwork-bot+netdevbpf
  3 siblings, 1 reply; 8+ messages in thread
From: Radhey Shyam Pandey @ 2024-10-09 16:28 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt,
	michal.simek, harini.katakam
  Cc: netdev, devicetree, linux-kernel, linux-arm-kernel, git,
	Abin Joseph, Radhey Shyam Pandey

From: Abin Joseph <abin.joseph@amd.com>

Use device managed ethernet device allocation to simplify the error
handling logic. No functional change.

Signed-off-by: Abin Joseph <abin.joseph@amd.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
---
Changes for v3:
- None

Changes for v2:
- None
---
 drivers/net/ethernet/xilinx/xilinx_emaclite.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 2eb7f23538a6..418587942527 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1097,7 +1097,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
 	dev_info(dev, "Device Tree Probing\n");
 
 	/* Create an ethernet device instance */
-	ndev = alloc_etherdev(sizeof(struct net_local));
+	ndev = devm_alloc_etherdev(dev, sizeof(struct net_local));
 	if (!ndev)
 		return -ENOMEM;
 
@@ -1110,15 +1110,13 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
 	/* Get IRQ for the device */
 	rc = platform_get_irq(ofdev, 0);
 	if (rc < 0)
-		goto error;
+		return rc;
 
 	ndev->irq = rc;
 
 	lp->base_addr = devm_platform_get_and_ioremap_resource(ofdev, 0, &res);
-	if (IS_ERR(lp->base_addr)) {
-		rc = PTR_ERR(lp->base_addr);
-		goto error;
-	}
+	if (IS_ERR(lp->base_addr))
+		return PTR_ERR(lp->base_addr);
 
 	ndev->mem_start = res->start;
 	ndev->mem_end = res->end;
@@ -1167,8 +1165,6 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
 
 put_node:
 	of_node_put(lp->phy_node);
-error:
-	free_netdev(ndev);
 	return rc;
 }
 
@@ -1197,8 +1193,6 @@ static void xemaclite_of_remove(struct platform_device *of_dev)
 
 	of_node_put(lp->phy_node);
 	lp->phy_node = NULL;
-
-	free_netdev(ndev);
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net-next v3 3/3] net: emaclite: Adopt clock support
  2024-10-09 16:28 [PATCH net-next v3 0/3] net: xilinx: emaclite: Adopt clock support Radhey Shyam Pandey
  2024-10-09 16:28 ` [PATCH net-next v3 1/3] dt-bindings: net: emaclite: Add " Radhey Shyam Pandey
  2024-10-09 16:28 ` [PATCH net-next v3 2/3] net: emaclite: Replace alloc_etherdev() with devm_alloc_etherdev() Radhey Shyam Pandey
@ 2024-10-09 16:28 ` Radhey Shyam Pandey
  2024-10-10  9:54   ` Simon Horman
  2024-10-10  9:56   ` Simon Horman
  2024-10-11 22:50 ` [PATCH net-next v3 0/3] net: xilinx: " patchwork-bot+netdevbpf
  3 siblings, 2 replies; 8+ messages in thread
From: Radhey Shyam Pandey @ 2024-10-09 16:28 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt,
	michal.simek, harini.katakam
  Cc: netdev, devicetree, linux-kernel, linux-arm-kernel, git,
	Abin Joseph, Radhey Shyam Pandey

From: Abin Joseph <abin.joseph@amd.com>

Adapt to use the clock framework. Add s_axi_aclk clock from the processor
bus clock domain and make clk optional to keep DTB backward compatibility.

Signed-off-by: Abin Joseph <abin.joseph@amd.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
---
Changes for v3:
- Remove braces around dev_err_probe().

Changes for v2:
- None
---
 drivers/net/ethernet/xilinx/xilinx_emaclite.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 418587942527..ecf47107146d 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -7,6 +7,7 @@
  * Copyright (c) 2007 - 2013 Xilinx, Inc.
  */
 
+#include <linux/clk.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/uaccess.h>
@@ -1091,6 +1092,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
 	struct net_device *ndev = NULL;
 	struct net_local *lp = NULL;
 	struct device *dev = &ofdev->dev;
+	struct clk *clkin;
 
 	int rc = 0;
 
@@ -1127,6 +1129,11 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
 	lp->tx_ping_pong = get_bool(ofdev, "xlnx,tx-ping-pong");
 	lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong");
 
+	clkin = devm_clk_get_optional_enabled(&ofdev->dev, NULL);
+	if (IS_ERR(clkin))
+		return dev_err_probe(&ofdev->dev, PTR_ERR(clkin),
+				"Failed to get and enable clock from Device Tree\n");
+
 	rc = of_get_ethdev_address(ofdev->dev.of_node, ndev);
 	if (rc) {
 		dev_warn(dev, "No MAC address found, using random\n");
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next v3 3/3] net: emaclite: Adopt clock support
  2024-10-09 16:28 ` [PATCH net-next v3 3/3] net: emaclite: Adopt clock support Radhey Shyam Pandey
@ 2024-10-10  9:54   ` Simon Horman
  2024-10-10  9:56   ` Simon Horman
  1 sibling, 0 replies; 8+ messages in thread
From: Simon Horman @ 2024-10-10  9:54 UTC (permalink / raw)
  To: Radhey Shyam Pandey
  Cc: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt,
	michal.simek, harini.katakam, netdev, devicetree, linux-kernel,
	linux-arm-kernel, git, Abin Joseph

On Wed, Oct 09, 2024 at 09:58:23PM +0530, Radhey Shyam Pandey wrote:
> From: Abin Joseph <abin.joseph@amd.com>
> 
> Adapt to use the clock framework. Add s_axi_aclk clock from the processor
> bus clock domain and make clk optional to keep DTB backward compatibility.
> 
> Signed-off-by: Abin Joseph <abin.joseph@amd.com>
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
> ---
> Changes for v3:
> - Remove braces around dev_err_probe().
> 
> Changes for v2:
> - None

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next v3 2/3] net: emaclite: Replace alloc_etherdev() with devm_alloc_etherdev()
  2024-10-09 16:28 ` [PATCH net-next v3 2/3] net: emaclite: Replace alloc_etherdev() with devm_alloc_etherdev() Radhey Shyam Pandey
@ 2024-10-10  9:55   ` Simon Horman
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2024-10-10  9:55 UTC (permalink / raw)
  To: Radhey Shyam Pandey
  Cc: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt,
	michal.simek, harini.katakam, netdev, devicetree, linux-kernel,
	linux-arm-kernel, git, Abin Joseph

On Wed, Oct 09, 2024 at 09:58:22PM +0530, Radhey Shyam Pandey wrote:
> From: Abin Joseph <abin.joseph@amd.com>
> 
> Use device managed ethernet device allocation to simplify the error
> handling logic. No functional change.
> 
> Signed-off-by: Abin Joseph <abin.joseph@amd.com>
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next v3 3/3] net: emaclite: Adopt clock support
  2024-10-09 16:28 ` [PATCH net-next v3 3/3] net: emaclite: Adopt clock support Radhey Shyam Pandey
  2024-10-10  9:54   ` Simon Horman
@ 2024-10-10  9:56   ` Simon Horman
  1 sibling, 0 replies; 8+ messages in thread
From: Simon Horman @ 2024-10-10  9:56 UTC (permalink / raw)
  To: Radhey Shyam Pandey
  Cc: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt,
	michal.simek, harini.katakam, netdev, devicetree, linux-kernel,
	linux-arm-kernel, git, Abin Joseph

On Wed, Oct 09, 2024 at 09:58:23PM +0530, Radhey Shyam Pandey wrote:
> From: Abin Joseph <abin.joseph@amd.com>
> 
> Adapt to use the clock framework. Add s_axi_aclk clock from the processor
> bus clock domain and make clk optional to keep DTB backward compatibility.
> 
> Signed-off-by: Abin Joseph <abin.joseph@amd.com>
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next v3 0/3] net: xilinx: emaclite: Adopt clock support
  2024-10-09 16:28 [PATCH net-next v3 0/3] net: xilinx: emaclite: Adopt clock support Radhey Shyam Pandey
                   ` (2 preceding siblings ...)
  2024-10-09 16:28 ` [PATCH net-next v3 3/3] net: emaclite: Adopt clock support Radhey Shyam Pandey
@ 2024-10-11 22:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-11 22:50 UTC (permalink / raw)
  To: Radhey Shyam Pandey
  Cc: davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt,
	michal.simek, harini.katakam, netdev, devicetree, linux-kernel,
	linux-arm-kernel, git

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 9 Oct 2024 21:58:20 +0530 you wrote:
> This patchset adds emaclite clock support. AXI Ethernet Lite IP can also
> be used on SoC platforms like Zynq UltraScale+ MPSoC which combines
> powerful processing system (PS) and user-programmable logic (PL) into
> the same device. On these platforms it is mandatory to explicitly enable
> IP clocks for proper functionality.
> 
> Changes for v3:
> - Add Conor's ack to 1/3 patch.
> - Remove braces around dev_err_probe().
> 
> [...]

Here is the summary with links:
  - [net-next,v3,1/3] dt-bindings: net: emaclite: Add clock support
    https://git.kernel.org/netdev/net-next/c/60dbdc6e08d6
  - [net-next,v3,2/3] net: emaclite: Replace alloc_etherdev() with devm_alloc_etherdev()
    https://git.kernel.org/netdev/net-next/c/130fbea551c5
  - [net-next,v3,3/3] net: emaclite: Adopt clock support
    https://git.kernel.org/netdev/net-next/c/76d46d766a45

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-10-11 22:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 16:28 [PATCH net-next v3 0/3] net: xilinx: emaclite: Adopt clock support Radhey Shyam Pandey
2024-10-09 16:28 ` [PATCH net-next v3 1/3] dt-bindings: net: emaclite: Add " Radhey Shyam Pandey
2024-10-09 16:28 ` [PATCH net-next v3 2/3] net: emaclite: Replace alloc_etherdev() with devm_alloc_etherdev() Radhey Shyam Pandey
2024-10-10  9:55   ` Simon Horman
2024-10-09 16:28 ` [PATCH net-next v3 3/3] net: emaclite: Adopt clock support Radhey Shyam Pandey
2024-10-10  9:54   ` Simon Horman
2024-10-10  9:56   ` Simon Horman
2024-10-11 22:50 ` [PATCH net-next v3 0/3] net: xilinx: " patchwork-bot+netdevbpf

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).