brcm2708: update linux 4.4 patches to latest version
[openwrt/staging/lynxis/omap.git] / target / linux / brcm2708 / patches-4.4 / 0347-clk-bcm2835-Mark-GPIO-clocks-enabled-at-boot-as-crit.patch
1 From 9a5319c6915364018e9422b6cef7e63a011b8b57 Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Mon, 9 May 2016 17:28:18 -0700
4 Subject: [PATCH 347/423] clk: bcm2835: Mark GPIO clocks enabled at boot as
5 critical.
6
7 These divide off of PLLD_PER and are used for the ethernet and wifi
8 PHYs source PLLs. Neither of them is currently represented by a phy
9 device that would grab the clock for us.
10
11 This keeps other drivers from killing the networking PHYs when they
12 disable their own clocks and trigger PLLD_PER's refcount going to 0.
13
14 v2: Skip marking as critical if they aren't on at boot.
15
16 Signed-off-by: Eric Anholt <eric@anholt.net>
17 ---
18 drivers/clk/bcm/clk-bcm2835.c | 13 ++++++++++++-
19 1 file changed, 12 insertions(+), 1 deletion(-)
20
21 --- a/drivers/clk/bcm/clk-bcm2835.c
22 +++ b/drivers/clk/bcm/clk-bcm2835.c
23 @@ -1246,6 +1246,15 @@ static struct clk *bcm2835_register_cloc
24 init.name = data->name;
25 init.flags = data->flags | CLK_IGNORE_UNUSED;
26
27 + /*
28 + * Some GPIO clocks for ethernet/wifi PLLs are marked as
29 + * critical (since some platforms use them), but if the
30 + * firmware didn't have them turned on then they clearly
31 + * aren't actually critical.
32 + */
33 + if ((cprman_read(cprman, data->ctl_reg) & CM_ENABLE) == 0)
34 + init.flags &= ~CLK_IS_CRITICAL;
35 +
36 if (data->is_vpu_clock) {
37 init.ops = &bcm2835_vpu_clock_clk_ops;
38 } else {
39 @@ -1720,13 +1729,15 @@ static const struct bcm2835_clk_desc clk
40 .div_reg = CM_GP1DIV,
41 .int_bits = 12,
42 .frac_bits = 12,
43 + .flags = CLK_IS_CRITICAL,
44 .is_mash_clock = true),
45 [BCM2835_CLOCK_GP2] = REGISTER_PER_CLK(
46 .name = "gp2",
47 .ctl_reg = CM_GP2CTL,
48 .div_reg = CM_GP2DIV,
49 .int_bits = 12,
50 - .frac_bits = 12),
51 + .frac_bits = 12,
52 + .flags = CLK_IS_CRITICAL),
53
54 /* HDMI state machine */
55 [BCM2835_CLOCK_HSM] = REGISTER_PER_CLK(