clkc.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Toshiba Visconti clock controller
  4. *
  5. * Copyright (c) 2021 TOSHIBA CORPORATION
  6. * Copyright (c) 2021 Toshiba Electronic Devices & Storage Corporation
  7. *
  8. * Nobuhiro Iwamatsu <[email protected]>
  9. */
  10. #ifndef _VISCONTI_CLKC_H_
  11. #define _VISCONTI_CLKC_H_
  12. #include <linux/mfd/syscon.h>
  13. #include <linux/clk-provider.h>
  14. #include <linux/of.h>
  15. #include <linux/of_address.h>
  16. #include <linux/delay.h>
  17. #include <linux/regmap.h>
  18. #include <linux/slab.h>
  19. #include <linux/string.h>
  20. #include <linux/io.h>
  21. #include <linux/spinlock.h>
  22. #include "reset.h"
  23. struct visconti_clk_provider {
  24. struct device *dev;
  25. struct regmap *regmap;
  26. struct clk_hw_onecell_data clk_data;
  27. };
  28. struct visconti_clk_gate_table {
  29. unsigned int id;
  30. const char *name;
  31. const struct clk_parent_data *parent_data;
  32. u8 num_parents;
  33. u8 flags;
  34. u32 ckon_offset;
  35. u32 ckoff_offset;
  36. u8 ck_idx;
  37. unsigned int div;
  38. u8 rs_id;
  39. };
  40. struct visconti_fixed_clk {
  41. unsigned int id;
  42. const char *name;
  43. const char *parent;
  44. unsigned long flag;
  45. unsigned int mult;
  46. unsigned int div;
  47. };
  48. struct visconti_clk_gate {
  49. struct clk_hw hw;
  50. struct regmap *regmap;
  51. u32 ckon_offset;
  52. u32 ckoff_offset;
  53. u8 ck_idx;
  54. u8 flags;
  55. u32 rson_offset;
  56. u32 rsoff_offset;
  57. u8 rs_idx;
  58. spinlock_t *lock;
  59. };
  60. struct visconti_clk_provider *visconti_init_clk(struct device *dev,
  61. struct regmap *regmap,
  62. unsigned long nr_clks);
  63. int visconti_clk_register_gates(struct visconti_clk_provider *data,
  64. const struct visconti_clk_gate_table *clks,
  65. int num_gate,
  66. const struct visconti_reset_data *reset,
  67. spinlock_t *lock);
  68. #define NO_RESET 0xFF
  69. #endif /* _VISCONTI_CLKC_H_ */