Files
threeeye bc1d038eac REVVL 6 Pro kernel bring-up: full working tree snapshot (2026-09-12)
Squashed backup commit (no shallow-clone history issues) of
xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream
commit 9eece662e) plus all fixes applied to get everpal_defconfig building
clean against a modern (GCC 15.2.0) toolchain -- see the previous commit
message on the lineage-23.2 branch (also in this repo history is not
available here since this is a squashed snapshot; full incremental history
lives in the local DL380 checkout and the upstream GitHub remote).

Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
2026-09-12 13:36:46 +00:00

67 lines
1.6 KiB
C

/*
* Copyright (C) 2015 MediaTek Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/platform_device.h>
#include <mt_emi.h>
#include "pasr_api_v1.h"
/* acquire DRAM Setting for PASR/DPD */
static unsigned int get_segment_nr(unsigned int rk_index)
{
unsigned int rank_size;
unsigned int num_of_1;
unsigned int i;
rank_size = get_rank_size(rk_index) / get_ch_num();
num_of_1 = 0;
for (i = 0; i < 32; i++) {
if (rank_size & 0x1)
num_of_1++;
rank_size = rank_size >> 1;
}
if (num_of_1 > 1)
return 6;
else
return 8;
}
void acquire_dram_setting(struct basic_dram_setting *pasrdpd)
{
unsigned int ch, rk;
pasrdpd->channel_nr = get_ch_num();
for (ch = 0; ch < MAX_CH; ch++) {
for (rk = 0; rk < MAX_RK; rk++) {
if ((ch >= pasrdpd->channel_nr) ||
(rk >= get_rk_num())) {
pasrdpd->channel[ch].rank[rk].valid_rank =
false;
pasrdpd->channel[ch].rank[rk].rank_size = 0;
pasrdpd->channel[ch].rank[rk].segment_nr = 0;
continue;
}
pasrdpd->channel[ch].rank[rk].valid_rank = true;
pasrdpd->channel[ch].rank[rk].rank_size =
get_rank_size(rk) / (pasrdpd->channel_nr);
pasrdpd->channel[ch].rank[rk].segment_nr =
get_segment_nr(rk);
}
}
}