clk.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Hisilicon Hi3620 clock gate driver
  3. *
  4. * Copyright (c) 2012-2013 Hisilicon Limited.
  5. * Copyright (c) 2012-2013 Linaro Limited.
  6. *
  7. * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
  8. * Xin Li <li.xin@linaro.org>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License along
  21. * with this program; if not, write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  23. *
  24. */
  25. #ifndef __HISI_CLK_H
  26. #define __HISI_CLK_H
  27. #include <linux/clk-provider.h>
  28. #include <linux/io.h>
  29. #include <linux/spinlock.h>
  30. struct hisi_fixed_rate_clock {
  31. unsigned int id;
  32. char *name;
  33. const char *parent_name;
  34. unsigned long flags;
  35. unsigned long fixed_rate;
  36. };
  37. struct hisi_fixed_factor_clock {
  38. unsigned int id;
  39. char *name;
  40. const char *parent_name;
  41. unsigned long mult;
  42. unsigned long div;
  43. unsigned long flags;
  44. };
  45. struct hisi_mux_clock {
  46. unsigned int id;
  47. const char *name;
  48. const char **parent_names;
  49. u8 num_parents;
  50. unsigned long flags;
  51. unsigned long offset;
  52. u8 shift;
  53. u8 width;
  54. u8 mux_flags;
  55. const char *alias;
  56. };
  57. struct hisi_divider_clock {
  58. unsigned int id;
  59. const char *name;
  60. const char *parent_name;
  61. unsigned long flags;
  62. unsigned long offset;
  63. u8 shift;
  64. u8 width;
  65. u8 div_flags;
  66. struct clk_div_table *table;
  67. const char *alias;
  68. };
  69. struct hisi_gate_clock {
  70. unsigned int id;
  71. const char *name;
  72. const char *parent_name;
  73. unsigned long flags;
  74. unsigned long offset;
  75. u8 bit_idx;
  76. u8 gate_flags;
  77. const char *alias;
  78. };
  79. struct clk *hisi_register_clkgate_sep(struct device *, const char *,
  80. const char *, unsigned long,
  81. void __iomem *, u8,
  82. u8, spinlock_t *);
  83. void __init hisi_clk_init(struct device_node *, int);
  84. void __init hisi_clk_register_fixed_rate(struct hisi_fixed_rate_clock *,
  85. int, void __iomem *);
  86. void __init hisi_clk_register_fixed_factor(struct hisi_fixed_factor_clock *,
  87. int, void __iomem *);
  88. void __init hisi_clk_register_mux(struct hisi_mux_clock *, int,
  89. void __iomem *);
  90. void __init hisi_clk_register_divider(struct hisi_divider_clock *,
  91. int, void __iomem *);
  92. void __init hisi_clk_register_gate_sep(struct hisi_gate_clock *,
  93. int, void __iomem *);
  94. #endif /* __HISI_CLK_H */