Commit cdc56c11 authored by Tero Kristo's avatar Tero Kristo Committed by Tony Lindgren

bus: ti-sysc: avoid toggling power state of module during probe

Current implementation for ti-sysc powers down the module once module
init is complete. However, right after power is disabled, it is enabled
via runtime PM. This is unnecessary so avoid it by re-ordering the
events a bit; move powering down of the module post runtime PM enable
which makes sure the use counts are maintained properly and there is
no extra power down/up sequence for the module.
Signed-off-by: default avatarTero Kristo <t-kristo@ti.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent df4f3459
...@@ -1584,11 +1584,6 @@ static int sysc_reset(struct sysc *ddata) ...@@ -1584,11 +1584,6 @@ static int sysc_reset(struct sysc *ddata)
static int sysc_init_module(struct sysc *ddata) static int sysc_init_module(struct sysc *ddata)
{ {
int error = 0; int error = 0;
bool manage_clocks = true;
if (ddata->cfg.quirks &
(SYSC_QUIRK_NO_IDLE | SYSC_QUIRK_NO_IDLE_ON_INIT))
manage_clocks = false;
error = sysc_clockdomain_init(ddata); error = sysc_clockdomain_init(ddata);
if (error) if (error)
...@@ -1621,28 +1616,32 @@ static int sysc_init_module(struct sysc *ddata) ...@@ -1621,28 +1616,32 @@ static int sysc_init_module(struct sysc *ddata)
if (ddata->legacy_mode) { if (ddata->legacy_mode) {
error = sysc_legacy_init(ddata); error = sysc_legacy_init(ddata);
if (error) if (error)
goto err_main_clocks; goto err_reset;
} }
if (!ddata->legacy_mode) { if (!ddata->legacy_mode) {
error = sysc_enable_module(ddata->dev); error = sysc_enable_module(ddata->dev);
if (error) if (error)
goto err_main_clocks; goto err_reset;
} }
error = sysc_reset(ddata); error = sysc_reset(ddata);
if (error) if (error)
dev_err(ddata->dev, "Reset failed with %d\n", error); dev_err(ddata->dev, "Reset failed with %d\n", error);
if (!ddata->legacy_mode && manage_clocks) if (error && !ddata->legacy_mode)
sysc_disable_module(ddata->dev); sysc_disable_module(ddata->dev);
err_reset:
if (error && !(ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT))
reset_control_assert(ddata->rsts);
err_main_clocks: err_main_clocks:
if (manage_clocks) if (error)
sysc_disable_main_clocks(ddata); sysc_disable_main_clocks(ddata);
err_opt_clocks: err_opt_clocks:
/* No re-enable of clockdomain autoidle to prevent module autoidle */ /* No re-enable of clockdomain autoidle to prevent module autoidle */
if (manage_clocks) { if (error) {
sysc_disable_opt_clocks(ddata); sysc_disable_opt_clocks(ddata);
sysc_clkdm_allow_idle(ddata); sysc_clkdm_allow_idle(ddata);
} }
...@@ -2415,10 +2414,17 @@ static int sysc_probe(struct platform_device *pdev) ...@@ -2415,10 +2414,17 @@ static int sysc_probe(struct platform_device *pdev)
goto unprepare; goto unprepare;
} }
/* Balance reset counts */ /* Balance use counts as PM runtime should have enabled these all */
if (ddata->rsts) if (!(ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT))
reset_control_assert(ddata->rsts); reset_control_assert(ddata->rsts);
if (!(ddata->cfg.quirks &
(SYSC_QUIRK_NO_IDLE | SYSC_QUIRK_NO_IDLE_ON_INIT))) {
sysc_disable_main_clocks(ddata);
sysc_disable_opt_clocks(ddata);
sysc_clkdm_allow_idle(ddata);
}
sysc_show_registers(ddata); sysc_show_registers(ddata);
ddata->dev->type = &sysc_device_type; ddata->dev->type = &sysc_device_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment