Takashi Iwai 39fb53
From 22ef01a203d27fee8b7694020b7e722db7efd2a7 Mon Sep 17 00:00:00 2001
Takashi Iwai 39fb53
From: Nicolin Chen <nicoleotsuka@gmail.com>
Takashi Iwai 39fb53
Date: Fri, 15 Sep 2017 12:10:13 -0700
Takashi Iwai 39fb53
Subject: [PATCH] clk: tegra: Use readl_relaxed_poll_timeout_atomic() in tegra210_clock_init()
Takashi Iwai 39fb53
Git-commit: 22ef01a203d27fee8b7694020b7e722db7efd2a7
Takashi Iwai 39fb53
Patch-mainline: v4.15-rc1
Takashi Iwai 39fb53
References: bsc#1051510
Takashi Iwai 39fb53
Takashi Iwai 39fb53
Below is the call trace of tegra210_init_pllu() function:
Takashi Iwai 39fb53
  start_kernel()
Takashi Iwai 39fb53
  -> time_init()
Takashi Iwai 39fb53
  --> of_clk_init()
Takashi Iwai 39fb53
  ---> tegra210_clock_init()
Takashi Iwai 39fb53
  ----> tegra210_pll_init()
Takashi Iwai 39fb53
  -----> tegra210_init_pllu()
Takashi Iwai 39fb53
Takashi Iwai 39fb53
Because the preemption is disabled in the start_kernel before calling
Takashi Iwai 39fb53
time_init, tegra210_init_pllu is actually in an atomic context while
Takashi Iwai 39fb53
it includes a readl_relaxed_poll_timeout that might sleep.
Takashi Iwai 39fb53
Takashi Iwai 39fb53
So this patch just changes this readl_relaxed_poll_timeout() to its
Takashi Iwai 39fb53
atomic version.
Takashi Iwai 39fb53
Takashi Iwai 39fb53
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Takashi Iwai 39fb53
Acked-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Takashi Iwai 39fb53
Signed-off-by: Thierry Reding <treding@nvidia.com>
Takashi Iwai 39fb53
Acked-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 39fb53
Takashi Iwai 39fb53
---
Takashi Iwai 39fb53
 drivers/clk/tegra/clk-tegra210.c | 4 ++--
Takashi Iwai 39fb53
 1 file changed, 2 insertions(+), 2 deletions(-)
Takashi Iwai 39fb53
Takashi Iwai 39fb53
diff --git a/drivers/clk/tegra/clk-tegra210.c b/drivers/clk/tegra/clk-tegra210.c
Takashi Iwai 39fb53
index be7b736371f6..9e6260869eb9 100644
Takashi Iwai 39fb53
--- a/drivers/clk/tegra/clk-tegra210.c
Takashi Iwai 39fb53
+++ b/drivers/clk/tegra/clk-tegra210.c
Takashi Iwai 39fb53
@@ -2568,8 +2568,8 @@ static int tegra210_enable_pllu(void)
Takashi Iwai 39fb53
 	reg |= PLL_ENABLE;
Takashi Iwai 39fb53
 	writel(reg, clk_base + PLLU_BASE);
Takashi Iwai 39fb53
 
Takashi Iwai 39fb53
-	readl_relaxed_poll_timeout(clk_base + PLLU_BASE, reg,
Takashi Iwai 39fb53
-				   reg & PLL_BASE_LOCK, 2, 1000);
Takashi Iwai 39fb53
+	readl_relaxed_poll_timeout_atomic(clk_base + PLLU_BASE, reg,
Takashi Iwai 39fb53
+					  reg & PLL_BASE_LOCK, 2, 1000);
Takashi Iwai 39fb53
 	if (!(reg & PLL_BASE_LOCK)) {
Takashi Iwai 39fb53
 		pr_err("Timed out waiting for PLL_U to lock\n");
Takashi Iwai 39fb53
 		return -ETIMEDOUT;
Takashi Iwai 39fb53
-- 
Takashi Iwai 39fb53
2.18.0
Takashi Iwai 39fb53