Skip to content

Commit

Permalink
spi: spi-mtk-nor: initialize spi controller after resume
Browse files Browse the repository at this point in the history
[ Upstream commit 317c204 ]

After system resumes, the registers of nor controller are
initialized with default values. The nor controller will
not function properly.

To handle both issues above, we add mtk_nor_init() in
mtk_nor_resume after pm_runtime_force_resume().

Fixes: 3bfd910 ("spi: spi-mtk-nor: Add power management support")

Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
Reviewed-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Link: https://lore.kernel.org/r/20220412115743.22641-1-allen-kh.cheng@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
kuanhsuncheng authored and gregkh committed Apr 27, 2022
1 parent f714abf commit 3f7914d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drivers/spi/spi-mtk-nor.c
Expand Up @@ -895,7 +895,17 @@ static int __maybe_unused mtk_nor_suspend(struct device *dev)

static int __maybe_unused mtk_nor_resume(struct device *dev)
{
return pm_runtime_force_resume(dev);
struct spi_controller *ctlr = dev_get_drvdata(dev);
struct mtk_nor *sp = spi_controller_get_devdata(ctlr);
int ret;

ret = pm_runtime_force_resume(dev);
if (ret)
return ret;

mtk_nor_init(sp);

return 0;
}

static const struct dev_pm_ops mtk_nor_pm_ops = {
Expand Down

0 comments on commit 3f7914d

Please sign in to comment.