Skip to content

Commit

Permalink
clk: gxbb: put dividers and muxes in tables
Browse files Browse the repository at this point in the history
Until now, there was only 2 dividers and 2 muxes declared for the gxbb
platform. With the ongoing work on various subsystem, including audio,
this is about to change. Use the same approach as gates for dividers and
muxes, putting them in tables to fix the register address at runtime.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/20170309104154.28295-5-jbrunet@baylibre.com
  • Loading branch information
jbrun3t authored and mturquette committed Mar 27, 2017
1 parent e988aae commit b92332e
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions drivers/clk/meson/gxbb.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,16 @@ static struct clk_gate *const gxbb_clk_gates[] = {
&gxbb_sar_adc_clk,
};

static struct clk_mux *const gxbb_clk_muxes[] = {
&gxbb_mpeg_clk_sel,
&gxbb_sar_adc_clk_sel,
};

static struct clk_divider *const gxbb_clk_dividers[] = {
&gxbb_mpeg_clk_div,
&gxbb_sar_adc_clk_div,
};

static int gxbb_clkc_probe(struct platform_device *pdev)
{
void __iomem *clk_base;
Expand All @@ -928,19 +938,21 @@ static int gxbb_clkc_probe(struct platform_device *pdev)
/* Populate the base address for CPU clk */
gxbb_cpu_clk.base = clk_base;

/* Populate the base address for the MPEG clks */
gxbb_mpeg_clk_sel.reg = clk_base + (u64)gxbb_mpeg_clk_sel.reg;
gxbb_mpeg_clk_div.reg = clk_base + (u64)gxbb_mpeg_clk_div.reg;

/* Populate the base address for the SAR ADC clks */
gxbb_sar_adc_clk_sel.reg = clk_base + (u64)gxbb_sar_adc_clk_sel.reg;
gxbb_sar_adc_clk_div.reg = clk_base + (u64)gxbb_sar_adc_clk_div.reg;

/* Populate base address for gates */
for (i = 0; i < ARRAY_SIZE(gxbb_clk_gates); i++)
gxbb_clk_gates[i]->reg = clk_base +
(u64)gxbb_clk_gates[i]->reg;

/* Populate base address for muxes */
for (i = 0; i < ARRAY_SIZE(gxbb_clk_muxes); i++)
gxbb_clk_muxes[i]->reg = clk_base +
(u64)gxbb_clk_muxes[i]->reg;

/* Populate base address for dividers */
for (i = 0; i < ARRAY_SIZE(gxbb_clk_dividers); i++)
gxbb_clk_dividers[i]->reg = clk_base +
(u64)gxbb_clk_dividers[i]->reg;

/*
* register all clks
*/
Expand Down

0 comments on commit b92332e

Please sign in to comment.