gdb: fix invalid sigprocmask call
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.9 / 0186-clk-bcm2835-Add-claim-clocks-property.patch
1 From 5c1128ebe6c7a4af3f1784a640df7f3698233e9d Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Mon, 13 Feb 2017 17:20:08 +0000
4 Subject: [PATCH] clk-bcm2835: Add claim-clocks property
5
6 The claim-clocks property can be used to prevent PLLs and dividers
7 from being marked as critical. It contains a vector of clock IDs,
8 as defined by dt-bindings/clock/bcm2835.h.
9
10 Use this mechanism to claim PLLD_DSI0, PLLD_DSI1, PLLH_AUX and
11 PLLH_PIX for the vc4_kms_v3d driver.
12
13 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
14 ---
15 arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 14 +++++++++
16 drivers/clk/bcm/clk-bcm2835.c | 34 ++++++++++++++++++++--
17 2 files changed, 46 insertions(+), 2 deletions(-)
18
19 --- a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts
20 +++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts
21 @@ -5,6 +5,8 @@
22 /dts-v1/;
23 /plugin/;
24
25 +#include <dt-bindings/clock/bcm2835.h>
26 +
27 / {
28 compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
29
30 @@ -155,6 +157,18 @@
31 };
32 };
33
34 + fragment@19 {
35 + target = <&clocks>;
36 + __overlay__ {
37 + claim-clocks = <
38 + BCM2835_PLLD_DSI0
39 + BCM2835_PLLD_DSI1
40 + BCM2835_PLLH_AUX
41 + BCM2835_PLLH_PIX
42 + >;
43 + };
44 + };
45 +
46 __overrides__ {
47 cma-256 = <0>,"+0-1-2-3-4";
48 cma-192 = <0>,"-0+1-2-3-4";
49 --- a/drivers/clk/bcm/clk-bcm2835.c
50 +++ b/drivers/clk/bcm/clk-bcm2835.c
51 @@ -1298,6 +1298,8 @@ static const struct clk_ops bcm2835_vpu_
52 .debug_init = bcm2835_clock_debug_init,
53 };
54
55 +static bool bcm2835_clk_is_claimed(const char *name);
56 +
57 static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman,
58 const struct bcm2835_pll_data *data)
59 {
60 @@ -1314,6 +1316,9 @@ static struct clk_hw *bcm2835_register_p
61 init.ops = &bcm2835_pll_clk_ops;
62 init.flags = CLK_IGNORE_UNUSED;
63
64 + if (!bcm2835_clk_is_claimed(data->name))
65 + init.flags |= CLK_IS_CRITICAL;
66 +
67 pll = kzalloc(sizeof(*pll), GFP_KERNEL);
68 if (!pll)
69 return NULL;
70 @@ -1367,8 +1372,10 @@ bcm2835_register_pll_divider(struct bcm2
71 divider->div.table = NULL;
72
73 if (!(cprman_read(cprman, data->cm_reg) & data->hold_mask)) {
74 - init.flags |= CLK_IS_CRITICAL;
75 - divider->div.flags |= CLK_IS_CRITICAL;
76 + if (!bcm2835_clk_is_claimed(data->source_pll))
77 + init.flags |= CLK_IS_CRITICAL;
78 + if (!bcm2835_clk_is_claimed(data->name))
79 + divider->div.flags |= CLK_IS_CRITICAL;
80 }
81
82 divider->cprman = cprman;
83 @@ -2104,6 +2111,8 @@ static const struct bcm2835_clk_desc clk
84 .ctl_reg = CM_PERIICTL),
85 };
86
87 +static bool bcm2835_clk_claimed[ARRAY_SIZE(clk_desc_array)];
88 +
89 /*
90 * Permanently take a reference on the parent of the SDRAM clock.
91 *
92 @@ -2123,6 +2132,19 @@ static int bcm2835_mark_sdc_parent_criti
93 return clk_prepare_enable(parent);
94 }
95
96 +static bool bcm2835_clk_is_claimed(const char *name)
97 +{
98 + int i;
99 +
100 + for (i = 0; i < ARRAY_SIZE(clk_desc_array); i++) {
101 + const char *clk_name = *(const char **)(clk_desc_array[i].data);
102 + if (!strcmp(name, clk_name))
103 + return bcm2835_clk_claimed[i];
104 + }
105 +
106 + return false;
107 +}
108 +
109 static int bcm2835_clk_probe(struct platform_device *pdev)
110 {
111 struct device *dev = &pdev->dev;
112 @@ -2132,6 +2154,7 @@ static int bcm2835_clk_probe(struct plat
113 const struct bcm2835_clk_desc *desc;
114 const size_t asize = ARRAY_SIZE(clk_desc_array);
115 size_t i;
116 + u32 clk_id;
117 int ret;
118
119 cprman = devm_kzalloc(dev, sizeof(*cprman) +
120 @@ -2147,6 +2170,13 @@ static int bcm2835_clk_probe(struct plat
121 if (IS_ERR(cprman->regs))
122 return PTR_ERR(cprman->regs);
123
124 + memset(bcm2835_clk_claimed, 0, sizeof(bcm2835_clk_claimed));
125 + for (i = 0;
126 + !of_property_read_u32_index(pdev->dev.of_node, "claim-clocks",
127 + i, &clk_id);
128 + i++)
129 + bcm2835_clk_claimed[clk_id]= true;
130 +
131 memcpy(cprman->real_parent_names, cprman_parent_names,
132 sizeof(cprman_parent_names));
133 of_clk_parent_fill(dev->of_node, cprman->real_parent_names,