mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-21 06:33:41 +00:00
8f8d5decc9
Removed because they are upstream:
generic/backport-5.15/704-15-v5.19-net-mtk_eth_soc-move-MAC_MCR-setting-to-mac_finish.patch
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.15.y&id=c5c0760adc260d55265c086b9efb350ea6dda38b
generic/pending-5.15/735-net-mediatek-mtk_eth_soc-release-MAC_MCR_FORCE_LINK-.patch
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.15.y&id=448cc8b5f743985f6d1d98aa4efb386fef4c3bf2
generic/pending-5.15/736-net-ethernet-mtk_eth_soc-fix-PPE-hanging-issue.patch
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.15.y&id=9fcadd125044007351905d40c405fadc2d3bb6d6
Add new configuration symbols for tegra target.
Tested-by: Stijn Segers <foss@volatilesystems.org>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit fb2c6e9d4d
)
85 lines
2.8 KiB
Diff
85 lines
2.8 KiB
Diff
From 4ec4cfbf63a697a5b1c82b400d28afd0347d555a Mon Sep 17 00:00:00 2001
|
|
From: Maxime Ripard <maxime@cerno.tech>
|
|
Date: Fri, 8 Apr 2022 10:06:11 +0200
|
|
Subject: [PATCH] clk: Take into account uncached clocks in
|
|
clk_set_rate_range()
|
|
|
|
clk_set_rate_range() will use the last requested rate for the clock when
|
|
it calls into the driver set_rate hook.
|
|
|
|
However, if CLK_GET_RATE_NOCACHE is set on that clock, the last
|
|
requested rate might not be matching the current rate of the clock. In
|
|
such a case, let's read out the rate from the hardware and use that in
|
|
our set_rate instead.
|
|
|
|
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> # imx8mp
|
|
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> # exynos4210, meson g12b
|
|
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
|
---
|
|
drivers/clk/clk.c | 6 +++++-
|
|
drivers/clk/clk_test.c | 28 ++++++++++++++++++++++++++++
|
|
2 files changed, 33 insertions(+), 1 deletion(-)
|
|
|
|
--- a/drivers/clk/clk.c
|
|
+++ b/drivers/clk/clk.c
|
|
@@ -2379,6 +2379,10 @@ static int clk_set_rate_range_nolock(str
|
|
goto out;
|
|
}
|
|
|
|
+ rate = clk->core->req_rate;
|
|
+ if (clk->core->flags & CLK_GET_RATE_NOCACHE)
|
|
+ rate = clk_core_get_rate_recalc(clk->core);
|
|
+
|
|
/*
|
|
* Since the boundaries have been changed, let's give the
|
|
* opportunity to the provider to adjust the clock rate based on
|
|
@@ -2396,7 +2400,7 @@ static int clk_set_rate_range_nolock(str
|
|
* - the determine_rate() callback does not really check for
|
|
* this corner case when determining the rate
|
|
*/
|
|
- rate = clamp(clk->core->req_rate, min, max);
|
|
+ rate = clamp(rate, min, max);
|
|
ret = clk_core_set_rate_nolock(clk->core, rate);
|
|
if (ret) {
|
|
/* rollback the changes */
|
|
--- a/drivers/clk/clk_test.c
|
|
+++ b/drivers/clk/clk_test.c
|
|
@@ -362,9 +362,37 @@ static void clk_test_uncached_set_range(
|
|
KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2);
|
|
}
|
|
|
|
+/*
|
|
+ * Test that for an uncached clock, clk_set_rate_range() will work
|
|
+ * properly if the rate has changed in hardware.
|
|
+ *
|
|
+ * In this case, it means that if the rate wasn't initially in the range
|
|
+ * we're trying to set, but got changed at some point into the range
|
|
+ * without the kernel knowing about it, its rate shouldn't be affected.
|
|
+ */
|
|
+static void clk_test_uncached_updated_rate_set_range(struct kunit *test)
|
|
+{
|
|
+ struct clk_dummy_context *ctx = test->priv;
|
|
+ struct clk_hw *hw = &ctx->hw;
|
|
+ struct clk *clk = hw->clk;
|
|
+ unsigned long rate;
|
|
+
|
|
+ ctx->rate = DUMMY_CLOCK_RATE_1 + 1000;
|
|
+ KUNIT_ASSERT_EQ(test,
|
|
+ clk_set_rate_range(clk,
|
|
+ DUMMY_CLOCK_RATE_1,
|
|
+ DUMMY_CLOCK_RATE_2),
|
|
+ 0);
|
|
+
|
|
+ rate = clk_get_rate(clk);
|
|
+ KUNIT_ASSERT_GT(test, rate, 0);
|
|
+ KUNIT_EXPECT_EQ(test, rate, DUMMY_CLOCK_RATE_1 + 1000);
|
|
+}
|
|
+
|
|
static struct kunit_case clk_uncached_test_cases[] = {
|
|
KUNIT_CASE(clk_test_uncached_get_rate),
|
|
KUNIT_CASE(clk_test_uncached_set_range),
|
|
+ KUNIT_CASE(clk_test_uncached_updated_rate_set_range),
|
|
{}
|
|
};
|
|
|