clock.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * keystone2: common clock header file
  3. *
  4. * (C) Copyright 2012-2014
  5. * Texas Instruments Incorporated, <www.ti.com>
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #ifndef __ASM_ARCH_CLOCK_H
  10. #define __ASM_ARCH_CLOCK_H
  11. #ifndef __ASSEMBLY__
  12. #ifdef CONFIG_SOC_K2HK
  13. #include <asm/arch/clock-k2hk.h>
  14. #endif
  15. #ifdef CONFIG_SOC_K2E
  16. #include <asm/arch/clock-k2e.h>
  17. #endif
  18. #ifdef CONFIG_SOC_K2L
  19. #include <asm/arch/clock-k2l.h>
  20. #endif
  21. #define CORE_PLL MAIN_PLL
  22. #define DDR3_PLL DDR3A_PLL
  23. #include <asm/types.h>
  24. #define GENERATE_ENUM(NUM, ENUM) ENUM = NUM,
  25. #define GENERATE_INDX_STR(NUM, STRING) #NUM"\t- "#STRING"\n"
  26. #define CLOCK_INDEXES_LIST CLK_LIST(GENERATE_INDX_STR)
  27. enum {
  28. SPD800,
  29. SPD850,
  30. SPD1000,
  31. SPD1200,
  32. SPD1250,
  33. SPD1350,
  34. SPD1400,
  35. SPD1500,
  36. NUM_SPDS,
  37. };
  38. /* PLL identifiers */
  39. enum {
  40. MAIN_PLL,
  41. TETRIS_PLL,
  42. PASS_PLL,
  43. DDR3A_PLL,
  44. DDR3B_PLL,
  45. MAX_PLL_COUNT,
  46. };
  47. enum clk_e {
  48. CLK_LIST(GENERATE_ENUM)
  49. };
  50. struct keystone_pll_regs {
  51. u32 reg0;
  52. u32 reg1;
  53. };
  54. /* PLL configuration data */
  55. struct pll_init_data {
  56. int pll;
  57. int pll_m; /* PLL Multiplier */
  58. int pll_d; /* PLL divider */
  59. int pll_od; /* PLL output divider */
  60. };
  61. extern const struct keystone_pll_regs keystone_pll_regs[];
  62. extern s16 divn_val[];
  63. extern int speeds[];
  64. void init_plls(int num_pll, struct pll_init_data *config);
  65. void init_pll(const struct pll_init_data *data);
  66. unsigned long clk_get_rate(unsigned int clk);
  67. unsigned long clk_round_rate(unsigned int clk, unsigned long hz);
  68. int clk_set_rate(unsigned int clk, unsigned long hz);
  69. int get_max_dev_speed(void);
  70. int get_max_arm_speed(void);
  71. #endif
  72. #endif