* [PATCH v2] clk: tegra: Add missing reset deassertion
@ 2022-04-29 12:58 Diogo Ivo
2022-05-04 9:24 ` Thierry Reding
0 siblings, 1 reply; 2+ messages in thread
From: Diogo Ivo @ 2022-04-29 12:58 UTC (permalink / raw)
To: dmitry.osipenko, thierry.reding; +Cc: linux-tegra
Commit 4782c0a5dd88e3797426e08c5c437e95a3156631 ("clk: tegra: Don't
deassert reset on enabling clocks") removed deassertion of reset lines
when enabling peripheral clocks. This breaks the initialization of the
DFLL driver which relied on this behaviour.
Fix this problem by adding explicit deassert/assert requests to the
driver and the corresponding reset to the DT. Tested on Google Pixel C.
Cc: stable@vger.kernel.org
Fixes: 4782c0a5dd88 ("clk: tegra: Don't deassert reset on enabling clocks")
Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
---
Changes in v2:
- Changed reset getter to the optional variant
arch/arm64/boot/dts/nvidia/tegra210.dtsi | 5 +++--
drivers/clk/tegra/clk-dfll.c | 12 ++++++++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/nvidia/tegra210.dtsi b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
index 218a2b32200f..4f0e51f1a343 100644
--- a/arch/arm64/boot/dts/nvidia/tegra210.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
@@ -1366,8 +1366,9 @@ dfll: clock@70110000 {
<&tegra_car TEGRA210_CLK_DFLL_REF>,
<&tegra_car TEGRA210_CLK_I2C5>;
clock-names = "soc", "ref", "i2c";
- resets = <&tegra_car TEGRA210_RST_DFLL_DVCO>;
- reset-names = "dvco";
+ resets = <&tegra_car TEGRA210_RST_DFLL_DVCO>,
+ <&tegra_car 155>;
+ reset-names = "dvco", "dfll";
#clock-cells = <0>;
clock-output-names = "dfllCPU_out";
status = "disabled";
diff --git a/drivers/clk/tegra/clk-dfll.c b/drivers/clk/tegra/clk-dfll.c
index 6144447f86c6..62238dca9a53 100644
--- a/drivers/clk/tegra/clk-dfll.c
+++ b/drivers/clk/tegra/clk-dfll.c
@@ -271,6 +271,7 @@ struct tegra_dfll {
struct clk *ref_clk;
struct clk *i2c_clk;
struct clk *dfll_clk;
+ struct reset_control *dfll_rst;
struct reset_control *dvco_rst;
unsigned long ref_rate;
unsigned long i2c_clk_rate;
@@ -1464,6 +1465,7 @@ static int dfll_init(struct tegra_dfll *td)
return -EINVAL;
}
+ reset_control_deassert(td->dfll_rst);
reset_control_deassert(td->dvco_rst);
ret = clk_prepare(td->ref_clk);
@@ -1509,6 +1511,7 @@ static int dfll_init(struct tegra_dfll *td)
clk_unprepare(td->ref_clk);
reset_control_assert(td->dvco_rst);
+ reset_control_assert(td->dfll_rst);
return ret;
}
@@ -1530,6 +1533,7 @@ int tegra_dfll_suspend(struct device *dev)
}
reset_control_assert(td->dvco_rst);
+ reset_control_assert(td->dfll_rst);
return 0;
}
@@ -1548,6 +1552,7 @@ int tegra_dfll_resume(struct device *dev)
{
struct tegra_dfll *td = dev_get_drvdata(dev);
+ reset_control_deassert(td->dfll_rst);
reset_control_deassert(td->dvco_rst);
pm_runtime_get_sync(td->dev);
@@ -1951,6 +1956,12 @@ int tegra_dfll_register(struct platform_device *pdev,
td->soc = soc;
+ td->dfll_rst = devm_reset_control_get_optional(td->dev, "dfll");
+ if (IS_ERR(td->dfll_rst)) {
+ dev_err(td->dev, "couldn't get dfll reset\n");
+ return PTR_ERR(td->dfll_rst);
+ }
+
td->dvco_rst = devm_reset_control_get(td->dev, "dvco");
if (IS_ERR(td->dvco_rst)) {
dev_err(td->dev, "couldn't get dvco reset\n");
@@ -2087,6 +2098,7 @@ struct tegra_dfll_soc_data *tegra_dfll_unregister(struct platform_device *pdev)
clk_unprepare(td->i2c_clk);
reset_control_assert(td->dvco_rst);
+ reset_control_assert(td->dfll_rst);
return td->soc;
}
--
2.36.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v2] clk: tegra: Add missing reset deassertion
2022-04-29 12:58 [PATCH v2] clk: tegra: Add missing reset deassertion Diogo Ivo
@ 2022-05-04 9:24 ` Thierry Reding
0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2022-05-04 9:24 UTC (permalink / raw)
To: Diogo Ivo; +Cc: dmitry.osipenko, linux-tegra
[-- Attachment #1: Type: text/plain, Size: 1162 bytes --]
On Fri, Apr 29, 2022 at 01:58:43PM +0100, Diogo Ivo wrote:
> Commit 4782c0a5dd88e3797426e08c5c437e95a3156631 ("clk: tegra: Don't
> deassert reset on enabling clocks") removed deassertion of reset lines
> when enabling peripheral clocks. This breaks the initialization of the
> DFLL driver which relied on this behaviour.
>
> Fix this problem by adding explicit deassert/assert requests to the
> driver and the corresponding reset to the DT. Tested on Google Pixel C.
>
> Cc: stable@vger.kernel.org
> Fixes: 4782c0a5dd88 ("clk: tegra: Don't deassert reset on enabling clocks")
> Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
> ---
> Changes in v2:
> - Changed reset getter to the optional variant
>
> arch/arm64/boot/dts/nvidia/tegra210.dtsi | 5 +++--
> drivers/clk/tegra/clk-dfll.c | 12 ++++++++++++
> 2 files changed, 15 insertions(+), 2 deletions(-)
I've applied this, but in the process split it up into two: one patch
for the clock driver and another for the device tree changes. For future
patches, please keep in mind that driver and device tree changes should
always be separate.
Thanks,
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-04 9:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-29 12:58 [PATCH v2] clk: tegra: Add missing reset deassertion Diogo Ivo
2022-05-04 9:24 ` Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox