clk: meson: meson8b: use the regmap in the internal reset controller

For now the reset controller was using raw register access because the
early init did not initialize the regmap. However, now that clocks are
initialized early we can simply use the regmap also for the reset
controller.
No functional changes.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
This commit is contained in:
Martin Blumenstingl 2018-07-21 21:14:00 +02:00 committed by Jerome Brunet
parent 6291b8c5ac
commit 93c873d686
1 changed files with 6 additions and 7 deletions

View File

@ -23,7 +23,7 @@ static DEFINE_SPINLOCK(meson_clk_lock);
struct meson8b_clk_reset { struct meson8b_clk_reset {
struct reset_controller_dev reset; struct reset_controller_dev reset;
void __iomem *base; struct regmap *regmap;
}; };
static const struct pll_params_table sys_pll_params_table[] = { static const struct pll_params_table sys_pll_params_table[] = {
@ -1064,7 +1064,6 @@ static int meson8b_clk_reset_update(struct reset_controller_dev *rcdev,
container_of(rcdev, struct meson8b_clk_reset, reset); container_of(rcdev, struct meson8b_clk_reset, reset);
unsigned long flags; unsigned long flags;
const struct meson8b_clk_reset_line *reset; const struct meson8b_clk_reset_line *reset;
u32 val;
if (id >= ARRAY_SIZE(meson8b_clk_reset_bits)) if (id >= ARRAY_SIZE(meson8b_clk_reset_bits))
return -EINVAL; return -EINVAL;
@ -1073,12 +1072,12 @@ static int meson8b_clk_reset_update(struct reset_controller_dev *rcdev,
spin_lock_irqsave(&meson_clk_lock, flags); spin_lock_irqsave(&meson_clk_lock, flags);
val = readl(meson8b_clk_reset->base + reset->reg);
if (assert) if (assert)
val |= BIT(reset->bit_idx); regmap_update_bits(meson8b_clk_reset->regmap, reset->reg,
BIT(reset->bit_idx), BIT(reset->bit_idx));
else else
val &= ~BIT(reset->bit_idx); regmap_update_bits(meson8b_clk_reset->regmap, reset->reg,
writel(val, meson8b_clk_reset->base + reset->reg); BIT(reset->bit_idx), 0);
spin_unlock_irqrestore(&meson_clk_lock, flags); spin_unlock_irqrestore(&meson_clk_lock, flags);
@ -1131,7 +1130,7 @@ static void __init meson8b_clkc_init(struct device_node *np)
return; return;
/* Reset Controller */ /* Reset Controller */
rstc->base = clk_base; rstc->regmap = map;
rstc->reset.ops = &meson8b_clk_reset_ops; rstc->reset.ops = &meson8b_clk_reset_ops;
rstc->reset.nr_resets = ARRAY_SIZE(meson8b_clk_reset_bits); rstc->reset.nr_resets = ARRAY_SIZE(meson8b_clk_reset_bits);
rstc->reset.of_node = np; rstc->reset.of_node = np;