pll.h 1.5 KB

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