[PATCH 7/7] clk: mediatek: reset: Add reset support for simple probe/remove

Rex-BC Chen rex-bc.chen at mediatek.com
Mon Apr 18 06:21:54 PDT 2022


- Add a pointer of "mtk_clk_rst_data" to "mtk_clk_desc".
- Add register reset function in mtk_clk_simple_probe().
- Add unregister reset function in mtk_clk_simple_remove().

Signed-off-by: Rex-BC Chen <rex-bc.chen at mediatek.com>
---
 drivers/clk/mediatek/clk-mtk.c | 6 ++++++
 drivers/clk/mediatek/clk-mtk.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c
index b4063261cf56..4ecdf0be26d5 100644
--- a/drivers/clk/mediatek/clk-mtk.c
+++ b/drivers/clk/mediatek/clk-mtk.c
@@ -453,6 +453,9 @@ int mtk_clk_simple_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, clk_data);
 
+	if (mcd->rst && mcd->rst->supported)
+		r = mtk_clk_register_rst_ctrl(node, mcd->rst);
+
 	return r;
 
 unregister_clks:
@@ -468,6 +471,9 @@ int mtk_clk_simple_remove(struct platform_device *pdev)
 	struct clk_onecell_data *clk_data = platform_get_drvdata(pdev);
 	struct device_node *node = pdev->dev.of_node;
 
+	if (mcd->rst && mcd->rst->supported)
+		mtk_clk_unregister_rst_ctrl(mcd->rst);
+
 	of_clk_del_provider(node);
 	mtk_clk_unregister_gates(mcd->clks, mcd->num_clks, clk_data);
 	mtk_free_clk_data(clk_data);
diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h
index dfb0549ceb6c..453d12cb57ac 100644
--- a/drivers/clk/mediatek/clk-mtk.h
+++ b/drivers/clk/mediatek/clk-mtk.h
@@ -194,6 +194,7 @@ struct clk *mtk_clk_register_ref2usb_tx(const char *name,
 struct mtk_clk_desc {
 	const struct mtk_gate *clks;
 	size_t num_clks;
+	struct mtk_clk_rst_data *rst;
 };
 
 int mtk_clk_simple_probe(struct platform_device *pdev);
-- 
2.18.0




More information about the Linux-mediatek mailing list