aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.15/950-0850-clk-Introduce-clk_hw_init_rate_request.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2022-05-16 23:40:32 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2022-05-17 15:11:22 +0200
commit20ea6adbf199097c4f5f591ffee088340630dae4 (patch)
treed6719d95e136611a1c25bbf7789652d6d402779d /target/linux/bcm27xx/patches-5.15/950-0850-clk-Introduce-clk_hw_init_rate_request.patch
parentbca05bd072180dc38ef740b37ded9572a6db1981 (diff)
downloadupstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.gz
upstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.bz2
upstream-20ea6adbf199097c4f5f591ffee088340630dae4.zip
bcm27xx: add support for linux v5.15
Build system: x86_64 Build-tested: bcm2708, bcm2709, bcm2710, bcm2711 Run-tested: bcm2708/RPiB+, bcm2709/RPi3B, bcm2710/RPi3B, bcm2711/RPi4B Signed-off-by: Marty Jones <mj8263788@gmail.com> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm27xx/patches-5.15/950-0850-clk-Introduce-clk_hw_init_rate_request.patch')
-rw-r--r--target/linux/bcm27xx/patches-5.15/950-0850-clk-Introduce-clk_hw_init_rate_request.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.15/950-0850-clk-Introduce-clk_hw_init_rate_request.patch b/target/linux/bcm27xx/patches-5.15/950-0850-clk-Introduce-clk_hw_init_rate_request.patch
new file mode 100644
index 0000000000..6a04498301
--- /dev/null
+++ b/target/linux/bcm27xx/patches-5.15/950-0850-clk-Introduce-clk_hw_init_rate_request.patch
@@ -0,0 +1,73 @@
+From 7023dd1743aa6bb305fdce96e6e80eecc6e01f16 Mon Sep 17 00:00:00 2001
+From: Maxime Ripard <maxime@cerno.tech>
+Date: Sat, 2 Apr 2022 14:49:56 +0200
+Subject: [PATCH] clk: Introduce clk_hw_init_rate_request()
+
+Some drivers (at91, imx, qcom) use __clk_determine_rate directly, and
+thus will need to initialise a clk_rate_request structure.
+
+However, drivers don't have access to the function that the core uses to
+initialize that structure which could prove to be useful.
+
+Let's create a function for clock providers that will initialize a
+clk_rate_request for a given clk_hw pointer and a rate.
+
+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 | 20 ++++++++++++++++++++
+ include/linux/clk-provider.h | 6 ++++++
+ 2 files changed, 26 insertions(+)
+
+--- a/drivers/clk/clk.c
++++ b/drivers/clk/clk.c
+@@ -1395,6 +1395,26 @@ static void clk_core_init_rate_req(struc
+ }
+ }
+
++/**
++ * clk_hw_init_rate_request - Initializes a clk_rate_request
++ * @hw: the clk for which we want to submit a rate request
++ * @req: the clk_rate_request structure we want to initialise
++ * @rate: the rate which is to be requested
++ *
++ * Initializes and fills a clk_rate_request structure to submit to
++ * __clk_determine_rate or similar functions.
++ */
++void clk_hw_init_rate_request(struct clk_hw * const hw,
++ struct clk_rate_request *req,
++ unsigned long rate)
++{
++ if (WARN_ON(!hw || !req))
++ return;
++
++ clk_core_init_rate_req(hw->core, req, rate);
++}
++EXPORT_SYMBOL_GPL(clk_hw_init_rate_request);
++
+ static bool clk_core_can_round(struct clk_core * const core)
+ {
+ return core->ops->determine_rate || core->ops->round_rate;
+--- a/include/linux/clk-provider.h
++++ b/include/linux/clk-provider.h
+@@ -42,6 +42,8 @@ struct dentry;
+ * struct clk_rate_request - Structure encoding the clk constraints that
+ * a clock user might require.
+ *
++ * Should be initialized by calling clk_hw_init_rate_request().
++ *
+ * @rate: Requested clock rate. This field will be adjusted by
+ * clock drivers according to hardware capabilities.
+ * @min_rate: Minimum rate imposed by clk users.
+@@ -60,6 +62,10 @@ struct clk_rate_request {
+ struct clk_hw *best_parent_hw;
+ };
+
++void clk_hw_init_rate_request(struct clk_hw * const hw,
++ struct clk_rate_request *req,
++ unsigned long rate);
++
+ /**
+ * struct clk_duty - Struture encoding the duty cycle ratio of a clock
+ *