0254-clk-bcm2835-Add-PWM-clock-support.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From ab4de687cdad0adbc555237364e5a8e2cdef5144 Mon Sep 17 00:00:00 2001
  2. From: Remi Pommarel <repk@triplefau.lt>
  3. Date: Sun, 6 Dec 2015 17:22:48 +0100
  4. Subject: [PATCH] clk: bcm2835: Add PWM clock support
  5. Register the pwm clock for bcm2835.
  6. Signed-off-by: Remi Pommarel <repk@triplefau.lt>
  7. Reviewed-by: Eric Anholt <eric@anholt.net>
  8. Signed-off-by: Michael Turquette <mturquette@baylibre.com>
  9. (cherry picked from commit cfbab8fbab9c330aca963095a439c451ac97c0dd)
  10. ---
  11. drivers/clk/bcm/clk-bcm2835.c | 13 +++++++++++++
  12. include/dt-bindings/clock/bcm2835.h | 3 ++-
  13. 2 files changed, 15 insertions(+), 1 deletion(-)
  14. --- a/drivers/clk/bcm/clk-bcm2835.c
  15. +++ b/drivers/clk/bcm/clk-bcm2835.c
  16. @@ -807,6 +807,16 @@ static const struct bcm2835_clock_data b
  17. .frac_bits = 8,
  18. };
  19. +static const struct bcm2835_clock_data bcm2835_clock_pwm_data = {
  20. + .name = "pwm",
  21. + .num_mux_parents = ARRAY_SIZE(bcm2835_clock_per_parents),
  22. + .parents = bcm2835_clock_per_parents,
  23. + .ctl_reg = CM_PWMCTL,
  24. + .div_reg = CM_PWMDIV,
  25. + .int_bits = 12,
  26. + .frac_bits = 12,
  27. +};
  28. +
  29. struct bcm2835_pll {
  30. struct clk_hw hw;
  31. struct bcm2835_cprman *cprman;
  32. @@ -1609,6 +1619,9 @@ static int bcm2835_clk_probe(struct plat
  33. cprman->regs + CM_PERIICTL, CM_GATE_BIT,
  34. 0, &cprman->regs_lock);
  35. + clks[BCM2835_CLOCK_PWM] =
  36. + bcm2835_register_clock(cprman, &bcm2835_clock_pwm_data);
  37. +
  38. return of_clk_add_provider(dev->of_node, of_clk_src_onecell_get,
  39. &cprman->onecell);
  40. }
  41. --- a/include/dt-bindings/clock/bcm2835.h
  42. +++ b/include/dt-bindings/clock/bcm2835.h
  43. @@ -43,5 +43,6 @@
  44. #define BCM2835_CLOCK_TSENS 27
  45. #define BCM2835_CLOCK_EMMC 28
  46. #define BCM2835_CLOCK_PERI_IMAGE 29
  47. +#define BCM2835_CLOCK_PWM 30
  48. -#define BCM2835_CLOCK_COUNT 30
  49. +#define BCM2835_CLOCK_COUNT 31