clk-core.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Purna Chandra Mandal,<purna.mandal@microchip.com>
  3. * Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
  4. *
  5. * This program is free software; you can distribute it and/or modify it
  6. * under the terms of the GNU General Public License (Version 2) as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. */
  14. #ifndef __MICROCHIP_CLK_PIC32_H_
  15. #define __MICROCHIP_CLK_PIC32_H_
  16. #include <linux/clk-provider.h>
  17. /* PIC32 clock data */
  18. struct pic32_clk_common {
  19. struct device *dev;
  20. void __iomem *iobase;
  21. spinlock_t reg_lock; /* clock lock */
  22. };
  23. /* System PLL clock */
  24. struct pic32_sys_pll_data {
  25. struct clk_init_data init_data;
  26. const u32 ctrl_reg;
  27. const u32 status_reg;
  28. const u32 lock_mask;
  29. };
  30. /* System clock */
  31. struct pic32_sys_clk_data {
  32. struct clk_init_data init_data;
  33. const u32 mux_reg;
  34. const u32 slew_reg;
  35. const u32 *parent_map;
  36. const u32 slew_div;
  37. };
  38. /* Reference Oscillator clock */
  39. struct pic32_ref_osc_data {
  40. struct clk_init_data init_data;
  41. const u32 ctrl_reg;
  42. const u32 *parent_map;
  43. };
  44. /* Peripheral Bus clock */
  45. struct pic32_periph_clk_data {
  46. struct clk_init_data init_data;
  47. const u32 ctrl_reg;
  48. };
  49. /* External Secondary Oscillator clock */
  50. struct pic32_sec_osc_data {
  51. struct clk_init_data init_data;
  52. const u32 enable_reg;
  53. const u32 status_reg;
  54. const u32 enable_mask;
  55. const u32 status_mask;
  56. const unsigned long fixed_rate;
  57. };
  58. extern const struct clk_ops pic32_pbclk_ops;
  59. extern const struct clk_ops pic32_sclk_ops;
  60. extern const struct clk_ops pic32_sclk_no_div_ops;
  61. extern const struct clk_ops pic32_spll_ops;
  62. extern const struct clk_ops pic32_roclk_ops;
  63. extern const struct clk_ops pic32_sosc_ops;
  64. struct clk *pic32_periph_clk_register(const struct pic32_periph_clk_data *data,
  65. struct pic32_clk_common *core);
  66. struct clk *pic32_refo_clk_register(const struct pic32_ref_osc_data *data,
  67. struct pic32_clk_common *core);
  68. struct clk *pic32_sys_clk_register(const struct pic32_sys_clk_data *data,
  69. struct pic32_clk_common *core);
  70. struct clk *pic32_spll_clk_register(const struct pic32_sys_pll_data *data,
  71. struct pic32_clk_common *core);
  72. struct clk *pic32_sosc_clk_register(const struct pic32_sec_osc_data *data,
  73. struct pic32_clk_common *core);
  74. #endif /* __MICROCHIP_CLK_PIC32_H_*/