Skip to content

Commit 0d3051c

Browse files
xdarklightjbrun3t
authored andcommitted
clk: meson: meson8b: Fix the polarity of the RESET_N lines
CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST and CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE are active low. This means: - asserting them requires setting the register value to 0 - de-asserting them requires setting the register value to 1 Set the register value accordingly for these two reset lines by setting the inverted the register value compared to all other reset lines. Fixes: 1896217 ("clk: meson: meson8b: register the built-in reset controller") Signed-off-by: Martin Blumenstingl <[email protected]> Signed-off-by: Jerome Brunet <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent da1978a commit 0d3051c

File tree

1 file changed

+56
-23
lines changed

1 file changed

+56
-23
lines changed

drivers/clk/meson/meson8b.c

Lines changed: 56 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3506,54 +3506,87 @@ static struct clk_regmap *const meson8b_clk_regmaps[] = {
35063506
static const struct meson8b_clk_reset_line {
35073507
u32 reg;
35083508
u8 bit_idx;
3509+
bool active_low;
35093510
} meson8b_clk_reset_bits[] = {
35103511
[CLKC_RESET_L2_CACHE_SOFT_RESET] = {
3511-
.reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 30
3512+
.reg = HHI_SYS_CPU_CLK_CNTL0,
3513+
.bit_idx = 30,
3514+
.active_low = false,
35123515
},
35133516
[CLKC_RESET_AXI_64_TO_128_BRIDGE_A5_SOFT_RESET] = {
3514-
.reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 29
3517+
.reg = HHI_SYS_CPU_CLK_CNTL0,
3518+
.bit_idx = 29,
3519+
.active_low = false,
35153520
},
35163521
[CLKC_RESET_SCU_SOFT_RESET] = {
3517-
.reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 28
3522+
.reg = HHI_SYS_CPU_CLK_CNTL0,
3523+
.bit_idx = 28,
3524+
.active_low = false,
35183525
},
35193526
[CLKC_RESET_CPU3_SOFT_RESET] = {
3520-
.reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 27
3527+
.reg = HHI_SYS_CPU_CLK_CNTL0,
3528+
.bit_idx = 27,
3529+
.active_low = false,
35213530
},
35223531
[CLKC_RESET_CPU2_SOFT_RESET] = {
3523-
.reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 26
3532+
.reg = HHI_SYS_CPU_CLK_CNTL0,
3533+
.bit_idx = 26,
3534+
.active_low = false,
35243535
},
35253536
[CLKC_RESET_CPU1_SOFT_RESET] = {
3526-
.reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 25
3537+
.reg = HHI_SYS_CPU_CLK_CNTL0,
3538+
.bit_idx = 25,
3539+
.active_low = false,
35273540
},
35283541
[CLKC_RESET_CPU0_SOFT_RESET] = {
3529-
.reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 24
3542+
.reg = HHI_SYS_CPU_CLK_CNTL0,
3543+
.bit_idx = 24,
3544+
.active_low = false,
35303545
},
35313546
[CLKC_RESET_A5_GLOBAL_RESET] = {
3532-
.reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 18
3547+
.reg = HHI_SYS_CPU_CLK_CNTL0,
3548+
.bit_idx = 18,
3549+
.active_low = false,
35333550
},
35343551
[CLKC_RESET_A5_AXI_SOFT_RESET] = {
3535-
.reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 17
3552+
.reg = HHI_SYS_CPU_CLK_CNTL0,
3553+
.bit_idx = 17,
3554+
.active_low = false,
35363555
},
35373556
[CLKC_RESET_A5_ABP_SOFT_RESET] = {
3538-
.reg = HHI_SYS_CPU_CLK_CNTL0, .bit_idx = 16
3557+
.reg = HHI_SYS_CPU_CLK_CNTL0,
3558+
.bit_idx = 16,
3559+
.active_low = false,
35393560
},
35403561
[CLKC_RESET_AXI_64_TO_128_BRIDGE_MMC_SOFT_RESET] = {
3541-
.reg = HHI_SYS_CPU_CLK_CNTL1, .bit_idx = 30
3562+
.reg = HHI_SYS_CPU_CLK_CNTL1,
3563+
.bit_idx = 30,
3564+
.active_low = false,
35423565
},
35433566
[CLKC_RESET_VID_CLK_CNTL_SOFT_RESET] = {
3544-
.reg = HHI_VID_CLK_CNTL, .bit_idx = 15
3567+
.reg = HHI_VID_CLK_CNTL,
3568+
.bit_idx = 15,
3569+
.active_low = false,
35453570
},
35463571
[CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_POST] = {
3547-
.reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 7
3572+
.reg = HHI_VID_DIVIDER_CNTL,
3573+
.bit_idx = 7,
3574+
.active_low = false,
35483575
},
35493576
[CLKC_RESET_VID_DIVIDER_CNTL_SOFT_RESET_PRE] = {
3550-
.reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 3
3577+
.reg = HHI_VID_DIVIDER_CNTL,
3578+
.bit_idx = 3,
3579+
.active_low = false,
35513580
},
35523581
[CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_POST] = {
3553-
.reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 1
3582+
.reg = HHI_VID_DIVIDER_CNTL,
3583+
.bit_idx = 1,
3584+
.active_low = true,
35543585
},
35553586
[CLKC_RESET_VID_DIVIDER_CNTL_RESET_N_PRE] = {
3556-
.reg = HHI_VID_DIVIDER_CNTL, .bit_idx = 0
3587+
.reg = HHI_VID_DIVIDER_CNTL,
3588+
.bit_idx = 0,
3589+
.active_low = true,
35573590
},
35583591
};
35593592

@@ -3562,22 +3595,22 @@ static int meson8b_clk_reset_update(struct reset_controller_dev *rcdev,
35623595
{
35633596
struct meson8b_clk_reset *meson8b_clk_reset =
35643597
container_of(rcdev, struct meson8b_clk_reset, reset);
3565-
unsigned long flags;
35663598
const struct meson8b_clk_reset_line *reset;
3599+
unsigned int value = 0;
3600+
unsigned long flags;
35673601

35683602
if (id >= ARRAY_SIZE(meson8b_clk_reset_bits))
35693603
return -EINVAL;
35703604

35713605
reset = &meson8b_clk_reset_bits[id];
35723606

3607+
if (assert != reset->active_low)
3608+
value = BIT(reset->bit_idx);
3609+
35733610
spin_lock_irqsave(&meson_clk_lock, flags);
35743611

3575-
if (assert)
3576-
regmap_update_bits(meson8b_clk_reset->regmap, reset->reg,
3577-
BIT(reset->bit_idx), BIT(reset->bit_idx));
3578-
else
3579-
regmap_update_bits(meson8b_clk_reset->regmap, reset->reg,
3580-
BIT(reset->bit_idx), 0);
3612+
regmap_update_bits(meson8b_clk_reset->regmap, reset->reg,
3613+
BIT(reset->bit_idx), value);
35813614

35823615
spin_unlock_irqrestore(&meson_clk_lock, flags);
35833616

0 commit comments

Comments
 (0)