pll.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __NVBIOS_PLL_H__
  3. #define __NVBIOS_PLL_H__
  4. /*XXX: kill me */
  5. struct nvkm_pll_vals {
  6. union {
  7. struct {
  8. #ifdef __BIG_ENDIAN
  9. uint8_t N1, M1, N2, M2;
  10. #else
  11. uint8_t M1, N1, M2, N2;
  12. #endif
  13. };
  14. struct {
  15. uint16_t NM1, NM2;
  16. } __attribute__((packed));
  17. };
  18. int log2P;
  19. int refclk;
  20. };
  21. /* these match types in pll limits table version 0x40,
  22. * nvkm uses them on all chipsets internally where a
  23. * specific pll needs to be referenced, but the exact
  24. * register isn't known.
  25. */
  26. enum nvbios_pll_type {
  27. PLL_CORE = 0x01,
  28. PLL_SHADER = 0x02,
  29. PLL_UNK03 = 0x03,
  30. PLL_MEMORY = 0x04,
  31. PLL_VDEC = 0x05,
  32. PLL_UNK40 = 0x40,
  33. PLL_UNK41 = 0x41,
  34. PLL_UNK42 = 0x42,
  35. PLL_VPLL0 = 0x80,
  36. PLL_VPLL1 = 0x81,
  37. PLL_VPLL2 = 0x82,
  38. PLL_VPLL3 = 0x83,
  39. PLL_MAX = 0xff
  40. };
  41. struct nvbios_pll {
  42. enum nvbios_pll_type type;
  43. u32 reg;
  44. u32 refclk;
  45. u8 min_p;
  46. u8 max_p;
  47. u8 bias_p;
  48. /*
  49. * for most pre nv50 cards setting a log2P of 7 (the common max_log2p
  50. * value) is no different to 6 (at least for vplls) so allowing the MNP
  51. * calc to use 7 causes the generated clock to be out by a factor of 2.
  52. * however, max_log2p cannot be fixed-up during parsing as the
  53. * unmodified max_log2p value is still needed for setting mplls, hence
  54. * an additional max_usable_log2p member
  55. */
  56. u8 max_p_usable;
  57. struct {
  58. u32 min_freq;
  59. u32 max_freq;
  60. u32 min_inputfreq;
  61. u32 max_inputfreq;
  62. u8 min_m;
  63. u8 max_m;
  64. u8 min_n;
  65. u8 max_n;
  66. } vco1, vco2;
  67. };
  68. int nvbios_pll_parse(struct nvkm_bios *, u32 type, struct nvbios_pll *);
  69. #endif