gk110.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright 2015 Red Hat Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Authors: Ben Skeggs
  23. */
  24. #define gf119_pmu_code gk110_pmu_code
  25. #define gf119_pmu_data gk110_pmu_data
  26. #include "priv.h"
  27. #include "fuc/gf119.fuc4.h"
  28. #include <subdev/timer.h>
  29. void
  30. gk110_pmu_pgob(struct nvkm_pmu *pmu, bool enable)
  31. {
  32. struct nvkm_device *device = pmu->subdev.device;
  33. static const struct {
  34. u32 addr;
  35. u32 data;
  36. } magic[] = {
  37. { 0x020520, 0xfffffffc },
  38. { 0x020524, 0xfffffffe },
  39. { 0x020524, 0xfffffffc },
  40. { 0x020524, 0xfffffff8 },
  41. { 0x020524, 0xffffffe0 },
  42. { 0x020530, 0xfffffffe },
  43. { 0x02052c, 0xfffffffa },
  44. { 0x02052c, 0xfffffff0 },
  45. { 0x02052c, 0xffffffc0 },
  46. { 0x02052c, 0xffffff00 },
  47. { 0x02052c, 0xfffffc00 },
  48. { 0x02052c, 0xfffcfc00 },
  49. { 0x02052c, 0xfff0fc00 },
  50. { 0x02052c, 0xff80fc00 },
  51. { 0x020528, 0xfffffffe },
  52. { 0x020528, 0xfffffffc },
  53. };
  54. int i;
  55. nvkm_mask(device, 0x000200, 0x00001000, 0x00000000);
  56. nvkm_rd32(device, 0x000200);
  57. nvkm_mask(device, 0x000200, 0x08000000, 0x08000000);
  58. msleep(50);
  59. nvkm_mask(device, 0x10a78c, 0x00000002, 0x00000002);
  60. nvkm_mask(device, 0x10a78c, 0x00000001, 0x00000001);
  61. nvkm_mask(device, 0x10a78c, 0x00000001, 0x00000000);
  62. nvkm_mask(device, 0x0206b4, 0x00000000, 0x00000000);
  63. for (i = 0; i < ARRAY_SIZE(magic); i++) {
  64. nvkm_wr32(device, magic[i].addr, magic[i].data);
  65. nvkm_msec(device, 2000,
  66. if (!(nvkm_rd32(device, magic[i].addr) & 0x80000000))
  67. break;
  68. );
  69. }
  70. nvkm_mask(device, 0x10a78c, 0x00000002, 0x00000000);
  71. nvkm_mask(device, 0x10a78c, 0x00000001, 0x00000001);
  72. nvkm_mask(device, 0x10a78c, 0x00000001, 0x00000000);
  73. nvkm_mask(device, 0x000200, 0x08000000, 0x00000000);
  74. nvkm_mask(device, 0x000200, 0x00001000, 0x00001000);
  75. nvkm_rd32(device, 0x000200);
  76. }
  77. static const struct nvkm_pmu_func
  78. gk110_pmu = {
  79. .code.data = gk110_pmu_code,
  80. .code.size = sizeof(gk110_pmu_code),
  81. .data.data = gk110_pmu_data,
  82. .data.size = sizeof(gk110_pmu_data),
  83. .reset = gt215_pmu_reset,
  84. .init = gt215_pmu_init,
  85. .fini = gt215_pmu_fini,
  86. .intr = gt215_pmu_intr,
  87. .send = gt215_pmu_send,
  88. .recv = gt215_pmu_recv,
  89. .pgob = gk110_pmu_pgob,
  90. };
  91. int
  92. gk110_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu)
  93. {
  94. return nvkm_pmu_new_(&gk110_pmu, device, index, ppmu);
  95. }