Commit 8383e259 authored by Tony Lindgren's avatar Tony Lindgren

bus: ti-sysc: Add support for disabling module without legacy mode

We must not assert reset for modules with no child device drivers
until in runtime_suspend. Otherwise register access will fail without
legacy mode helping us.

Let's add a flag for disable_on_idle and move the reset driver
handling to runtime suspend and resume. We can then also use the
disable_on_idle flag to reconfigure sysconfig register for PM
modes requesting it.

Let's also make the other flags use bitfield while at it instead of
bool.
Tested-by: default avatarKeerthy <j-keerthy@ti.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 6e09f497
...@@ -89,9 +89,10 @@ struct sysc { ...@@ -89,9 +89,10 @@ struct sysc {
struct ti_sysc_cookie cookie; struct ti_sysc_cookie cookie;
const char *name; const char *name;
u32 revision; u32 revision;
bool enabled; unsigned int enabled:1;
bool needs_resume; unsigned int needs_resume:1;
bool child_needs_resume; unsigned int child_needs_resume:1;
unsigned int disable_on_idle:1;
struct delayed_work idle_work; struct delayed_work idle_work;
}; };
...@@ -1021,6 +1022,9 @@ static int __maybe_unused sysc_runtime_suspend_legacy(struct device *dev, ...@@ -1021,6 +1022,9 @@ static int __maybe_unused sysc_runtime_suspend_legacy(struct device *dev,
dev_err(dev, "%s: could not idle: %i\n", dev_err(dev, "%s: could not idle: %i\n",
__func__, error); __func__, error);
if (ddata->disable_on_idle)
reset_control_assert(ddata->rsts);
return 0; return 0;
} }
...@@ -1030,6 +1034,9 @@ static int __maybe_unused sysc_runtime_resume_legacy(struct device *dev, ...@@ -1030,6 +1034,9 @@ static int __maybe_unused sysc_runtime_resume_legacy(struct device *dev,
struct ti_sysc_platform_data *pdata; struct ti_sysc_platform_data *pdata;
int error; int error;
if (ddata->disable_on_idle)
reset_control_deassert(ddata->rsts);
pdata = dev_get_platdata(ddata->dev); pdata = dev_get_platdata(ddata->dev);
if (!pdata) if (!pdata)
return 0; return 0;
...@@ -1077,6 +1084,9 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev) ...@@ -1077,6 +1084,9 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev)
err_allow_idle: err_allow_idle:
sysc_clkdm_allow_idle(ddata); sysc_clkdm_allow_idle(ddata);
if (ddata->disable_on_idle)
reset_control_assert(ddata->rsts);
return error; return error;
} }
...@@ -1090,6 +1100,9 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev) ...@@ -1090,6 +1100,9 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev)
if (ddata->enabled) if (ddata->enabled)
return 0; return 0;
if (ddata->disable_on_idle)
reset_control_deassert(ddata->rsts);
sysc_clkdm_deny_idle(ddata); sysc_clkdm_deny_idle(ddata);
if (sysc_opt_clks_needed(ddata)) { if (sysc_opt_clks_needed(ddata)) {
...@@ -2306,7 +2319,7 @@ static int sysc_probe(struct platform_device *pdev) ...@@ -2306,7 +2319,7 @@ static int sysc_probe(struct platform_device *pdev)
} }
if (!of_get_available_child_count(ddata->dev->of_node)) if (!of_get_available_child_count(ddata->dev->of_node))
reset_control_assert(ddata->rsts); ddata->disable_on_idle = true;
return 0; return 0;
......
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