Skip to content

Commit 1a5cd7c

Browse files
committed
bus: ti-sysc: Enable all clocks directly during init to read revision
The first thing we want to do is just read the module revision register to be able to configure the module specific quirks and configure the module registers. As the interconnect target module may not yet be properly configured and may need a reset first, we don't want to use pm_runtime_get() at this point. To read the revision register, let's just enable the all the clocks for the interconnect target module during init even if the optional clocks are not needed. That way we can read the revision register to configure the quirks needed for PM runtime. Signed-off-by: Tony Lindgren <[email protected]>
1 parent d878970 commit 1a5cd7c

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

drivers/bus/ti-sysc.c

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,39 +1042,45 @@ static int sysc_reset(struct sysc *ddata)
10421042
100, MAX_MODULE_SOFTRESET_WAIT);
10431043
}
10441044

1045-
/* At this point the module is configured enough to read the revision */
1045+
/*
1046+
* At this point the module is configured enough to read the revision but
1047+
* module may not be completely configured yet to use PM runtime. Enable
1048+
* all clocks directly during init to configure the quirks needed for PM
1049+
* runtime based on the revision register.
1050+
*/
10461051
static int sysc_init_module(struct sysc *ddata)
10471052
{
1048-
int error;
1053+
int error = 0;
1054+
bool manage_clocks = true;
10491055

10501056
if (ddata->cfg.quirks &
1051-
(SYSC_QUIRK_NO_IDLE | SYSC_QUIRK_NO_IDLE_ON_INIT)) {
1052-
ddata->revision = sysc_read_revision(ddata);
1053-
goto rev_quirks;
1054-
}
1057+
(SYSC_QUIRK_NO_IDLE | SYSC_QUIRK_NO_IDLE_ON_INIT))
1058+
manage_clocks = false;
10551059

1056-
error = pm_runtime_get_sync(ddata->dev);
1057-
if (error < 0) {
1058-
pm_runtime_put_noidle(ddata->dev);
1060+
if (manage_clocks) {
1061+
error = sysc_enable_opt_clocks(ddata);
1062+
if (error)
1063+
return error;
10591064

1060-
return 0;
1065+
error = sysc_enable_main_clocks(ddata);
1066+
if (error)
1067+
goto err_opt_clocks;
10611068
}
10621069

1070+
ddata->revision = sysc_read_revision(ddata);
1071+
sysc_init_revision_quirks(ddata);
1072+
10631073
error = sysc_reset(ddata);
1064-
if (error) {
1074+
if (error)
10651075
dev_err(ddata->dev, "Reset failed with %d\n", error);
1066-
pm_runtime_put_sync(ddata->dev);
10671076

1068-
return error;
1069-
}
1070-
1071-
ddata->revision = sysc_read_revision(ddata);
1072-
pm_runtime_put_sync(ddata->dev);
1073-
1074-
rev_quirks:
1075-
sysc_init_revision_quirks(ddata);
1077+
if (manage_clocks)
1078+
sysc_disable_main_clocks(ddata);
1079+
err_opt_clocks:
1080+
if (manage_clocks)
1081+
sysc_disable_opt_clocks(ddata);
10761082

1077-
return 0;
1083+
return error;
10781084
}
10791085

10801086
static int sysc_init_sysc_mask(struct sysc *ddata)
@@ -1812,11 +1818,11 @@ static int sysc_probe(struct platform_device *pdev)
18121818
if (error)
18131819
return error;
18141820

1815-
pm_runtime_enable(ddata->dev);
18161821
error = sysc_init_module(ddata);
18171822
if (error)
18181823
goto unprepare;
18191824

1825+
pm_runtime_enable(ddata->dev);
18201826
error = pm_runtime_get_sync(ddata->dev);
18211827
if (error < 0) {
18221828
pm_runtime_put_noidle(ddata->dev);

0 commit comments

Comments
 (0)