181-clk-sunxi-add-names-for-pll56.patch 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. From 8f3156f3f2b70128b2761526c208c8e3bfda694e Mon Sep 17 00:00:00 2001
  2. From: Chen-Yu Tsai <wens@csie.org>
  3. Date: Mon, 3 Feb 2014 09:51:39 +0800
  4. Subject: [PATCH] clk: sunxi: add names for pll5, pll6 parent clocks to
  5. factors_data
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. Some factor clocks, such as the parent clock of pll5 and pll6, have
  10. multiple output names. Add the corresponding names to factors_data
  11. tied to compatible string.
  12. Signed-off-by: Chen-Yu Tsai <wens@csie.org>
  13. Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
  14. Acked-by: Mike Turquette <mturquette@linaro.org>
  15. Signed-off-by: Emilio López <emilio@elopez.com.ar>
  16. ---
  17. drivers/clk/sunxi/clk-sunxi.c | 27 ++++++++++++++++++---------
  18. 1 file changed, 18 insertions(+), 9 deletions(-)
  19. --- a/drivers/clk/sunxi/clk-sunxi.c
  20. +++ b/drivers/clk/sunxi/clk-sunxi.c
  21. @@ -389,6 +389,7 @@ struct factors_data {
  22. int mux;
  23. struct clk_factors_config *table;
  24. void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p);
  25. + const char *name;
  26. };
  27. static struct clk_factors_config sun4i_pll1_config = {
  28. @@ -457,6 +458,14 @@ static const struct factors_data sun4i_p
  29. .enable = 31,
  30. .table = &sun4i_pll5_config,
  31. .getter = sun4i_get_pll5_factors,
  32. + .name = "pll5",
  33. +};
  34. +
  35. +static const struct factors_data sun4i_pll6_data __initconst = {
  36. + .enable = 31,
  37. + .table = &sun4i_pll5_config,
  38. + .getter = sun4i_get_pll5_factors,
  39. + .name = "pll6",
  40. };
  41. static const struct factors_data sun4i_apb1_data __initconst = {
  42. @@ -499,14 +508,14 @@ static struct clk * __init sunxi_factors
  43. (parents[i] = of_clk_get_parent_name(node, i)) != NULL)
  44. i++;
  45. - /* Nodes should be providing the name via clock-output-names
  46. - * but originally our dts didn't, and so we used node->name.
  47. - * The new, better nodes look like clk@deadbeef, so we pull the
  48. - * name just in this case */
  49. - if (!strcmp("clk", clk_name)) {
  50. - of_property_read_string_index(node, "clock-output-names",
  51. - 0, &clk_name);
  52. - }
  53. + /*
  54. + * some factor clocks, such as pll5 and pll6, may have multiple
  55. + * outputs, and have their name designated in factors_data
  56. + */
  57. + if (data->name)
  58. + clk_name = data->name;
  59. + else
  60. + of_property_read_string(node, "clock-output-names", &clk_name);
  61. factors = kzalloc(sizeof(struct clk_factors), GFP_KERNEL);
  62. if (!factors)
  63. @@ -838,7 +847,7 @@ static const struct divs_data pll5_divs_
  64. };
  65. static const struct divs_data pll6_divs_data __initconst = {
  66. - .factors = &sun4i_pll5_data,
  67. + .factors = &sun4i_pll6_data,
  68. .div = {
  69. { .shift = 0, .table = pll6_sata_tbl, .gate = 14 }, /* M, SATA */
  70. { .fixed = 2 }, /* P, other */