This source file includes following definitions.
- rv1_vbios_smu_send_msg_with_param
- rv1_vbios_smu_set_dispclk
- rv1_vbios_smu_set_dprefclk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #include "core_types.h"
27 #include "clk_mgr_internal.h"
28 #include "reg_helper.h"
29
30 #define MAX_INSTANCE 5
31 #define MAX_SEGMENT 5
32
33 struct IP_BASE_INSTANCE {
34 unsigned int segment[MAX_SEGMENT];
35 };
36
37 struct IP_BASE {
38 struct IP_BASE_INSTANCE instance[MAX_INSTANCE];
39 };
40
41
42 static const struct IP_BASE MP1_BASE = { { { { 0x00016000, 0, 0, 0, 0 } },
43 { { 0, 0, 0, 0, 0 } },
44 { { 0, 0, 0, 0, 0 } },
45 { { 0, 0, 0, 0, 0 } },
46 { { 0, 0, 0, 0, 0 } } } };
47
48 #define mmMP1_SMN_C2PMSG_91 0x29B
49 #define mmMP1_SMN_C2PMSG_83 0x293
50 #define mmMP1_SMN_C2PMSG_67 0x283
51 #define mmMP1_SMN_C2PMSG_91_BASE_IDX 0
52 #define mmMP1_SMN_C2PMSG_83_BASE_IDX 0
53 #define mmMP1_SMN_C2PMSG_67_BASE_IDX 0
54
55 #define MP1_SMN_C2PMSG_91__CONTENT_MASK 0xffffffffL
56 #define MP1_SMN_C2PMSG_83__CONTENT_MASK 0xffffffffL
57 #define MP1_SMN_C2PMSG_67__CONTENT_MASK 0xffffffffL
58 #define MP1_SMN_C2PMSG_91__CONTENT__SHIFT 0x00000000
59 #define MP1_SMN_C2PMSG_83__CONTENT__SHIFT 0x00000000
60 #define MP1_SMN_C2PMSG_67__CONTENT__SHIFT 0x00000000
61
62 #define REG(reg_name) \
63 (MP1_BASE.instance[0].segment[mm ## reg_name ## _BASE_IDX] + mm ## reg_name)
64
65 #define FN(reg_name, field) \
66 FD(reg_name##__##field)
67
68 #define VBIOSSMC_MSG_SetDispclkFreq 0x4
69 #define VBIOSSMC_MSG_SetDprefclkFreq 0x5
70
71 int rv1_vbios_smu_send_msg_with_param(struct clk_mgr_internal *clk_mgr, unsigned int msg_id, unsigned int param)
72 {
73
74 REG_WRITE(MP1_SMN_C2PMSG_91, 0);
75
76
77 REG_WRITE(MP1_SMN_C2PMSG_83, param);
78
79
80 REG_WRITE(MP1_SMN_C2PMSG_67, msg_id);
81
82 REG_WAIT(MP1_SMN_C2PMSG_91, CONTENT, 1, 10, 200000);
83
84
85 return REG_READ(MP1_SMN_C2PMSG_83);
86 }
87
88 int rv1_vbios_smu_set_dispclk(struct clk_mgr_internal *clk_mgr, int requested_dispclk_khz)
89 {
90 int actual_dispclk_set_mhz = -1;
91 struct dc *core_dc = clk_mgr->base.ctx->dc;
92 struct dmcu *dmcu = core_dc->res_pool->dmcu;
93
94
95 actual_dispclk_set_mhz = rv1_vbios_smu_send_msg_with_param(
96 clk_mgr,
97 VBIOSSMC_MSG_SetDispclkFreq,
98 requested_dispclk_khz / 1000);
99
100
101 actual_dispclk_set_mhz = REG_READ(MP1_SMN_C2PMSG_83) * 1000;
102
103 if (!IS_FPGA_MAXIMUS_DC(core_dc->ctx->dce_environment)) {
104 if (dmcu && dmcu->funcs->is_dmcu_initialized(dmcu)) {
105 if (clk_mgr->dfs_bypass_disp_clk != actual_dispclk_set_mhz)
106 dmcu->funcs->set_psr_wait_loop(dmcu,
107 actual_dispclk_set_mhz / 7);
108 }
109 }
110
111 return actual_dispclk_set_mhz * 1000;
112 }
113
114 int rv1_vbios_smu_set_dprefclk(struct clk_mgr_internal *clk_mgr)
115 {
116 int actual_dprefclk_set_mhz = -1;
117
118 actual_dprefclk_set_mhz = rv1_vbios_smu_send_msg_with_param(
119 clk_mgr,
120 VBIOSSMC_MSG_SetDprefclkFreq,
121 clk_mgr->base.dprefclk_khz / 1000);
122
123
124
125 return actual_dprefclk_set_mhz * 1000;
126 }