Skip to content

Commit 9ff50bf

Browse files
committed
Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
Pull clk driver fixes from Stephen Boyd: - Make the regulator state match the GDSC power domain state at boot on Qualcomm SoCs so that the regulator isn't turned off inadvertently. - Fix earlycon on i.MX6Q SoCs * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: clk: qcom: gdsc: Ensure regulator init state matches GDSC state clk: imx6q: fix uart earlycon unwork
2 parents 9085423 + 9711759 commit 9ff50bf

File tree

2 files changed

+37
-19
lines changed

2 files changed

+37
-19
lines changed

drivers/clk/imx/clk-imx6q.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,6 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
974974
hws[IMX6QDL_CLK_PLL3_USB_OTG]->clk);
975975
}
976976

977-
imx_register_uart_clocks(1);
977+
imx_register_uart_clocks(2);
978978
}
979979
CLK_OF_DECLARE(imx6q, "fsl,imx6q-ccm", imx6q_clocks_init);

drivers/clk/qcom/gdsc.c

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -357,34 +357,52 @@ static int gdsc_init(struct gdsc *sc)
357357
if (on < 0)
358358
return on;
359359

360-
/*
361-
* Votable GDSCs can be ON due to Vote from other masters.
362-
* If a Votable GDSC is ON, make sure we have a Vote.
363-
*/
364-
if ((sc->flags & VOTABLE) && on)
365-
gdsc_enable(&sc->pd);
360+
if (on) {
361+
/* The regulator must be on, sync the kernel state */
362+
if (sc->rsupply) {
363+
ret = regulator_enable(sc->rsupply);
364+
if (ret < 0)
365+
return ret;
366+
}
366367

367-
/*
368-
* Make sure the retain bit is set if the GDSC is already on, otherwise
369-
* we end up turning off the GDSC and destroying all the register
370-
* contents that we thought we were saving.
371-
*/
372-
if ((sc->flags & RETAIN_FF_ENABLE) && on)
373-
gdsc_retain_ff_on(sc);
368+
/*
369+
* Votable GDSCs can be ON due to Vote from other masters.
370+
* If a Votable GDSC is ON, make sure we have a Vote.
371+
*/
372+
if (sc->flags & VOTABLE) {
373+
ret = regmap_update_bits(sc->regmap, sc->gdscr,
374+
SW_COLLAPSE_MASK, val);
375+
if (ret)
376+
return ret;
377+
}
378+
379+
/* Turn on HW trigger mode if supported */
380+
if (sc->flags & HW_CTRL) {
381+
ret = gdsc_hwctrl(sc, true);
382+
if (ret < 0)
383+
return ret;
384+
}
374385

375-
/* If ALWAYS_ON GDSCs are not ON, turn them ON */
376-
if (sc->flags & ALWAYS_ON) {
377-
if (!on)
378-
gdsc_enable(&sc->pd);
386+
/*
387+
* Make sure the retain bit is set if the GDSC is already on,
388+
* otherwise we end up turning off the GDSC and destroying all
389+
* the register contents that we thought we were saving.
390+
*/
391+
if (sc->flags & RETAIN_FF_ENABLE)
392+
gdsc_retain_ff_on(sc);
393+
} else if (sc->flags & ALWAYS_ON) {
394+
/* If ALWAYS_ON GDSCs are not ON, turn them ON */
395+
gdsc_enable(&sc->pd);
379396
on = true;
380-
sc->pd.flags |= GENPD_FLAG_ALWAYS_ON;
381397
}
382398

383399
if (on || (sc->pwrsts & PWRSTS_RET))
384400
gdsc_force_mem_on(sc);
385401
else
386402
gdsc_clear_mem_on(sc);
387403

404+
if (sc->flags & ALWAYS_ON)
405+
sc->pd.flags |= GENPD_FLAG_ALWAYS_ON;
388406
if (!sc->pd.power_off)
389407
sc->pd.power_off = gdsc_disable;
390408
if (!sc->pd.power_on)

0 commit comments

Comments
 (0)