Commit 34d5003b authored by Dinh Nguyen's avatar Dinh Nguyen Committed by Michael Turquette

clk: socfpga: Add a second parent option for the dbg_base_clk

The debug base clock can be bypassed from the main PLL to the OSC1 clock.
The bypass register is the staysoc1(0x10) register that is in the clock
manager.

This patch adds the option to get the correct parent for the debug base
clock.
Signed-off-by: default avatarDinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 0f350f06
...@@ -44,8 +44,17 @@ static unsigned long clk_periclk_recalc_rate(struct clk_hw *hwclk, ...@@ -44,8 +44,17 @@ static unsigned long clk_periclk_recalc_rate(struct clk_hw *hwclk,
return parent_rate / div; return parent_rate / div;
} }
static u8 clk_periclk_get_parent(struct clk_hw *hwclk)
{
u32 clk_src;
clk_src = readl(clk_mgr_base_addr + CLKMGR_DBCTRL);
return clk_src & 0x1;
}
static const struct clk_ops periclk_ops = { static const struct clk_ops periclk_ops = {
.recalc_rate = clk_periclk_recalc_rate, .recalc_rate = clk_periclk_recalc_rate,
.get_parent = clk_periclk_get_parent,
}; };
static __init void __socfpga_periph_init(struct device_node *node, static __init void __socfpga_periph_init(struct device_node *node,
...@@ -55,7 +64,7 @@ static __init void __socfpga_periph_init(struct device_node *node, ...@@ -55,7 +64,7 @@ static __init void __socfpga_periph_init(struct device_node *node,
struct clk *clk; struct clk *clk;
struct socfpga_periph_clk *periph_clk; struct socfpga_periph_clk *periph_clk;
const char *clk_name = node->name; const char *clk_name = node->name;
const char *parent_name; const char *parent_name[SOCFPGA_MAX_PARENTS];
struct clk_init_data init; struct clk_init_data init;
int rc; int rc;
u32 fixed_div; u32 fixed_div;
...@@ -89,9 +98,10 @@ static __init void __socfpga_periph_init(struct device_node *node, ...@@ -89,9 +98,10 @@ static __init void __socfpga_periph_init(struct device_node *node,
init.name = clk_name; init.name = clk_name;
init.ops = ops; init.ops = ops;
init.flags = 0; init.flags = 0;
parent_name = of_clk_get_parent_name(node, 0);
init.parent_names = &parent_name; init.num_parents = of_clk_parent_fill(node, parent_name,
init.num_parents = 1; SOCFPGA_MAX_PARENTS);
init.parent_names = parent_name;
periph_clk->hw.hw.init = &init; periph_clk->hw.hw.init = &init;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
/* Clock Manager offsets */ /* Clock Manager offsets */
#define CLKMGR_CTRL 0x0 #define CLKMGR_CTRL 0x0
#define CLKMGR_BYPASS 0x4 #define CLKMGR_BYPASS 0x4
#define CLKMGR_DBCTRL 0x10
#define CLKMGR_L4SRC 0x70 #define CLKMGR_L4SRC 0x70
#define CLKMGR_PERPLL_SRC 0xAC #define CLKMGR_PERPLL_SRC 0xAC
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment