This source file includes following definitions.
- athub_v2_0_update_medium_grain_clock_gating
- athub_v2_0_update_medium_grain_light_sleep
- athub_v2_0_set_clockgating
- athub_v2_0_get_clockgating
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "amdgpu.h"
25 #include "athub_v2_0.h"
26
27 #include "athub/athub_2_0_0_offset.h"
28 #include "athub/athub_2_0_0_sh_mask.h"
29 #include "athub/athub_2_0_0_default.h"
30 #include "navi10_enum.h"
31
32 #include "soc15_common.h"
33
34 static void
35 athub_v2_0_update_medium_grain_clock_gating(struct amdgpu_device *adev,
36 bool enable)
37 {
38 uint32_t def, data;
39
40 def = data = RREG32_SOC15(ATHUB, 0, mmATHUB_MISC_CNTL);
41
42 if (enable && (adev->cg_flags & AMD_CG_SUPPORT_MC_MGCG))
43 data |= ATHUB_MISC_CNTL__CG_ENABLE_MASK;
44 else
45 data &= ~ATHUB_MISC_CNTL__CG_ENABLE_MASK;
46
47 if (def != data)
48 WREG32_SOC15(ATHUB, 0, mmATHUB_MISC_CNTL, data);
49 }
50
51 static void
52 athub_v2_0_update_medium_grain_light_sleep(struct amdgpu_device *adev,
53 bool enable)
54 {
55 uint32_t def, data;
56
57 def = data = RREG32_SOC15(ATHUB, 0, mmATHUB_MISC_CNTL);
58
59 if (enable && (adev->cg_flags & AMD_CG_SUPPORT_MC_LS) &&
60 (adev->cg_flags & AMD_CG_SUPPORT_HDP_LS))
61 data |= ATHUB_MISC_CNTL__CG_MEM_LS_ENABLE_MASK;
62 else
63 data &= ~ATHUB_MISC_CNTL__CG_MEM_LS_ENABLE_MASK;
64
65 if (def != data)
66 WREG32_SOC15(ATHUB, 0, mmATHUB_MISC_CNTL, data);
67 }
68
69 int athub_v2_0_set_clockgating(struct amdgpu_device *adev,
70 enum amd_clockgating_state state)
71 {
72 if (amdgpu_sriov_vf(adev))
73 return 0;
74
75 switch (adev->asic_type) {
76 case CHIP_NAVI10:
77 case CHIP_NAVI14:
78 case CHIP_NAVI12:
79 athub_v2_0_update_medium_grain_clock_gating(adev,
80 state == AMD_CG_STATE_GATE ? true : false);
81 athub_v2_0_update_medium_grain_light_sleep(adev,
82 state == AMD_CG_STATE_GATE ? true : false);
83 break;
84 default:
85 break;
86 }
87
88 return 0;
89 }
90
91 void athub_v2_0_get_clockgating(struct amdgpu_device *adev, u32 *flags)
92 {
93 int data;
94
95
96 data = RREG32_SOC15(ATHUB, 0, mmATHUB_MISC_CNTL);
97 if (data & ATHUB_MISC_CNTL__CG_ENABLE_MASK)
98 *flags |= AMD_CG_SUPPORT_ATHUB_MGCG;
99
100
101 if (data & ATHUB_MISC_CNTL__CG_MEM_LS_ENABLE_MASK)
102 *flags |= AMD_CG_SUPPORT_ATHUB_LS;
103 }