0350-clk-bcm2835-Mark-GPIO-clocks-enabled-at-boot-as-crit.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From edb0177945936b14fe58662743f9e9d4eeba4b73 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 350/381] clk: bcm2835: Mark GPIO clocks enabled at boot as
  5. critical.
  6. These divide off of PLLD_PER and are used for the ethernet and wifi
  7. PHYs source PLLs. Neither of them is currently represented by a phy
  8. device that would grab the clock for us.
  9. This keeps other drivers from killing the networking PHYs when they
  10. disable their own clocks and trigger PLLD_PER's refcount going to 0.
  11. v2: Skip marking as critical if they aren't on at boot.
  12. Signed-off-by: Eric Anholt <eric@anholt.net>
  13. ---
  14. drivers/clk/bcm/clk-bcm2835.c | 13 ++++++++++++-
  15. 1 file changed, 12 insertions(+), 1 deletion(-)
  16. --- a/drivers/clk/bcm/clk-bcm2835.c
  17. +++ b/drivers/clk/bcm/clk-bcm2835.c
  18. @@ -1250,6 +1250,15 @@ static struct clk *bcm2835_register_cloc
  19. init.name = data->name;
  20. init.flags = data->flags | CLK_IGNORE_UNUSED;
  21. + /*
  22. + * Some GPIO clocks for ethernet/wifi PLLs are marked as
  23. + * critical (since some platforms use them), but if the
  24. + * firmware didn't have them turned on then they clearly
  25. + * aren't actually critical.
  26. + */
  27. + if ((cprman_read(cprman, data->ctl_reg) & CM_ENABLE) == 0)
  28. + init.flags &= ~CLK_IS_CRITICAL;
  29. +
  30. if (data->is_vpu_clock) {
  31. init.ops = &bcm2835_vpu_clock_clk_ops;
  32. } else {
  33. @@ -1724,13 +1733,15 @@ static const struct bcm2835_clk_desc clk
  34. .div_reg = CM_GP1DIV,
  35. .int_bits = 12,
  36. .frac_bits = 12,
  37. + .flags = CLK_IS_CRITICAL,
  38. .is_mash_clock = true),
  39. [BCM2835_CLOCK_GP2] = REGISTER_PER_CLK(
  40. .name = "gp2",
  41. .ctl_reg = CM_GP2CTL,
  42. .div_reg = CM_GP2DIV,
  43. .int_bits = 12,
  44. - .frac_bits = 12),
  45. + .frac_bits = 12,
  46. + .flags = CLK_IS_CRITICAL),
  47. /* HDMI state machine */
  48. [BCM2835_CLOCK_HSM] = REGISTER_PER_CLK(