mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-28 01:28:59 +00:00
1343acc8cd
Deleted (upstreamed): bcm27xx/patches-5.10/950-0669-drm-vc4-hdmi-Make-sure-the-device-is-powered-with-CE.patch [1] bcm27xx/patches-5.10/950-0672-drm-vc4-hdmi-Move-initial-register-read-after-pm_run.patch [1] gemini/patches-5.10/0003-ARM-dts-gemini-NAS4220-B-fis-index-block-with-128-Ki.patch [2] Manually rebased: bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch Manually reverted: generic/pending-5.10/860-Revert-ASoC-mediatek-Check-for-error-clk-pointer.patch [3] [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.94&id=55b10b88ac8654fc2f31518aa349a2e643b37f18 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.94&id=958a8819d41420d7a74ed922a09cacc0ba3a4218 [3] https://lore.kernel.org/all/trinity-2a727d96-0335-4d03-8f30-e22a0e10112d-1643363480085@3c-app-gmx-bap33/ Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
121 lines
3.8 KiB
Diff
121 lines
3.8 KiB
Diff
From 05cae664e29e510111cf24f2beb1c31cba09bcce Mon Sep 17 00:00:00 2001
|
|
From: Phil Elwell <phil@raspberrypi.org>
|
|
Date: Mon, 13 Feb 2017 17:20:08 +0000
|
|
Subject: [PATCH] clk-bcm2835: Add claim-clocks property
|
|
|
|
The claim-clocks property can be used to prevent PLLs and dividers
|
|
from being marked as critical. It contains a vector of clock IDs,
|
|
as defined by dt-bindings/clock/bcm2835.h.
|
|
|
|
Use this mechanism to claim PLLD_DSI0, PLLD_DSI1, PLLH_AUX and
|
|
PLLH_PIX for the vc4_kms_v3d driver.
|
|
|
|
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
|
---
|
|
drivers/clk/bcm/clk-bcm2835.c | 45 ++++++++++++++++++++++++++++++++---
|
|
1 file changed, 42 insertions(+), 3 deletions(-)
|
|
|
|
--- a/drivers/clk/bcm/clk-bcm2835.c
|
|
+++ b/drivers/clk/bcm/clk-bcm2835.c
|
|
@@ -1307,6 +1307,8 @@ static const struct clk_ops bcm2835_vpu_
|
|
.debug_init = bcm2835_clock_debug_init,
|
|
};
|
|
|
|
+static bool bcm2835_clk_is_claimed(const char *name);
|
|
+
|
|
static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman,
|
|
const void *data)
|
|
{
|
|
@@ -1324,6 +1326,9 @@ static struct clk_hw *bcm2835_register_p
|
|
init.ops = &bcm2835_pll_clk_ops;
|
|
init.flags = pll_data->flags | CLK_IGNORE_UNUSED;
|
|
|
|
+ if (!bcm2835_clk_is_claimed(pll_data->name))
|
|
+ init.flags |= CLK_IS_CRITICAL;
|
|
+
|
|
pll = kzalloc(sizeof(*pll), GFP_KERNEL);
|
|
if (!pll)
|
|
return NULL;
|
|
@@ -1379,9 +1384,11 @@ bcm2835_register_pll_divider(struct bcm2
|
|
divider->div.hw.init = &init;
|
|
divider->div.table = NULL;
|
|
|
|
- if (!(cprman_read(cprman, data->cm_reg) & data->hold_mask)) {
|
|
- init.flags |= CLK_IS_CRITICAL;
|
|
- divider->div.flags |= CLK_IS_CRITICAL;
|
|
+ if (!(cprman_read(cprman, divider_data->cm_reg) & divider_data->hold_mask)) {
|
|
+ if (!bcm2835_clk_is_claimed(divider_data->source_pll))
|
|
+ init.flags |= CLK_IS_CRITICAL;
|
|
+ if (!bcm2835_clk_is_claimed(divider_data->name))
|
|
+ divider->div.flags |= CLK_IS_CRITICAL;
|
|
}
|
|
|
|
divider->cprman = cprman;
|
|
@@ -1438,6 +1445,15 @@ static struct clk_hw *bcm2835_register_c
|
|
init.flags = clock_data->flags | CLK_IGNORE_UNUSED;
|
|
|
|
/*
|
|
+ * Some GPIO clocks for ethernet/wifi PLLs are marked as
|
|
+ * critical (since some platforms use them), but if the
|
|
+ * firmware didn't have them turned on then they clearly
|
|
+ * aren't actually critical.
|
|
+ */
|
|
+ if ((cprman_read(cprman, clock_data->ctl_reg) & CM_ENABLE) == 0)
|
|
+ init.flags &= ~CLK_IS_CRITICAL;
|
|
+
|
|
+ /*
|
|
* Pass the CLK_SET_RATE_PARENT flag if we are allowed to propagate
|
|
* rate changes on at least of the parents.
|
|
*/
|
|
@@ -2216,6 +2232,8 @@ static const struct bcm2835_clk_desc clk
|
|
.ctl_reg = CM_PERIICTL),
|
|
};
|
|
|
|
+static bool bcm2835_clk_claimed[ARRAY_SIZE(clk_desc_array)];
|
|
+
|
|
/*
|
|
* Permanently take a reference on the parent of the SDRAM clock.
|
|
*
|
|
@@ -2235,6 +2253,19 @@ static int bcm2835_mark_sdc_parent_criti
|
|
return clk_prepare_enable(parent);
|
|
}
|
|
|
|
+static bool bcm2835_clk_is_claimed(const char *name)
|
|
+{
|
|
+ int i;
|
|
+
|
|
+ for (i = 0; i < ARRAY_SIZE(clk_desc_array); i++) {
|
|
+ const char *clk_name = *(const char **)(clk_desc_array[i].data);
|
|
+ if (!strcmp(name, clk_name))
|
|
+ return bcm2835_clk_claimed[i];
|
|
+ }
|
|
+
|
|
+ return false;
|
|
+}
|
|
+
|
|
static int bcm2835_clk_probe(struct platform_device *pdev)
|
|
{
|
|
struct device *dev = &pdev->dev;
|
|
@@ -2244,6 +2275,7 @@ static int bcm2835_clk_probe(struct plat
|
|
const size_t asize = ARRAY_SIZE(clk_desc_array);
|
|
const struct cprman_plat_data *pdata;
|
|
size_t i;
|
|
+ u32 clk_id;
|
|
int ret;
|
|
|
|
pdata = of_device_get_match_data(&pdev->dev);
|
|
@@ -2262,6 +2294,13 @@ static int bcm2835_clk_probe(struct plat
|
|
if (IS_ERR(cprman->regs))
|
|
return PTR_ERR(cprman->regs);
|
|
|
|
+ memset(bcm2835_clk_claimed, 0, sizeof(bcm2835_clk_claimed));
|
|
+ for (i = 0;
|
|
+ !of_property_read_u32_index(pdev->dev.of_node, "claim-clocks",
|
|
+ i, &clk_id);
|
|
+ i++)
|
|
+ bcm2835_clk_claimed[clk_id]= true;
|
|
+
|
|
memcpy(cprman->real_parent_names, cprman_parent_names,
|
|
sizeof(cprman_parent_names));
|
|
of_clk_parent_fill(dev->of_node, cprman->real_parent_names,
|