0434-clk-bcm2835-Add-an-enum-for-the-DSI1-pixel-clock.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. From 105aa2411add3d0d8bb815109e4a6fb6c778a1d2 Mon Sep 17 00:00:00 2001
  2. From: Eric Anholt <eric@anholt.net>
  3. Date: Thu, 14 Apr 2016 19:00:33 -0700
  4. Subject: [PATCH] clk: bcm2835: Add an enum for the DSI1 pixel clock.
  5. Signed-off-by: Eric Anholt <eric@anholt.net>
  6. ---
  7. drivers/clk/bcm/clk-bcm2835.c | 39 +++++++++++++++++++++++++++++++++++--
  8. include/dt-bindings/clock/bcm2835.h | 1 +
  9. 2 files changed, 38 insertions(+), 2 deletions(-)
  10. --- a/drivers/clk/bcm/clk-bcm2835.c
  11. +++ b/drivers/clk/bcm/clk-bcm2835.c
  12. @@ -942,6 +942,9 @@ static long bcm2835_clock_rate_from_divi
  13. const struct bcm2835_clock_data *data = clock->data;
  14. u64 temp;
  15. + if (data->int_bits == 0 && data->frac_bits == 0)
  16. + return parent_rate;
  17. +
  18. /*
  19. * The divisor is a 12.12 fixed point field, but only some of
  20. * the bits are populated in any given clock.
  21. @@ -965,7 +968,12 @@ static unsigned long bcm2835_clock_get_r
  22. struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
  23. struct bcm2835_cprman *cprman = clock->cprman;
  24. const struct bcm2835_clock_data *data = clock->data;
  25. - u32 div = cprman_read(cprman, data->div_reg);
  26. + u32 div;
  27. +
  28. + if (data->int_bits == 0 && data->frac_bits == 0)
  29. + return parent_rate;
  30. +
  31. + div = cprman_read(cprman, data->div_reg);
  32. return bcm2835_clock_rate_from_divisor(clock, parent_rate, div);
  33. }
  34. @@ -1411,6 +1419,28 @@ static const char *const bcm2835_clock_v
  35. __VA_ARGS__)
  36. /*
  37. + * DSI1 parent clocks. The DSI1 byte clock comes from the DSI1 PHY,
  38. + * which in turn sources from plld_dsi1.
  39. + */
  40. +static const char *const bcm2835_clock_dsi1_parents[] = {
  41. + "gnd",
  42. + "xosc",
  43. + "testdebug0",
  44. + "testdebug1",
  45. + "dsi1_ddr",
  46. + "dsi1_ddr_inv",
  47. + "dsi1_ddr2",
  48. + "dsi1_ddr2_inv",
  49. + "dsi1_byte",
  50. + "dsi1_byte_inv",
  51. +};
  52. +
  53. +#define REGISTER_DSI1_CLK(...) REGISTER_CLK( \
  54. + .num_mux_parents = ARRAY_SIZE(bcm2835_clock_dsi1_parents), \
  55. + .parents = bcm2835_clock_dsi1_parents, \
  56. + __VA_ARGS__)
  57. +
  58. +/*
  59. * the real definition of all the pll, pll_dividers and clocks
  60. * these make use of the above REGISTER_* macros
  61. */
  62. @@ -1855,7 +1885,12 @@ static const struct bcm2835_clk_desc clk
  63. .div_reg = CM_DSI1EDIV,
  64. .int_bits = 4,
  65. .frac_bits = 8),
  66. -
  67. + [BCM2835_CLOCK_DSI1P] = REGISTER_DSI1_CLK(
  68. + .name = "dsi1p",
  69. + .ctl_reg = CM_DSI1PCTL,
  70. + .div_reg = CM_DSI1PDIV,
  71. + .int_bits = 0,
  72. + .frac_bits = 0),
  73. /* the gates */
  74. /*
  75. --- a/include/dt-bindings/clock/bcm2835.h
  76. +++ b/include/dt-bindings/clock/bcm2835.h
  77. @@ -64,3 +64,4 @@
  78. #define BCM2835_CLOCK_CAM1 46
  79. #define BCM2835_CLOCK_DSI0E 47
  80. #define BCM2835_CLOCK_DSI1E 48
  81. +#define BCM2835_CLOCK_DSI1P 49