Thread (16 messages) 16 messages, 3 authors, 2024-05-16

Re: [PATCH 4/5] clk: en7523: Add reset-controller support for EN7581 SoC

From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Date: 2024-05-16 09:50:41
Also in: linux-clk, linux-devicetree

Il 15/05/24 14:58, Lorenzo Bianconi ha scritto:
Introduce reset API support to EN7581 clock driver.

Tested-by: Zhengping Zhang <redacted>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Heh, that's exactly the usual MediaTek reset controller :-D
quoted hunk ↗ jump to hunk
---
  drivers/clk/clk-en7523.c | 96 +++++++++++++++++++++++++++++++++++++++-
  1 file changed, 94 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
index 381605be333f..18798b692b68 100644
--- a/drivers/clk/clk-en7523.c
+++ b/drivers/clk/clk-en7523.c
@@ -6,6 +6,7 @@
  #include <linux/of.h>
  #include <linux/of_device.h>
  #include <linux/platform_device.h>
+#include <linux/reset-controller.h>
  #include <dt-bindings/clock/en7523-clk.h>
  
  #define REG_PCI_CONTROL			0x88
@@ -65,8 +66,18 @@ struct en_clk_gate {
  	struct clk_hw hw;
  };
  
+#define RST_NR_PER_BANK		32
Please move this definition at the beginning of this file, grouping that with
the others.

..snip...
quoted hunk ↗ jump to hunk
@@ -456,12 +542,14 @@ static int en7523_clk_probe(struct platform_device *pdev)
  	en7523_register_clocks(&pdev->dev, clk_data, base, np_base);
  
  	r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
-	if (r)
+	if (r) {
  		dev_err(&pdev->dev,
  			"could not register clock provider: %s: %d\n",
  			pdev->name, r);
+		return r;
+	}
  
-	return r;
+	return en7523_reset_register(&pdev->dev, np_base, soc_data);
If en7523_reset_register fails, you want to call of_clk_del_provider(), so
you can't just return like this...

Cheers,
Angelo
quoted hunk ↗ jump to hunk
  }
  
  static const struct en_clk_soc_data en7523_data = {
@@ -480,6 +568,10 @@ static const struct en_clk_soc_data en7581_data = {
  		.unprepare = en7581_pci_unprepare,
  		.disable = en7581_pci_disable,
  	},
+	.reset_data = {
+		.base_addr = REG_RESET_CONTROL2,
+		.n_banks = 2,
+	},
  	.hw_init = en7581_clk_hw_init,
  };
  



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help