Skip to content

Commit 83f5236

Browse files
committed
drm/i915: Remove memory frequency calculation
This memory frequency calculated is only used to check if it is zero, what is not useful as it will never actually be zero. Also the calculation is wrong, we should be checking other bit to select the appropriate frequency multiplier while this code is stuck with a fixed multiplier. So here dropping it as whole. v2: - Also remove memory frequency calculation for gen9 LP platforms Cc: Yakui Zhao <yakui.zhao@intel.com> Cc: Matt Roper <matthew.d.roper@intel.com> Fixes: 5d0c938 ("drm/i915/gen11+: Only load DRAM information from pcode") Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20211013010046.91858-1-jose.souza@intel.com
1 parent e690858 commit 83f5236

2 files changed

Lines changed: 2 additions & 36 deletions

File tree

‎drivers/gpu/drm/i915/i915_reg.h‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11106,12 +11106,6 @@ enum skl_power_gate {
1110611106
#define DC_STATE_DEBUG_MASK_CORES (1 << 0)
1110711107
#define DC_STATE_DEBUG_MASK_MEMORY_UP (1 << 1)
1110811108

11109-
#define BXT_P_CR_MC_BIOS_REQ_0_0_0 _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x7114)
11110-
#define BXT_REQ_DATA_MASK 0x3F
11111-
#define BXT_DRAM_CHANNEL_ACTIVE_SHIFT 12
11112-
#define BXT_DRAM_CHANNEL_ACTIVE_MASK (0xF << 12)
11113-
#define BXT_MEMORY_FREQ_MULTIPLIER_HZ 133333333
11114-
1111511109
#define BXT_D_CR_DRP0_DUNIT8 0x1000
1111611110
#define BXT_D_CR_DRP0_DUNIT9 0x1200
1111711111
#define BXT_D_CR_DRP0_DUNIT_START 8
@@ -11142,9 +11136,7 @@ enum skl_power_gate {
1114211136
#define BXT_DRAM_TYPE_LPDDR4 (0x2 << 22)
1114311137
#define BXT_DRAM_TYPE_DDR4 (0x4 << 22)
1114411138

11145-
#define SKL_MEMORY_FREQ_MULTIPLIER_HZ 266666666
1114611139
#define SKL_MC_BIOS_DATA_0_0_0_MCHBAR_PCU _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5E04)
11147-
#define SKL_REQ_DATA_MASK (0xF << 0)
1114811140
#define DG1_GEAR_TYPE REG_BIT(16)
1114911141

1115011142
#define SKL_MAD_INTER_CHANNEL_0_0_0_MCHBAR_MCMAIN _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5000)

‎drivers/gpu/drm/i915/intel_dram.c‎

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ static int
244244
skl_get_dram_info(struct drm_i915_private *i915)
245245
{
246246
struct dram_info *dram_info = &i915->dram_info;
247-
u32 mem_freq_khz, val;
248247
int ret;
249248

250249
dram_info->type = skl_get_dram_type(i915);
@@ -255,17 +254,6 @@ skl_get_dram_info(struct drm_i915_private *i915)
255254
if (ret)
256255
return ret;
257256

258-
val = intel_uncore_read(&i915->uncore,
259-
SKL_MC_BIOS_DATA_0_0_0_MCHBAR_PCU);
260-
mem_freq_khz = DIV_ROUND_UP((val & SKL_REQ_DATA_MASK) *
261-
SKL_MEMORY_FREQ_MULTIPLIER_HZ, 1000);
262-
263-
if (dram_info->num_channels * mem_freq_khz == 0) {
264-
drm_info(&i915->drm,
265-
"Couldn't get system memory bandwidth\n");
266-
return -EINVAL;
267-
}
268-
269257
return 0;
270258
}
271259

@@ -350,24 +338,10 @@ static void bxt_get_dimm_info(struct dram_dimm_info *dimm, u32 val)
350338
static int bxt_get_dram_info(struct drm_i915_private *i915)
351339
{
352340
struct dram_info *dram_info = &i915->dram_info;
353-
u32 dram_channels;
354-
u32 mem_freq_khz, val;
355-
u8 num_active_channels, valid_ranks = 0;
341+
u32 val;
342+
u8 valid_ranks = 0;
356343
int i;
357344

358-
val = intel_uncore_read(&i915->uncore, BXT_P_CR_MC_BIOS_REQ_0_0_0);
359-
mem_freq_khz = DIV_ROUND_UP((val & BXT_REQ_DATA_MASK) *
360-
BXT_MEMORY_FREQ_MULTIPLIER_HZ, 1000);
361-
362-
dram_channels = val & BXT_DRAM_CHANNEL_ACTIVE_MASK;
363-
num_active_channels = hweight32(dram_channels);
364-
365-
if (mem_freq_khz * num_active_channels == 0) {
366-
drm_info(&i915->drm,
367-
"Couldn't get system memory bandwidth\n");
368-
return -EINVAL;
369-
}
370-
371345
/*
372346
* Now read each DUNIT8/9/10/11 to check the rank of each dimms.
373347
*/

0 commit comments

Comments
 (0)