File drivers/gpu/alga/amd/si/dyn_pm/driver.c changed (mode: 100644) (index 0cddb2a..d1b1b53) |
34 |
34 |
|
|
35 |
35 |
#include "ctx.h" |
#include "ctx.h" |
36 |
36 |
#include "private.h" |
#include "private.h" |
37 |
|
|
|
38 |
|
/* the driver state mc regs are the initial/emergency ones for the init */ |
|
39 |
|
void smc_mc_reg_tbl_driver_init(struct smc_mc_reg_tbl *tbl) |
|
40 |
|
{ |
|
41 |
|
struct smc_mc_reg_set *initial; |
|
42 |
|
struct smc_mc_reg_set *driver; |
|
43 |
|
|
|
44 |
|
initial = &tbl->sets[MC_REG_SET_IDX_INITIAL_EMERGENCY]; |
|
45 |
|
driver = &tbl->sets[MC_REG_SET_IDX_DRIVER]; |
|
46 |
|
|
|
47 |
|
memcpy(driver, initial, sizeof(*driver)); |
|
48 |
|
} |
|
File drivers/gpu/alga/amd/si/dyn_pm/initial.c changed (mode: 100644) (index 85120e0..fc59fc0) |
36 |
36 |
#include "private.h" |
#include "private.h" |
37 |
37 |
#include "smc_lvl.h" |
#include "smc_lvl.h" |
38 |
38 |
#include "smc_volt.h" |
#include "smc_volt.h" |
39 |
|
#include "smc_mc_reg_tbl.h" |
|
40 |
|
#include "smc_mc_arb_tbl.h" |
|
41 |
39 |
|
|
42 |
40 |
long smc_state_tbl_initial_init(struct ctx *ctx, struct smc_state_tbl *tbl) |
long smc_state_tbl_initial_init(struct ctx *ctx, struct smc_state_tbl *tbl) |
43 |
41 |
{ |
{ |
|
... |
... |
long smc_state_tbl_initial_init(struct ctx *ctx, struct smc_state_tbl *tbl) |
92 |
90 |
put_unaligned_be32(dd->pp.default_eng_clk, &lvl->eng_clk.clk); |
put_unaligned_be32(dd->pp.default_eng_clk, &lvl->eng_clk.clk); |
93 |
91 |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
94 |
92 |
|
|
95 |
|
lvl->mc_arb_set_idx = MC_ARB_SET_IDX_INITIAL; |
|
|
93 |
|
lvl->mc_arb_set_idx = MC_ARB_SET_IDX_INITIAL_EMERGENCY; |
96 |
94 |
lvl->mc_reg_set_idx = MC_REG_SET_IDX_INITIAL_EMERGENCY; |
lvl->mc_reg_set_idx = MC_REG_SET_IDX_INITIAL_EMERGENCY; |
97 |
95 |
|
|
98 |
96 |
if (ctx->volt_caps & VOLT_CAPS_VDDC_CTL_ENA) { |
if (ctx->volt_caps & VOLT_CAPS_VDDC_CTL_ENA) { |
|
... |
... |
long smc_state_tbl_initial_init(struct ctx *ctx, struct smc_state_tbl *tbl) |
173 |
171 |
&lvl->sq_pwr_throttle_1); |
&lvl->sq_pwr_throttle_1); |
174 |
172 |
return 0; |
return 0; |
175 |
173 |
} |
} |
176 |
|
|
|
177 |
|
long smc_mc_arb_tbl_initial_init(struct ctx *ctx, |
|
178 |
|
struct smc_state_tbl *smc_state_tbl, |
|
179 |
|
struct smc_mc_arb_tbl *smc_mc_arb_tbl) |
|
180 |
|
{ |
|
181 |
|
u32 eng_clk; |
|
182 |
|
u32 mem_clk; |
|
183 |
|
struct smc_mc_arb_regs *initial_set; |
|
184 |
|
long r; |
|
185 |
|
|
|
186 |
|
/* |
|
187 |
|
* we don't use the atombios pp boot state table, then we get the |
|
188 |
|
* required information directly from the smc table |
|
189 |
|
*/ |
|
190 |
|
eng_clk = get_unaligned_be32(&smc_state_tbl->initial_lvl.eng_clk.clk); |
|
191 |
|
mem_clk = get_unaligned_be32(&smc_state_tbl->initial_lvl.mem_clk.clk); |
|
192 |
|
|
|
193 |
|
initial_set = &smc_mc_arb_tbl->sets[MC_ARB_SET_IDX_INITIAL]; |
|
194 |
|
|
|
195 |
|
r = smc_mc_arb_tbl_set_compute(ctx, initial_set, eng_clk, mem_clk); |
|
196 |
|
if (r == -SI_ERR) { |
|
197 |
|
dev_err(&ctx->dev->dev, "dyn_pm:unable to init the memory controller arb register set for the initial state\n"); |
|
198 |
|
return -SI_ERR; |
|
199 |
|
} |
|
200 |
|
return 0; |
|
201 |
|
} |
|
File drivers/gpu/alga/amd/si/dyn_pm/private.h changed (mode: 100644) (index cf86f5f..45a2cf7) |
18 |
18 |
#define MEM_CLK_STUTTER_MODE_THRESHOLD MEM_CLK_STROBE_MODE_THRESHOLD |
#define MEM_CLK_STUTTER_MODE_THRESHOLD MEM_CLK_STROBE_MODE_THRESHOLD |
19 |
19 |
|
|
20 |
20 |
/* this is our layout for the smc mc_arb_tbl */ |
/* this is our layout for the smc mc_arb_tbl */ |
21 |
|
#define MC_ARB_SET_IDX_INITIAL 0 /* only one lvl */ |
|
22 |
|
#define MC_ARB_SET_IDX_EMERGENCY 1 /* only one lvl */ |
|
23 |
|
#define MC_ARB_SET_IDX_ULV 2 /* only one lvl */ |
|
|
21 |
|
#define MC_ARB_SET_IDX_INITIAL_EMERGENCY 0 |
|
22 |
|
#define MC_ARB_SET_IDX_ULV 1 |
|
23 |
|
/* third slot is not used */ |
24 |
24 |
/* index of the set of the first current pwr state lvl */ |
/* index of the set of the first current pwr state lvl */ |
25 |
|
#define MC_ARB_SET_IDX_DRIVER 3 |
|
|
25 |
|
#define MC_ARB_SET_IDX_DRIVER 3 |
26 |
26 |
|
|
27 |
27 |
/* this is our layout for the smc mc_reg_tbl */ |
/* this is our layout for the smc mc_reg_tbl */ |
28 |
28 |
#define MC_REG_SET_IDX_INITIAL_EMERGENCY 0 |
#define MC_REG_SET_IDX_INITIAL_EMERGENCY 0 |
File drivers/gpu/alga/amd/si/dyn_pm/smc_mc_arb_tbl.c changed (mode: 100644) (index cd08a72..c8345d6) |
... |
... |
long smc_mc_arb_tbl_set_compute(struct ctx *ctx, struct smc_mc_arb_regs *set, |
103 |
103 |
return 0; |
return 0; |
104 |
104 |
} |
} |
105 |
105 |
|
|
|
106 |
|
static long initial_emergency_init(struct ctx *ctx, |
|
107 |
|
struct smc_state_tbl *smc_state_tbl, |
|
108 |
|
struct smc_mc_arb_tbl *smc_mc_arb_tbl) |
|
109 |
|
{ |
|
110 |
|
u32 eng_clk; |
|
111 |
|
u32 mem_clk; |
|
112 |
|
struct smc_mc_arb_regs *initial_set; |
|
113 |
|
long r; |
|
114 |
|
|
|
115 |
|
/* |
|
116 |
|
* we don't use the atombios pp boot state table, then we get the |
|
117 |
|
* required information directly from the smc table |
|
118 |
|
*/ |
|
119 |
|
eng_clk = get_unaligned_be32(&smc_state_tbl->initial_lvl.eng_clk.clk); |
|
120 |
|
mem_clk = get_unaligned_be32(&smc_state_tbl->initial_lvl.mem_clk.clk); |
|
121 |
|
|
|
122 |
|
initial_set = &smc_mc_arb_tbl->sets[MC_ARB_SET_IDX_INITIAL_EMERGENCY]; |
|
123 |
|
|
|
124 |
|
r = smc_mc_arb_tbl_set_compute(ctx, initial_set, eng_clk, mem_clk); |
|
125 |
|
if (r == -SI_ERR) { |
|
126 |
|
dev_err(&ctx->dev->dev, "dyn_pm:unable to init the memory controller arb register set for the initial state\n"); |
|
127 |
|
return -SI_ERR; |
|
128 |
|
} |
|
129 |
|
return 0; |
|
130 |
|
} |
|
131 |
|
|
106 |
132 |
long smc_mc_arb_tbl_init(struct ctx *ctx, struct smc_state_tbl *smc_state_tbl, |
long smc_mc_arb_tbl_init(struct ctx *ctx, struct smc_state_tbl *smc_state_tbl, |
107 |
133 |
struct smc_mc_arb_tbl *smc_mc_arb_tbl) |
struct smc_mc_arb_tbl *smc_mc_arb_tbl) |
108 |
134 |
{ |
{ |
|
... |
... |
long smc_mc_arb_tbl_init(struct ctx *ctx, struct smc_state_tbl *smc_state_tbl, |
110 |
136 |
|
|
111 |
137 |
LOG("smc memory controller arb table init"); |
LOG("smc memory controller arb table init"); |
112 |
138 |
|
|
113 |
|
r = smc_mc_arb_tbl_initial_init(ctx, smc_state_tbl, smc_mc_arb_tbl); |
|
|
139 |
|
r = initial_emergency_init(ctx, smc_state_tbl, smc_mc_arb_tbl); |
114 |
140 |
if (r == -SI_ERR) |
if (r == -SI_ERR) |
115 |
141 |
return -SI_ERR; |
return -SI_ERR; |
116 |
|
/* |
|
117 |
|
* XXX:the emergency state is using the same mc arb reg set than the |
|
118 |
|
* initial state, then in the table the mc arb reg set index is 0 |
|
119 |
|
*/ |
|
120 |
142 |
r = smc_mc_arb_tbl_ulv_init(ctx, smc_mc_arb_tbl); |
r = smc_mc_arb_tbl_ulv_init(ctx, smc_mc_arb_tbl); |
121 |
143 |
if (r == -SI_ERR) |
if (r == -SI_ERR) |
122 |
144 |
return -SI_ERR; |
return -SI_ERR; |
123 |
|
/* |
|
124 |
|
* XXX:the driver state is using the same mc arb reg set than the |
|
125 |
|
* initial state, then in the table the mc arb reg set index is 0 |
|
126 |
|
*/ |
|
|
145 |
|
/* XXX:in initing phase, the driver state is the initial state */ |
127 |
146 |
|
|
128 |
147 |
/* set the hw register set to use for the mc arb */ |
/* set the hw register set to use for the mc arb */ |
129 |
148 |
smc_mc_arb_tbl->arb_freq_fx_current = MAC_MC_CG_ARB_FREQ_F1; |
smc_mc_arb_tbl->arb_freq_fx_current = MAC_MC_CG_ARB_FREQ_F1; |
File drivers/gpu/alga/amd/si/dyn_pm/smc_mc_reg_tbl.c changed (mode: 100644) (index b344461..2d02863) |
... |
... |
long smc_mc_reg_tbl_init(struct ctx *ctx, struct smc_state_tbl *smc_state_tbl, |
228 |
228 |
|
|
229 |
229 |
initial_emergency_init(ctx, smc_state_tbl, smc_mc_reg_tbl); |
initial_emergency_init(ctx, smc_state_tbl, smc_mc_reg_tbl); |
230 |
230 |
smc_mc_reg_tbl_ulv_init(ctx, smc_mc_reg_tbl); |
smc_mc_reg_tbl_ulv_init(ctx, smc_mc_reg_tbl); |
231 |
|
smc_mc_reg_tbl_driver_init(smc_mc_reg_tbl); |
|
|
231 |
|
/* XXX:in initing phase, the driver state is the initial state */ |
232 |
232 |
return 0; |
return 0; |
233 |
233 |
} |
} |
234 |
234 |
|
|
File drivers/gpu/alga/amd/si/dyn_pm/ulv.c changed (mode: 100644) (index e763d7a..93fe6a2) |
... |
... |
void smc_mc_reg_tbl_ulv_init(struct ctx *ctx, |
120 |
120 |
* namely the first set, since the table is sorted from lowest mem clk |
* namely the first set, since the table is sorted from lowest mem clk |
121 |
121 |
* to highest. Yes, the mem clk from the atombios pwr lvl is ignored. |
* to highest. Yes, the mem clk from the atombios pwr lvl is ignored. |
122 |
122 |
*/ |
*/ |
123 |
|
set = &smc_mc_reg_tbl->sets[MC_REG_SET_IDX_INITIAL_EMERGENCY]; |
|
|
123 |
|
set = &smc_mc_reg_tbl->sets[MC_REG_SET_IDX_ULV]; |
124 |
124 |
smc_mc_reg_set_load(ctx, 0, set); |
smc_mc_reg_set_load(ctx, 0, set); |
125 |
125 |
} |
} |
126 |
126 |
|
|