Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

soc: mtk-pm-domains: do not register smi node as syscon

Mediatek requires mmsys clocks to be unprepared during suspend,
otherwise system has chances to hang.

syscon_regmap_lookup_by_phandle_optional() will attach and prepare the
first clock in smi node, leading to additional prepare to the clock
which is not balanced with the prepare/unprepare pair in resume/suspend
callbacks.

If a power domain node requests an smi node and the smi node's first
clock is an mmsys clock, it will results in an unstable suspend resume.

Fixes: f414854c8843 ("soc: mediatek: pm-domains: Add SMI block as bus protection block")
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: chun-jie.chen <chun-jie.chen@mediatek.com>
Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20210601035905.2970384-2-hsinyi@chromium.org
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>

authored by

Hsin-Yi Wang and committed by
Matthias Brugger
eed6ff1b ba96de3a

+8 -3
+8 -3
drivers/soc/mediatek/mtk-pm-domains.c
··· 297 297 const struct scpsys_domain_data *domain_data; 298 298 struct scpsys_domain *pd; 299 299 struct device_node *root_node = scpsys->dev->of_node; 300 + struct device_node *smi_node; 300 301 struct property *prop; 301 302 const char *clk_name; 302 303 int i, ret, num_clks; ··· 353 352 if (IS_ERR(pd->infracfg)) 354 353 return ERR_CAST(pd->infracfg); 355 354 356 - pd->smi = syscon_regmap_lookup_by_phandle_optional(node, "mediatek,smi"); 357 - if (IS_ERR(pd->smi)) 358 - return ERR_CAST(pd->smi); 355 + smi_node = of_parse_phandle(node, "mediatek,smi", 0); 356 + if (smi_node) { 357 + pd->smi = device_node_to_regmap(smi_node); 358 + of_node_put(smi_node); 359 + if (IS_ERR(pd->smi)) 360 + return ERR_CAST(pd->smi); 361 + } 359 362 360 363 num_clks = of_clk_get_parent_count(node); 361 364 if (num_clks > 0) {