Skip to content

Commit

Permalink
clk: mmp2: fix link error without mmp2
Browse files Browse the repository at this point in the history
The newly added function is only built into the kernel if mmp2
is enabled, causing a link error otherwise.

arm-linux-gnueabi-ld: drivers/clk/mmp/clk.o: in function `mmp_register_pll_clks':
clk.c:(.text+0x6dc): undefined reference to `mmp_clk_register_pll'

Move it to a different file to get it to link.

Fixes: 5d34d0b ("clk: mmp2: Add support for PLL clock sources")
Signed-off-by: Arnd Bergmann <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Reported-by: Guenter Roeck <[email protected]>
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
  • Loading branch information
arndb authored and bebarino committed Apr 13, 2020
1 parent 924ed1f commit 742b50f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 39 deletions.
33 changes: 32 additions & 1 deletion drivers/clk/mmp/clk-pll.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static const struct clk_ops mmp_clk_pll_ops = {
.recalc_rate = mmp_clk_pll_recalc_rate,
};

struct clk *mmp_clk_register_pll(char *name,
static struct clk *mmp_clk_register_pll(char *name,
unsigned long default_rate,
void __iomem *enable_reg, u32 enable,
void __iomem *reg, u8 shift,
Expand Down Expand Up @@ -137,3 +137,34 @@ struct clk *mmp_clk_register_pll(char *name,

return clk;
}

void mmp_register_pll_clks(struct mmp_clk_unit *unit,
struct mmp_param_pll_clk *clks,
void __iomem *base, int size)
{
struct clk *clk;
int i;

for (i = 0; i < size; i++) {
void __iomem *reg = NULL;

if (clks[i].offset)
reg = base + clks[i].offset;

clk = mmp_clk_register_pll(clks[i].name,
clks[i].default_rate,
base + clks[i].enable_offset,
clks[i].enable,
reg, clks[i].shift,
clks[i].input_rate,
base + clks[i].postdiv_offset,
clks[i].postdiv_shift);
if (IS_ERR(clk)) {
pr_err("%s: failed to register clock %s\n",
__func__, clks[i].name);
continue;
}
if (clks[i].id)
unit->clk_table[clks[i].id] = clk;
}
}
31 changes: 0 additions & 31 deletions drivers/clk/mmp/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,37 +176,6 @@ void mmp_register_div_clks(struct mmp_clk_unit *unit,
}
}

void mmp_register_pll_clks(struct mmp_clk_unit *unit,
struct mmp_param_pll_clk *clks,
void __iomem *base, int size)
{
struct clk *clk;
int i;

for (i = 0; i < size; i++) {
void __iomem *reg = NULL;

if (clks[i].offset)
reg = base + clks[i].offset;

clk = mmp_clk_register_pll(clks[i].name,
clks[i].default_rate,
base + clks[i].enable_offset,
clks[i].enable,
reg, clks[i].shift,
clks[i].input_rate,
base + clks[i].postdiv_offset,
clks[i].postdiv_shift);
if (IS_ERR(clk)) {
pr_err("%s: failed to register clock %s\n",
__func__, clks[i].name);
continue;
}
if (clks[i].id)
unit->clk_table[clks[i].id] = clk;
}
}

void mmp_clk_add(struct mmp_clk_unit *unit, unsigned int id,
struct clk *clk)
{
Expand Down
7 changes: 0 additions & 7 deletions drivers/clk/mmp/clk.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,6 @@ void mmp_register_pll_clks(struct mmp_clk_unit *unit,
struct mmp_param_pll_clk *clks,
void __iomem *base, int size);

extern struct clk *mmp_clk_register_pll(char *name,
unsigned long default_rate,
void __iomem *enable_reg, u32 enable,
void __iomem *reg, u8 shift,
unsigned long input_rate,
void __iomem *postdiv_reg, u8 postdiv_shift);

#define DEFINE_MIX_REG_INFO(w_d, s_d, w_m, s_m, fc) \
{ \
.width_div = (w_d), \
Expand Down

0 comments on commit 742b50f

Please sign in to comment.