icst.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
  4. *
  5. * Support functions for calculating clocks/divisors for the ICST
  6. * clock generators. See https://www.idt.com/ for more information
  7. * on these devices.
  8. */
  9. #ifndef ICST_H
  10. #define ICST_H
  11. struct icst_params {
  12. unsigned long ref;
  13. unsigned long vco_max; /* inclusive */
  14. unsigned long vco_min; /* exclusive */
  15. unsigned short vd_min; /* inclusive */
  16. unsigned short vd_max; /* inclusive */
  17. unsigned char rd_min; /* inclusive */
  18. unsigned char rd_max; /* inclusive */
  19. const unsigned char *s2div; /* chip specific s2div array */
  20. const unsigned char *idx2s; /* chip specific idx2s array */
  21. };
  22. struct icst_vco {
  23. unsigned short v;
  24. unsigned char r;
  25. unsigned char s;
  26. };
  27. unsigned long icst_hz(const struct icst_params *p, struct icst_vco vco);
  28. struct icst_vco icst_hz_to_vco(const struct icst_params *p, unsigned long freq);
  29. /*
  30. * ICST307 VCO frequency must be between 6MHz and 200MHz (3.3 or 5V).
  31. * This frequency is pre-output divider.
  32. */
  33. #define ICST307_VCO_MIN 6000000
  34. #define ICST307_VCO_MAX 200000000
  35. extern const unsigned char icst307_s2div[];
  36. extern const unsigned char icst307_idx2s[];
  37. /*
  38. * ICST525 VCO frequency must be between 10MHz and 200MHz (3V) or 320MHz (5V).
  39. * This frequency is pre-output divider.
  40. */
  41. #define ICST525_VCO_MIN 10000000
  42. #define ICST525_VCO_MAX_3V 200000000
  43. #define ICST525_VCO_MAX_5V 320000000
  44. extern const unsigned char icst525_s2div[];
  45. extern const unsigned char icst525_idx2s[];
  46. #endif