add all low timings

This commit is contained in:
Lightos1
2026-06-14 14:39:32 +02:00
parent 8e7d82156c
commit 01c78bf8b6
11 changed files with 116 additions and 32 deletions

View File

@@ -36,7 +36,7 @@ volatile CustomizeTable C = {
.hpMode = DISABLED,
.commonEmcMemVolt = 1175000, /* LPDDR4(X) JEDEC Specification */
.eristaEmcMaxClock = 1600000, /* Maximum HB-MGCH ram rating */
.eristaEmcMaxClock = 1633000, /* Maximum HB-MGCH ram rating */
/* Available: 66MHz step rate, 100MHz step rate, 133MHz step rate and jedec. */
/* Jedec freqs are 1333MHz, 1600MHz, 1866MHz, 2133MHz, 2400MHz, 2666MHz, 2933MHz, 3200MHz. */
@@ -65,8 +65,14 @@ volatile CustomizeTable C = {
/* Frequency where non low timings gets used. */
.timingEmcTbreak = DISABLED,
.low_t6_tRTW = 0,
.low_t7_tWTR = 0,
.low_t1_tRCD = 0,
.low_t2_tRP = 0,
.low_t3_tRAS = 0,
.low_t4_tRRD = 0,
.low_t5_tRFC = 0,
.low_t6_tRTW = 0,
.low_t7_tWTR = 0,
.low_t8_tREFI = 0,
.readLatency = {
/* 1333 */ 0,

View File

@@ -20,8 +20,8 @@
#pragma once
#define CUST_REV 4
#define KIP_VERSION 241
#define CUST_REV 5
#define KIP_VERSION 242
#include "oc_common.hpp"
#include "pcv/pcv_common.hpp"
@@ -89,8 +89,14 @@ struct CustomizeTable {
u32 t2_tRP_cap;
u32 timingEmcTbreak;
u32 low_t1_tRCD;
u32 low_t2_tRP;
u32 low_t3_tRAS;
u32 low_t4_tRRD;
u32 low_t5_tRFC;
u32 low_t6_tRTW;
u32 low_t7_tWTR;
u32 low_t8_tREFI;
u32 readLatency[4];
u32 writeLatency[4];

View File

@@ -134,27 +134,32 @@ namespace ams::ldr::hoc::pcv::mariko {
/* At 1333WL, for some reason (incorrect ram timing config in mtc table?), tRP causes crashes at high reductions - 2 seems to be the most common limit. */
/* This is a lazy workaround until I find the issue... */
u32 tRPpbIndex = C.t2_tRP;
const bool lowFreq = freq < C.timingEmcTbreak;
volatile u32 tRPpbIndex = lowFreq ? C.low_t2_tRP : C.t2_tRP;
if (WL == WL_1331) {
tRPpbIndex = MIN(C.t2_tRP_cap, C.t2_tRP);
tRPpbIndex = MIN(C.t2_tRP_cap, tRPpbIndex);
}
tRCD = tRCD_values[C.t1_tRCD];
tRPpb = tRP_values[tRPpbIndex];
tRAS = tRAS_values[C.t3_tRAS];
tRRD = tRRD_values[C.t4_tRRD];
tRFCpb = tRFC_values[C.t5_tRFC];
u32 tRTW = C.t6_tRTW;
u32 tWTR = 10 - tWTR_values[C.t7_tWTR];
tRCD = tRCD_values[lowFreq ? C.low_t1_tRCD : C.t1_tRCD];
tRPpb = tRP_values[tRPpbIndex];
tRAS = tRAS_values[lowFreq ? C.low_t3_tRAS : C.t3_tRAS];
tRRD = tRRD_values[lowFreq ? C.low_t4_tRRD : C.t4_tRRD];
tRFCpb = tRFC_values[lowFreq ? C.low_t5_tRFC : C.t5_tRFC];
if (freq < C.timingEmcTbreak) {
tRTW = C.low_t6_tRTW;
tWTR = 10 - tWTR_values[C.low_t7_tWTR];
}
u32 tRTW = lowFreq ? C.low_t6_tRTW : C.t6_tRTW;
u32 tWTR = 10 - tWTR_values[lowFreq ? C.low_t7_tWTR : C.t7_tWTR];
s32 finetRTW = C.fineTune_t6_tRTW;
s32 finetWTR = C.fineTune_t7_tWTR;
u32 tREFI = lowFreq ? C.low_t8_tREFI : C.t8_tREFI;
refresh_raw = 0xFFFF;
if (tREFI != 6) {
refresh_raw = CEIL(tREFpb_values[tREFI] / tCK_avg) - 0x40;
refresh_raw = MIN(refresh_raw, static_cast<u32>(0xFFFF));
}
tRC = tRAS + tRPpb;
tRFCab = tRFCpb * 2;
tXSR = static_cast<double>(tRFCab + 7.5);

View File

@@ -130,6 +130,8 @@ namespace ams::ldr::hoc {
inline u32 tFAW;
inline double tRPab;
inline u32 refresh_raw;
inline u32 RL;
inline u32 WL;

View File

@@ -375,12 +375,6 @@ namespace ams::ldr::hoc::pcv::mariko {
WRITE_PARAM_ALL_REG(table, emc_cfg, 0xF3200000);
}
u32 refresh_raw = 0xFFFF;
if (C.t8_tREFI != 6) {
refresh_raw = CEIL(tREFpb_values[C.t8_tREFI] / tCK_avg) - 0x40;
refresh_raw = MIN(refresh_raw, static_cast<u32>(0xFFFF));
}
u32 trefbw = refresh_raw + 0x40;
trefbw = MIN(trefbw, static_cast<u32>(0x3FFF));