Skip to content

Commit 499f818

Browse files
ziyao233bebarino
authored andcommitted
clk: loongson2: Allow specifying clock flags for gate clock
Some gate clocks need to be supplied with flags, e.g., it may be required to specify CLK_IS_CRTICAL for CPU clocks. Add a field to loongson2_clk_board_info for representing clock flags, and specify it when registering gate clocks. A new helper macro, CLK_GATE_FLAGS, is added to simplify definitions. Signed-off-by: Yao Zi <ziyao@disroot.org> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 793e6b7 commit 499f818

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

drivers/clk/clk-loongson2.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ struct loongson2_clk_board_info {
5050
const char *name;
5151
const char *parent_name;
5252
unsigned long fixed_rate;
53+
unsigned long flags;
5354
u8 reg_offset;
5455
u8 div_shift;
5556
u8 div_width;
@@ -105,6 +106,18 @@ struct loongson2_clk_board_info {
105106
.bit_idx = _bidx, \
106107
}
107108

109+
#define CLK_GATE_FLAGS(_id, _name, _pname, _offset, _bidx, \
110+
_flags) \
111+
{ \
112+
.id = _id, \
113+
.type = CLK_TYPE_GATE, \
114+
.name = _name, \
115+
.parent_name = _pname, \
116+
.reg_offset = _offset, \
117+
.bit_idx = _bidx, \
118+
.flags = _flags \
119+
}
120+
108121
#define CLK_FIXED(_id, _name, _pname, _rate) \
109122
{ \
110123
.id = _id, \
@@ -332,7 +345,8 @@ static int loongson2_clk_probe(struct platform_device *pdev)
332345
&clp->clk_lock);
333346
break;
334347
case CLK_TYPE_GATE:
335-
hw = devm_clk_hw_register_gate(dev, p->name, p->parent_name, 0,
348+
hw = devm_clk_hw_register_gate(dev, p->name, p->parent_name,
349+
p->flags,
336350
clp->base + p->reg_offset,
337351
p->bit_idx, 0,
338352
&clp->clk_lock);

0 commit comments

Comments
 (0)