Skip to content

Commit dfd1427

Browse files
Dinh Nguyenbebarino
authored andcommitted
clk: agilex/stratix10/n5x: fix how the bypass_reg is handled
If the bypass_reg is set, then we can return the bypass parent, however, if there is not a bypass_reg, we need to figure what the correct parent mux is. The previous code never handled the parent mux if there was a bypass_reg. Fixes: 80c6b7a ("clk: socfpga: agilex: add clock driver for the Agilex platform") Cc: [email protected] Signed-off-by: Dinh Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent c2c9c56 commit dfd1427

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/clk/socfpga/clk-periph-s10.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,21 @@ static u8 clk_periclk_get_parent(struct clk_hw *hwclk)
6464
{
6565
struct socfpga_periph_clk *socfpgaclk = to_periph_clk(hwclk);
6666
u32 clk_src, mask;
67-
u8 parent;
67+
u8 parent = 0;
6868

69+
/* handle the bypass first */
6970
if (socfpgaclk->bypass_reg) {
7071
mask = (0x1 << socfpgaclk->bypass_shift);
7172
parent = ((readl(socfpgaclk->bypass_reg) & mask) >>
7273
socfpgaclk->bypass_shift);
73-
} else {
74+
if (parent)
75+
return parent;
76+
}
77+
78+
if (socfpgaclk->hw.reg) {
7479
clk_src = readl(socfpgaclk->hw.reg);
7580
parent = (clk_src >> CLK_MGR_FREE_SHIFT) &
76-
CLK_MGR_FREE_MASK;
81+
CLK_MGR_FREE_MASK;
7782
}
7883
return parent;
7984
}

0 commit comments

Comments
 (0)