mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-01 11:36:49 +00:00
db7b247fa9
Removed because it is upstream:
bcm53xx/patches-5.15/030-v5.16-0019-ARM-dts-BCM53573-Describe-on-SoC-BCM53125-rev-4-swit.patch
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=cb1003c07e746e4e82bdd3959c9ea37018ed41a3
Removed because it is upstream:
bcm53xx/patches-5.15/037-v6.6-0004-ARM-dts-BCM53573-Drop-nonexistent-default-off-LED-tr.patch
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c65a23e98e38dc991f495d6bdb3cfa6163a88a0c
Removed because it is upstream:
bcm53xx/patches-5.15/037-v6.6-0005-ARM-dts-BCM53573-Drop-nonexistent-usb-cells.patch
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=71475bcee001cae3844644c2787eef93b26489d1
Adapted hack-5.15/650-netfilter-add-xt_FLOWOFFLOAD-target.patch to match
the changes from the upstream flow offload patch:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7c71b831220edeab7ce603d818dc1708d9ea4137
Manually Adapted the following patch:
bcm53xx/patches-5.15/035-v6.2-0004-ARM-dts-broadcom-align-LED-node-names-with-dtschema.patch
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
(cherry picked from commit 387fde0da0
)
138 lines
4.0 KiB
Diff
138 lines
4.0 KiB
Diff
From 1008f7a86f470914e78a54a2a75cf8bbc8b8f9db Mon Sep 17 00:00:00 2001
|
|
From: Maxime Ripard <maxime@cerno.tech>
|
|
Date: Fri, 15 Apr 2022 14:17:41 +0200
|
|
Subject: [PATCH] clk: Add clk_get_rate_range
|
|
|
|
With the recent introduction of clock drivers that will force their
|
|
clock rate to either the minimum or maximum boundaries, it becomes
|
|
harder for clock users to discover either boundary of their clock.
|
|
|
|
Indeed, the best way to do that previously was to call clk_round_rate()
|
|
on either 0 or ULONG_MAX and count on the driver to clamp the rate to
|
|
the current boundary, but that won't work anymore.
|
|
|
|
Since any other alternative (calling clk_set_rate_range() and looking at
|
|
the returned value, calling clk_round_rate() still, or just doing
|
|
nothing) depends on how the driver will behaves, we actually are
|
|
punching a hole through the abstraction provided by the clock framework.
|
|
|
|
In order to avoid any abstraction violation, let's create a bunch of
|
|
accessors that will return the current minimum and maximum for a given
|
|
clock.
|
|
|
|
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
|
---
|
|
drivers/clk/clk.c | 18 ++++++++++++++
|
|
include/linux/clk.h | 59 +++++++++++++++++++++++++++++++++++++++++++++
|
|
2 files changed, 77 insertions(+)
|
|
|
|
--- a/drivers/clk/clk.c
|
|
+++ b/drivers/clk/clk.c
|
|
@@ -2586,6 +2586,24 @@ int clk_set_max_rate(struct clk *clk, un
|
|
EXPORT_SYMBOL_GPL(clk_set_max_rate);
|
|
|
|
/**
|
|
+ * clk_get_rate_range - returns the clock rate range for a clock source
|
|
+ * @clk: clock source
|
|
+ * @min: Pointer to the variable that will hold the minimum
|
|
+ * @max: Pointer to the variable that will hold the maximum
|
|
+ *
|
|
+ * Fills the @min and @max variables with the minimum and maximum that
|
|
+ * the clock source can reach.
|
|
+ */
|
|
+void clk_get_rate_range(struct clk *clk, unsigned long *min, unsigned long *max)
|
|
+{
|
|
+ if (!clk || !min || !max)
|
|
+ return;
|
|
+
|
|
+ clk_core_get_boundaries(clk->core, min, max);
|
|
+}
|
|
+EXPORT_SYMBOL_GPL(clk_get_rate_range);
|
|
+
|
|
+/**
|
|
* clk_get_parent - return the parent of a clk
|
|
* @clk: the clk whose parent gets returned
|
|
*
|
|
--- a/include/linux/clk.h
|
|
+++ b/include/linux/clk.h
|
|
@@ -807,6 +807,17 @@ bool clk_has_parent(struct clk *clk, str
|
|
int clk_set_rate_range(struct clk *clk, unsigned long min, unsigned long max);
|
|
|
|
/**
|
|
+ * clk_get_rate_range - returns the clock rate range for a clock source
|
|
+ * @clk: clock source
|
|
+ * @min: Pointer to the variable that will hold the minimum
|
|
+ * @max: Pointer to the variable that will hold the maximum
|
|
+ *
|
|
+ * Fills the @min and @max variables with the minimum and maximum that
|
|
+ * the clock source can reach.
|
|
+ */
|
|
+void clk_get_rate_range(struct clk *clk, unsigned long *min, unsigned long *max);
|
|
+
|
|
+/**
|
|
* clk_set_min_rate - set a minimum clock rate for a clock source
|
|
* @clk: clock source
|
|
* @rate: desired minimum clock rate in Hz, inclusive
|
|
@@ -1018,6 +1029,16 @@ static inline int clk_set_rate_range(str
|
|
return 0;
|
|
}
|
|
|
|
+static inline void clk_get_rate_range(struct clk *clk, unsigned long *min,
|
|
+ unsigned long *max)
|
|
+{
|
|
+ if (!min || !max)
|
|
+ return;
|
|
+
|
|
+ *min = 0;
|
|
+ *max = ULONG_MAX;
|
|
+}
|
|
+
|
|
static inline int clk_set_min_rate(struct clk *clk, unsigned long rate)
|
|
{
|
|
return 0;
|
|
@@ -1108,6 +1129,44 @@ static inline int clk_drop_range(struct
|
|
}
|
|
|
|
/**
|
|
+ * clk_get_min_rate - returns the minimum clock rate for a clock source
|
|
+ * @clk: clock source
|
|
+ *
|
|
+ * Returns either the minimum clock rate in Hz that clock source can
|
|
+ * reach, or 0 on error.
|
|
+ */
|
|
+static inline unsigned long clk_get_min_rate(struct clk *clk)
|
|
+{
|
|
+ unsigned long min, max;
|
|
+
|
|
+ if (!clk)
|
|
+ return 0;
|
|
+
|
|
+ clk_get_rate_range(clk, &min, &max);
|
|
+
|
|
+ return min;
|
|
+}
|
|
+
|
|
+/**
|
|
+ * clk_get_max_rate - returns the maximum clock rate for a clock source
|
|
+ * @clk: clock source
|
|
+ *
|
|
+ * Returns either the maximum clock rate in Hz that clock source can
|
|
+ * reach, or 0 on error.
|
|
+ */
|
|
+static inline unsigned long clk_get_max_rate(struct clk *clk)
|
|
+{
|
|
+ unsigned long min, max;
|
|
+
|
|
+ if (!clk)
|
|
+ return 0;
|
|
+
|
|
+ clk_get_rate_range(clk, &min, &max);
|
|
+
|
|
+ return max;
|
|
+}
|
|
+
|
|
+/**
|
|
* clk_get_optional - lookup and obtain a reference to an optional clock
|
|
* producer.
|
|
* @dev: device for clock "consumer"
|