clk: mediatek: reset: Add reset support for simple probe
authorRex-BC Chen <rex-bc.chen@mediatek.com>
Mon, 23 May 2022 09:33:38 +0000 (17:33 +0800)
committerStephen Boyd <sboyd@kernel.org>
Thu, 16 Jun 2022 00:24:13 +0000 (17:24 -0700)
- Add a pointer of "mtk_clk_rst_desc" to "mtk_clk_desc".
- Add register reset with device function in mtk_clk_simple_probe().

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: NĂ­colas F. R. A. Prado <nfraprado@collabora.com>
Tested-by: NĂ­colas F. R. A. Prado <nfraprado@collabora.com>
Link: https://lore.kernel.org/r/20220523093346.28493-12-rex-bc.chen@mediatek.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/mediatek/clk-mtk.c
drivers/clk/mediatek/clk-mtk.h

index b918800..05a188c 100644 (file)
@@ -444,6 +444,13 @@ int mtk_clk_simple_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, clk_data);
 
+       if (mcd->rst_desc) {
+               r = mtk_register_reset_controller_with_dev(&pdev->dev,
+                                                          mcd->rst_desc);
+               if (r)
+                       goto unregister_clks;
+       }
+
        return r;
 
 unregister_clks:
index 6ed0c74..1b95c48 100644 (file)
@@ -192,6 +192,7 @@ struct clk_hw *mtk_clk_register_ref2usb_tx(const char *name,
 struct mtk_clk_desc {
        const struct mtk_gate *clks;
        size_t num_clks;
+       const struct mtk_clk_rst_desc *rst_desc;
 };
 
 int mtk_clk_simple_probe(struct platform_device *pdev);