| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- From b8eb1081d267708ba976525a1fe2162901b34f3a Mon Sep 17 00:00:00 2001
- From: AngeloGioacchino Del Regno <[email protected]>
- Date: Fri, 20 Jan 2023 10:20:37 +0100
- Subject: [PATCH] clk: mediatek: clk-mtk: Add dummy clock ops
- In order to migrate some (few) old clock drivers to the common
- mtk_clk_simple_probe() function, add dummy clock ops to be able
- to insert a dummy clock with ID 0 at the beginning of the list.
- Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
- Reviewed-by: Miles Chen <[email protected]>
- Reviewed-by: Chen-Yu Tsai <[email protected]>
- Tested-by: Miles Chen <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
- Tested-by: Mingming Su <[email protected]>
- Signed-off-by: Stephen Boyd <[email protected]>
- ---
- drivers/clk/mediatek/clk-mtk.c | 16 ++++++++++++++++
- drivers/clk/mediatek/clk-mtk.h | 19 +++++++++++++++++++
- 2 files changed, 35 insertions(+)
- --- a/drivers/clk/mediatek/clk-mtk.c
- +++ b/drivers/clk/mediatek/clk-mtk.c
- @@ -18,6 +18,22 @@
- #include "clk-mtk.h"
- #include "clk-gate.h"
-
- +const struct mtk_gate_regs cg_regs_dummy = { 0, 0, 0 };
- +EXPORT_SYMBOL_GPL(cg_regs_dummy);
- +
- +static int mtk_clk_dummy_enable(struct clk_hw *hw)
- +{
- + return 0;
- +}
- +
- +static void mtk_clk_dummy_disable(struct clk_hw *hw) { }
- +
- +const struct clk_ops mtk_clk_dummy_ops = {
- + .enable = mtk_clk_dummy_enable,
- + .disable = mtk_clk_dummy_disable,
- +};
- +EXPORT_SYMBOL_GPL(mtk_clk_dummy_ops);
- +
- static void mtk_init_clk_data(struct clk_hw_onecell_data *clk_data,
- unsigned int clk_num)
- {
- --- a/drivers/clk/mediatek/clk-mtk.h
- +++ b/drivers/clk/mediatek/clk-mtk.h
- @@ -22,6 +22,25 @@
-
- struct platform_device;
-
- +/*
- + * We need the clock IDs to start from zero but to maintain devicetree
- + * backwards compatibility we can't change bindings to start from zero.
- + * Only a few platforms are affected, so we solve issues given by the
- + * commonized MTK clocks probe function(s) by adding a dummy clock at
- + * the beginning where needed.
- + */
- +#define CLK_DUMMY 0
- +
- +extern const struct clk_ops mtk_clk_dummy_ops;
- +extern const struct mtk_gate_regs cg_regs_dummy;
- +
- +#define GATE_DUMMY(_id, _name) { \
- + .id = _id, \
- + .name = _name, \
- + .regs = &cg_regs_dummy, \
- + .ops = &mtk_clk_dummy_ops, \
- + }
- +
- struct mtk_fixed_clk {
- int id;
- const char *name;
|